@@ -155,8 +155,20 @@ While the implementation of this feature is in progress, in the hub and spoke si
155
155
156
156
9 . Generate the secret called ` hub-kubeconfig-secret ` in ` open-cluster-management-agent ` namespace using above kubeconfig:
157
157
``` shell
158
- HUB_KUBECONFIG= $( aws eks update-kubeconfig --name $HUB_CLUSTER_NAME --kubeconfig /awscli/kubeconfig.kubeconfig --role-arn arn:aws:iam::" $HUB_ACCOUNT_ID " :role/$HUB_ROLE_NAME --dry-run)
158
+ aws eks update-kubeconfig --name $HUB_CLUSTER_NAME --kubeconfig /awscli/kubeconfig.kubeconfig --role-arn arn:aws:iam::" $HUB_ACCOUNT_ID " :role/$HUB_ROLE_NAME --dry-run > hub-kubeconfig
159
159
160
+ # Updating the clusterName to "hub" to make it same as bootstrap-kubeconfig
161
+ # to pass a validation in ocm. Install yq, if missing.
162
+ # Note - The yq command works only on a Linux machine. Please use a text editor to manually replace the values otherwise.
163
+ NEW_CLUSTER_NAME=" hub"
164
+ yq eval "
165
+ (.clusters[].name = \" ${NEW_CLUSTER_NAME} \" ) |
166
+ (.contexts[].context.cluster = \" ${NEW_CLUSTER_NAME} \" ) |
167
+ del(.users[].user.exec.env)
168
+ " -i " hub-kubeconfig"
169
+
170
+ HUB_KUBECONFIG=$( cat hub-kubeconfig)
171
+
160
172
AGENT_NAME_ENCODED=$( kubectl get klusterlet klusterlet -o jsonpath=' {.metadata.uid}' | tr -d ' \n' | base64 | tr -d ' \n' )
161
173
SPOKE_CLUSTER_NAME_ENCODED=$( echo -n " $SPOKE_CLUSTER_NAME " | base64 | tr -d ' \n' )
162
174
HUB_KUBECONFIG_ENCODED=$( echo -n " $HUB_KUBECONFIG " | base64 | tr -d ' \n' )
@@ -166,15 +178,6 @@ While the implementation of this feature is in progress, in the hub and spoke si
166
178
-e " s|\$ {SPOKE_CLUSTER_NAME_ENCODED}|$SPOKE_CLUSTER_NAME_ENCODED |g" \
167
179
-e " s|\$ {HUB_KUBECONFIG_ENCODED}|$HUB_KUBECONFIG_ENCODED_ESCAPED |g" \
168
180
templates/Template-hub-kubeconfig-secret.yaml > hubKubeconfigSecret.yaml
169
-
170
- # Updating the clusterName to "hub" to make it same as bootstrap-kubeconfig
171
- # to pass a validation in ocm. Install yq, if missing, for following command
172
- NEW_CLUSTER_NAME=" hub"
173
- yq eval "
174
- (.clusters[].name = \" ${NEW_CLUSTER_NAME} \" ) |
175
- (.contexts[].context.cluster = \" ${NEW_CLUSTER_NAME} \" ) |
176
- del(.users[].user.exec.env)
177
- " -i " hubKubeconfigSecret.yaml"
178
181
179
182
kubectl apply -f hubKubeconfigSecret.yaml
180
183
```
0 commit comments