Skip to content

Commit

Permalink
Need to create the remote config secret
Browse files Browse the repository at this point in the history
Signed-off-by: Pete Wall <pete.wall@grafana.com>
  • Loading branch information
petewall committed Oct 29, 2024
1 parent 9d80959 commit b9af9d3
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 20 deletions.
11 changes: 11 additions & 0 deletions charts/k8s-monitoring/docs/examples/remote-config/output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ metadata:
app.kubernetes.io/part-of: alloy
app.kubernetes.io/component: rbac
---
# Source: k8s-monitoring/templates/remote_config_secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: "alloy-metrics-remote-cfg-ko-k8s-monitoring"
namespace: "default"
type: Opaque
data:
username: "bXktcmVtb3RlLWNmZy11c2Vy"
password: "bXktcmVtb3RlLWNmZy1wYXNzd29yZA=="
---
# Source: k8s-monitoring/templates/alloy-config.yaml
apiVersion: v1
kind: ConfigMap
Expand Down
24 changes: 24 additions & 0 deletions charts/k8s-monitoring/templates/remote_config_secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- range $collector := (include "collectors.list.enabled" .) | fromYamlArray }}
{{- $remoteConfigValues := merge ((index $.Values $collector).remoteConfig) (dict "type" "remoteConfig" "name" (printf "%s-remote-cfg" $collector)) }}
{{- with $remoteConfigValues }}
{{- if .enabled }}
{{- if eq (include "secrets.shouldCreateKubernetesSecret" . ) "true" }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "secrets.kubernetesSecretName" (deepCopy $ | merge (dict "object" .)) | quote }}
namespace: {{ include "secrets.kubernetesSecretNamespace" (deepCopy $ | merge (dict "object" .)) | quote }}
type: Opaque
data:
{{- $secrets := include "secrets.list.remoteConfig" . | fromYamlArray }}
{{- range $secret := $secrets }}
{{- $value := include "secrets.getSecretValue" (dict "object" $remoteConfigValues "key" $secret) -}}
{{- if $value }}
{{ include "secrets.getSecretKey" (dict "object" $remoteConfigValues "key" $secret) }}: {{ $value | b64enc | quote }}
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
10 changes: 5 additions & 5 deletions charts/k8s-monitoring/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
"type": "object",
"properties": {
"create": {
"type": "null"
"type": "boolean"
},
"embed": {
"type": "boolean"
Expand Down Expand Up @@ -337,7 +337,7 @@
"type": "object",
"properties": {
"create": {
"type": "null"
"type": "boolean"
},
"embed": {
"type": "boolean"
Expand Down Expand Up @@ -503,7 +503,7 @@
"type": "object",
"properties": {
"create": {
"type": "null"
"type": "boolean"
},
"embed": {
"type": "boolean"
Expand Down Expand Up @@ -652,7 +652,7 @@
"type": "object",
"properties": {
"create": {
"type": "null"
"type": "boolean"
},
"embed": {
"type": "boolean"
Expand Down Expand Up @@ -817,7 +817,7 @@
"type": "object",
"properties": {
"create": {
"type": "null"
"type": "boolean"
},
"embed": {
"type": "boolean"
Expand Down
25 changes: 10 additions & 15 deletions charts/k8s-monitoring/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,9 @@ alloy-metrics:
passwordFrom: ""

secret:
# -- (bool) Whether to create a secret for the remote config server.
# @default -- `true`
# -- Whether to create a secret for the remote config server.
# @section -- Collectors - Alloy Metrics
create:
create: true
# -- If true, skip secret creation and embed the credentials directly into the configuration.
# @section -- Collectors - Alloy Metrics
embed: false
Expand Down Expand Up @@ -376,10 +375,9 @@ alloy-singleton:
passwordFrom: ""

secret:
# -- (bool) Whether to create a secret for the remote config server.
# @default -- `true`
# -- Whether to create a secret for the remote config server.
# @section -- Collectors - Alloy Singleton
create:
create: true
# -- If true, skip secret creation and embed the credentials directly into the configuration.
# @section -- Collectors - Alloy Singleton
embed: false
Expand Down Expand Up @@ -484,10 +482,9 @@ alloy-logs:
passwordFrom: ""

secret:
# -- (bool) Whether to create a secret for the remote config server.
# @default -- `true`
# -- Whether to create a secret for the remote config server.
# @section -- Collectors - Alloy Logs
create:
create: true
# -- If true, skip secret creation and embed the credentials directly into the configuration.
# @section -- Collectors - Alloy Logs
embed: false
Expand Down Expand Up @@ -592,10 +589,9 @@ alloy-receiver:
passwordFrom: ""

secret:
# -- (bool) Whether to create a secret for the remote config server.
# @default -- `true`
# -- Whether to create a secret for the remote config server.
# @section -- Collectors - Alloy Receiver
create:
create: true
# -- If true, skip secret creation and embed the credentials directly into the configuration.
# @section -- Collectors - Alloy Receiver
embed: false
Expand Down Expand Up @@ -693,10 +689,9 @@ alloy-profiles:
passwordFrom: ""

secret:
# -- (bool) Whether to create a secret for the remote config server.
# @default -- `true`
# -- Whether to create a secret for the remote config server.
# @section -- Collectors - Alloy Profiles
create:
create: true
# -- If true, skip secret creation and embed the credentials directly into the configuration.
# @section -- Collectors - Alloy Profiles
embed: false
Expand Down

0 comments on commit b9af9d3

Please sign in to comment.