Skip to content

Commit

Permalink
Add script to enable authn-jwt flow
Browse files Browse the repository at this point in the history
Can be used in automation that uses this helm chart
  • Loading branch information
tzheleznyak committed Jan 10, 2022
1 parent 6a9c8b4 commit a1e9c1c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions ci/jenkins_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export HELM_VERSION="${HELM_VERSION:-3.1.3}"
export KUBECTL_VERSION="${KUBECTL_VERSION:-1.16.9}"
export RELEASE_NAME="$CONJUR_NAMESPACE"
export SKIP_GCLOUD_LOGIN="${SKIP_GCLOUD_LOGIN:-false}"
export AUTHN_STRATEGY="${AUTHN_STRATEGY:authn-k8s}"

announce "Building gcloud/kubectl/helm client image..."
# Build the gcloud/kubectl/helm client container image
Expand Down
2 changes: 1 addition & 1 deletion examples/common/2_helm_install_or_upgrade_conjur.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fi
args+=("-n" "$CONJUR_NAMESPACE" \
"--set" "account.name=$CONJUR_ACCOUNT" \
"--set" "account.create=true" \
"--set" "authenticators=authn\,authn-k8s/$AUTHENTICATOR_ID" \
"--set" "authenticators=authn\,$AUTHN_STRATEGY/$AUTHENTICATOR_ID" \
"--set" "logLevel=$CONJUR_LOG_LEVEL" \
"--set" "service.external.enabled=$CONJUR_LOADBALANCER_SVCS" \
"--wait" \
Expand Down
6 changes: 3 additions & 3 deletions examples/common/4_ensure_authn_k8s_enabled.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ authenticators="$(kubectl get secret \
$HELM_RELEASE-conjur-authenticators \
--template={{.data.key}} | base64 -d)"
if grep -q "$authenticators" <<< "$AUTHENTICATOR_ID"; then
echo "Enabling authenticator ID $AUTHENTICATOR_ID for authn-k8s"
echo "Enabling authenticator ID $AUTHENTICATOR_ID for $AUTHN_STRATEGY"
helm upgrade \
-n "$CONJUR_NAMESPACE" \
--reuse-values \
--set authenticators="authn\,authn-k8s/$AUTHENTICATOR_ID" \
--set authenticators="authn\,$AUTHN_STRATEGY/$AUTHENTICATOR_ID" \
--set logLevel="$CONJUR_LOG_LEVEL" \
--wait \
--timeout 300s \
Expand All @@ -25,5 +25,5 @@ if grep -q "$authenticators" <<< "$AUTHENTICATOR_ID"; then
wait_for_conjur_ready

else
echo "Authenticator ID $AUTHENTICATOR_ID is already enabled for authn-k8s"
echo "Authenticator ID $AUTHENTICATOR_ID is already enabled for $AUTHN_STRATEGY"
fi
3 changes: 3 additions & 0 deletions examples/common/customize.env
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@
# Configuration for Conjur authn-k8s
#export ANNOTATION_BASED_AUTHN="<true-or-false-defaults-to-true>"
#export AUTHENTICATOR_ID="<authenticator-id-string-defaults-to-my-authenticator-id>"

# Default authn strategy is authn-k8s. But we want to support ad of authn-jwt
#export AUTNH_STRATEGY="authn-k8s"
2 changes: 2 additions & 0 deletions examples/kubernetes-in-docker/0_export_env_vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ if [[ "USE_DOCKER_LOCAL_REGISTRY" == "false" ]]; then
check_env_var "DOCKER_PASSWORD"
check_env_var "DOCKER_EMAIL"
fi

export AUTNH_STRATEGY="authn-k8s"
2 changes: 2 additions & 0 deletions examples/openshift/0_export_env_vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ if [[ "USE_DOCKER_LOCAL_REGISTRY" == "false" ]]; then
check_env_var "DOCKER_PASSWORD"
check_env_var "DOCKER_EMAIL"
fi

export AUTNH_STRATEGY="authn-k8s"

0 comments on commit a1e9c1c

Please sign in to comment.