Skip to content

Commit

Permalink
feat(infisical): add service token rendering as secret
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeMac committed Feb 19, 2024
1 parent ce7d2aa commit c4c4a55
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions infisical-secrets-operator/templates/config.cue
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ import (
affinity?: corev1.#Affinity
topologySpreadConstraints?: [...corev1.#TopologySpreadConstraint]

infisical: {
serviceToken?: {
name: *"infisicalservicetoken" | string
token: string
}
}

initSecrets?: [Name=string]: {
metadata: name: Name
...
Expand Down Expand Up @@ -109,6 +116,10 @@ import (
"\(k)": v
}

if config.infisical.serviceToken != _|_ {
infisicalservicetoken: #Secret & {#config: config}
}

if config.initSecrets != _|_ {
for k, v in (config.initSecrets) {
"\(k)": v & #InfisicalSecret & {#config: config}
Expand Down
12 changes: 12 additions & 0 deletions infisical-secrets-operator/templates/secrets.cue
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
package templates

import (
corev1 "k8s.io/api/core/v1"
infisicalsecretv1alpha1 "secrets.infisical.com/infisicalsecret/v1alpha1"
)

#Secret: corev1.#Secret & {
#config: #Config
apiVersion: "v1"
kind: "Secret"
metadata: {
name: #config.infisical.serviceToken.name
namespace: #config.metadata.namespace
}
stringData: serviceToken: #config.infisical.serviceToken.token
}

#InfisicalSecret: infisicalsecretv1alpha1.#InfisicalSecret & {
#config: #Config
metadata: {
Expand Down

0 comments on commit c4c4a55

Please sign in to comment.