-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make prepare-supervisor-on-kind.sh work with older versions of bash
- Loading branch information
Showing
1 changed file
with
18 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -238,13 +238,23 @@ fi | |
kubectl create secret tls -n "$PINNIPED_TEST_SUPERVISOR_NAMESPACE" my-federation-domain-tls --cert "$tls_crt_path" --key "$tls_key_path" \ | ||
--dry-run=client --output yaml | kubectl apply -f - | ||
|
||
# Variable that will be used to build up the "identityProviders" yaml for the FederationDomain. | ||
fd_idps="" | ||
# Make a FederationDomain using the TLS Secret and identity providers from above in a temp file. | ||
fd_file="/tmp/federationdomain.yaml" | ||
cat << EOF > $fd_file | ||
apiVersion: config.supervisor.pinniped.dev/v1alpha1 | ||
kind: FederationDomain | ||
metadata: | ||
name: my-federation-domain | ||
spec: | ||
issuer: $issuer | ||
tls: | ||
secretName: my-federation-domain-tls | ||
identityProviders: | ||
EOF | ||
|
||
if [[ "$use_oidc_upstream" == "yes" ]]; then | ||
# Indenting the heredoc by 4 spaces to make it indented the correct amount in the FederationDomain below. | ||
fd_idps="${fd_idps}$( | ||
cat <<EOF | ||
cat << EOF >> $fd_file | ||
- displayName: "My OIDC IDP 🚀" | ||
objectRef: | ||
|
@@ -264,13 +274,11 @@ if [[ "$use_oidc_upstream" == "yes" ]]; then | |
username: oidc:[email protected] | ||
groups: [ oidc:a, oidc:b ] | ||
EOF | ||
)" | ||
fi | ||
|
||
if [[ "$use_ldap_upstream" == "yes" ]]; then | ||
# Indenting the heredoc by 4 spaces to make it indented the correct amount in the FederationDomain below. | ||
fd_idps="${fd_idps}$( | ||
cat <<EOF | ||
cat << EOF >> $fd_file | ||
- displayName: "My LDAP IDP 🚀" | ||
objectRef: | ||
|
@@ -320,35 +328,22 @@ if [[ "$use_ldap_upstream" == "yes" ]]; then | |
rejected: true | ||
message: "Only users in certain kube groups are allowed to authenticate" | ||
EOF | ||
)" | ||
fi | ||
|
||
if [[ "$use_ad_upstream" == "yes" ]]; then | ||
# Indenting the heredoc by 4 spaces to make it indented the correct amount in the FederationDomain below. | ||
fd_idps="${fd_idps}$( | ||
cat <<EOF | ||
cat << EOF >> $fd_file | ||
- displayName: "My AD IDP" | ||
objectRef: | ||
apiGroup: idp.supervisor.pinniped.dev | ||
kind: ActiveDirectoryIdentityProvider | ||
name: my-ad-provider | ||
EOF | ||
)" | ||
fi | ||
|
||
# Make a FederationDomain using the TLS Secret and identity providers from above. | ||
cat <<EOF | kubectl apply --namespace "$PINNIPED_TEST_SUPERVISOR_NAMESPACE" -f - | ||
apiVersion: config.supervisor.pinniped.dev/v1alpha1 | ||
kind: FederationDomain | ||
metadata: | ||
name: my-federation-domain | ||
spec: | ||
issuer: $issuer | ||
tls: | ||
secretName: my-federation-domain-tls | ||
identityProviders:${fd_idps} | ||
EOF | ||
# Apply the FederationDomain from the file created above. | ||
kubectl apply --namespace "$PINNIPED_TEST_SUPERVISOR_NAMESPACE" -f "$fd_file" | ||
|
||
echo "Waiting for FederationDomain to initialize or update..." | ||
kubectl wait --for=condition=Ready FederationDomain/my-federation-domain -n "$PINNIPED_TEST_SUPERVISOR_NAMESPACE" | ||
|