-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
salt,docs,tests: Add procedure to change the Control Plane Ingress IP
Add a simple orchestrate and small procedure in the documentation to change the Control Plane Ingress IP
- Loading branch information
1 parent
a5b85dd
commit 4fe7cac
Showing
6 changed files
with
191 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Changing the Control Plane Ingress IP | ||
===================================== | ||
|
||
#. On the Bootstrap node, update the ``ip`` field from | ||
``networks.controlPlane.ingress`` in the Bootstrap configuration file. | ||
(refer to :ref:`Bootstrap Configuration<Bootstrap Configuration>`) | ||
|
||
#. Refresh the pillar. | ||
|
||
.. code-block:: console | ||
$ salt-call saltutil.refresh_pillar wait=True | ||
#. Check that the change is taken into account. | ||
|
||
.. code-block:: console | ||
$ salt-call metalk8s_network.get_control_plane_ingress_ip | ||
local: | ||
<my-new-ip> | ||
#. On the Bootstrap node, reconfigure apiServer: | ||
|
||
.. parsed-literal:: | ||
$ salt-call state.sls \\ | ||
metalk8s.kubernetes.apiserver \\ | ||
saltenv=metalk8s-|version| | ||
#. Reconfigure Control Plane components: | ||
|
||
.. parsed-literal:: | ||
$ kubectl exec -n kube-system -c salt-master \\ | ||
--kubeconfig=/etc/kubernetes/admin.conf \\ | ||
$(kubectl --kubeconfig=/etc/kubernetes/admin.conf get pod \\ | ||
-l "app.kubernetes.io/name=salt-master" \\ | ||
--namespace=kube-system -o jsonpath='{.items[0].metadata.name}') \\ | ||
-- salt-run state.orchestrate \\ | ||
metalk8s.orchestrate.update-control-plane-ingress-ip \\ | ||
saltenv=metalk8s-|version| | ||
#. You can :ref:`access the MetalK8s GUI <installation-services-admin-ui>` | ||
using this new IP. |
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
57 changes: 57 additions & 0 deletions
57
salt/metalk8s/orchestrate/update-control-plane-ingress-ip.sls
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{%- set bootstrap_node = salt.metalk8s.minions_by_role('bootstrap') | first %} | ||
Check pillar content on {{ bootstrap_node }}: | ||
salt.function: | ||
- name: metalk8s.check_pillar_keys | ||
- tgt: {{ bootstrap_node }} | ||
- kwarg: | ||
keys: | ||
- metalk8s.endpoints.repositories | ||
raise_error: False | ||
- retry: | ||
attempts: 5 | ||
|
||
Regenerate Control Plane Ingress cert on {{ bootstrap_node }}: | ||
salt.state: | ||
- tgt: {{ bootstrap_node }} | ||
- sls: | ||
- metalk8s.addons.nginx-ingress-control-plane.certs | ||
- saltenv: {{ saltenv }} | ||
- require: | ||
- salt: Check pillar content on {{ bootstrap_node }} | ||
|
||
Reconfigure Control Plane Ingress: | ||
salt.runner: | ||
- name: state.orchestrate | ||
- mods: | ||
- metalk8s.addons.nginx-ingress-control-plane.deployed | ||
- saltenv: {{ saltenv }} | ||
- require: | ||
- salt: Regenerate Control Plane Ingress cert on {{ bootstrap_node }} | ||
|
||
Reconfigure Control Plane components: | ||
salt.runner: | ||
- name: state.orchestrate | ||
- mods: | ||
- metalk8s.addons.dex.deployed | ||
- metalk8s.addons.prometheus-operator.deployed | ||
- metalk8s.addons.ui.deployed | ||
- saltenv: {{ saltenv }} | ||
- require: | ||
- salt: Reconfigure Control Plane Ingress | ||
|
||
{%- set master_nodes = salt.metalk8s.minions_by_role('master') %} | ||
{%- for node in master_nodes | sort %} | ||
|
||
Reconfigure apiserver on {{ node }}: | ||
salt.state: | ||
- tgt: {{ node }} | ||
- sls: | ||
- metalk8s.kubernetes.apiserver | ||
- saltenv: {{ saltenv }} | ||
- require: | ||
- salt: Reconfigure Control Plane components | ||
{%- if loop.previtem is defined %} | ||
- salt: Reconfigure apiserver on {{ loop.previtem }} | ||
{%- endif %} | ||
|
||
{%- endfor %} |
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 |
---|---|---|
|
@@ -18,3 +18,13 @@ Feature: Ingress | |
And the node control-plane IP is not equal to its workload-plane IP | ||
When we perform an HTTP request on port 80 on a control-plane IP | ||
Then the server should not respond | ||
|
||
Scenario: Change Control Plane Ingress IP to node-1 IP | ||
Given the Kubernetes API is available | ||
And we are on a multi node cluster | ||
And pods with label 'app.kubernetes.io/name=ingress-nginx' are 'Ready' | ||
When we update control plane ingress IP to node 'node-1' IP | ||
And we wait for the rollout of 'daemonset/ingress-nginx-control-plane-controller' in namespace 'metalk8s-ingress' to complete | ||
And we wait for the rollout of 'deploy/dex' in namespace 'metalk8s-auth' to complete | ||
Then the control plane ingress IP is equal to node 'node-1' IP | ||
And we are able to login to Dex as '[email protected]' using password 'password' |
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