diff --git a/.vib/kubectl/goss/goss.yaml b/.vib/kubectl/goss/goss.yaml new file mode 100644 index 000000000000..272197b305ab --- /dev/null +++ b/.vib/kubectl/goss/goss.yaml @@ -0,0 +1,11 @@ +gossfile: + # Goss tests exclusive to the current container + ../../kubectl/goss/kubectl.yaml: {} + # Load scripts from .vib/common/goss/templates + ../../common/goss/templates/check-app-version.yaml: {} + ../../common/goss/templates/check-binaries.yaml: {} + ../../common/goss/templates/check-broken-symlinks.yaml: {} + ../../common/goss/templates/check-ca-certs.yaml: {} + ../../common/goss/templates/check-linked-libraries.yaml: {} + ../../common/goss/templates/check-sed-in-place.yaml: {} + ../../common/goss/templates/check-spdx.yaml: {} diff --git a/.vib/kubectl/goss/kubectl.yaml b/.vib/kubectl/goss/kubectl.yaml new file mode 100644 index 000000000000..c0f5f5704e12 --- /dev/null +++ b/.vib/kubectl/goss/kubectl.yaml @@ -0,0 +1,7 @@ +command: + check-kubectl-config: + {{- $context := printf "context_%s" (randAlpha 5) }} + exec: kubectl config set-context {{ $context }} && kubectl config view --output=jsonpath='{.contexts[0].name}' && rm ${HOME}/.kube/config + exit-status: 0 + stdout: + - /^{{ $context }}$/ diff --git a/.vib/kubectl/goss/vars.yaml b/.vib/kubectl/goss/vars.yaml new file mode 100644 index 000000000000..f910c0a0fcf4 --- /dev/null +++ b/.vib/kubectl/goss/vars.yaml @@ -0,0 +1,6 @@ +binaries: + - kubectl +root_dir: /opt/bitnami +version: + bin_name: kubectl + flag: version --client diff --git a/.vib/kubectl/vib-publish.json b/.vib/kubectl/vib-publish.json index 8b6fe8eab4e6..e5cc3a2f04fe 100644 --- a/.vib/kubectl/vib-publish.json +++ b/.vib/kubectl/vib-publish.json @@ -3,7 +3,8 @@ "resources": { "url": "{VIB_ENV_CONTAINER_URL}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -82,6 +83,21 @@ } } } + }, + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "kubectl/goss/goss.yaml", + "vars_file": "kubectl/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-kubectl" + } + } + } } ] }, diff --git a/.vib/kubectl/vib-verify.json b/.vib/kubectl/vib-verify.json index a34e8aee9161..6a2d84251c75 100644 --- a/.vib/kubectl/vib-verify.json +++ b/.vib/kubectl/vib-verify.json @@ -3,7 +3,8 @@ "resources": { "url": "{SHA_ARCHIVE}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -46,6 +47,21 @@ "OS" ] } + }, + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "kubectl/goss/goss.yaml", + "vars_file": "kubectl/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-kubectl" + } + } + } } ] }