Skip to content

Commit

Permalink
WIP: Set up the node -> machine mapping
Browse files Browse the repository at this point in the history
This manually updates the status of the Machine objects to contains:

1) nodeRef pointing back to the Node
2) addresses of the Node, copied to the Machine
  • Loading branch information
bcrochet committed Apr 5, 2019
1 parent 510502d commit 9c45bc3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions 06_create_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,29 @@ sudo virsh net-dhcp-leases baremetal
# disable NoSchedule taints for masters until we have workers deployed
oc adm taint nodes -l node-role.kubernetes.io/master node-role.kubernetes.io/master:NoSchedule-

# BEGIN Hack #260
# Hack workaround for openshift-metalkube/dev-scripts#260 until it's done automatically
oc --config ocp/auth/kubeconfig proxy &
proxy_pid=$!

# Currently only works on masters
for node in $(oc --config ocp/auth/kubeconfig get nodes -o template --template='{{range .items}}{{.metadata.uid}}:{{.metadata.name}}{{"\n"}}{{end}}'); do
name=$(echo $node | cut -f2 -d':')
uid=$(echo $node | cut -f1 -d':')
addresses=$(oc --config ocp/auth/kubeconfig get node $name -o json | jq -c '.status.addresses')
curl -X PATCH http://localhost:8001/apis/machine.openshift.io/v1beta1/namespaces/openshift-machine-api/machines/$CLUSTER_NAME-$name/status -H "Content-type: application/merge-patch+json" -d '{"status":{"addresses":'"${addresses}"',"nodeRef":{"kind":"Node","name":"'"${name}"'","uid":"'"${uid}"'"}}}'
done

kill $proxy_pid

# Bounce the machine approver to get it to notice the changes.
oc scale deployment -n openshift-cluster-machine-approver --replicas=0 machine-approver
oc scale deployment -n openshift-cluster-machine-approver --replicas=1 machine-approver

# Wait a tiny bit, then list the csrs
sleep 5
oc get csrs
# END Hack

wait_for_cvo_finish ocp
echo "Cluster up, you can interact with it via oc --config ${KUBECONFIG} <command>"

0 comments on commit 9c45bc3

Please sign in to comment.