diff --git a/deploy/manifests/oci-native-ingress-controller/templates/deployment.yaml b/deploy/manifests/oci-native-ingress-controller/templates/deployment.yaml index 1ac91efd..6cac76e0 100644 --- a/deploy/manifests/oci-native-ingress-controller/templates/deployment.yaml +++ b/deploy/manifests/oci-native-ingress-controller/templates/deployment.yaml @@ -18,10 +18,10 @@ metadata: name: oci-native-ingress-controller namespace: native-ingress-controller-system labels: - helm.sh/chart: oci-native-ingress-controller-1.3.5 + helm.sh/chart: oci-native-ingress-controller-1.3.6 app.kubernetes.io/name: oci-native-ingress-controller app.kubernetes.io/instance: oci-native-ingress-controller - app.kubernetes.io/version: "1.3.5" + app.kubernetes.io/version: "1.3.6" app.kubernetes.io/managed-by: Helm spec: replicas: 1 @@ -51,7 +51,7 @@ spec: readOnlyRootFilesystem: true runAsNonRoot: true runAsUser: 1000 - image: "ghcr.io/oracle/oci-native-ingress-controller:v1.3.5" + image: "ghcr.io/oracle/oci-native-ingress-controller:v1.3.6" imagePullPolicy: Always args: - --lease-lock-name=oci-native-ingress-controller diff --git a/deploy/manifests/oci-native-ingress-controller/templates/rbac.yaml b/deploy/manifests/oci-native-ingress-controller/templates/rbac.yaml index 84ef0401..c0e5030c 100644 --- a/deploy/manifests/oci-native-ingress-controller/templates/rbac.yaml +++ b/deploy/manifests/oci-native-ingress-controller/templates/rbac.yaml @@ -11,10 +11,10 @@ kind: ClusterRole metadata: name: oci-native-ingress-controller-role labels: - helm.sh/chart: oci-native-ingress-controller-1.3.5 + helm.sh/chart: oci-native-ingress-controller-1.3.6 app.kubernetes.io/name: oci-native-ingress-controller app.kubernetes.io/instance: oci-native-ingress-controller - app.kubernetes.io/version: "1.3.5" + app.kubernetes.io/version: "1.3.6" app.kubernetes.io/managed-by: Helm rules: - apiGroups: [""] @@ -48,10 +48,10 @@ kind: ClusterRoleBinding metadata: name: oci-native-ingress-controller-rolebinding labels: - helm.sh/chart: oci-native-ingress-controller-1.3.5 + helm.sh/chart: oci-native-ingress-controller-1.3.6 app.kubernetes.io/name: oci-native-ingress-controller app.kubernetes.io/instance: oci-native-ingress-controller - app.kubernetes.io/version: "1.3.5" + app.kubernetes.io/version: "1.3.6" app.kubernetes.io/managed-by: Helm roleRef: apiGroup: rbac.authorization.k8s.io @@ -69,10 +69,10 @@ metadata: name: oci-native-ingress-controller-leader-election-role namespace: native-ingress-controller-system labels: - helm.sh/chart: oci-native-ingress-controller-1.3.5 + helm.sh/chart: oci-native-ingress-controller-1.3.6 app.kubernetes.io/name: oci-native-ingress-controller app.kubernetes.io/instance: oci-native-ingress-controller - app.kubernetes.io/version: "1.3.5" + app.kubernetes.io/version: "1.3.6" app.kubernetes.io/managed-by: Helm rules: - apiGroups: ["coordination.k8s.io"] @@ -90,10 +90,10 @@ metadata: name: oci-native-ingress-controller-leader-election-rolebinding namespace: native-ingress-controller-system labels: - helm.sh/chart: oci-native-ingress-controller-1.3.5 + helm.sh/chart: oci-native-ingress-controller-1.3.6 app.kubernetes.io/name: oci-native-ingress-controller app.kubernetes.io/instance: oci-native-ingress-controller - app.kubernetes.io/version: "1.3.5" + app.kubernetes.io/version: "1.3.6" app.kubernetes.io/managed-by: Helm roleRef: apiGroup: rbac.authorization.k8s.io diff --git a/deploy/manifests/oci-native-ingress-controller/templates/service.yaml b/deploy/manifests/oci-native-ingress-controller/templates/service.yaml index e3da5d66..31451370 100644 --- a/deploy/manifests/oci-native-ingress-controller/templates/service.yaml +++ b/deploy/manifests/oci-native-ingress-controller/templates/service.yaml @@ -12,10 +12,10 @@ metadata: name: oci-native-ingress-controller namespace: native-ingress-controller-system labels: - helm.sh/chart: oci-native-ingress-controller-1.3.5 + helm.sh/chart: oci-native-ingress-controller-1.3.6 app.kubernetes.io/name: oci-native-ingress-controller app.kubernetes.io/instance: oci-native-ingress-controller - app.kubernetes.io/version: "1.3.5" + app.kubernetes.io/version: "1.3.6" app.kubernetes.io/managed-by: Helm spec: type: ClusterIP diff --git a/deploy/manifests/oci-native-ingress-controller/templates/serviceaccount.yaml b/deploy/manifests/oci-native-ingress-controller/templates/serviceaccount.yaml index fff2f31e..53fe61cb 100644 --- a/deploy/manifests/oci-native-ingress-controller/templates/serviceaccount.yaml +++ b/deploy/manifests/oci-native-ingress-controller/templates/serviceaccount.yaml @@ -12,8 +12,8 @@ metadata: name: oci-native-ingress-controller namespace: native-ingress-controller-system labels: - helm.sh/chart: oci-native-ingress-controller-1.3.5 + helm.sh/chart: oci-native-ingress-controller-1.3.6 app.kubernetes.io/name: oci-native-ingress-controller app.kubernetes.io/instance: oci-native-ingress-controller - app.kubernetes.io/version: "1.3.5" + app.kubernetes.io/version: "1.3.6" app.kubernetes.io/managed-by: Helm diff --git a/deploy/manifests/oci-native-ingress-controller/templates/webhook.yaml b/deploy/manifests/oci-native-ingress-controller/templates/webhook.yaml index 6176c442..bc5d48f5 100644 --- a/deploy/manifests/oci-native-ingress-controller/templates/webhook.yaml +++ b/deploy/manifests/oci-native-ingress-controller/templates/webhook.yaml @@ -36,10 +36,10 @@ kind: MutatingWebhookConfiguration metadata: name: oci-native-ingress-controller-webhook labels: - helm.sh/chart: oci-native-ingress-controller-1.3.5 + helm.sh/chart: oci-native-ingress-controller-1.3.6 app.kubernetes.io/name: oci-native-ingress-controller app.kubernetes.io/instance: oci-native-ingress-controller - app.kubernetes.io/version: "1.3.5" + app.kubernetes.io/version: "1.3.6" app.kubernetes.io/managed-by: Helm annotations: cert-manager.io/inject-ca-from: native-ingress-controller-system/oci-native-ingress-controller-webhook-serving-cert diff --git a/helm/oci-native-ingress-controller/Chart.yaml b/helm/oci-native-ingress-controller/Chart.yaml index 06aff095..0a8ec5be 100644 --- a/helm/oci-native-ingress-controller/Chart.yaml +++ b/helm/oci-native-ingress-controller/Chart.yaml @@ -8,8 +8,8 @@ apiVersion: v2 name: oci-native-ingress-controller description: OCI Native Ingress Controller type: application -version: 1.3.5 -appVersion: "1.3.5" +version: 1.3.6 +appVersion: "1.3.6" maintainers: - name: OKE Foundations team diff --git a/helm/oci-native-ingress-controller/values.yaml b/helm/oci-native-ingress-controller/values.yaml index d14222e5..2f26411a 100644 --- a/helm/oci-native-ingress-controller/values.yaml +++ b/helm/oci-native-ingress-controller/values.yaml @@ -22,7 +22,7 @@ image: repository: ghcr.io/oracle/oci-native-ingress-controller pullPolicy: Always # Overrides the image tag whose default is the chart appVersion. - tag: "v1.3.5" + tag: "v1.3.6" imagePullSecrets: [] nameOverride: "" diff --git a/pkg/server/config b/pkg/server/config index ffb5557f..60f5d73a 100644 --- a/pkg/server/config +++ b/pkg/server/config @@ -5,7 +5,6 @@ clusters: - name: cluster-ckmntg4fska cluster: server: https://129.80.70.29:6443 - certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURpVENDQW5HZ0F3SUJBZ0lSQU5GbG9rWEVxOTgyTGNwUmE4YUxDREF3RFFZSktvWklodmNOQVFFTEJRQXcKWGpFUE1BMEdBMVVFQXd3R1N6aHpJRU5CTVFzd0NRWURWUVFHRXdKVlV6RVBNQTBHQTFVRUJ3d0dRWFZ6ZEdsdQpNUTh3RFFZRFZRUUtEQVpQY21GamJHVXhEREFLQmdOVkJBc01BMDlqYVRFT01Bd0dBMVVFQ0F3RlZHVjRZWE13CkhoY05Nak13TXpFME1EVTFOVEF5V2hjTk1qZ3dNekUwTURVMU5UQXlXakJlTVE4d0RRWURWUVFEREFaTE9ITWcKUTBFeEN6QUpCZ05WQkFZVEFsVlRNUTh3RFFZRFZRUUhEQVpCZFhOMGFXNHhEekFOQmdOVkJBb01Cazl5WVdOcwpaVEVNTUFvR0ExVUVDd3dEVDJOcE1RNHdEQVlEVlFRSURBVlVaWGhoY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCCkJRQURnZ0VQQURDQ0FRb0NnZ0VCQUw5Mjl1M3h5YVJaNW42U20vb09PZWtwejUzRUxCejNWZ3BqWFRxeW9RL2sKaDl4NzBOQkNxZ2pmUUpWMWF3aE9Md24rQ1kwWkZvdkVQTE5GOHliSGh2NHdHTEVSRTNQWDY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id1.cluster.oc1.iad.aaaaaaaafwztfxvg7aksgmlcjfemq4zoce34x66i3wknnt377ckmntg4fska + - ocid1.cluster.oc1.iad.aaaaaaaafwztfxvg7aks___ckmntg4fska - --region - us-ashburn-1 env: [] diff --git a/pkg/server/server.go b/pkg/server/server.go index db807116..a5f12a1f 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -11,7 +11,6 @@ package server import ( "context" - "fmt" "net/http" "os" @@ -148,29 +147,33 @@ func SetUpControllers(opts types.IngressOpts, ingressClassInformer networkinginf } func fetchCniType(id string, client *containerengine.ContainerEngineClient) (string, error) { + resp := getCluster(id, client) + return GetCniFromCluster(resp) +} - // Create a request and dependent object(s). - req := containerengine.GetClusterRequest{ClusterId: common.String(id)} - - // Send the request using the service client - resp, err := client.GetCluster(context.Background(), req) - if err != nil { - klog.Fatalf("failed to get cluster details: %v", err) - } - cni := resp.Cluster.ClusterPodNetworkOptions - +func GetCniFromCluster(resp containerengine.Cluster) (string, error) { + cni := resp.ClusterPodNetworkOptions for _, n := range cni { switch n.(type) { - case containerengine.FlannelOverlayClusterPodNetworkOptionDetails: - return string(containerengine.ClusterPodNetworkOptionDetailsCniTypeFlannelOverlay), nil case containerengine.OciVcnIpNativeClusterPodNetworkOptionDetails: return string(containerengine.ClusterPodNetworkOptionDetailsCniTypeOciVcnIpNative), nil default: - return "", fmt.Errorf("unsupported CNI found in Cluster : %v", n) + return string(containerengine.ClusterPodNetworkOptionDetailsCniTypeFlannelOverlay), nil } } + return string(containerengine.ClusterPodNetworkOptionDetailsCniTypeFlannelOverlay), nil +} + +func getCluster(id string, client *containerengine.ContainerEngineClient) containerengine.Cluster { + // Create a request and dependent object(s). + req := containerengine.GetClusterRequest{ClusterId: common.String(id)} - return "", fmt.Errorf("no CNI found in Cluster") + // Send the request using the service client + resp, err := client.GetCluster(context.Background(), req) + if err != nil { + klog.Fatalf("failed to get cluster details: %v", err) + } + return resp.Cluster } func setupClient(ctx context.Context, opts types.IngressOpts, k8client clientset.Interface) *client.ClientProvider { diff --git a/pkg/server/server_test.go b/pkg/server/server_test.go index 4fcbcabd..2623ff57 100644 --- a/pkg/server/server_test.go +++ b/pkg/server/server_test.go @@ -4,6 +4,7 @@ import ( "testing" . "github.com/onsi/gomega" + . "github.com/oracle/oci-go-sdk/v65/containerengine" ) func TestKubeConfig(t *testing.T) { @@ -12,3 +13,16 @@ func TestKubeConfig(t *testing.T) { Expect(err == nil && cfg != nil).Should(Equal(true)) Expect(cfg.Host).Should(Equal("https://129.80.70.29:6443")) } + +func TestGetCniFromCluster(t *testing.T) { + RegisterTestingT(t) + ns := make([]ClusterPodNetworkOptionDetails, 1) + + // No value test + resp := Cluster{ + ClusterPodNetworkOptions: ns, + } + cni, err := GetCniFromCluster(resp) + Expect(cni).Should(Equal(string(ClusterPodNetworkOptionDetailsCniTypeFlannelOverlay))) + Expect(err).Should(BeNil()) +}