Repository: kubermatic/machine-controller
Pull request #1397 (2022-08-08 12:09:48)

enable DHCPv6 in RockyLinux
**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>` format, will close the issue(s) when PR gets merged)*:
Part of https://github.com/kubermatic/kubermatic/issues/9994

**Special notes for your reviewer**:

**Optional Release Note**:
<!--
Write your release note:
1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required".
2. If no release note is required, just write "NONE".
-->
```release-note
NONE
```


kubermatic-bot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubermatic/machine-controller/pull/1397#" title="Author self-approved">PratikDeoghare</a>*
To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign **ahmedwaleedmalik** after the PR has been reviewed.
You can assign the PR to them by writing `/assign @ahmedwaleedmalik` in a comment when ready.

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubermatic%2Fmachine-controller).

<details open>
Needs approval from an approver in each of these files:

- **[pkg/userdata/OWNERS](https://github.com/kubermatic/machine-controller/blob/master/pkg/userdata/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["ahmedwaleedmalik"]} -->
PratikDeoghare: /assign @ahmedwaleedmalik
kubermatic-bot: @PratikDeoghare: The following test **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
pull-machine-controller-e2e-hetzner | 1779c775b1bb81c335aa2782712ffff3525d2448 | [link](https://public-prow.loodse.com/view/gs/prow-dev-public-data/pr-logs/pull/kubermatic_machine-controller/1397/pull-machine-controller-e2e-hetzner/1556613667661811712) | true | `/test pull-machine-controller-e2e-hetzner`

[Full PR test history](https://public-prow.loodse.com/pr-history?org=kubermatic&repo=machine-controller&pr=1397)

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
PratikDeoghare: /retest

Patch:
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 163cca41..f035f371 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,11 +1,29 @@
 **What this PR does / why we need it**:
 
-**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>` format, will close the issue(s) when PR gets merged)*:
+**Which issue(s) this PR fixes**:
+<!--optional, in `fixes #<issue number>` format, will close the issue(s) when PR gets merged-->
 Fixes #
 
+**What type of PR is this?**
+<!--
+Add one of the following kinds:
+/kind bug
+/kind cleanup
+/kind documentation
+/kind feature
+/kind design
+
+Optionally add one or more of the following kinds if applicable:
+/kind api-change
+/kind deprecation
+/kind failing-test
+/kind flake
+/kind regression
+-->
+
 **Special notes for your reviewer**:
 
-**Optional Release Note**:
+**Does this PR introduce a user-facing change? Then add your Release Note here**:
 <!--
 Write your release note:
 1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required".
@@ -14,3 +32,16 @@ Write your release note:
 ```release-note
 
 ```
+
+**Documentation**:
+<!--
+Please do one of the following options:
+- Add a link to the existing documentation
+- Add a link to the kubermatic/docs pull request
+- If no documentation change is applicable then add:
+  - TBD (documentation will be added later)
+  - NONE (no documentation needed for this PR)
+-->
+```documentation
+
+```
diff --git a/docs/operating-system.md b/docs/operating-system.md
index 998195a7..beb70e6e 100644
--- a/docs/operating-system.md
+++ b/docs/operating-system.md
@@ -9,11 +9,14 @@
 | AWS | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
 | Azure | ✓ | ✓ | ✓ | ✓ | x | x | ✓ |
 | Digitalocean  | ✓ | ✓ | x | x | x | x | ✓ |
+| Equinix Metal | ✓ | ✓ | ✓ | x | x | x | ✓ |
 | Google Cloud Platform | ✓ | x | x | x | x | x | x |
 | Hetzner | ✓ | ✓ | x | x | x | x | ✓ |
-| Equinix Metal | ✓ | ✓ | x | x | x | x | x |
+| KubeVirt | ✓ | ✓ | ✓ | ✓ | x | x | ✓ |
+| Nutanix | ✓ | ✓ | x | x | x | x | x |
 | Openstack | ✓ | ✓ | ✓ | ✓ | x | x | ✓ |
 | VMware Cloud Director | ✓ | x | x | x | x | x | x |
+| VSphere | ✓ | ✓ | ✓ | ✓ | x | x | ✓ |
 
 ## Configuring a operating system
 
@@ -22,6 +25,7 @@ Allowed values:
 
 - `amzn2`
 - `centos`
+- `flatcar`
 - `rhel`
 - `rockylinux`
 - `sles`
@@ -38,106 +42,7 @@ Machine controller may work with other OS versions that are not listed in the ta
 |---|---|
 | AmazonLinux2 | 2.x |
 | CentOS | 7.4.x, 7.6.x, 7.7.x |
-| RHEL | 8.0, 8.1 |
+| RHEL | 8.x |
 | Rocky Linux | 8.5 |
