-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
E2E Workflow scripts test against Enterprise follower in K8s (#349)
* Maintain shell on failure * Test E2E workflow against Conjur Enterprise in KinD Conjur Leader and Follower in K8s cluster. * Enterprise E2E workflow updated for GKE * E2E workflow: CONJUR_NAMESPACE to CONJUR_NAMESPACE_NAME Maintains style with TEST_APP_NAMESPACE_NAME, and agrees with kubernetes-conjur-deploy required env var * Add Jenkinsfile stage for Enterprise/GKE E2E workflow * Update CI GHA workflow * E2E Workflow README updates * PR Review updates
- Loading branch information
1 parent
fffd504
commit 26e7c34
Showing
21 changed files
with
509 additions
and
163 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 was deleted.
Oops, something went wrong.
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,69 @@ | ||
#!/bin/bash | ||
|
||
set -o pipefail | ||
|
||
### PLATFORM DETAILS | ||
export CONJUR_OSS_HELM_INSTALLED="${CONJUR_OSS_HELM_INSTALLED:-true}" | ||
|
||
# PLATFORM is used to differentiate between general Kubernetes platforms (K8s vs. oc), while | ||
# CLUSTER_TYPE is used to differentiate between sub-platforms (for vanilla K8s, KinD vs. GKE) | ||
if [[ "$CONJUR_OSS_HELM_INSTALLED" == "true" ]]; then | ||
CLUSTER_TYPE="${CLUSTER_TYPE:-kind}" | ||
else | ||
CLUSTER_TYPE="${CLUSTER_TYPE:-gke}" | ||
export UNIQUE_TEST_ID="$(uuidgen | tr "[:upper:]" "[:lower:]" | head -c 10)" | ||
fi | ||
export CLUSTER_TYPE | ||
|
||
if [[ "$CLUSTER_TYPE" == "oc" ]]; then | ||
PLATFORM="openshift" | ||
else | ||
PLATFORM="kubernetes" | ||
fi | ||
export PLATFORM | ||
|
||
### DOCKER CONFIG | ||
export USE_DOCKER_LOCAL_REGISTRY="${USE_DOCKER_LOCAL_REGISTRY:-true}" | ||
export DOCKER_REGISTRY_URL="${DOCKER_REGISTRY_URL:-localhost:5000}" | ||
export DOCKER_REGISTRY_PATH="${DOCKER_REGISTRY_PATH:-localhost:5000}" | ||
export PULL_DOCKER_REGISTRY_URL="${PULL_DOCKER_REGISTRY_URL:-${DOCKER_REGISTRY_URL}}" | ||
export PULL_DOCKER_REGISTRY_PATH="${PULL_DOCKER_REGISTRY_PATH:-${DOCKER_REGISTRY_PATH}}" | ||
|
||
### CONJUR AND TEST APP CONFIG | ||
export CONJUR_ACCOUNT="${CONJUR_ACCOUNT:-myConjurAccount}" | ||
export AUTHENTICATOR_ID="${AUTHENTICATOR_ID:-my-authenticator-id}" | ||
export CONJUR_AUTHN_LOGIN_RESOURCE="${CONJUR_AUTHN_LOGIN_RESOURCE:-service_account}" | ||
export CONJUR_AUTHN_LOGIN_PREFIX="${CONJUR_AUTHN_LOGIN_PREFIX:-host/conjur/authn-k8s/$AUTHENTICATOR_ID/apps}" | ||
export CONJUR_VERSION="${CONJUR_VERSION:-5}" | ||
export TEST_APP_NAMESPACE_NAME="${TEST_APP_NAMESPACE_NAME:-app-test}" | ||
export TEST_APP_DATABASE="${TEST_APP_DATABASE:-postgres}" | ||
|
||
if [[ "$CONJUR_OSS_HELM_INSTALLED" == "true" ]]; then | ||
conjur_service="conjur-oss" | ||
export CONJUR_NAMESPACE_NAME="${CONJUR_NAMESPACE_NAME:-$conjur_service}" | ||
else | ||
conjur_service="conjur-master" | ||
export CONJUR_NAMESPACE_NAME="${CONJUR_NAMESPACE_NAME:-$conjur_service-${UNIQUE_TEST_ID}}" | ||
export TEST_APP_NAMESPACE_NAME="$TEST_APP_NAMESPACE_NAME-$UNIQUE_TEST_ID" | ||
fi | ||
|
||
export CONJUR_APPLIANCE_URL=${CONJUR_APPLIANCE_URL:-https://$conjur_service.$CONJUR_NAMESPACE_NAME.svc.cluster.local} | ||
export SAMPLE_APP_BACKEND_DB_PASSWORD="$(openssl rand -hex 12)" | ||
|
||
### PLATFORM SPECIFIC CONFIG | ||
if [[ "$CLUSTER_TYPE" == "gke" ]]; then | ||
export CONJUR_FOLLOWER_URL="https://conjur-follower.$CONJUR_NAMESPACE_NAME.svc.cluster.local" | ||
export CONJUR_ADMIN_PASSWORD="MySecretP@ss1" | ||
export CONJUR_APPLIANCE_IMAGE="registry2.itci.conjur.net/conjur-appliance:5.0-stable" | ||
export CONJUR_FOLLOWER_COUNT=1 | ||
export CONJUR_AUTHN_LOGIN="host/conjur/authn-k8s/${AUTHENTICATOR_ID}/apps/$CONJUR_NAMESPACE_NAME/service_account/conjur-cluster" | ||
export STOP_RUNNING_ENV=true | ||
export DEPLOY_MASTER_CLUSTER=true | ||
export CONFIGURE_CONJUR_MASTER=true | ||
export PLATFORM_CONTAINER="platform-container" | ||
|
||
docker build --tag "$PLATFORM_CONTAINER:$CONJUR_NAMESPACE_NAME" \ | ||
--file Dockerfile \ | ||
--build-arg KUBECTL_VERSION="$KUBECTL_VERSION" \ | ||
. | ||
fi |
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,61 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
cd "$(dirname "$0")" || ( echo "cannot cd into dir" && exit 1 ) | ||
|
||
source utils.sh | ||
|
||
function setup_conjur_enterprise { | ||
check_env_var GCLOUD_PROJECT_NAME | ||
check_env_var GCLOUD_ZONE | ||
check_env_var GCLOUD_CLUSTER_NAME | ||
check_env_var GCLOUD_SERVICE_KEY | ||
|
||
docker pull "$CONJUR_APPLIANCE_IMAGE" | ||
|
||
pushd temp > /dev/null | ||
git clone --single-branch --branch master [email protected]:cyberark/kubernetes-conjur-deploy "kubernetes-conjur-deploy-$UNIQUE_TEST_ID" | ||
popd > /dev/null | ||
|
||
announce "Deploying Conjur Enterprise" | ||
|
||
if [[ "${CLUSTER_TYPE}" == "gke" ]]; then | ||
run_command_with_platform "cd temp/kubernetes-conjur-deploy-$UNIQUE_TEST_ID && ./start" | ||
fi | ||
} | ||
|
||
function setup_conjur_open_source { | ||
pushd temp > /dev/null | ||
git clone https://github.com/cyberark/conjur-oss-helm-chart.git | ||
|
||
pushd conjur-oss-helm-chart/examples/common > /dev/null | ||
source ./utils.sh | ||
|
||
announce "Setting demo environment variable defaults" | ||
source ../kubernetes-in-docker/0_export_env_vars.sh | ||
|
||
announce "Creating a Kubernetes-in-Docker cluster if necessary" | ||
./1_create_kind_cluster.sh | ||
|
||
announce "Helm installing/upgrading Conjur OSS cluster" | ||
./2_helm_install_or_upgrade_conjur.sh | ||
|
||
# Wait for Conjur pods to become ready (just in case there are old | ||
# Conjur pods getting terminated as part of Helm upgrade) | ||
announce "Waiting for Conjur to become ready" | ||
wait_for_conjur_ready | ||
|
||
announce "Enabling the Conjur Kubernetes authenticator if necessary" | ||
./4_ensure_authn_k8s_enabled.sh | ||
popd > /dev/null | ||
|
||
rm -rf conjur-oss-helm-chart | ||
popd > /dev/null | ||
} | ||
|
||
mkdir -p temp | ||
if [[ "$CONJUR_OSS_HELM_INSTALLED" == "true" ]]; then | ||
setup_conjur_open_source | ||
else | ||
setup_conjur_enterprise | ||
fi |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.