-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Milestone Job integration tests for Helm Chart
Add Helm chart test flow Add vanilla flow for deployment with Helm
- Loading branch information
Showing
11 changed files
with
165 additions
and
22 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
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,29 @@ | ||
# This app is created to run end-to-end with the Secrets Provider Job | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: test-env | ||
name: test-env | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: test-env | ||
template: | ||
metadata: | ||
labels: | ||
app: test-env | ||
spec: | ||
serviceAccountName: secrets-provider-service-account | ||
containers: | ||
- image: centos:7 | ||
name: test-app | ||
command: ["sleep"] | ||
args: ["infinity"] | ||
env: | ||
- name: TEST_SECRET | ||
valueFrom: | ||
secretKeyRef: | ||
name: test-k8s-secret | ||
key: secret |
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,9 @@ | ||
# Not to be shipped. Created for end-to-end testing | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: test-k8s-secret | ||
type: Opaque | ||
stringData: | ||
conjur-map: |- | ||
secret: secrets/test_secret |
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,26 @@ | ||
# This app is created to run end-to-end with the Secrets Provider Job | ||
apiVersion: v1 | ||
kind: DeploymentConfig | ||
metadata: | ||
name: test-env | ||
spec: | ||
replicas: 1 | ||
selector: | ||
app: test-env | ||
template: | ||
metadata: | ||
labels: | ||
app: test-env | ||
spec: | ||
serviceAccountName:secrets-provider-service-account | ||
containers: | ||
- image: centos:7 | ||
name: test-app | ||
command: ["sleep"] | ||
args: ["infinity"] | ||
env: | ||
- name: TEST_SECRET | ||
valueFrom: | ||
secretKeyRef: | ||
name: test-k8s-secret | ||
key: secret |
48 changes: 48 additions & 0 deletions
48
deploy/test/test_cases/TEST_ID_17_helm_job_deploys_successfully.sh
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,48 @@ | ||
#!/bin/bash | ||
set -euxo pipefail | ||
|
||
# This test verifies that the Secrets Provider Job is deployed successfully and Conjur secret appears in pod environment | ||
# separately deployed application | ||
|
||
set_namespace $CONJUR_NAMESPACE_NAME | ||
|
||
# Configure authn and login Conjur urls | ||
configure_env_url | ||
|
||
# Fetch SSL cert from Conjur/DAP | ||
fetch_ssl | ||
|
||
# Save cert for later setting in Helm | ||
$cli_with_timeout "exec ${conjur_pod_name} --namespace $CONJUR_NAMESPACE_NAME cat $cert_location" > "conjur.pem" | ||
|
||
set_namespace $APP_NAMESPACE_NAME | ||
|
||
pushd ../../../ | ||
sed -e "s#{{ SECRETS_PROVIDER_ROLE }}#${SECRETS_PROVIDER_ROLE:-"secrets-provider-role"}#g" \ | ||
-e "s#{{ SECRETS_PROVIDER_ROLE_BINDING }}#${SECRETS_PROVIDER_ROLE_BINDING:-"secrets-provider-role-binding"}#g" \ | ||
-e "s#{{ SERVICE_ACCOUNT_CREATE }}#${SERVICE_ACCOUNT_CREATE:-"true"}#g" \ | ||
-e "s#{{ SERVICE_ACCOUNT }}#${SERVICE_ACCOUNT:-"secrets-provider-service-account"}#g" \ | ||
-e "s#{{ K8S_SECRETS }}#${K8S_SECRETS:-"test-k8s-secret"}#g" \ | ||
-e "s#{{ CONJUR_ACCOUNT }}#${CONJUR_ACCOUNT:-"cucumber"}#g" \ | ||
-e "s#{{ CONJUR_APPLIANCE_URL }}#${CONJUR_APPLIANCE_URL:-"https://conjur-follower.${CONJUR_NAMESPACE_NAME}.svc.cluster.local/api"}#g" \ | ||
-e "s#{{ CONJUR_AUTHN_URL }}#${CONJUR_AUTHN_URL:-"https://conjur-follower.${CONJUR_NAMESPACE_NAME}.svc.cluster.local/api/authn-k8s/${AUTHENTICATOR_ID}"}#g" \ | ||
-e "s#{{ CONJUR_AUTHN_LOGIN }}# ${CONJUR_AUTHN_LOGIN:-"host/conjur/authn-k8s/${AUTHENTICATOR_ID}/apps/${APP_NAMESPACE_NAME}/*/*"}#g" \ | ||
-e "s#{{ SECRETS_PROVIDER_SSL_CONFIG_MAP }}# ${SECRETS_PROVIDER_SSL_CONFIG_MAP:-"secrets-provider-ssl-config-map"}#g" \ | ||
"secrets-provider-chart/ci/test-values-template.yaml" > "secrets-provider-chart/ci/test-values.yaml" | ||
|
||
helm install -f "secrets-provider-chart/ci/test-values.yaml" secrets-provider ./secrets-provider-chart --set-file environment.conjur.sslCertificate.value="deploy/test/test_cases/conjur.pem" | ||
popd | ||
|
||
CONFIG_DIR="../helm-props/k8s" | ||
if [[ "$PLATFORM" = "openshift" ]]; then | ||
CONFIG_DIR="../helm-props/openshift" | ||
fi | ||
|
||
# Deploy app to test against | ||
kubectl apply -f ../helm-props/k8s/helm-app.yaml | ||
|
||
pod_name=$($cli_with_timeout get pods --namespace=$APP_NAMESPACE_NAME --selector app=test-env --no-headers | awk '{print $1}') | ||
verify_secret_value_in_pod $pod_name "TEST_SECRET" "some-secret" | ||
|
||
# Check for Job completion | ||
$cli_with_timeout wait --for=condition=complete job/secrets-provider |
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