Skip to content

Commit

Permalink
Merge pull request #31 from conjurdemos/allow-local-ac-image
Browse files Browse the repository at this point in the history
Enable running with local authenticator build
  • Loading branch information
izgeri committed Nov 2, 2018
2 parents 4e43171 + f003d48 commit 476ccf3
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 2 deletions.
10 changes: 10 additions & 0 deletions 5_build_and_push_containers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,13 @@ else
popd

fi

if [[ $LOCAL_AUTHENTICATOR == true ]]; then
# Re-tag the locally-built conjur-authn-k8s-client:dev image
authn_image=$(platform_image conjur-authn-k8s-client)
docker tag conjur-authn-k8s-client:dev $authn_image

if [[ is_minienv != true ]]; then
docker push $authn_image
fi
fi
8 changes: 8 additions & 0 deletions 6_deploy_test_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ init_connection_specs() {
test_sidecar_app_docker_image=$(platform_image test-sidecar-app)
test_init_app_docker_image=$(platform_image test-init-app)

if [[ $LOCAL_AUTHENTICATOR == true ]]; then
authenticator_client_image=$(platform_image conjur-authn-k8s-client)
else
authenticator_client_image="cyberark/conjur-kubernetes-authenticator"
fi

conjur_appliance_url=https://conjur-follower.$CONJUR_NAMESPACE_NAME.svc.cluster.local/api
conjur_authenticator_url=https://conjur-follower.$CONJUR_NAMESPACE_NAME.svc.cluster.local/api/authn-k8s/$AUTHENTICATOR_ID

Expand Down Expand Up @@ -103,6 +109,7 @@ deploy_sidecar_app() {
sleep 5

sed -e "s#{{ TEST_APP_DOCKER_IMAGE }}#$test_sidecar_app_docker_image#g" ./$PLATFORM/test-app-summon-sidecar.yml |
sed -e "s#{{ AUTHENTICATOR_CLIENT_IMAGE }}#$authenticator_client_image#g" |
sed -e "s#{{ IMAGE_PULL_POLICY }}#$IMAGE_PULL_POLICY#g" |
sed -e "s#{{ CONJUR_VERSION }}#$CONJUR_VERSION#g" |
sed -e "s#{{ CONJUR_ACCOUNT }}#$CONJUR_ACCOUNT#g" |
Expand Down Expand Up @@ -132,6 +139,7 @@ deploy_init_container_app() {
sleep 5

sed -e "s#{{ TEST_APP_DOCKER_IMAGE }}#$test_init_app_docker_image#g" ./$PLATFORM/test-app-summon-init.yml |
sed -e "s#{{ AUTHENTICATOR_CLIENT_IMAGE }}#$authenticator_client_image#g" |
sed -e "s#{{ IMAGE_PULL_POLICY }}#$IMAGE_PULL_POLICY#g" |
sed -e "s#{{ CONJUR_VERSION }}#$CONJUR_VERSION#g" |
sed -e "s#{{ CONJUR_ACCOUNT }}#$CONJUR_ACCOUNT#g" |
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,18 @@ available.
## OpenShift
The test app uses the Conjur Ruby API, configured with the access token provided by the authenticator
sidecar, to retrieve a secret value from Conjur.

# Development

If you are using this repository for development purposes, there is some
additional functionality that you may find useful.

- Setting the `LOCAL_AUTHENTICATOR` environment variable to `true` will push
the Conjur K8s authenticator client from your local Docker registry to the
remote registry (if used), and will use that image rather than the image
stored in DockerHub.
This can be useful if you are working on changes to the [authenticator client](https://github.com/cyberark/conjur-authn-k8s-client).
If you run `./bin/build` in that project to generate a local Docker image
`conjur-authn-k8s-client:dev` and set `LOCAL_AUTHENTICATOR=true`, then when
you run the `./start` script in this repo the demo apps will be deployed with
your local build of the authenticator.
2 changes: 1 addition & 1 deletion kubernetes/test-app-summon-init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ spec:
name: conjur-access-token
readOnly: true
initContainers:
- image: cyberark/conjur-kubernetes-authenticator
- image: {{ AUTHENTICATOR_CLIENT_IMAGE }}
imagePullPolicy: Always
name: authenticator
env:
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/test-app-summon-sidecar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ spec:
- mountPath: /run/conjur
name: conjur-access-token
readOnly: true
- image: cyberark/conjur-kubernetes-authenticator
- image: {{ AUTHENTICATOR_CLIENT_IMAGE }}
imagePullPolicy: Always
name: authenticator
env:
Expand Down
1 change: 1 addition & 0 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ PLATFORM="${PLATFORM:-kubernetes}" # default to kubernetes if env var not set

MINIKUBE="${MINIKUBE:-false}"
MINISHIFT="${MINISHIFT:-false}"
LOCAL_AUTHENTICATOR="${LOCAL_AUTHENTICATOR:-false}"

if [ $PLATFORM = 'kubernetes' ]; then
cli=kubectl
Expand Down

0 comments on commit 476ccf3

Please sign in to comment.