Skip to content

Commit

Permalink
Support creating secrets in component (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
DebakelOrakel authored Sep 20, 2024
1 parent 208caa0 commit 5cd1b28
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ parameters:
namespaceLogForwarderEnabled: false
namespaceLogForwarder: {}

secrets: {}

operatorResources:
clusterLogging:
requests:
Expand Down
3 changes: 3 additions & 0 deletions component/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,14 @@ local subscriptions = std.filter(function(it) it != null, [
elasticsearch,
]);

local secrets = com.generateResources(params.secrets, kube.Secret);

// Define outputs below
{
'00_namespace': namespace,
'10_operator_group': operatorGroup,
'20_subscriptions': subscriptions,
[if std.length(params.secrets) > 0 then '99_secrets']: secrets,
}
+ (import 'config_logging.libsonnet')
+ (import 'config_forwarding.libsonnet')
Expand Down
11 changes: 11 additions & 0 deletions docs/modules/ROOT/pages/references/parameters.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,17 @@ A dictionary holding the `.spec` for namespaced log forwarding.
See in examples below for configuration.


== `secrets`

[horizontal]
type:: dict
default:: `{}`

A dict of secrets to create in the namespace.
The key is the name of the secret, the value is the content of the secret.
The value must be a dict with a key `stringData` which is a dict of key/value pairs to add to the secret.


== Examples

[source,yaml]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
data: {}
kind: Secret
metadata:
annotations: {}
labels:
name: my-secret
name: my-secret
stringData:
secret-key: t-silent-test-1234/c-green-test-1234/secret-value
type: Opaque
5 changes: 5 additions & 0 deletions tests/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,8 @@ parameters:
- my-apps
outputRefs:
- custom-forwarder

secrets:
my-secret:
stringData:
secret-key: '?{vaultkv:${cluster:tenant}/${cluster:name}/secret-value}'

0 comments on commit 5cd1b28

Please sign in to comment.