Skip to content

Commit

Permalink
relocatable only requires RoutingViaHost for OCP 4.12
Browse files Browse the repository at this point in the history
  • Loading branch information
loganmc10 committed May 18, 2023
1 parent 2c1bce8 commit f1a9c0e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion edge/docs/RELOCATABLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This feature requires OpenShift 4.12 or higher.
When the ```relocatable``` option is enabled, the cluster is configured in such a way that its primary interface IP addresses can be changed without impacting the operation of the cluster.

## How it works
You set the value of ```relocatable.interface``` to the name of the external facing interface. A secondary static IP address is assigned to this interface. The machineNetwork CIDR is also set to a static internal subnet. Finally, a MachineConfig is created that modifies /etc/default/nodeip-configuration to tell the cluster to use the static IP as the node IP. 'routingViaHost' is also enabled.
You set the value of ```relocatable.interface``` to the name of the external facing interface. A secondary static IP address is assigned to this interface. The machineNetwork CIDR is also set to a static internal subnet. Finally, a MachineConfig is created that modifies /etc/default/nodeip-configuration to tell the cluster to use the static IP as the node IP. 'routingViaHost' is also enabled for OCP 4.12.

All of these actions together cause the server to use the static IP for everything related to OpenShift, while still allowing access to the cluster from outside via the primary interface IP address. This means that the external IP can be changed, and the cluster will continue to use the static IP internally for its operation.

Expand Down
26 changes: 17 additions & 9 deletions edge/roles/edge_install/tasks/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@
register: k8s_result
until: k8s_result is not failed

- name: Configure routingViaHost
when: (edgeCluster.routingViaHost is defined and edgeCluster.routingViaHost) or (edgeCluster.relocatable is defined)
kubernetes.core.k8s:
template: RoutingViaHost.yaml.j2
apply: true
state: present
register: k8s_result
until: k8s_result is not failed

- name: Disable CRI-O wipe
when:
- edgeCluster.clearRegistryConfig is defined
Expand Down Expand Up @@ -111,6 +102,23 @@
register: k8s_result
until: k8s_result is not failed

- name: Get Cluster Version
kubernetes.core.k8s_info:
api_version: hive.openshift.io/v1
kind: ClusterDeployment
name: "{{ metadata.name }}"
namespace: "{{ metadata.name }}"
register: cluster_deployment
until: cluster_deployment.resources[0].status.installVersion is defined

- name: Configure routingViaHost
kubernetes.core.k8s:
template: RoutingViaHost.yaml.j2
apply: true
state: present
register: k8s_result
until: k8s_result is not failed

- name: Setup InfraEnv and BMH
ansible.builtin.include_tasks: setup_bmh.yaml

Expand Down
2 changes: 0 additions & 2 deletions edge/roles/edge_install/templates/AgentClusterInstall.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ spec:
{% if edgeCluster.reservedCpuSet is defined %}
- name: "workload-partitioning"
{% endif %}
{% if (edgeCluster.routingViaHost is defined and edgeCluster.routingViaHost) or (edgeCluster.relocatable is defined) %}
- name: "routing-via-host"
{% endif %}
{% if edgeCluster.clearRegistryConfig is defined and edgeCluster.clearRegistryConfig %}
- name: "crio-wipe"
{% endif %}
Expand Down
3 changes: 3 additions & 0 deletions edge/roles/edge_install/templates/RoutingViaHost.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: "routing-via-host"
namespace: "{{ metadata.name }}"
data:
{% if (edgeCluster.routingViaHost is defined and edgeCluster.routingViaHost) or
(edgeCluster.relocatable is defined and cluster_deployment.resources[0].status.installVersion is ansible.builtin.version("4.13.0", "lt")) %}
routing_via_host.yaml: |
apiVersion: operator.openshift.io/v1
kind: Network
Expand All @@ -14,3 +16,4 @@ data:
ovnKubernetesConfig:
gatewayConfig:
routingViaHost: true
{% endif %}

0 comments on commit f1a9c0e

Please sign in to comment.