-| SLES |  SLES 15 SP1 |
-| Ubuntu | 18.04 LTS |
-
-### Ubuntu
-
-```yaml
-apiVersion: "cluster.k8s.io/v1alpha1"
-kind: MachineDeployment
-metadata:
-  name: machine1
-  namespace: kube-system
-spec:
-  paused: false
-  replicas: 1
-  strategy:
-    type: RollingUpdate
-    rollingUpdate:
-      maxSurge: 1
-      maxUnavailable: 0
-  minReadySeconds: 0
-  selector:
-    matchLabels:
-      foo: bar
-  template:
-    metadata:
-      labels:
-        foo: bar
-    spec:
-      providerConfig:
-        value:
-          ...
-          operatingSystem: "ubuntu"
-          operatingSystemSpec:
-            # do a apt-get dist-upgrade on start and reboot if required
-            distUpgradeOnBoot: true
-```
-
-### Container Linux
-
-```yaml
-apiVersion: "cluster.k8s.io/v1alpha1"
-kind: MachineDeployment
-metadata:
-  name: machine1
-  namespace: kube-system
-spec:
-  paused: false
-  replicas: 1
-  strategy:
-    type: RollingUpdate
-    rollingUpdate:
-      maxSurge: 1
-      maxUnavailable: 0
-  minReadySeconds: 0
-  selector:
-    matchLabels:
-      foo: bar
-  template:
-    metadata:
-      labels:
-        foo: bar
-    spec:
-      providerConfig:
-        value:
-          ...
-          operatingSystem: "flatcar"
-          operatingSystemSpec:
-            # disable auto update
-            disableAutoUpdate: true
-```
-
-### CentOS
-
-```yaml
-apiVersion: "cluster.k8s.io/v1alpha1"
-kind: MachineDeployment
-metadata:
-  name: machine1
-  namespace: kube-system
-spec:
-  paused: false
-  replicas: 1
-  strategy:
-    type: RollingUpdate
-    rollingUpdate:
-      maxSurge: 1
-      maxUnavailable: 0
-  minReadySeconds: 0
-  selector:
-    matchLabels:
-      foo: bar
-  template:
-    metadata:
-      labels:
-        foo: bar
-    spec:
-      providerConfig:
-        value:
-          ...
-          operatingSystem: "centos"
-```
+| SLES |  SLES 15 SP3 |
+| Ubuntu | 20.04 LTS |
\ No newline at end of file
diff --git a/pkg/cloudprovider/provider/aws/provider.go b/pkg/cloudprovider/provider/aws/provider.go
index ee28c057..8b96c6b4 100644
--- a/pkg/cloudprovider/provider/aws/provider.go
+++ b/pkg/cloudprovider/provider/aws/provider.go
@@ -153,13 +153,13 @@ var (
 		providerconfigtypes.OperatingSystemSLES: {
 			awstypes.CPUArchitectureX86_64: {
 				// Be as precise as possible - otherwise we might get a nightly dev build
-				description: "SUSE Linux Enterprise Server 15 SP1 (HVM, 64-bit, SSD-Backed)",
+				description: "SUSE Linux Enterprise Server 15 SP3 (HVM, 64-bit, SSD-Backed)",
 				// The AWS marketplace ID from SLES
 				owner: "013907871322",
 			},
 			awstypes.CPUArchitectureARM64: {
 				// Be as precise as possible - otherwise we might get a nightly dev build
-				description: "SUSE Linux Enterprise Server 15 SP1 (HVM, 64-bit, SSD-Backed)",
+				description: "SUSE Linux Enterprise Server 15 SP3 (HVM, 64-bit, SSD-Backed)",
 				// The AWS marketplace ID from SLES
 				owner: "013907871322",
 			},
diff --git a/pkg/cloudprovider/provider/kubevirt/provider.go b/pkg/cloudprovider/provider/kubevirt/provider.go
index 63c8ba9c..2523c62f 100644
--- a/pkg/cloudprovider/provider/kubevirt/provider.go
+++ b/pkg/cloudprovider/provider/kubevirt/provider.go
@@ -458,8 +458,9 @@ func (p *provider) GetCloudConfig(spec clusterv1alpha1.MachineSpec) (config stri
 	if err != nil {
 		return "", "", fmt.Errorf("failed to parse config: %w", err)
 	}
+
 	cc := kubevirttypes.CloudConfig{
-		Kubeconfig: c.Kubeconfig,
+		Namespace: c.Namespace,
 	}
 	ccs, err := cc.String()
 
diff --git a/pkg/userdata/rockylinux/provider.go b/pkg/userdata/rockylinux/provider.go
index 93098430..eebe3734 100644
--- a/pkg/userdata/rockylinux/provider.go
+++ b/pkg/userdata/rockylinux/provider.go
@@ -233,6 +233,12 @@ write_files:
     {{ end }}
 {{ .ContainerRuntimeScript | indent 4 }}
 {{ safeDownloadBinariesScript .KubeletVersion | indent 4 }}
+    DEFAULT_IFC_NAME=$(ip -o route get 1  | grep -oP "dev \K\S+")
+    echo NETWORKING_IPV6=yes >> /etc/sysconfig/network
+    echo IPV6INIT=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    echo DHCPV6C=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    ifdown $DEFAULT_IFC_NAME && ifup $DEFAULT_IFC_NAME
+
     # set kubelet nodeip environment variable
     mkdir -p /etc/systemd/system/kubelet.service.d/
     /opt/bin/setup_net_env.sh


Test patch:
diff --git a/pkg/userdata/rockylinux/testdata/kubelet-v1.22-aws.yaml b/pkg/userdata/rockylinux/testdata/kubelet-v1.22-aws.yaml
index 2e8b1aba..2b58e6cc 100644
--- a/pkg/userdata/rockylinux/testdata/kubelet-v1.22-aws.yaml
+++ b/pkg/userdata/rockylinux/testdata/kubelet-v1.22-aws.yaml
@@ -168,6 +168,12 @@ write_files:
         chmod +x /opt/bin/health-monitor.sh
     fi
 
+    DEFAULT_IFC_NAME=$(ip -o route get 1  | grep -oP "dev \K\S+")
+    echo NETWORKING_IPV6=yes >> /etc/sysconfig/network
+    echo IPV6INIT=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    echo DHCPV6C=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    ifdown $DEFAULT_IFC_NAME && ifup $DEFAULT_IFC_NAME
+
     # set kubelet nodeip environment variable
     mkdir -p /etc/systemd/system/kubelet.service.d/
     /opt/bin/setup_net_env.sh
diff --git a/pkg/userdata/rockylinux/testdata/kubelet-v1.23-aws-external.yaml b/pkg/userdata/rockylinux/testdata/kubelet-v1.23-aws-external.yaml
index 1621348e..fb1eafba 100644
--- a/pkg/userdata/rockylinux/testdata/kubelet-v1.23-aws-external.yaml
+++ b/pkg/userdata/rockylinux/testdata/kubelet-v1.23-aws-external.yaml
@@ -168,6 +168,12 @@ write_files:
         chmod +x /opt/bin/health-monitor.sh
     fi
 
+    DEFAULT_IFC_NAME=$(ip -o route get 1  | grep -oP "dev \K\S+")
+    echo NETWORKING_IPV6=yes >> /etc/sysconfig/network
+    echo IPV6INIT=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    echo DHCPV6C=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    ifdown $DEFAULT_IFC_NAME && ifup $DEFAULT_IFC_NAME
+
     # set kubelet nodeip environment variable
     mkdir -p /etc/systemd/system/kubelet.service.d/
     /opt/bin/setup_net_env.sh
diff --git a/pkg/userdata/rockylinux/testdata/kubelet-v1.23-aws.yaml b/pkg/userdata/rockylinux/testdata/kubelet-v1.23-aws.yaml
index 587dc6d1..e3082bbf 100644
--- a/pkg/userdata/rockylinux/testdata/kubelet-v1.23-aws.yaml
+++ b/pkg/userdata/rockylinux/testdata/kubelet-v1.23-aws.yaml
@@ -168,6 +168,12 @@ write_files:
         chmod +x /opt/bin/health-monitor.sh
     fi
 
+    DEFAULT_IFC_NAME=$(ip -o route get 1  | grep -oP "dev \K\S+")
+    echo NETWORKING_IPV6=yes >> /etc/sysconfig/network
+    echo IPV6INIT=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    echo DHCPV6C=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    ifdown $DEFAULT_IFC_NAME && ifup $DEFAULT_IFC_NAME
+
     # set kubelet nodeip environment variable
     mkdir -p /etc/systemd/system/kubelet.service.d/
     /opt/bin/setup_net_env.sh
diff --git a/pkg/userdata/rockylinux/testdata/kubelet-v1.23-nutanix.yaml b/pkg/userdata/rockylinux/testdata/kubelet-v1.23-nutanix.yaml
index bf9f1047..721b1194 100644
--- a/pkg/userdata/rockylinux/testdata/kubelet-v1.23-nutanix.yaml
+++ b/pkg/userdata/rockylinux/testdata/kubelet-v1.23-nutanix.yaml
@@ -175,6 +175,12 @@ write_files:
         chmod +x /opt/bin/health-monitor.sh
     fi
 
+    DEFAULT_IFC_NAME=$(ip -o route get 1  | grep -oP "dev \K\S+")
+    echo NETWORKING_IPV6=yes >> /etc/sysconfig/network
+    echo IPV6INIT=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    echo DHCPV6C=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    ifdown $DEFAULT_IFC_NAME && ifup $DEFAULT_IFC_NAME
+
     # set kubelet nodeip environment variable
     mkdir -p /etc/systemd/system/kubelet.service.d/
     /opt/bin/setup_net_env.sh
diff --git a/pkg/userdata/rockylinux/testdata/kubelet-v1.23-vsphere-mirrors.yaml b/pkg/userdata/rockylinux/testdata/kubelet-v1.23-vsphere-mirrors.yaml
index 5524b8cd..14cb1eab 100644
--- a/pkg/userdata/rockylinux/testdata/kubelet-v1.23-vsphere-mirrors.yaml
+++ b/pkg/userdata/rockylinux/testdata/kubelet-v1.23-vsphere-mirrors.yaml
@@ -181,6 +181,12 @@ write_files:
         chmod +x /opt/bin/health-monitor.sh
     fi
 
+    DEFAULT_IFC_NAME=$(ip -o route get 1  | grep -oP "dev \K\S+")
+    echo NETWORKING_IPV6=yes >> /etc/sysconfig/network
+    echo IPV6INIT=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    echo DHCPV6C=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    ifdown $DEFAULT_IFC_NAME && ifup $DEFAULT_IFC_NAME
+
     # set kubelet nodeip environment variable
     mkdir -p /etc/systemd/system/kubelet.service.d/
     /opt/bin/setup_net_env.sh
diff --git a/pkg/userdata/rockylinux/testdata/kubelet-v1.23-vsphere-proxy.yaml b/pkg/userdata/rockylinux/testdata/kubelet-v1.23-vsphere-proxy.yaml
index 931fdde4..9273d0b8 100644
--- a/pkg/userdata/rockylinux/testdata/kubelet-v1.23-vsphere-proxy.yaml
+++ b/pkg/userdata/rockylinux/testdata/kubelet-v1.23-vsphere-proxy.yaml
@@ -181,6 +181,12 @@ write_files:
         chmod +x /opt/bin/health-monitor.sh
     fi
 
+    DEFAULT_IFC_NAME=$(ip -o route get 1  | grep -oP "dev \K\S+")
+    echo NETWORKING_IPV6=yes >> /etc/sysconfig/network
+    echo IPV6INIT=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    echo DHCPV6C=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    ifdown $DEFAULT_IFC_NAME && ifup $DEFAULT_IFC_NAME
+
     # set kubelet nodeip environment variable
     mkdir -p /etc/systemd/system/kubelet.service.d/
     /opt/bin/setup_net_env.sh
diff --git a/pkg/userdata/rockylinux/testdata/kubelet-v1.23-vsphere.yaml b/pkg/userdata/rockylinux/testdata/kubelet-v1.23-vsphere.yaml
index e701f596..75d43c26 100644
--- a/pkg/userdata/rockylinux/testdata/kubelet-v1.23-vsphere.yaml
+++ b/pkg/userdata/rockylinux/testdata/kubelet-v1.23-vsphere.yaml
@@ -173,6 +173,12 @@ write_files:
         chmod +x /opt/bin/health-monitor.sh
     fi
 
+    DEFAULT_IFC_NAME=$(ip -o route get 1  | grep -oP "dev \K\S+")
+    echo NETWORKING_IPV6=yes >> /etc/sysconfig/network
+    echo IPV6INIT=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    echo DHCPV6C=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    ifdown $DEFAULT_IFC_NAME && ifup $DEFAULT_IFC_NAME
+
     # set kubelet nodeip environment variable
     mkdir -p /etc/systemd/system/kubelet.service.d/
     /opt/bin/setup_net_env.sh
diff --git a/pkg/userdata/rockylinux/testdata/kubelet-v1.24-aws.yaml b/pkg/userdata/rockylinux/testdata/kubelet-v1.24-aws.yaml
index 2b29d711..16f21929 100644
--- a/pkg/userdata/rockylinux/testdata/kubelet-v1.24-aws.yaml
+++ b/pkg/userdata/rockylinux/testdata/kubelet-v1.24-aws.yaml
@@ -167,6 +167,12 @@ write_files:
         chmod +x /opt/bin/health-monitor.sh
     fi
 
+    DEFAULT_IFC_NAME=$(ip -o route get 1  | grep -oP "dev \K\S+")
+    echo NETWORKING_IPV6=yes >> /etc/sysconfig/network
+    echo IPV6INIT=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    echo DHCPV6C=yes >> /etc/sysconfig/network-scripts/ifcfg-$DEFAULT_IFC_NAME
+    ifdown $DEFAULT_IFC_NAME && ifup $DEFAULT_IFC_NAME
+
     # set kubelet nodeip environment variable
     mkdir -p /etc/systemd/system/kubelet.service.d/
     /opt/bin/setup_net_env.sh