Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions examples/chart/teleport-kube-agent/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if or .Values.authToken .Values.joinParams.tokenName }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -12,4 +11,3 @@ type: Opaque
stringData:
auth-token: |
{{ coalesce .Values.joinParams.tokenName .Values.authToken }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you removed if or .Values.authToken .Values.joinParams.tokenName so couldn't these both be null/falsy? What gets put here in that case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default, .Values.authToken is "" so coalesce will write "".

If you override the default value with nil, it will print whatever you define

{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
generate a secret when neither authToken nor joinParams.tokenName are provided:
1: |
apiVersion: v1
kind: Secret
metadata:
name: teleport-kube-agent-join-token
namespace: NAMESPACE
stringData:
auth-token: ""
type: Opaque
generates a secret when authToken is provided:
1: |
apiVersion: v1
Expand Down
8 changes: 5 additions & 3 deletions examples/chart/teleport-kube-agent/tests/secret_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ suite: Secret
templates:
- secret.yaml
tests:
- it: does not generate a secret when join method is token and neither authToken nor joinParams.tokenName are provided
- it: generate a secret when neither authToken nor joinParams.tokenName are provided
asserts:
- hasDocuments:
count: 0

count: 1
- isKind:
of: Secret
- matchSnapshot: {}
- it: generates a secret when authToken is provided
set:
authToken: sample-auth-token-dont-use-this
Expand Down