Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow for native package secret copying #16

Merged
merged 12 commits into from
Jul 8, 2024
2 changes: 1 addition & 1 deletion .github/workflows/tag-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
ghToken: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Package
run: uds run -f tasks/publish.yaml package --set FLAVOR=${{ matrix.flavor }}
run: uds run -f tasks/publish.yaml package --set FLAVOR=${{ matrix.flavor }} --no-progress

- name: Debug Output
if: ${{ always() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
strategy:
matrix:
flavor: [upstream]
type: [install]
type: [install, upgrade]

steps:
- name: Checkout repository
Expand Down
6 changes: 6 additions & 0 deletions bundle/uds-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ packages:
app: valkey-cli
port: 6379
description: "Ingress from Valkey CLI (for tests)"
- path: copyPassword
value:
enabled: true
namespace: valkey-cli
secretName: valkey
secretKey: valkey-password
valkey:
variables:
- name: VALKEY_RESOURCES
Expand Down
18 changes: 18 additions & 0 deletions chart/templates/password-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- $password := randAlphaNum 16 }}
apiVersion: v1
kind: Secret
metadata:
name: valkey-password
namespace: {{ .Release.Namespace }}
stringData:
valkey-password: {{ printf "%s" $password | quote }}
{{- if .Values.copyPassword.enabled }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.copyPassword.secretName }}
namespace: {{ .Values.copyPassword.namespace }}
stringData:
{{ dict .Values.copyPassword.secretKey $password | toYaml }}
{{- end }}
6 changes: 6 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
copyPassword:
enabled: false
namespace: ""
secretName: ""
secretKey: ""

custom: []
5 changes: 0 additions & 5 deletions tests/valkey/namespace.yaml

This file was deleted.

16 changes: 16 additions & 0 deletions tests/valkey/uds-package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: uds.dev/v1alpha1
kind: Package
metadata:
name: valkey-cli
namespace: valkey-cli
spec:
network:
allow:
- direction: Egress
selector:
app: valkey-cli
remoteNamespace: valkey
remoteSelector:
app.kubernetes.io/name: valkey
port: 6379
description: "Egress from Valkey CLI (for tests)"
4 changes: 2 additions & 2 deletions tests/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ components:
- name: valkey-cli
namespace: valkey-cli
files:
- valkey/namespace.yaml
- valkey/uds-package.yaml
- valkey/valkey-cli.yaml
images:
- docker.io/bitnami/valkey:7.2.5-debian-12-r5
actions:
onDeploy:
after:
- cmd: ./zarf tools kubectl get secret -n valkey valkey --template='{{ index .data "valkey-password" }}' | base64 -d
- cmd: ./zarf tools kubectl get secret -n valkey-cli valkey --template='{{ index .data "valkey-password" }}' | base64 -d
mute: true
setVariables:
- name: VALKEY_PASSWORD
Expand Down
4 changes: 4 additions & 0 deletions values/values.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
architecture: standalone

auth:
existingSecret: valkey-password
existingSecretPasswordKey: valkey-password