-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
80 additions
and
66 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
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 |
---|---|---|
@@ -1,20 +1,12 @@ | ||
#!/bin/bash | ||
|
||
NAMESPACE={{ namespace }}-{{ cluster }} | ||
BASE={{ namespace }} | ||
CLUSTER={{ cluster }} | ||
CLUSTERDIR={{ clusterdir }} | ||
SECRET=$(oc -n $NAMESPACE get secret | grep user-data-$CLUSTER | head -1 | awk '{print $1}') | ||
TOKEN=$(oc -n $NAMESPACE get secret $SECRET -o jsonpath='{.data.value}' | base64 -d | awk -F "Bearer " '{print $2}' | awk -F "\"" '{print "Bearer " $1}') | ||
NODEPOOL={{ nodepool|default(cluster) }} | ||
NAMESPACE=${BASE}-${CLUSTER} | ||
CLUSTERDIR=$HOME/.kcli/clusters/$CLUSTER | ||
|
||
{% if nodeport|default(False) %} | ||
IP=$(oc get node -o wide --selector='node-role.kubernetes.io/master' | grep -v NAME| head -1 | awk '{print $6}') | ||
PORT=$(oc -n $NAMESPACE get svc ignition-server-proxy -o jsonpath={.spec.ports[0].nodePort}) | ||
curl -k -H "Authorization: $TOKEN" https://$IP:$PORT/ignition > $CLUSTERDIR/nodepool.ign | ||
{% else %} | ||
MANAGEMENT_INGRESS_DOMAIN={{ management_ingress_domain }} | ||
curl -k -H "Authorization: $TOKEN" https://ignition-server-$NAMESPACE.$MANAGEMENT_INGRESS_DOMAIN/ignition > $CLUSTERDIR/nodepool.ign | ||
{% endif %} | ||
SECRET=$(oc -n $NAMESPACE get secret -o jsonpath="{range .items[?(@.metadata.annotations.hypershift\.openshift\.io/nodePool==\"$BASE/$NODEPOOL\")]}{.metadata.name}{'\n'}{end}" | grep token) | ||
oc -n $NAMESPACE get secret $SECRET -o jsonpath={'.data.payload'} | base64 -d > $CLUSTERDIR/nodepool_$NODEPOOL.ign | ||
|
||
if [ ! -s $CLUSTERDIR/nodepool.ign ] || [ "$(grep 'Token not found' $CLUSTERDIR/nodepool.ign)" != "" ] || [ "$(grep '503 Service Unavailable' $CLUSTERDIR/nodepool.ign)" != "" ] ; then | ||
rm -f $CLUSTERDIR/nodepool.ign | ||
fi | ||
[ -s $CLUSTERDIR/nodepool_$NODEPOOL.ign ] || rm -f $CLUSTERDIR/nodepool_$NODEPOOL.ign |
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
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
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
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
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
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
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