-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb24f5f
commit 4e0f351
Showing
17 changed files
with
270 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,5 +22,6 @@ | |
*.tmproj | ||
.vscode/ | ||
|
||
# helm-unittest | ||
/tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,10 +7,15 @@ sources: | |
- https://github.com/FNNDSC/pfcon | ||
|
||
type: application | ||
version: "0.2.3" | ||
version: "1.0.0-alpha.1" | ||
appVersion: "5.2.3" | ||
|
||
maintainers: | ||
- name: The FNNDSC Dev Team | ||
email: [email protected] | ||
url: https://fnndsc.org | ||
|
||
dependencies: | ||
- name: util | ||
version: "~0.1.0" | ||
repository: "https://fnndsc.github.io/charts" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../util |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
{{- $pfconSecret := (print .Release.Name "-pfcon") -}} | ||
apiVersion: v1 | ||
kind: Secret | ||
type: Opaque | ||
metadata: | ||
name: {{ .Release.Name }}-pfcon | ||
name: {{ $pfconSecret }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "pfcon.labels" . | nindent 4 }} | ||
stringData: | ||
PFCON_USER: 'pfcon' | ||
data: | ||
{{- with (lookup "v1" "Secret" .Release.Namespace ( print .Release.Name "-pfcon")) }} | ||
SECRET_KEY: {{ index .data "SECRET_KEY" }} | ||
PFCON_USER: {{ index .data "PFCON_USER" }} | ||
PFCON_PASSWORD: {{ index .data "PFCON_PASSWORD" }} | ||
{{- else }} | ||
SECRET_KEY: {{ randAlphaNum 32 | b64enc | quote }} | ||
PFCON_USER: {{ "pfcon" | b64enc | quote }} | ||
PFCON_PASSWORD: {{ randAlphaNum 32 | b64enc | quote }} | ||
{{- end }} | ||
SECRET_KEY: {{ include "util.valueOrLookupOrRandom" (dict "root" . "value" .Values.pfcon.secretKey "secret" $pfconSecret "name" "SECRET_KEY" "length" 32 ) }} | ||
PFCON_PASSWORD: {{ include "util.valueOrLookupOrRandom" (dict "root" . "value" .Values.password "secret" $pfconSecret "name" "PFCON_PASSWORD" "length" 32 ) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
suite: Validation of pfcon config | ||
templates: | ||
- pfcon-config.yml | ||
tests: | ||
- it: should show an error if pfcon.extraEnv.SECRET_KEY is set | ||
set: | ||
pfcon.extraEnv.SECRET_KEY: abc123 | ||
asserts: | ||
- failedTemplate: | ||
errorMessage: Do not set pfcon.extraEnv.SECRET_KEY. Use pfcon.secretKey instead. | ||
- it: should not allow pfcon.extraEnv.PFCON_INNETWORK to be set | ||
set: | ||
pfcon.extraEnv.PFCON_INNETWORK: true | ||
asserts: | ||
- failedTemplate: | ||
errorMessage: Do not set pfcon.extraEnv.PFCON_INNETWORK. Use pfcon.config.innetwork instead. | ||
- it: should not allow pfcon.extraEnv.STORAGE_ENV to be set | ||
set: | ||
pfcon.extraEnv.STORAGE_ENV: "filesystem" | ||
asserts: | ||
- failedTemplate: | ||
errorMessage: Do not set pfcon.extraEnv.STORAGE_ENV. Use pfcon.config.storageEnv instead. |
10 changes: 10 additions & 0 deletions
10
charts/pfcon/tests/pman_config_disallow_extraEnv_secret_key_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
suite: Disallow insecure setting of SECRET_KEY | ||
templates: | ||
- pman-config.yml | ||
tests: | ||
- it: should show an error if pman.extraEnv.SECRET_KEY is set | ||
set: | ||
pman.extraEnv.SECRET_KEY: abc123 | ||
asserts: | ||
- failedTemplate: | ||
errorMessage: Do not set pman.extraEnv.SECRET_KEY. Use pman.secretKey instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
charts/pfcon/tests/valueOrLookupOrRandom_changed_name_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
suite: util.valueOrLookupOrRandom subsequent run (with changed name) | ||
templates: | ||
- pman-secrets.yml | ||
release: | ||
name: subsequent-run-test | ||
namespace: suruntest | ||
revision: 2 | ||
upgrade: true | ||
kubernetesProvider: | ||
scheme: | ||
"v1/Secret": | ||
gvr: | ||
version: v1 | ||
resource: secrets | ||
namespaced: true | ||
objects: | ||
- kind: Secret | ||
apiVersion: v1 | ||
metadata: | ||
name: subsequent-run-test-pman | ||
namespace: suruntest | ||
data: | ||
NOT_SECRET_KEY: 'aWFtYm9sZAo=' | ||
tests: | ||
- it: should randomly generate a new secret because old secret does not contain the right key | ||
asserts: | ||
- matchRegex: | ||
path: data.SECRET_KEY | ||
pattern: ^[-A-Za-z0-9+/]{40,}={0,3}$ |
17 changes: 17 additions & 0 deletions
17
charts/pfcon/tests/valueOrLookupOrRandom_first_run_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
suite: util.valueOrLookupOrRandom first run | ||
templates: | ||
- pman-secrets.yml | ||
tests: | ||
- it: should generate a random secret, base64-encoded | ||
asserts: | ||
- matchRegex: | ||
path: data.SECRET_KEY | ||
pattern: ^[-A-Za-z0-9+/]{40,}={0,3}$ | ||
- it: should use the given secret | ||
set: | ||
pman.secretKey: namesjamesbond | ||
asserts: | ||
- equal: | ||
path: data.SECRET_KEY | ||
value: namesjamesbond | ||
decodeBase64: true |
Oops, something went wrong.