Skip to content

Commit d9c4806

Browse files
committed
add script for identity secret
1 parent 1aa9837 commit d9c4806

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,9 @@ create-management-cluster: $(KUSTOMIZE) $(ENVSUBST)
472472
# Install cert manager and wait for availability
473473
./hack/install-cert-manager.sh
474474

475+
# Create secret for AzureClusterIdentity
476+
./hack/create-identity-secret.sh
477+
475478
# Deploy CAPI
476479
curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v0.4.0/cluster-api-components.yaml | $(ENVSUBST) | kubectl apply -f -
477480

hack/create-identity-secret.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
# Copyright 2021 The Kubernetes Authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -o errexit
17+
set -o nounset
18+
set -o pipefail
19+
20+
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
21+
cd "${REPO_ROOT}" || exit 1
22+
23+
# shellcheck source=hack/ensure-kubectl.sh
24+
source "${REPO_ROOT}/hack/ensure-kubectl.sh"
25+
# shellcheck source=hack/parse-prow-creds.sh
26+
source "${REPO_ROOT}/hack/parse-prow-creds.sh"
27+
28+
export CLUSTER_IDENTITY_SECRET_NAME="cluster-identity-secret"
29+
export CLUSTER_IDENTITY_NAME=${CLUSTER_IDENTITY_NAME:="cluster-identity"}
30+
export AZURE_CLUSTER_IDENTITY_SECRET_NAMESPACE="default"
31+
export AZURE_CLUSTER_IDENTITY_CLIENT_ID="${AZURE_CLIENT_ID}"
32+
33+
kubectl create secret generic "${CLUSTER_IDENTITY_SECRET_NAME}" --from-literal=clientSecret="${AZURE_CLIENT_SECRET}"
34+
35+
kubectl label secret "${CLUSTER_IDENTITY_SECRET_NAME}" "clusterctl.cluster.x-k8s.io/move-hierarchy"="true"

0 commit comments

Comments
 (0)