Skip to content

Commit 4acb4a6

Browse files
committed
feat(k8s/amour): vector
1 parent 7d14528 commit 4acb4a6

15 files changed

+411
-100
lines changed

k8s/amour/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ cue_export(
3030
"//k8s/amour/emqx:cue_emqx_library",
3131
"//k8s/amour/emqx_exporter:cue_emqx_exporter_library",
3232
"//k8s/amour/external_secrets:cue_external_secrets_library",
33-
"//k8s/amour/fluent_bit:cue_fluent_bit_library",
3433
"//k8s/amour/frigate:cue_frigate_library",
3534
"//k8s/amour/grafana:cue_grafana_library",
3635
"//k8s/amour/grafana_operator:cue_grafana_operator_library",
@@ -54,6 +53,7 @@ cue_export(
5453
"//k8s/amour/tailscale:cue_tailscale_library",
5554
"//k8s/amour/thomas:cue_thomas_library",
5655
"//k8s/amour/trivy_system:cue_trivy_system_library",
56+
"//k8s/amour/vector:cue_vector_library",
5757
"//k8s/amour/victoria_logs:cue_victoria_logs_library",
5858
"//k8s/amour/vm:cue_vm_library",
5959
"//k8s/amour/vm_operator:cue_vm_operator_library",

k8s/amour/fluent_bit/BUILD.bazel

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@com_github_tnarg_rules_cue//cue:cue.bzl", "cue_export", "cue_library")
1+
load("@com_github_tnarg_rules_cue//cue:cue.bzl", "cue_library")
22

33
cue_library(
44
name = "cue_fluent_bit_library",
@@ -22,9 +22,3 @@ cue_library(
2222
"//cue.mod/gen/k8s.io/api/rbac/v1:cue_v1_library",
2323
],
2424
)
25-
26-
cue_export(
27-
name = "fluent_bit",
28-
src = "fluent-bit.cue",
29-
visibility = ["//visibility:public"],
30-
)

k8s/amour/fluent_bit/fluent-bit.cue

Lines changed: 0 additions & 90 deletions
This file was deleted.

k8s/amour/list.cue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/uhthomas/automata/k8s/amour/emqx"
1111
"github.com/uhthomas/automata/k8s/amour/emqx_exporter"
1212
"github.com/uhthomas/automata/k8s/amour/external_secrets"
13-
"github.com/uhthomas/automata/k8s/amour/fluent_bit"
13+
// "github.com/uhthomas/automata/k8s/amour/fluent_bit"
1414
"github.com/uhthomas/automata/k8s/amour/frigate"
1515
"github.com/uhthomas/automata/k8s/amour/grafana"
1616
"github.com/uhthomas/automata/k8s/amour/grafana_operator"
@@ -35,6 +35,7 @@ import (
3535
"github.com/uhthomas/automata/k8s/amour/tailscale"
3636
"github.com/uhthomas/automata/k8s/amour/thomas"
3737
"github.com/uhthomas/automata/k8s/amour/trivy_system"
38+
"github.com/uhthomas/automata/k8s/amour/vector"
3839
"github.com/uhthomas/automata/k8s/amour/victoria_logs"
3940
"github.com/uhthomas/automata/k8s/amour/vm_operator"
4041
"github.com/uhthomas/automata/k8s/amour/vm"
@@ -74,7 +75,7 @@ _items: [
7475
emqx.#List.items,
7576
emqx_exporter.#List.items,
7677
external_secrets.#List.items,
77-
fluent_bit.#List.items,
78+
// fluent_bit.#List.items,
7879
frigate.#List.items,
7980
grafana.#List.items,
8081
grafana_operator.#List.items,
@@ -99,6 +100,7 @@ _items: [
99100
tailscale.#List.items,
100101
thomas.#List.items,
101102
trivy_system.#List.items,
103+
vector.#List.items,
102104
victoria_logs.#List.items,
103105
vm_operator.#List.items,
104106
vm.#List.items,

k8s/amour/vector/BUILD.bazel

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
load("@com_github_tnarg_rules_cue//cue:cue.bzl", "cue_library")
2+
3+
cue_library(
4+
name = "cue_vector_library",
5+
srcs = [
6+
"cluster_role_binding_list.cue",
7+
"cluster_role_list.cue",
8+
"config_map_list.cue",
9+
"daemon_set_list.cue",
10+
"list.cue",
11+
"namespace_list.cue",
12+
"service_account_list.cue",
13+
"service_list.cue",
14+
"vm_service_scrape_list.cue",
15+
],
16+
importpath = "github.com/uhthomas/automata/k8s/amour/vector",
17+
visibility = ["//visibility:public"],
18+
deps = [
19+
"//cue.mod/gen/github.com/VictoriaMetrics/operator/api/victoriametrics/v1beta1:cue_v1beta1_library",
20+
"//cue.mod/gen/k8s.io/api/apps/v1:cue_v1_library",
21+
"//cue.mod/gen/k8s.io/api/core/v1:cue_v1_library",
22+
"//cue.mod/gen/k8s.io/api/rbac/v1:cue_v1_library",
23+
],
24+
)

k8s/amour/vector/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Vector
2+
3+
[https://vector.dev/](https://vector.dev/)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package vector
2+
3+
import rbacv1 "k8s.io/api/rbac/v1"
4+
5+
#ClusterRoleBindingList: rbacv1.#ClusterRoleBindingList & {
6+
apiVersion: "rbac.authorization.k8s.io/v1"
7+
kind: "ClusterRoleBindingList"
8+
items: [...{
9+
apiVersion: "rbac.authorization.k8s.io/v1"
10+
kind: "ClusterRoleBinding"
11+
}]
12+
}
13+
14+
#ClusterRoleBindingList: items: [{
15+
subjects: [{
16+
kind: rbacv1.#ServiceAccountKind
17+
name: #Name
18+
namespace: #Namespace
19+
}]
20+
roleRef: {
21+
apiGroup: rbacv1.#GroupName
22+
kind: "ClusterRole"
23+
name: #Name
24+
}
25+
}]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package vector
2+
3+
import (
4+
rbacv1 "k8s.io/api/rbac/v1"
5+
"k8s.io/api/core/v1"
6+
)
7+
8+
#ClusterRoleList: rbacv1.#ClusterRoleList & {
9+
apiVersion: "rbac.authorization.k8s.io/v1"
10+
kind: "ClusterRoleList"
11+
items: [...{
12+
apiVersion: "rbac.authorization.k8s.io/v1"
13+
kind: "ClusterRole"
14+
}]
15+
}
16+
17+
#ClusterRoleList: items: [{
18+
rules: [{
19+
apiGroups: [v1.#GroupName]
20+
resources: ["namespaces", "nodes", "pods"]
21+
verbs: ["list", "watch"]
22+
}]
23+
}]
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package vector
2+
3+
import (
4+
"encoding/yaml"
5+
6+
"k8s.io/api/core/v1"
7+
)
8+
9+
#ConfigMapList: v1.#ConfigMapList & {
10+
apiVersion: "v1"
11+
kind: "ConfigMapList"
12+
items: [...{
13+
apiVersion: "v1"
14+
kind: "ConfigMap"
15+
}]
16+
}
17+
18+
#ConfigMapList: items: [{
19+
data: {
20+
"agent.yaml": yaml.Marshal({
21+
data_dir: "/vector-data-dir"
22+
api: {
23+
enabled: true
24+
address: "127.0.0.1:8686"
25+
playground: false
26+
}
27+
sources: {
28+
kubernetes_logs: type: "kubernetes_logs"
29+
host_metrics: {
30+
filesystem: {
31+
devices: excludes: ["binfmt_misc"]
32+
filesystems: excludes: ["binfmt_misc"]
33+
mountpoints: excludes: ["*/proc/sys/fs/binfmt_misc"]
34+
}
35+
type: "host_metrics"
36+
}
37+
internal_metrics: type: "internal_metrics"
38+
}
39+
sinks: {
40+
prom_exporter: {
41+
type: "prometheus_exporter"
42+
inputs: ["host_metrics", "internal_metrics"]
43+
address: "0.0.0.0:9090"
44+
}
45+
// stdout: {
46+
// type: "console"
47+
// inputs: ["kubernetes_logs"]
48+
// encoding: codec: "json"
49+
// }
50+
vlogs: {
51+
type: "http"
52+
inputs: ["kubernetes_logs"]
53+
uri: "http://victoria-logs.victoria-logs/insert/jsonline?_stream_fields=stream,source_type,kubernetes.pod_node_name,kubernetes.pod_namespace,kubernetes.pod_owner,kubernetes.pod_name,kubernetes.container_name&_msg_field=message&_time_field=timestamp"
54+
encoding: codec: "json"
55+
framing: method: "newline_delimited"
56+
healthcheck: enabled: false
57+
request: headers: {
58+
AccountID: "0"
59+
ProjectID: "0"
60+
}
61+
}
62+
// [sinks.vlogs]
63+
// inputs = [ "your_input" ]
64+
// type = "http"
65+
// uri = "http://localhost:9428/insert/jsonline?_stream_fields=host,container_name&_msg_field=message&_time_field=timestamp"
66+
// encoding.codec = "json"
67+
// framing.method = "newline_delimited"
68+
// healthcheck.enabled = false
69+
70+
// [sinks.vlogs.request.headers]
71+
// AccountID = "12"
72+
// ProjectID = "34"
73+
}
74+
})
75+
}
76+
}]

0 commit comments

Comments
 (0)