diff --git a/hack/debug-ldapidentityprovider.sh b/hack/debug-ldapidentityprovider.sh index 1ef6bc354..69d1b6742 100755 --- a/hack/debug-ldapidentityprovider.sh +++ b/hack/debug-ldapidentityprovider.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2023 the Pinniped contributors. All Rights Reserved. +# Copyright 2023-2024 the Pinniped contributors. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 set -euo pipefail @@ -62,9 +62,6 @@ while (("$#")); do ;; -*) log_error "Unsupported flag $1" >&2 - if [[ "$1" == *"active-directory"* ]]; then - log_error "Did you mean --get-active-directory-vars?" - fi exit 1 ;; *) diff --git a/hack/prepare-for-integration-tests.sh b/hack/prepare-for-integration-tests.sh index 24a6acec4..711f0dc0c 100755 --- a/hack/prepare-for-integration-tests.sh +++ b/hack/prepare-for-integration-tests.sh @@ -15,6 +15,9 @@ # For example, to alternatively build and deploy Pinniped as a Carvel package, use: # PINNIPED_USE_LOCAL_KIND_REGISTRY=1 ./hack/prepare-for-integration-tests.sh --clean --pre-install ./hack/lib/carvel_packages/build.sh --alternate-deploy ./hack/lib/carvel_packages/deploy.sh # +# Set PINNIPED_USE_CONTOUR=1 when running this script to cause the kind cluster created by this script to be +# ready for using PINNIPED_USE_CONTOUR=1 with subsequent hack scripts, e.g. prepare-supervisor-on-kind.sh. +# set -euo pipefail pinniped_path="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" @@ -109,9 +112,6 @@ while (("$#")); do ;; -*) log_error "Unsupported flag $1" >&2 - if [[ "$1" == *"active-directory"* ]]; then - log_error "Did you mean --get-active-directory-vars?" - fi exit 1 ;; *) diff --git a/hack/prepare-supervisor-on-kind.sh b/hack/prepare-supervisor-on-kind.sh index 0bd24c43f..3a56ea268 100755 --- a/hack/prepare-supervisor-on-kind.sh +++ b/hack/prepare-supervisor-on-kind.sh @@ -28,7 +28,7 @@ # PINNIPED_USE_CONTOUR=1 hack/prepare-for-integration-tests.sh -c # PINNIPED_USE_CONTOUR=1 hack/prepare-supervisor-on-kind.sh --oidc --ldap # -# Depends on `step` which can be installed by `brew install step` on MacOS. +# This script depends on `step` which can be installed by `brew install step` on MacOS. # set -euo pipefail @@ -69,11 +69,11 @@ while (("$#")); do shift ;; --github) + # This assumes that you used the --get-github-vars flag with hack/prepare-for-integration-tests.sh. use_github_upstream=yes shift ;; --ad) - # Use an ActiveDirectoryIdentityProvider. # This assumes that you used the --get-active-directory-vars flag with hack/prepare-for-integration-tests.sh. use_ad_upstream=yes shift @@ -499,6 +499,7 @@ fi # Make a JWTAuthenticator which respects JWTs from the Supervisor's issuer. # The issuer URL must be accessible from within the cluster for OIDC discovery. +echo "Creating JWTAuthenticator..." cat <&2 kind: WebhookAuthenticator apiVersion: authentication.concierge.pinniped.dev/v1alpha1 metadata: - name: my-webhook + name: my-webhook-authenticator spec: endpoint: ${PINNIPED_TEST_WEBHOOK_ENDPOINT} tls: certificateAuthorityData: ${PINNIPED_TEST_WEBHOOK_CA_BUNDLE} EOF +echo "Waiting for WebhookAuthenticator to be ready..." +kubectl wait --for=condition=Ready webhookauthenticator my-webhook-authenticator --timeout 60s + +# Compile the CLI. +echo "Building the Pinniped CLI..." +go build ./cmd/pinniped + # Use the CLI to get a kubeconfig that will use this WebhookAuthenticator. -go build -o /tmp/pinniped ./cmd/pinniped +echo "Generating webhook kubeconfig..." /tmp/pinniped get kubeconfig \ --concierge-authenticator-type webhook \ - --concierge-authenticator-name my-webhook \ - --static-token "$PINNIPED_TEST_USER_TOKEN" >/tmp/kubeconfig-with-webhook-auth.yaml + --concierge-authenticator-name my-webhook-authenticator \ + --static-token "$PINNIPED_TEST_USER_TOKEN" >kubeconfig-webhook.yaml -echo "export KUBECONFIG=/tmp/kubeconfig-with-webhook-auth.yaml" +echo +echo "To log in using webhook:" +echo "PINNIPED_DEBUG=true ./pinniped whoami --kubeconfig ./kubeconfig-webhook.yaml" +echo