Skip to content

Commit

Permalink
feat(k8s/amour/default): monitor kube-apiserver
Browse files Browse the repository at this point in the history
  • Loading branch information
uhthomas committed Jul 30, 2024
1 parent 779056b commit 33454eb
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cue.mod/gen/sigs.k8s.io/external-dns/endpoint/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
load("@com_github_tnarg_rules_cue//cue:cue.bzl", "cue_library")

cue_library(
name = "cue_endpoint_library",
srcs = [
"crypto_go_gen.cue",
"domain_filter_go_gen.cue",
"endpoint_go_gen.cue",
"labels_go_gen.cue",
"target_filter_go_gen.cue",
],
importpath = "sigs.k8s.io/external-dns/endpoint",
visibility = ["//visibility:public"],
deps = ["//cue.mod/gen/k8s.io/apimachinery/pkg/apis/meta/v1:cue_v1_library"],
)
1 change: 1 addition & 0 deletions k8s/amour/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ cue_export(
"//k8s/amour/cert_manager_csi_driver:cue_cert_manager_csi_driver_library",
"//k8s/amour/cilium:cue_cilium_library",
"//k8s/amour/dcgm_exporter:cue_dcgm_exporter_library",
"//k8s/amour/default:cue_default_library",
"//k8s/amour/emqx:cue_emqx_library",
"//k8s/amour/emqx_exporter:cue_emqx_exporter_library",
"//k8s/amour/external_dns:cue_external_dns_library",
Expand Down
13 changes: 13 additions & 0 deletions k8s/amour/default/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
load("@com_github_tnarg_rules_cue//cue:cue.bzl", "cue_library")

cue_library(
name = "cue_default_library",
srcs = [
"list.cue",
"namespace_list.cue",
"vm_service_scrape_list.cue",
],
importpath = "github.com/uhthomas/automata/k8s/amour/default",
visibility = ["//visibility:public"],
deps = ["//cue.mod/gen/k8s.io/api/core/v1:cue_v1_library"],
)
22 changes: 22 additions & 0 deletions k8s/amour/default/list.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package default

import (
"list"

"k8s.io/api/core/v1"
)

#Namespace: "default"

#List: v1.#List & {
apiVersion: "v1"
kind: "List"
items: [...{metadata: namespace: #Namespace}]
}

#List: items: list.Concat(_items)

_items: [
#NamespaceList.items,
#VMServiceScrapeList.items,
]
14 changes: 14 additions & 0 deletions k8s/amour/default/namespace_list.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package default

import "k8s.io/api/core/v1"

#NamespaceList: v1.#NamespaceList & {
apiVersion: "v1"
kind: "NamespaceList"
items: [...{
apiVersion: "v1"
kind: "Namespace"
}]
}

#NamespaceList: items: [{metadata: name: #Namespace}]
35 changes: 35 additions & 0 deletions k8s/amour/default/vm_service_scrape_list.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package default

import "k8s.io/api/core/v1"

// TODO: Use generated types.
//
// https://github.com/cue-lang/cue/issues/2466
#VMServiceScrapeList: v1.#List & {
apiVersion: "operator.victoriametrics.com/v1beta1"
kind: "VMServiceScrapeList"
items: [...{
apiVersion: "operator.victoriametrics.com/v1beta1"
kind: "VMServiceScrape"
}]
}

#VMServiceScrapeList: items: [{
metadata: name: "kube-api-server"
spec: {
jobLabel: "component"
endpoints: [{
port: "https"
scheme: "https"
tlsConfig: {
caFile: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
serverName: "kubernetes"
}
bearerTokenFile: "/var/run/secrets/kubernetes.io/serviceaccount/token"
}]
selector: matchLabels: {
component: "apiserver"
provider: "kubernetes"
}
}
}]
40 changes: 40 additions & 0 deletions k8s/amour/kube_system/service_list.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package kube_system

import "k8s.io/api/core/v1"

#ServiceList: v1.#ServiceList & {
apiVersion: "v1"
kind: "ServiceList"
items: [...{
apiVersion: "v1"
kind: "Service"
}]
}

#ServiceList: items: [{
metadata: {
name: "kube-controller-manager"
labels: "app.kubernetes.io/name": name
}
spec: {
ports: [{
name: "metrics"
port: 10257
}]
selector: "k8s-app": "kube-controller-manager"
clusterIP: v1.#ClusterIPNone
}
}, {
metadata: {
name: "kube-scheduler"
labels: "app.kubernetes.io/name": name
}
spec: {
ports: [{
name: "metrics"
port: 10259
}]
selector: "k8s-app": "kube-scheduler"
clusterIP: v1.#ClusterIPNone
}
}]
2 changes: 2 additions & 0 deletions k8s/amour/list.cue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/uhthomas/automata/k8s/amour/cert_manager"
"github.com/uhthomas/automata/k8s/amour/cilium"
"github.com/uhthomas/automata/k8s/amour/dcgm_exporter"
"github.com/uhthomas/automata/k8s/amour/default"
"github.com/uhthomas/automata/k8s/amour/emqx"
"github.com/uhthomas/automata/k8s/amour/emqx_exporter"
"github.com/uhthomas/automata/k8s/amour/external_dns"
Expand Down Expand Up @@ -75,6 +76,7 @@ _items: [
cert_manager.#List.items,
cilium.#List.items,
dcgm_exporter.#List.items,
default.#List.items,
emqx.#List.items,
emqx_exporter.#List.items,
external_dns.#List.items,
Expand Down

0 comments on commit 33454eb

Please sign in to comment.