oracle / cluster-api-provider-oci

Kubernetes Cluster API Provider for Oracle Cloud Infrastructure
https://oracle.github.io/cluster-api-provider-oci/
Apache License 2.0
38 stars 21 forks source link

fix: Machinepool should use OCI_MANAGED_KUBERNETES_VERSION ENV #375

Closed joekr closed 2 weeks ago

joekr commented 4 weeks ago

What this PR does / why we need it: Using KUBERNETES_VERSION instead of OCI_MANAGED_KUBERNETES_VERSION will have a version mismatch and the managed nodes will fail to join.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged): Fixes # Before this the Managed Cluster - Simple was not passing for me. I'm not sure how it was for others. This basically makes sure the cluster and the machine pool are using the same K8s version.

joekr commented 4 weeks ago

e2e tests

Ran 7 of 28 Specs in 2625.648 seconds
SUCCESS! -- 7 Passed | 0 Failed | 0 Pending | 21 Skipped

unit tests

?       github.com/oracle/cluster-api-provider-oci      [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/config [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/metrics        [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/scope/mocks    [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/services/base  [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/services/base/mock_base        [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/services/compute       [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/services/compute/mock_compute  [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/services/computemanagement     [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/services/computemanagement/mock_computemanagement      [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/services/containerengine       [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/services/containerengine/mock_containerengine  [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/services/identity      [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/services/identity/mock_identity        [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/services/loadbalancer  [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/services/loadbalancer/mock_lb  [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/services/networkloadbalancer   [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/services/networkloadbalancer/mock_nlb  [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/services/vcn   [no test files]
?       github.com/oracle/cluster-api-provider-oci/cloud/services/vcn/mock_vcn  [no test files]
?       github.com/oracle/cluster-api-provider-oci/feature      [no test files]
?       github.com/oracle/cluster-api-provider-oci/version      [no test files]
ok      github.com/oracle/cluster-api-provider-oci/api/v1beta1  26.750s coverage: 22.9% of statements
ok      github.com/oracle/cluster-api-provider-oci/api/v1beta2  1.515s  coverage: 15.0% of statements
ok      github.com/oracle/cluster-api-provider-oci/cloud/ociutil        0.966s  coverage: 19.6% of statements
ok      github.com/oracle/cluster-api-provider-oci/cloud/scope  229.590s        coverage: 76.1% of statements
ok      github.com/oracle/cluster-api-provider-oci/cloud/util   1.036s  coverage: 61.1% of statements
ok      github.com/oracle/cluster-api-provider-oci/controllers  28.313s coverage: 58.7% of statements
ok      github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1      8.484s  coverage: 15.3% of statements
ok      github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2      2.197s  coverage: 4.8% of statements
ok      github.com/oracle/cluster-api-provider-oci/exp/controllers      3.010s  coverage: 56.3% of statements
joekr commented 2 weeks ago

Failing e2e cluster config (I'm cutting out a lot of the unrelated info to make it easier to read).

---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachinePool
metadata:
  name: capoci-e2e-al4-managed-mp-0
  namespace: capoci-e2e-al4
spec:
  clusterName: capoci-e2e-al4-managed
  replicas: 1
  template:
    spec:
      bootstrap:
        dataSecretName: ""
      clusterName: capoci-e2e-al4-managed
      infrastructureRef:
        apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
        kind: OCIManagedMachinePool
        name: capoci-e2e-al4-managed-mp-0
      version: v1.28.7
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachinePool
metadata:
  name: capoci-e2e-al4-managed-mp-1
  namespace: capoci-e2e-al4
spec:
  clusterName: capoci-e2e-al4-managed
  replicas: 1
  template:
    spec:
      bootstrap:
        dataSecretName: ""
      clusterName: capoci-e2e-al4-managed
      infrastructureRef:
        apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
        kind: OCIManagedMachinePool
        name: capoci-e2e-al4-managed-mp-1
      version: v1.28.7
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: OCIManagedCluster
metadata:
  labels:
    cluster.x-k8s.io/cluster-name: capoci-e2e-al4-managed
  name: capoci-e2e-al4-managed-managed
  namespace: capoci-e2e-al4
spec:
  compartmentId: <compartment>
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: OCIManagedControlPlane
metadata:
  name: capoci-e2e-al4-managed
  namespace: capoci-e2e-al4
spec:
  version: v1.27.2

after change

---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachinePool
metadata:
  name: capoci-e2e-div-managed-mp-0
  namespace: capoci-e2e-div
spec:
  clusterName: capoci-e2e-div-managed
  replicas: 1
  template:
    spec:
      bootstrap:
        dataSecretName: ""
      clusterName: capoci-e2e-div-managed
      infrastructureRef:
        apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
        kind: OCIManagedMachinePool
        name: capoci-e2e-div-managed-mp-0
      version: v1.28.2
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachinePool
metadata:
  name: capoci-e2e-div-managed-mp-1
  namespace: capoci-e2e-div
spec:
  clusterName: capoci-e2e-div-managed
  replicas: 1
  template:
    spec:
      bootstrap:
        dataSecretName: ""
      clusterName: capoci-e2e-div-managed
      infrastructureRef:
        apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
        kind: OCIManagedMachinePool
        name: capoci-e2e-div-managed-mp-1
      version: v1.28.2
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: OCIManagedCluster
metadata:
  labels:
    cluster.x-k8s.io/cluster-name: capoci-e2e-div-managed
  name: capoci-e2e-div-managed-managed
  namespace: capoci-e2e-div
spec:
  compartmentId: <compartment>
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: OCIManagedControlPlane
metadata:
  name: capoci-e2e-div-managed
  namespace: capoci-e2e-div
spec:
  version: v1.28.2