-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E2E Workflow scripts test against Enterprise follower in K8s #349
Changes from all commits
18586bf
fcf70a3
3677551
a767703
a4d36c1
e002b66
a6bb5bd
d2d53e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trying to figure out why we need PLATFORM in addtion to TEST_PLATFORM. Do you happen to know why both are needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After a little investigation, the only practical use of the long-form I changed the long-form PLATFORM to MANIFEST_DIR, and TEST_PLATFORM to PLATFORM. EDIT There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AH, thanks for the explanation. I was thinking that the distinction between these 2 would be something like this. |
||
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 |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this name change, it's MUCH clearer!