From 0cf164208d9a5719f7360f12a1521ea238d50567 Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Fri, 30 Jun 2023 11:12:10 +0530 Subject: [PATCH 01/14] OKE self managed nodes --- cloud/scope/cluster_accessor.go | 4 + cloud/scope/machine.go | 56 ++++++------ cloud/scope/machine_pool.go | 42 ++++----- cloud/scope/machine_pool_test.go | 12 ++- cloud/scope/machine_test.go | 85 ++++++++++++------- cloud/scope/managed_control_plane.go | 72 +++++++++++++++- cloud/scope/oci_managed_cluster.go | 8 ++ cloud/scope/oci_selfmanaged_cluster.go | 9 ++ cloud/scope/vnic_reconciler.go | 2 +- cloud/scope/vnic_reconciler_test.go | 8 +- controllers/ocimachine_controller.go | 32 +++++-- controllers/ocimachine_controller_test.go | 18 ++-- exp/controllers/ocimachinepool_controller.go | 28 ++++-- .../ocimachinepool_controller_test.go | 24 +++--- ...imanagedcluster_controlplane_controller.go | 4 + ...gedcluster_controlplane_controller_test.go | 14 ++- templates/cluster-template.yaml | 18 +++- 17 files changed, 310 insertions(+), 126 deletions(-) diff --git a/cloud/scope/cluster_accessor.go b/cloud/scope/cluster_accessor.go index 6b10f339..b2ad6d3f 100644 --- a/cloud/scope/cluster_accessor.go +++ b/cloud/scope/cluster_accessor.go @@ -46,6 +46,8 @@ type OCIClusterAccessor interface { GetClientOverrides() *infrastructurev1beta2.ClientOverrides // GetNetworkSpec returns the NetworkSpec of the cluster. GetNetworkSpec() *infrastructurev1beta2.NetworkSpec + // GetControlPlaneEndpoint returns the control plane endpoint of the cluster. + GetControlPlaneEndpoint() clusterv1.APIEndpoint // SetControlPlaneEndpoint sets the control plane endpoint of the cluster. SetControlPlaneEndpoint(endpoint clusterv1.APIEndpoint) // GetFailureDomains returns the failure domains of the cluster. @@ -60,4 +62,6 @@ type OCIClusterAccessor interface { MarkConditionFalse(t clusterv1.ConditionType, reason string, severity clusterv1.ConditionSeverity, messageFormat string, messageArgs ...interface{}) // GetIdentityRef returns the Identity reference of the cluster GetIdentityRef() *corev1.ObjectReference + // GetProviderID returns the provider id for the instance + GetProviderID(instanceId string) string } diff --git a/cloud/scope/machine.go b/cloud/scope/machine.go index 651c68fa..4ae7e507 100644 --- a/cloud/scope/machine.go +++ b/cloud/scope/machine.go @@ -58,7 +58,7 @@ type MachineScopeParams struct { Machine *clusterv1.Machine Client client.Client ComputeClient compute.ComputeClient - OCICluster *infrastructurev1beta2.OCICluster + OCIClusterAccessor OCIClusterAccessor OCIMachine *infrastructurev1beta2.OCIMachine VCNClient vcn.Client NetworkLoadBalancerClient nlb.NetworkLoadBalancerClient @@ -72,7 +72,7 @@ type MachineScope struct { Cluster *clusterv1.Cluster Machine *clusterv1.Machine ComputeClient compute.ComputeClient - OCICluster *infrastructurev1beta2.OCICluster + OCIClusterAccessor OCIClusterAccessor OCIMachine *infrastructurev1beta2.OCIMachine VCNClient vcn.Client NetworkLoadBalancerClient nlb.NetworkLoadBalancerClient @@ -84,7 +84,7 @@ func NewMachineScope(params MachineScopeParams) (*MachineScope, error) { if params.Machine == nil { return nil, errors.New("failed to generate new scope from nil Machine") } - if params.OCICluster == nil { + if params.OCIClusterAccessor == nil { return nil, errors.New("failed to generate new scope from nil OCICluster") } @@ -102,7 +102,7 @@ func NewMachineScope(params MachineScopeParams) (*MachineScope, error) { Client: params.Client, ComputeClient: params.ComputeClient, Cluster: params.Cluster, - OCICluster: params.OCICluster, + OCIClusterAccessor: params.OCIClusterAccessor, patchHelper: helper, Machine: params.Machine, OCIMachine: params.OCIMachine, @@ -227,12 +227,12 @@ func (m *MachineScope) GetOrCreateMachine(ctx context.Context) (*core.Instance, } metadata["user_data"] = base64.StdEncoding.EncodeToString([]byte(cloudInitData)) - tags := m.getFreeFormTags(*m.OCICluster) + tags := m.getFreeFormTags() definedTags := ConvertMachineDefinedTags(m.OCIMachine.Spec.DefinedTags) - availabilityDomain := m.OCICluster.Status.FailureDomains[*failureDomain].Attributes[AvailabilityDomain] - faultDomain := m.OCICluster.Status.FailureDomains[*failureDomain].Attributes[FaultDomain] + availabilityDomain := m.OCIClusterAccessor.GetFailureDomains()[*failureDomain].Attributes[AvailabilityDomain] + faultDomain := m.OCIClusterAccessor.GetFailureDomains()[*failureDomain].Attributes[FaultDomain] launchDetails := core.LaunchInstanceDetails{DisplayName: common.String(m.OCIMachine.Name), SourceDetails: sourceDetails, CreateVnicDetails: &core.CreateVnicDetails{ @@ -283,11 +283,11 @@ func (m *MachineScope) GetOrCreateMachine(ctx context.Context) (*core.Instance, } } -func (m *MachineScope) getFreeFormTags(ociCluster infrastructurev1beta2.OCICluster) map[string]string { - tags := ociutil.BuildClusterTags(ociCluster.GetOCIResourceIdentifier()) +func (m *MachineScope) getFreeFormTags() map[string]string { + tags := ociutil.BuildClusterTags(m.OCIClusterAccessor.GetOCIResourceIdentifier()) // first use cluster level tags, then override with machine level tags - if ociCluster.Spec.FreeformTags != nil { - for k, v := range ociCluster.Spec.FreeformTags { + if m.OCIClusterAccessor.GetFreeformTags() != nil { + for k, v := range m.OCIClusterAccessor.GetFreeformTags() { tags[k] = v } } @@ -310,7 +310,7 @@ func (m *MachineScope) DeleteMachine(ctx context.Context) error { // IsResourceCreatedByClusterAPI determines if the instance was created by the cluster using the // tags created at instance launch. func (m *MachineScope) IsResourceCreatedByClusterAPI(resourceFreeFormTags map[string]string) bool { - tagsAddedByClusterAPI := ociutil.BuildClusterTags(string(m.OCICluster.GetOCIResourceIdentifier())) + tagsAddedByClusterAPI := ociutil.BuildClusterTags(string(m.OCIClusterAccessor.GetOCIResourceIdentifier())) for k, v := range tagsAddedByClusterAPI { if resourceFreeFormTags[k] != v { return false @@ -499,12 +499,12 @@ func (m *MachineScope) ReconcileCreateInstanceOnLB(ctx context.Context) error { if err != nil { return err } - loadbalancerId := m.OCICluster.Spec.NetworkSpec.APIServerLB.LoadBalancerId + loadbalancerId := m.OCIClusterAccessor.GetNetworkSpec().APIServerLB.LoadBalancerId m.Logger.Info("Private IP of the instance", "private-ip", instanceIp) m.Logger.Info("Control Plane load balancer", "id", loadbalancerId) // Check the load balancer type - loadbalancerType := m.OCICluster.Spec.NetworkSpec.APIServerLB.LoadBalancerType + loadbalancerType := m.OCIClusterAccessor.GetNetworkSpec().APIServerLB.LoadBalancerType // By default, the load balancer type is Network Load Balancer // Unless user specifies the load balancer type to be LBaaS if loadbalancerType == infrastructurev1beta2.LoadBalancerTypeLB { @@ -517,7 +517,7 @@ func (m *MachineScope) ReconcileCreateInstanceOnLB(ctx context.Context) error { backendSet := lb.BackendSets[APIServerLBBackendSetName] // When creating a LB, there is no way to set the backend Name, default backend name is the instance IP and port // So we use default backend name instead of machine name - backendName := instanceIp + ":" + strconv.Itoa(int(m.OCICluster.Spec.ControlPlaneEndpoint.Port)) + backendName := instanceIp + ":" + strconv.Itoa(int(m.OCIClusterAccessor.GetControlPlaneEndpoint().Port)) if !m.containsLBBackend(backendSet, backendName) { logger := m.Logger.WithValues("backend-set", *backendSet.Name) workRequest := m.OCIMachine.Status.CreateBackendWorkRequestId @@ -533,7 +533,7 @@ func (m *MachineScope) ReconcileCreateInstanceOnLB(ctx context.Context) error { BackendSetName: backendSet.Name, CreateBackendDetails: loadbalancer.CreateBackendDetails{ IpAddress: common.String(instanceIp), - Port: common.Int(int(m.OCICluster.Spec.ControlPlaneEndpoint.Port)), + Port: common.Int(int(m.OCIClusterAccessor.GetControlPlaneEndpoint().Port)), }, OpcRetryToken: ociutil.GetOPCRetryToken("%s-%s", "create-backend", string(m.OCIMachine.UID)), }) @@ -573,7 +573,7 @@ func (m *MachineScope) ReconcileCreateInstanceOnLB(ctx context.Context) error { BackendSetName: backendSet.Name, CreateBackendDetails: networkloadbalancer.CreateBackendDetails{ IpAddress: common.String(instanceIp), - Port: common.Int(int(m.OCICluster.Spec.ControlPlaneEndpoint.Port)), + Port: common.Int(int(m.OCIClusterAccessor.GetControlPlaneEndpoint().Port)), Name: common.String(m.Name()), }, OpcRetryToken: ociutil.GetOPCRetryToken("%s-%s", "create-backend", string(m.OCIMachine.UID)), @@ -604,9 +604,9 @@ func (m *MachineScope) ReconcileCreateInstanceOnLB(ctx context.Context) error { // See https://docs.oracle.com/en-us/iaas/Content/NetworkLoadBalancer/BackendServers/backend_server_management.htm#BackendServerManagement // for more info on Backend Server Management func (m *MachineScope) ReconcileDeleteInstanceOnLB(ctx context.Context) error { - loadbalancerId := m.OCICluster.Spec.NetworkSpec.APIServerLB.LoadBalancerId + loadbalancerId := m.OCIClusterAccessor.GetNetworkSpec().APIServerLB.LoadBalancerId // Check the load balancer type - loadbalancerType := m.OCICluster.Spec.NetworkSpec.APIServerLB.LoadBalancerType + loadbalancerType := m.OCIClusterAccessor.GetNetworkSpec().APIServerLB.LoadBalancerType if loadbalancerType == infrastructurev1beta2.LoadBalancerTypeLB { lb, err := m.LoadBalancerClient.GetLoadBalancer(ctx, loadbalancer.GetLoadBalancerRequest{ LoadBalancerId: loadbalancerId, @@ -625,7 +625,7 @@ func (m *MachineScope) ReconcileDeleteInstanceOnLB(ctx context.Context) error { if err != nil { return err } - backendName := instanceIp + ":" + strconv.Itoa(int(m.OCICluster.Spec.ControlPlaneEndpoint.Port)) + backendName := instanceIp + ":" + strconv.Itoa(int(m.OCIClusterAccessor.GetControlPlaneEndpoint().Port)) if m.containsLBBackend(backendSet, backendName) { logger := m.Logger.WithValues("backend-set", *backendSet.Name) workRequest := m.OCIMachine.Status.DeleteBackendWorkRequestId @@ -728,11 +728,11 @@ func (m *MachineScope) getCompartmentId() string { if m.OCIMachine.Spec.CompartmentId != "" { return m.OCIMachine.Spec.CompartmentId } - return m.OCICluster.Spec.CompartmentId + return m.OCIClusterAccessor.GetCompartmentId() } func (m *MachineScope) getGetControlPlaneMachineSubnet() *string { - for _, subnet := range m.OCICluster.Spec.NetworkSpec.Vcn.Subnets { + for _, subnet := range m.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets { if subnet.Role == infrastructurev1beta2.ControlPlaneRole { return subnet.ID } @@ -742,7 +742,7 @@ func (m *MachineScope) getGetControlPlaneMachineSubnet() *string { func (m *MachineScope) getGetControlPlaneMachineNSGs() []string { nsgs := make([]string, 0) - for _, nsg := range m.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List { + for _, nsg := range m.OCIClusterAccessor.GetNetworkSpec().Vcn.NetworkSecurityGroup.List { if nsg.Role == infrastructurev1beta2.ControlPlaneRole { nsgs = append(nsgs, *nsg.ID) } @@ -753,16 +753,16 @@ func (m *MachineScope) getGetControlPlaneMachineNSGs() []string { // getMachineSubnet iterates through the OCICluster Vcn subnets // and returns the subnet ID if the name matches func (m *MachineScope) getMachineSubnet(name string) (*string, error) { - for _, subnet := range m.OCICluster.Spec.NetworkSpec.Vcn.Subnets { + for _, subnet := range m.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets { if subnet.Name == name { return subnet.ID, nil } } - return nil, errors.New(fmt.Sprintf("Subnet with name %s not found for cluster %s", name, m.OCICluster.Name)) + return nil, errors.New(fmt.Sprintf("Subnet with name %s not found for cluster %s", name, m.OCIClusterAccessor.GetName())) } func (m *MachineScope) getWorkerMachineSubnet() *string { - for _, subnet := range m.OCICluster.Spec.NetworkSpec.Vcn.Subnets { + for _, subnet := range m.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets { if subnet.Role == infrastructurev1beta2.WorkerRole { // if a subnet name is defined, use the correct subnet if m.OCIMachine.Spec.SubnetName != "" { @@ -781,7 +781,7 @@ func (m *MachineScope) getWorkerMachineNSGs() []string { if len(m.OCIMachine.Spec.NetworkDetails.NsgNames) > 0 { nsgs := make([]string, 0) for _, nsgName := range m.OCIMachine.Spec.NetworkDetails.NsgNames { - for _, nsg := range m.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List { + for _, nsg := range m.OCIClusterAccessor.GetNetworkSpec().Vcn.NetworkSecurityGroup.List { if nsg.Name == nsgName { nsgs = append(nsgs, *nsg.ID) } @@ -790,7 +790,7 @@ func (m *MachineScope) getWorkerMachineNSGs() []string { return nsgs } else { nsgs := make([]string, 0) - for _, nsg := range m.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List { + for _, nsg := range m.OCIClusterAccessor.GetNetworkSpec().Vcn.NetworkSecurityGroup.List { if nsg.Role == infrastructurev1beta2.WorkerRole { nsgs = append(nsgs, *nsg.ID) } diff --git a/cloud/scope/machine_pool.go b/cloud/scope/machine_pool.go index 048c5152..9176ff8e 100644 --- a/cloud/scope/machine_pool.go +++ b/cloud/scope/machine_pool.go @@ -54,7 +54,7 @@ type MachinePoolScopeParams struct { MachinePool *expclusterv1.MachinePool Client client.Client ComputeManagementClient computemanagement.Client - OCICluster *infrastructurev1beta2.OCICluster + OCIClusterAccessor OCIClusterAccessor OCIMachinePool *expinfra1.OCIMachinePool } @@ -65,7 +65,7 @@ type MachinePoolScope struct { Cluster *clusterv1.Cluster MachinePool *expclusterv1.MachinePool ComputeManagementClient computemanagement.Client - OCICluster *infrastructurev1beta2.OCICluster + OCIClusterAccesor OCIClusterAccessor OCIMachinePool *expinfra1.OCIMachinePool } @@ -74,7 +74,7 @@ func NewMachinePoolScope(params MachinePoolScopeParams) (*MachinePoolScope, erro if params.MachinePool == nil { return nil, errors.New("failed to generate new scope from nil MachinePool") } - if params.OCICluster == nil { + if params.OCIClusterAccessor == nil { return nil, errors.New("failed to generate new scope from nil OCICluster") } @@ -92,7 +92,7 @@ func NewMachinePoolScope(params MachinePoolScopeParams) (*MachinePoolScope, erro Client: params.Client, ComputeManagementClient: params.ComputeManagementClient, Cluster: params.Cluster, - OCICluster: params.OCICluster, + OCIClusterAccesor: params.OCIClusterAccessor, patchHelper: helper, MachinePool: params.MachinePool, OCIMachinePool: params.OCIMachinePool, @@ -145,7 +145,7 @@ func (m *MachinePoolScope) SetReplicaCount(count int32) { // GetWorkerMachineSubnet returns the WorkerRole core.Subnet id for the cluster func (m *MachinePoolScope) GetWorkerMachineSubnet() *string { - for _, subnet := range m.OCICluster.Spec.NetworkSpec.Vcn.Subnets { + for _, subnet := range m.OCIClusterAccesor.GetNetworkSpec().Vcn.Subnets { if subnet.Role == infrastructurev1beta2.WorkerRole { return subnet.ID } @@ -161,7 +161,7 @@ func (m *MachinePoolScope) ListMachinePoolInstances(ctx context.Context) ([]core } req := core.ListInstancePoolInstancesRequest{ - CompartmentId: common.String(m.OCICluster.Spec.CompartmentId), + CompartmentId: common.String(m.OCIClusterAccesor.GetCompartmentId()), InstancePoolId: poolOcid, } @@ -226,7 +226,7 @@ func (m *MachinePoolScope) GetBootstrapData() (string, error) { // GetWorkerMachineNSG returns the worker role core.NetworkSecurityGroup id for the cluster func (m *MachinePoolScope) GetWorkerMachineNSG() *string { - for _, nsg := range m.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List { + for _, nsg := range m.OCIClusterAccesor.GetNetworkSpec().Vcn.NetworkSecurityGroup.List { if nsg.Role == infrastructurev1beta2.WorkerRole { return nsg.ID } @@ -272,7 +272,7 @@ func (m *MachinePoolScope) buildInstanceConfigurationShapeConfig() (core.Instanc func (s *MachinePoolScope) BuildInstancePoolPlacement() ([]core.CreateInstancePoolPlacementConfigurationDetails, error) { var placements []core.CreateInstancePoolPlacementConfigurationDetails - ads := s.OCICluster.Spec.AvailabilityDomains + ads := s.OCIClusterAccesor.GetAvailabilityDomains() specPlacementDetails := s.OCIMachinePool.Spec.PlacementDetails @@ -315,7 +315,7 @@ func (s *MachinePoolScope) BuildInstancePoolPlacement() ([]core.CreateInstancePo // IsResourceCreatedByClusterAPI determines if the instance was created by the cluster using the // tags created at instance launch. func (s *MachinePoolScope) IsResourceCreatedByClusterAPI(resourceFreeFormTags map[string]string) bool { - tagsAddedByClusterAPI := ociutil.BuildClusterTags(string(s.OCICluster.GetOCIResourceIdentifier())) + tagsAddedByClusterAPI := ociutil.BuildClusterTags(string(s.OCIClusterAccesor.GetOCIResourceIdentifier())) for k, v := range tagsAddedByClusterAPI { if resourceFreeFormTags[k] != v { return false @@ -326,9 +326,9 @@ func (s *MachinePoolScope) IsResourceCreatedByClusterAPI(resourceFreeFormTags ma // GetFreeFormTags gets the free form tags for the MachinePoolScope cluster and returns them func (m *MachinePoolScope) GetFreeFormTags() map[string]string { - tags := ociutil.BuildClusterTags(m.OCICluster.GetOCIResourceIdentifier()) - if m.OCICluster.Spec.FreeformTags != nil { - for k, v := range m.OCICluster.Spec.FreeformTags { + tags := ociutil.BuildClusterTags(m.OCIClusterAccesor.GetOCIResourceIdentifier()) + if m.OCIClusterAccesor.GetFreeformTags() != nil { + for k, v := range m.OCIClusterAccesor.GetFreeformTags() { tags[k] = v } } @@ -345,8 +345,8 @@ func (m *MachinePoolScope) ReconcileInstanceConfiguration(ctx context.Context) e } freeFormTags := m.GetFreeFormTags() definedTags := make(map[string]map[string]interface{}) - if m.OCICluster.Spec.DefinedTags != nil { - for ns, mapNs := range m.OCICluster.Spec.DefinedTags { + if m.OCIClusterAccesor.GetDefinedTags() != nil { + for ns, mapNs := range m.OCIClusterAccesor.GetDefinedTags() { mapValues := make(map[string]interface{}) for k, v := range mapNs { mapValues[k] = v @@ -415,7 +415,7 @@ func (m *MachinePoolScope) createInstanceConfiguration(ctx context.Context, laun } req := core.CreateInstanceConfigurationRequest{ CreateInstanceConfiguration: core.CreateInstanceConfigurationDetails{ - CompartmentId: common.String(m.OCICluster.Spec.CompartmentId), + CompartmentId: common.String(m.OCIClusterAccesor.GetCompartmentId()), DisplayName: common.String(fmt.Sprintf("%s-%s", m.OCIMachinePool.GetName(), m.OCIMachinePool.ResourceVersion)), FreeformTags: freeFormTags, DefinedTags: definedTags, @@ -446,7 +446,7 @@ func (m *MachinePoolScope) getLaunchInstanceDetails(instanceConfigurationSpec in metadata["user_data"] = base64.StdEncoding.EncodeToString([]byte(cloudInitData)) launchDetails := &core.InstanceConfigurationLaunchInstanceDetails{ - CompartmentId: common.String(m.OCICluster.Spec.CompartmentId), + CompartmentId: common.String(m.OCIClusterAccesor.GetCompartmentId()), DisplayName: common.String(m.OCIMachinePool.GetName()), Shape: common.String(*m.OCIMachinePool.Spec.InstanceConfiguration.Shape), Metadata: metadata, @@ -520,7 +520,7 @@ func (m *MachinePoolScope) FindInstancePool(ctx context.Context) (*core.Instance // We have to first list the pools to get the instance pool. // List returns InstancePoolSummary which lacks some details of InstancePool reqList := core.ListInstancePoolsRequest{ - CompartmentId: common.String(m.OCICluster.Spec.CompartmentId), + CompartmentId: common.String(m.OCIClusterAccesor.GetCompartmentId()), DisplayName: common.String(m.OCIMachinePool.GetName()), } @@ -580,7 +580,7 @@ func (m *MachinePoolScope) CreateInstancePool(ctx context.Context) (*core.Instan m.Info("Creating Instance Pool") req := core.CreateInstancePoolRequest{ CreateInstancePoolDetails: core.CreateInstancePoolDetails{ - CompartmentId: common.String(m.OCICluster.Spec.CompartmentId), + CompartmentId: common.String(m.OCIClusterAccesor.GetCompartmentId()), InstanceConfigurationId: m.GetInstanceConfigurationId(), Size: common.Int(replicas), DisplayName: common.String(m.OCIMachinePool.GetName()), @@ -841,7 +841,7 @@ func (m *MachinePoolScope) getWorkerMachineNSGs() []string { if instanceVnicConfiguration != nil && len(instanceVnicConfiguration.NsgNames) > 0 { nsgs := make([]string, 0) for _, nsgName := range instanceVnicConfiguration.NsgNames { - for _, nsg := range m.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List { + for _, nsg := range m.OCIClusterAccesor.GetNetworkSpec().Vcn.NetworkSecurityGroup.List { if nsg.Name == nsgName { nsgs = append(nsgs, *nsg.ID) } @@ -850,7 +850,7 @@ func (m *MachinePoolScope) getWorkerMachineNSGs() []string { return nsgs } else { nsgs := make([]string, 0) - for _, nsg := range m.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List { + for _, nsg := range m.OCIClusterAccesor.GetNetworkSpec().Vcn.NetworkSecurityGroup.List { if nsg.Role == infrastructurev1beta2.WorkerRole { nsgs = append(nsgs, *nsg.ID) } @@ -912,7 +912,7 @@ func (m *MachinePoolScope) getInstanceConfigurationsFromDisplayNameSortedTimeCre } req := core.ListInstanceConfigurationsRequest{ - CompartmentId: common.String(m.OCICluster.Spec.CompartmentId), + CompartmentId: common.String(m.OCIClusterAccesor.GetCompartmentId()), SortBy: core.ListInstanceConfigurationsSortByTimecreated, SortOrder: core.ListInstanceConfigurationsSortOrderDesc, } diff --git a/cloud/scope/machine_pool_test.go b/cloud/scope/machine_pool_test.go index f51c7a05..12c5b395 100644 --- a/cloud/scope/machine_pool_test.go +++ b/cloud/scope/machine_pool_test.go @@ -130,7 +130,9 @@ func TestInstanceConfigCreate(t *testing.T) { ms, err = NewMachinePoolScope(MachinePoolScopeParams{ ComputeManagementClient: computeManagementClient, OCIMachinePool: machinePool, - OCICluster: ociCluster, + OCIClusterAccessor: OCISelfManagedCluster{ + OCICluster: ociCluster, + }, Cluster: &clusterv1.Cluster{ Spec: clusterv1.ClusterSpec{}, }, @@ -488,7 +490,9 @@ func TestInstancePoolCreate(t *testing.T) { ms, err = NewMachinePoolScope(MachinePoolScopeParams{ ComputeManagementClient: computeManagementClient, OCIMachinePool: machinePool, - OCICluster: ociCluster, + OCIClusterAccessor: OCISelfManagedCluster{ + OCICluster: ociCluster, + }, Cluster: &clusterv1.Cluster{ Spec: clusterv1.ClusterSpec{}, }, @@ -669,7 +673,9 @@ func TestInstancePoolUpdate(t *testing.T) { ms, err = NewMachinePoolScope(MachinePoolScopeParams{ ComputeManagementClient: computeManagementClient, OCIMachinePool: machinePool, - OCICluster: ociCluster, + OCIClusterAccessor: OCISelfManagedCluster{ + OCICluster: ociCluster, + }, Cluster: &clusterv1.Cluster{ Spec: clusterv1.ClusterSpec{}, }, diff --git a/cloud/scope/machine_test.go b/cloud/scope/machine_test.go index 3d0c53fe..934f7838 100644 --- a/cloud/scope/machine_test.go +++ b/cloud/scope/machine_test.go @@ -92,9 +92,11 @@ func TestInstanceReconciliation(t *testing.T) { }, }, }, - Cluster: &clusterv1.Cluster{}, - OCICluster: &ociCluster, - Client: client, + Cluster: &clusterv1.Cluster{}, + OCIClusterAccessor: OCISelfManagedCluster{ + OCICluster: &ociCluster, + }, + Client: client, }) ms.Machine.Namespace = "default" g.Expect(err).To(BeNil()) @@ -285,7 +287,8 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCICluster.Spec.CompartmentId = "clustercompartment" + ociCluster := ms.OCIClusterAccessor.(OCISelfManagedCluster).OCICluster + ociCluster.Spec.CompartmentId = "clustercompartment" ms.OCIMachine.Spec.CompartmentId = "" computeClient.EXPECT().ListInstances(gomock.Any(), gomock.Eq(core.ListInstancesRequest{ @@ -303,7 +306,8 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCICluster.Spec.CompartmentId = "clustercompartment" + ociCluster := ms.OCIClusterAccessor.(OCISelfManagedCluster).OCICluster + ociCluster.Spec.CompartmentId = "clustercompartment" computeClient.EXPECT().ListInstances(gomock.Any(), gomock.Eq(core.ListInstancesRequest{ DisplayName: common.String("name"), @@ -498,7 +502,8 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCICluster.Spec.NetworkSpec.Vcn.Subnets = append(ms.OCICluster.Spec.NetworkSpec.Vcn.Subnets, &infrastructurev1beta2.Subnet{ + ociCluster := ms.OCIClusterAccessor.(OCISelfManagedCluster).OCICluster + ociCluster.Spec.NetworkSpec.Vcn.Subnets = append(ociCluster.Spec.NetworkSpec.Vcn.Subnets, &infrastructurev1beta2.Subnet{ Role: infrastructurev1beta2.WorkerRole, ID: common.String("test-subnet-1"), }) @@ -550,7 +555,8 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCICluster.Spec.NetworkSpec.Vcn.Subnets = append(ms.OCICluster.Spec.NetworkSpec.Vcn.Subnets, &infrastructurev1beta2.Subnet{ + ociCluster := ms.OCIClusterAccessor.(OCISelfManagedCluster).OCICluster + ociCluster.Spec.NetworkSpec.Vcn.Subnets = append(ociCluster.Spec.NetworkSpec.Vcn.Subnets, &infrastructurev1beta2.Subnet{ Role: infrastructurev1beta2.WorkerRole, Name: "test-subnet-name", ID: common.String("test-subnet-1"), @@ -604,7 +610,8 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List = append(ms.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List, &infrastructurev1beta2.NSG{ + ociCluster := ms.OCIClusterAccessor.(OCISelfManagedCluster).OCICluster + ociCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List = append(ociCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List, &infrastructurev1beta2.NSG{ Role: infrastructurev1beta2.WorkerRole, ID: common.String("test-nsg-1"), Name: "test-nsg", @@ -661,7 +668,8 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List = append(ms.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List, &infrastructurev1beta2.NSG{ + ociCluster := ms.OCIClusterAccessor.(OCISelfManagedCluster).OCICluster + ociCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List = append(ociCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List, &infrastructurev1beta2.NSG{ Role: infrastructurev1beta2.WorkerRole, ID: common.String("test-nsg-1"), Name: "test-nsg", @@ -1217,10 +1225,12 @@ func TestNLBReconciliationCreation(t *testing.T) { CompartmentId: "test", }, }, - Machine: &clusterv1.Machine{}, - Cluster: &clusterv1.Cluster{}, - OCICluster: &ociCluster, - Client: client, + Machine: &clusterv1.Machine{}, + Cluster: &clusterv1.Cluster{}, + OCIClusterAccessor: OCISelfManagedCluster{ + OCICluster: &ociCluster, + }, + Client: client, }) ms.Machine.Namespace = "default" g.Expect(err).To(BeNil()) @@ -1539,10 +1549,12 @@ func TestNLBReconciliationDeletion(t *testing.T) { CompartmentId: "test", }, }, - Machine: &clusterv1.Machine{}, - Cluster: &clusterv1.Cluster{}, - OCICluster: &ociCluster, - Client: client, + Machine: &clusterv1.Machine{}, + Cluster: &clusterv1.Cluster{}, + OCIClusterAccessor: OCISelfManagedCluster{ + OCICluster: &ociCluster, + }, + Client: client, }) ms.Machine.Namespace = "default" g.Expect(err).To(BeNil()) @@ -1779,10 +1791,12 @@ func TestLBReconciliationCreation(t *testing.T) { CompartmentId: "test", }, }, - Machine: &clusterv1.Machine{}, - Cluster: &clusterv1.Cluster{}, - OCICluster: &ociCluster, - Client: client, + Machine: &clusterv1.Machine{}, + Cluster: &clusterv1.Cluster{}, + OCIClusterAccessor: OCISelfManagedCluster{ + OCICluster: &ociCluster, + }, + Client: client, }) ms.Machine.Namespace = "default" g.Expect(err).To(BeNil()) @@ -2100,10 +2114,12 @@ func TestLBReconciliationDeletion(t *testing.T) { CompartmentId: "test", }, }, - Machine: &clusterv1.Machine{}, - Cluster: &clusterv1.Cluster{}, - OCICluster: &ociCluster, - Client: client, + Machine: &clusterv1.Machine{}, + Cluster: &clusterv1.Cluster{}, + OCIClusterAccessor: OCISelfManagedCluster{ + OCICluster: &ociCluster, + }, + Client: client, }) ms.Machine.Namespace = "default" g.Expect(err).To(BeNil()) @@ -2377,10 +2393,12 @@ func TestInstanceDeletion(t *testing.T) { InstanceId: common.String("test"), }, }, - Machine: &clusterv1.Machine{}, - Cluster: &clusterv1.Cluster{}, - OCICluster: &ociCluster, - Client: client, + Machine: &clusterv1.Machine{}, + Cluster: &clusterv1.Cluster{}, + OCIClusterAccessor: OCISelfManagedCluster{ + OCICluster: &ociCluster, + }, + Client: client, }) ms.Machine.Namespace = "default" g.Expect(err).To(BeNil()) @@ -2454,7 +2472,8 @@ func setupAllParams(ms *MachineScope) { ms.OCIMachine.Spec.ShapeConfig.MemoryInGBs = "100" ms.OCIMachine.Spec.ShapeConfig.BaselineOcpuUtilization = "BASELINE_1_8" ms.OCIMachine.Spec.IsPvEncryptionInTransitEnabled = true - ms.OCICluster.Status.FailureDomains = map[string]clusterv1.FailureDomainSpec{ + ociCluster := ms.OCIClusterAccessor.(OCISelfManagedCluster).OCICluster + ociCluster.Status.FailureDomains = map[string]clusterv1.FailureDomainSpec{ "1": { Attributes: map[string]string{ "AvailabilityDomain": "ad1", @@ -2472,13 +2491,13 @@ func setupAllParams(ms *MachineScope) { }, } ms.Machine.Spec.FailureDomain = common.String("2") - ms.OCICluster.Spec.NetworkSpec.Vcn.Subnets = []*infrastructurev1beta2.Subnet{ + ociCluster.Spec.NetworkSpec.Vcn.Subnets = []*infrastructurev1beta2.Subnet{ { Role: infrastructurev1beta2.WorkerRole, ID: common.String("nodesubnet"), }, } - ms.OCICluster.UID = "uid" - ms.OCICluster.Spec.OCIResourceIdentifier = "resource_uid" + ociCluster.UID = "uid" + ociCluster.Spec.OCIResourceIdentifier = "resource_uid" ms.OCIMachine.UID = "machineuid" } diff --git a/cloud/scope/managed_control_plane.go b/cloud/scope/managed_control_plane.go index 5e15e3c3..f500f551 100644 --- a/cloud/scope/managed_control_plane.go +++ b/cloud/scope/managed_control_plane.go @@ -18,10 +18,12 @@ package scope import ( "context" + "encoding/base64" "encoding/json" "fmt" - "io/ioutil" + "io" "reflect" + "strings" "github.com/go-logr/logr" infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" @@ -46,6 +48,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ) +const ( + OKEInitScript = "#!/usr/bin/env bash\nbash /etc/oke/oke-install.sh \\\n --apiserver-endpoint \"CLUSTER_ENDPOINT\" \\\n --kubelet-ca-cert \"BASE_64_CA\"" +) + // ManagedControlPlaneScopeParams defines the params need to create a new ManagedControlPlaneScope type ManagedControlPlaneScopeParams struct { Logger *logr.Logger @@ -384,7 +390,7 @@ func (s *ManagedControlPlaneScope) createCAPIKubeconfigSecret(ctx context.Contex if err != nil { return err } - body, err := ioutil.ReadAll(response.Content) + body, err := io.ReadAll(response.Content) if err != nil { return err } @@ -479,6 +485,68 @@ func (s *ManagedControlPlaneScope) ReconcileKubeconfig(ctx context.Context, okeC return nil } +// ReconcileBootstrapSecret reconciles the bootsrap secret which will be used by self managed nodes +func (s *ManagedControlPlaneScope) ReconcileBootstrapSecret(ctx context.Context, okeCluster *oke.Cluster) error { + controllerOwnerRef := *metav1.NewControllerRef(s.OCIManagedControlPlane, infrastructurev1beta2.GroupVersion.WithKind("OCIManagedControlPlane")) + secretName := fmt.Sprintf("%s-self-managed", s.Cluster.Name) + secretKey := client.ObjectKey{ + Namespace: s.Cluster.Namespace, + Name: secretName, + } + err := s.client.Get(ctx, secretKey, &corev1.Secret{}) + if err != nil { + if !apierrors.IsNotFound(err) { + return errors.Wrap(err, "failed to get kubeconfig secret") + } + + req := oke.CreateKubeconfigRequest{ClusterId: okeCluster.Id} + response, err := s.ContainerEngineClient.CreateKubeconfig(ctx, req) + if err != nil { + return err + } + body, err := io.ReadAll(response.Content) + if err != nil { + return err + } + config, err := clientcmd.NewClientConfigFromBytes(body) + + rawConfig, err := config.RawConfig() + if err != nil { + return err + } + currentContext := rawConfig.Contexts[rawConfig.CurrentContext] + currentCluster := rawConfig.Clusters[currentContext.Cluster] + certData := base64.StdEncoding.EncodeToString(currentCluster.CertificateAuthorityData) + + endpoint := strings.Split(*okeCluster.Endpoints.PrivateEndpoint, ":")[0] + initStr := strings.Replace(OKEInitScript, "BASE_64_CA", certData, 1) + initStr = strings.Replace(initStr, "CLUSTER_ENDPOINT", endpoint, 1) + + cluster := s.Cluster + secret := &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: secretName, + Namespace: cluster.Namespace, + Labels: map[string]string{ + clusterv1.ClusterNameLabel: cluster.Name, + }, + OwnerReferences: []metav1.OwnerReference{ + controllerOwnerRef, + }, + }, + Data: map[string][]byte{ + secret.KubeconfigDataName: []byte(initStr), + }, + } + + if err := s.client.Create(ctx, secret); err != nil { + return errors.Wrap(err, "failed to create kubeconfig secret") + } + } + + return nil +} + func (s *ManagedControlPlaneScope) updateCAPIKubeconfigSecret(ctx context.Context, configSecret *corev1.Secret, okeCluster *oke.Cluster) error { data, ok := configSecret.Data[secret.KubeconfigDataName] if !ok { diff --git a/cloud/scope/oci_managed_cluster.go b/cloud/scope/oci_managed_cluster.go index 5c4a60ce..4526aee9 100644 --- a/cloud/scope/oci_managed_cluster.go +++ b/cloud/scope/oci_managed_cluster.go @@ -86,6 +86,10 @@ func (c OCIManagedCluster) SetControlPlaneEndpoint(endpoint clusterv1.APIEndpoin c.OCIManagedCluster.Spec.ControlPlaneEndpoint = endpoint } +func (c OCIManagedCluster) GetControlPlaneEndpoint() clusterv1.APIEndpoint { + return c.OCIManagedCluster.Spec.ControlPlaneEndpoint +} + func (c OCIManagedCluster) GetFailureDomains() clusterv1.FailureDomains { return c.OCIManagedCluster.Status.FailureDomains } @@ -102,3 +106,7 @@ func (c OCIManagedCluster) GetAvailabilityDomains() map[string]infrastructurev1b func (c OCIManagedCluster) SetAvailabilityDomains(ads map[string]infrastructurev1beta2.OCIAvailabilityDomain) { c.OCIManagedCluster.Spec.AvailabilityDomains = ads } + +func (c OCIManagedCluster) GetProviderID(instanceId string) string { + return instanceId +} diff --git a/cloud/scope/oci_selfmanaged_cluster.go b/cloud/scope/oci_selfmanaged_cluster.go index c9e825d9..d0e92cf8 100644 --- a/cloud/scope/oci_selfmanaged_cluster.go +++ b/cloud/scope/oci_selfmanaged_cluster.go @@ -17,6 +17,7 @@ limitations under the License. package scope import ( + "fmt" infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" corev1 "k8s.io/api/core/v1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" @@ -101,3 +102,11 @@ func (c OCISelfManagedCluster) GetAvailabilityDomains() map[string]infrastructur func (c OCISelfManagedCluster) SetAvailabilityDomains(ads map[string]infrastructurev1beta2.OCIAvailabilityDomain) { c.OCICluster.Spec.AvailabilityDomains = ads } + +func (c OCISelfManagedCluster) GetControlPlaneEndpoint() clusterv1.APIEndpoint { + return c.OCICluster.Spec.ControlPlaneEndpoint +} + +func (c OCISelfManagedCluster) GetProviderID(instanceId string) string { + return fmt.Sprintf("oci://%s", instanceId) +} diff --git a/cloud/scope/vnic_reconciler.go b/cloud/scope/vnic_reconciler.go index 06c9a902..c3371411 100644 --- a/cloud/scope/vnic_reconciler.go +++ b/cloud/scope/vnic_reconciler.go @@ -65,7 +65,7 @@ func (m *MachineScope) createVnicAttachment(ctx context.Context, spec infrastruc } } - tags := m.getFreeFormTags(*m.OCICluster) + tags := m.getFreeFormTags() definedTags := ConvertMachineDefinedTags(m.OCIMachine.Spec.DefinedTags) diff --git a/cloud/scope/vnic_reconciler_test.go b/cloud/scope/vnic_reconciler_test.go index 1ff2f86f..aa652302 100644 --- a/cloud/scope/vnic_reconciler_test.go +++ b/cloud/scope/vnic_reconciler_test.go @@ -91,9 +91,11 @@ func TestReconcileVnicAttachment(t *testing.T) { }, }, }, - Cluster: &clusterv1.Cluster{}, - OCICluster: &ociCluster, - Client: client, + Cluster: &clusterv1.Cluster{}, + OCIClusterAccessor: OCISelfManagedCluster{ + OCICluster: &ociCluster, + }, + Client: client, }) ms.Machine.Namespace = "default" g.Expect(err).To(BeNil()) diff --git a/controllers/ocimachine_controller.go b/controllers/ocimachine_controller.go index 1206e1cd..8afff881 100644 --- a/controllers/ocimachine_controller.go +++ b/controllers/ocimachine_controller.go @@ -19,6 +19,7 @@ package controllers import ( "context" "fmt" + expV1Beta2 "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" "time" "github.com/go-logr/logr" @@ -111,14 +112,28 @@ func (r *OCIMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request) Name: cluster.Spec.InfrastructureRef.Name, } + var clusterAccessor scope.OCIClusterAccessor if err := r.Client.Get(ctx, ociClusterName, ociCluster); err != nil { - logger.Info("Cluster is not available yet") - r.Recorder.Eventf(ociMachine, corev1.EventTypeWarning, "ClusterNotAvailable", "Cluster is not available yet") - return ctrl.Result{}, nil - } - clusterAccessor := scope.OCISelfManagedCluster{ - OCICluster: ociCluster, + // check for oci managed cluster + ociManagedCluster := &expV1Beta2.OCIManagedCluster{} + ociManagedClusterName := client.ObjectKey{ + Namespace: cluster.Namespace, + Name: cluster.Spec.InfrastructureRef.Name, + } + if err := r.Client.Get(ctx, ociManagedClusterName, ociManagedCluster); err != nil { + logger.Info("Cluster is not available yet") + r.Recorder.Eventf(ociMachine, corev1.EventTypeWarning, "ClusterNotAvailable", "Cluster is not available yet") + return ctrl.Result{}, nil + } + clusterAccessor = scope.OCIManagedCluster{ + OCIManagedCluster: ociManagedCluster, + } + } else { + clusterAccessor = scope.OCISelfManagedCluster{ + OCICluster: ociCluster, + } } + _, _, clients, err := cloudutil.InitClientsAndRegion(ctx, r.Client, r.Region, clusterAccessor, r.ClientProvider) if err != nil { return ctrl.Result{}, err @@ -130,7 +145,7 @@ func (r *OCIMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request) ComputeClient: clients.ComputeClient, Logger: &logger, Cluster: cluster, - OCICluster: ociCluster, + OCIClusterAccessor: clusterAccessor, Machine: machine, OCIMachine: ociMachine, VCNClient: clients.VCNClient, @@ -251,7 +266,8 @@ func (r *OCIMachineReconciler) reconcileNormal(ctx context.Context, logger logr. machineScope.Info("OCI Compute Instance found", "InstanceID", *instance.Id) machine.Spec.InstanceId = instance.Id - machine.Spec.ProviderID = common.String(fmt.Sprintf("oci://%s", *instance.Id)) + + machine.Spec.ProviderID = common.String(machineScope.OCIClusterAccessor.GetProviderID(*instance.Id)) // Proceed to reconcile the DOMachine state. switch instance.LifecycleState { diff --git a/controllers/ocimachine_controller_test.go b/controllers/ocimachine_controller_test.go index 80f360fb..394d0069 100644 --- a/controllers/ocimachine_controller_test.go +++ b/controllers/ocimachine_controller_test.go @@ -178,9 +178,11 @@ func TestNormalReconciliationFunction(t *testing.T) { VCNClient: vcnClient, OCIMachine: ociMachine, Machine: machine, - OCICluster: ociCluster, - Cluster: getCluster(), - Client: client, + OCIClusterAccessor: scope.OCISelfManagedCluster{ + OCICluster: ociCluster, + }, + Cluster: getCluster(), + Client: client, }) recorder = record.NewFakeRecorder(2) @@ -669,10 +671,12 @@ func TestMachineReconciliationDeletionNormal(t *testing.T) { ociCluster.UID = "uid" ociCluster.Spec.NetworkSpec.APIServerLB.LoadBalancerId = common.String("nlbid") ms, err = scope.NewMachineScope(scope.MachineScopeParams{ - ComputeClient: computeClient, - OCIMachine: ociMachine, - Machine: machine, - OCICluster: ociCluster, + ComputeClient: computeClient, + OCIMachine: ociMachine, + Machine: machine, + OCIClusterAccessor: scope.OCISelfManagedCluster{ + OCICluster: ociCluster, + }, Cluster: getCluster(), Client: client, NetworkLoadBalancerClient: nlbClient, diff --git a/exp/controllers/ocimachinepool_controller.go b/exp/controllers/ocimachinepool_controller.go index 5b330580..58e30fa0 100644 --- a/exp/controllers/ocimachinepool_controller.go +++ b/exp/controllers/ocimachinepool_controller.go @@ -119,16 +119,28 @@ func (r *OCIMachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Reque Name: cluster.Name, } + var clusterAccessor scope.OCIClusterAccessor if err := r.Client.Get(ctx, ociClusterName, ociCluster); err != nil { - logger.Info("Cluster is not available yet") - r.Recorder.Eventf(ociMachinePool, corev1.EventTypeWarning, "ClusterNotAvailable", "Cluster is not available yet") - logger.V(2).Info("OCICluster is not available yet") - return ctrl.Result{}, nil + ociManagedCluster := &infrav2exp.OCIManagedCluster{} + ociManagedClusterName := client.ObjectKey{ + Namespace: cluster.Namespace, + Name: cluster.Spec.InfrastructureRef.Name, + } + if err := r.Client.Get(ctx, ociManagedClusterName, ociManagedCluster); err != nil { + logger.Info("Cluster is not available yet") + r.Recorder.Eventf(ociMachinePool, corev1.EventTypeWarning, "ClusterNotAvailable", "Cluster is not available yet") + logger.V(2).Info("OCICluster is not available yet") + return ctrl.Result{}, nil + } + clusterAccessor = scope.OCIManagedCluster{ + OCIManagedCluster: ociManagedCluster, + } + } else { + clusterAccessor = scope.OCISelfManagedCluster{ + OCICluster: ociCluster, + } } - clusterAccessor := scope.OCISelfManagedCluster{ - OCICluster: ociCluster, - } _, _, clients, err := cloudutil.InitClientsAndRegion(ctx, r.Client, r.Region, clusterAccessor, r.ClientProvider) if err != nil { return ctrl.Result{}, err @@ -140,7 +152,7 @@ func (r *OCIMachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Reque ComputeManagementClient: clients.ComputeManagementClient, Logger: &logger, Cluster: cluster, - OCICluster: ociCluster, + OCIClusterAccessor: clusterAccessor, MachinePool: machinePool, OCIMachinePool: ociMachinePool, }) diff --git a/exp/controllers/ocimachinepool_controller_test.go b/exp/controllers/ocimachinepool_controller_test.go index f82d2b2f..35118377 100644 --- a/exp/controllers/ocimachinepool_controller_test.go +++ b/exp/controllers/ocimachinepool_controller_test.go @@ -211,11 +211,13 @@ func TestReconciliationFunction(t *testing.T) { ociCluster := getOCIClusterWithOwner() ms, err = scope.NewMachinePoolScope(scope.MachinePoolScopeParams{ ComputeManagementClient: computeManagementClient, - OCICluster: ociCluster, - Cluster: getCluster(), - Client: client, - OCIMachinePool: ociMachinePool, - MachinePool: machinePool, + OCIClusterAccessor: scope.OCISelfManagedCluster{ + OCICluster: ociCluster, + }, + Cluster: getCluster(), + Client: client, + OCIMachinePool: ociMachinePool, + MachinePool: machinePool, }) recorder = record.NewFakeRecorder(2) @@ -460,11 +462,13 @@ func TestDeleteeconciliationFunction(t *testing.T) { ociCluster := getOCIClusterWithOwner() ms, err = scope.NewMachinePoolScope(scope.MachinePoolScopeParams{ ComputeManagementClient: computeManagementClient, - OCICluster: ociCluster, - Cluster: getCluster(), - Client: client, - OCIMachinePool: ociMachinePool, - MachinePool: machinePool, + OCIClusterAccessor: scope.OCISelfManagedCluster{ + OCICluster: ociCluster, + }, + Cluster: getCluster(), + Client: client, + OCIMachinePool: ociMachinePool, + MachinePool: machinePool, }) recorder = record.NewFakeRecorder(2) diff --git a/exp/controllers/ocimanagedcluster_controlplane_controller.go b/exp/controllers/ocimanagedcluster_controlplane_controller.go index 921b5f13..c8f8d60c 100644 --- a/exp/controllers/ocimanagedcluster_controlplane_controller.go +++ b/exp/controllers/ocimanagedcluster_controlplane_controller.go @@ -225,6 +225,10 @@ func (r *OCIManagedClusterControlPlaneReconciler) reconcile(ctx context.Context, if err != nil { return ctrl.Result{}, err } + err = controlPlaneScope.ReconcileBootstrapSecret(ctx, okeControlPlane) + if err != nil { + return ctrl.Result{}, err + } isUpdated, err := controlPlaneScope.UpdateControlPlane(ctx, okeControlPlane) if err != nil { return ctrl.Result{}, err diff --git a/exp/controllers/ocimanagedcluster_controlplane_controller_test.go b/exp/controllers/ocimanagedcluster_controlplane_controller_test.go index 17a0c08b..06de0f46 100644 --- a/exp/controllers/ocimanagedcluster_controlplane_controller_test.go +++ b/exp/controllers/ocimanagedcluster_controlplane_controller_test.go @@ -189,7 +189,7 @@ func TestControlPlaneReconciliationFunction(t *testing.T) { setup := func(t *testing.T, g *WithT) { var err error mockCtrl = gomock.NewController(t) - client := fake.NewClientBuilder().WithObjects(getSecret()).Build() + client := fake.NewClientBuilder().WithObjects(getSecret(), getBootstrapSecret()).Build() okeClient = mock_containerengine.NewMockClient(mockCtrl) baseClient = mock_base.NewMockBaseClient(mockCtrl) ociManagedControlPlane = getOCIManagedControlPlane() @@ -684,3 +684,15 @@ func expectControlPlaneConditions(g *WithT, m *infrav2exp.OCIManagedControlPlane g.Expect(actual.Reason).To(Equal(c.reason)) } } + +func getBootstrapSecret() *corev1.Secret { + return &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-cluster-self-managed", + Namespace: "test", + }, + Data: map[string][]byte{ + "value": []byte("test"), + }, + } +} diff --git a/templates/cluster-template.yaml b/templates/cluster-template.yaml index 668b6e3f..637bd706 100644 --- a/templates/cluster-template.yaml +++ b/templates/cluster-template.yaml @@ -137,4 +137,20 @@ spec: infrastructureRef: name: "${CLUSTER_NAME}-md-0" apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 - kind: OCIMachineTemplate \ No newline at end of file + kind: OCIMachineTemplate +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: OCIMachineTemplate +metadata: + name: "${CLUSTER_NAME}-md-0" +spec: + template: + spec: + imageId: "${OCI_IMAGE_ID}" + compartmentId: "${OCI_COMPARTMENT_ID}" + shape: "${OCI_NODE_MACHINE_TYPE=VM.Standard.E4.Flex}" + shapeConfig: + ocpus: "${OCI_NODE_MACHINE_TYPE_OCPUS=1}" + metadata: + ssh_authorized_keys: "${OCI_SSH_KEY}" + isPvEncryptionInTransitEnabled: ${OCI_NODE_PV_TRANSIT_ENCRYPTION=true} \ No newline at end of file From 9578f85f20ecbff4907fac00fc832b19befc4a3e Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Mon, 3 Jul 2023 07:38:57 +0530 Subject: [PATCH 02/14] OKE self managed nodes and rmove OKE out of experimental --- Makefile | 1 + api/v1beta1/constants.go | 2 + api/v1beta1/conversion.go | 19 +- api/v1beta1/conversion_test.go | 37 + .../v1beta1/ocimanagedcluster_conversion.go | 7 +- .../v1beta1/ocimanagedcluster_types.go | 5 +- .../ocimanagedclustertemplate_types.go | 0 .../ocimanagedcontrolplane_conversion.go | 2 +- .../v1beta1/ocimanagedcontrolplane_types.go | 0 .../ocimanagedcontrolplanetemplate_types.go | 0 api/v1beta1/types.go | 7 + api/v1beta1/zz_generated.conversion.go | 898 +++++++++++++++++ api/v1beta1/zz_generated.deepcopy.go | 611 ++++++++++++ api/v1beta2/conditions_consts.go | 13 + api/v1beta2/constants.go | 2 + api/v1beta2/conversion.go | 15 + .../v1beta2/ocimanagedcluster_types.go | 7 +- .../v1beta2/ocimanagedcluster_webhook.go | 329 ++++--- .../v1beta2/ocimanagedcluster_webhook_test.go | 219 +++-- .../ocimanagedclustertemplate_types.go | 0 .../v1beta2/ocimanagedcontrolplane_types.go | 0 .../v1beta2/ocimanagedcontrolplane_webhook.go | 0 .../ocimanagedcontrolplane_webhook_test.go | 0 .../ocimanagedcontrolplanetemplate_types.go | 0 api/v1beta2/types.go | 7 + api/v1beta2/zz_generated.deepcopy.go | 747 +++++++++++++++ cloud/scope/managed_control_plane.go | 77 +- cloud/scope/managed_control_plane_test.go | 105 +- cloud/scope/managed_machine_pool.go | 22 +- cloud/scope/managed_machine_pool_test.go | 38 +- cloud/scope/oci_managed_cluster.go | 3 +- cloud/scope/virtual_machine_pool.go | 8 +- cloud/scope/virtual_machine_pool_test.go | 16 +- ...e.cluster.x-k8s.io_ocimanagedclusters.yaml | 2 + ...r.x-k8s.io_ocimanagedclustertemplates.yaml | 2 + config/manager/manager.yaml | 2 +- controllers/ocimachine_controller.go | 3 +- .../ocimanagedcluster_controller.go | 23 +- .../ocimanagedcluster_controller_test.go | 124 +-- ...imanagedcluster_controlplane_controller.go | 42 +- ...gedcluster_controlplane_controller_test.go | 52 +- exp/api/v1beta1/constants.go | 5 +- exp/api/v1beta1/conversion.go | 18 - exp/api/v1beta1/conversion_test.go | 38 - .../v1beta1/ocimanagedmachinepool_types.go | 10 +- exp/api/v1beta1/zz_generated.conversion.go | 903 +----------------- exp/api/v1beta1/zz_generated.deepcopy.go | 612 ------------ exp/api/v1beta2/conditions_consts.go | 13 - exp/api/v1beta2/conversion.go | 15 - .../v1beta2/ocimanagedmachinepool_types.go | 10 +- .../v1beta2/ocimanagedmachinepool_webhook.go | 3 +- exp/api/v1beta2/zz_generated.deepcopy.go | 748 --------------- exp/controllers/ocimachinepool_controller.go | 2 +- .../ocimachinepool_controller_test.go | 23 + .../ocimanaged_machinepool_controller.go | 8 +- .../ocimanaged_machinepool_controller_test.go | 15 +- .../ocivirtual_machinepool_controller.go | 8 +- .../ocivirtual_machinepool_controller_test.go | 82 +- main.go | 51 +- test/e2e/config/e2e_conf.yaml | 1 + .../cluster.yaml | 36 + .../kustomization.yaml | 4 + .../md.yaml | 35 + test/e2e/managed_cluster_test.go | 55 +- 64 files changed, 3153 insertions(+), 2989 deletions(-) rename {exp/api => api}/v1beta1/ocimanagedcluster_conversion.go (87%) rename {exp/api => api}/v1beta1/ocimanagedcluster_types.go (94%) rename {exp/api => api}/v1beta1/ocimanagedclustertemplate_types.go (100%) rename {exp/api => api}/v1beta1/ocimanagedcontrolplane_conversion.go (96%) rename {exp/api => api}/v1beta1/ocimanagedcontrolplane_types.go (100%) rename {exp/api => api}/v1beta1/ocimanagedcontrolplanetemplate_types.go (100%) rename {exp/api => api}/v1beta2/ocimanagedcluster_types.go (92%) rename {exp/api => api}/v1beta2/ocimanagedcluster_webhook.go (52%) rename {exp/api => api}/v1beta2/ocimanagedcluster_webhook_test.go (71%) rename {exp/api => api}/v1beta2/ocimanagedclustertemplate_types.go (100%) rename {exp/api => api}/v1beta2/ocimanagedcontrolplane_types.go (100%) rename {exp/api => api}/v1beta2/ocimanagedcontrolplane_webhook.go (100%) rename {exp/api => api}/v1beta2/ocimanagedcontrolplane_webhook_test.go (100%) rename {exp/api => api}/v1beta2/ocimanagedcontrolplanetemplate_types.go (100%) rename {exp/controllers => controllers}/ocimanagedcluster_controller.go (96%) rename {exp/controllers => controllers}/ocimanagedcluster_controller_test.go (91%) rename {exp/controllers => controllers}/ocimanagedcluster_controlplane_controller.go (87%) rename {exp/controllers => controllers}/ocimanagedcluster_controlplane_controller_test.go (88%) create mode 100644 test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/cluster.yaml create mode 100644 test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/md.yaml diff --git a/Makefile b/Makefile index 680ab382..00ca1e9d 100644 --- a/Makefile +++ b/Makefile @@ -294,6 +294,7 @@ generate-e2e-templates: $(KUSTOMIZE) $(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta2/cluster-template-cluster-identity --load-restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta2/cluster-template-cluster-identity.yaml $(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta2/cluster-template-windows-calico --load-restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta2/cluster-template-windows-calico.yaml $(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta2/cluster-template-managed-virtual --load-restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta2/cluster-template-managed-virtual.yaml + $(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta2/cluster-template-managed-self-managed-nodes --load-restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta2/cluster-template-managed-self-managed-nodes.yaml .PHONY: test-e2e-run test-e2e-run: generate-e2e-templates $(GINKGO) $(ENVSUBST) ## Run e2e tests diff --git a/api/v1beta1/constants.go b/api/v1beta1/constants.go index 7b050ee8..7af74da9 100644 --- a/api/v1beta1/constants.go +++ b/api/v1beta1/constants.go @@ -28,4 +28,6 @@ const ( ControlPlaneDefaultName = "control-plane" WorkerDefaultName = "worker" ServiceLBDefaultName = "service-lb" + PodDefaultName = "pod" + PodDefaultCIDR = "10.0.128.0/18" ) diff --git a/api/v1beta1/conversion.go b/api/v1beta1/conversion.go index 8d3b757a..07a46af6 100644 --- a/api/v1beta1/conversion.go +++ b/api/v1beta1/conversion.go @@ -121,7 +121,24 @@ func Convert_v1beta1_OCIMachineSpec_To_v1beta2_OCIMachineSpec(in *OCIMachineSpec } // Convert_v1beta2_LoadBalancer_To_v1beta1_LoadBalancer converts v1beta2 LoadBalancer to v1beta1 LoadBalancer - func Convert_v1beta2_LoadBalancer_To_v1beta1_LoadBalancer(in *v1beta2.LoadBalancer, out *LoadBalancer, s conversion.Scope) error { return autoConvert_v1beta2_LoadBalancer_To_v1beta1_LoadBalancer(in, out, s) } + +func Convert_v1beta2_OCIManagedControlPlaneStatus_To_v1beta1_OCIManagedControlPlaneStatus(in *v1beta2.OCIManagedControlPlaneStatus, out *OCIManagedControlPlaneStatus, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedControlPlaneStatus_To_v1beta1_OCIManagedControlPlaneStatus(in, out, s) +} + +func Convert_v1beta2_OCIManagedControlPlaneSpec_To_v1beta1_OCIManagedControlPlaneSpec(in *v1beta2.OCIManagedControlPlaneSpec, out *OCIManagedControlPlaneSpec, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedControlPlaneSpec_To_v1beta1_OCIManagedControlPlaneSpec(in, out, s) +} + +// Convert_v1beta1_OCIManagedClusterStatus_To_v1beta2_OCIManagedClusterStatus converts v1beta1 OCIManagedClusterStatus to v1beta2 OCIManagedClusterStatus +func Convert_v1beta1_OCIManagedClusterStatus_To_v1beta2_OCIManagedClusterStatus(in *OCIManagedClusterStatus, out *v1beta2.OCIManagedClusterStatus, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedClusterStatus_To_v1beta2_OCIManagedClusterStatus(in, out, s) +} + +// Convert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec converts v1beta1 OCIManagedClusterSpec to v1beta2 OCIManagedClusterSpec +func Convert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec(in *v1beta2.OCIManagedClusterSpec, out *OCIManagedClusterSpec, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec(in, out, s) +} diff --git a/api/v1beta1/conversion_test.go b/api/v1beta1/conversion_test.go index e9f9a2e4..a32052aa 100644 --- a/api/v1beta1/conversion_test.go +++ b/api/v1beta1/conversion_test.go @@ -34,6 +34,7 @@ func fuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} { OCIMachineTemplateFuzzer, OCIClusterFuzzer, OCIClusterTemplateFuzzer, + OCIManagedClusterFuzzer, } } @@ -93,6 +94,28 @@ func OCIMachineTemplateFuzzer(obj *OCIMachineTemplate, c fuzz.Continue) { obj.Spec.Template.Spec.NSGName = "" } +func OCIManagedClusterFuzzer(obj *OCIManagedCluster, c fuzz.Continue) { + c.FuzzNoCustom(obj) + // nil fields which have been removed so that tests dont fail + for _, nsg := range obj.Spec.NetworkSpec.Vcn.NetworkSecurityGroups { + if nsg != nil { + ingressRules := make([]IngressSecurityRuleForNSG, len(nsg.IngressRules)) + for _, rule := range nsg.IngressRules { + rule.ID = nil + ingressRules = append(ingressRules, rule) + } + nsg.IngressRules = ingressRules + + egressRules := make([]EgressSecurityRuleForNSG, len(nsg.EgressRules)) + for _, rule := range nsg.EgressRules { + (&rule).ID = nil + egressRules = append(egressRules, rule) + } + nsg.EgressRules = egressRules + } + } +} + func TestFuzzyConversion(t *testing.T) { g := NewWithT(t) scheme := runtime.NewScheme() @@ -134,4 +157,18 @@ func TestFuzzyConversion(t *testing.T) { FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, })) + t.Run("for OCIManagedControlPlane", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ + Scheme: scheme, + Hub: &v1beta2.OCIManagedControlPlane{}, + Spoke: &OCIManagedControlPlane{}, + FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, + })) + + t.Run("for OCIManagedCluster", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ + Scheme: scheme, + Hub: &v1beta2.OCIManagedCluster{}, + Spoke: &OCIManagedCluster{}, + FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, + })) + } diff --git a/exp/api/v1beta1/ocimanagedcluster_conversion.go b/api/v1beta1/ocimanagedcluster_conversion.go similarity index 87% rename from exp/api/v1beta1/ocimanagedcluster_conversion.go rename to api/v1beta1/ocimanagedcluster_conversion.go index e13c49dc..933984be 100644 --- a/exp/api/v1beta1/ocimanagedcluster_conversion.go +++ b/api/v1beta1/ocimanagedcluster_conversion.go @@ -17,8 +17,7 @@ limitations under the License. package v1beta1 import ( - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" - "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" + "github.com/oracle/cluster-api-provider-oci/api/v1beta2" utilconversion "sigs.k8s.io/cluster-api/util/conversion" "sigs.k8s.io/controller-runtime/pkg/conversion" ) @@ -31,7 +30,7 @@ func (src *OCIManagedCluster) ConvertTo(dstRaw conversion.Hub) error { return err } - ad, err := infrastructurev1beta1.Convertv1beta1AdMapTov1beta2AdMap(src.Status.AvailabilityDomains) + ad, err := Convertv1beta1AdMapTov1beta2AdMap(src.Status.AvailabilityDomains) if err != nil { return err } @@ -61,7 +60,7 @@ func (r *OCIManagedCluster) ConvertFrom(srcRaw conversion.Hub) error { return err } - ad, err := infrastructurev1beta1.Convertv1beta2AdMapTov1beta1AdMap(src.Spec.AvailabilityDomains) + ad, err := Convertv1beta2AdMapTov1beta1AdMap(src.Spec.AvailabilityDomains) if err != nil { return err } diff --git a/exp/api/v1beta1/ocimanagedcluster_types.go b/api/v1beta1/ocimanagedcluster_types.go similarity index 94% rename from exp/api/v1beta1/ocimanagedcluster_types.go rename to api/v1beta1/ocimanagedcluster_types.go index c0fbb48d..3e35b708 100644 --- a/exp/api/v1beta1/ocimanagedcluster_types.go +++ b/api/v1beta1/ocimanagedcluster_types.go @@ -17,7 +17,6 @@ limitations under the License. package v1beta1 import ( - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" @@ -43,7 +42,7 @@ type OCIManagedClusterSpec struct { // NetworkSpec encapsulates all things related to OCI network. // +optional - NetworkSpec infrastructurev1beta1.NetworkSpec `json:"networkSpec,omitempty"` + NetworkSpec NetworkSpec `json:"networkSpec,omitempty"` // Free-form tags for this resource. // +optional @@ -76,7 +75,7 @@ type OCIManagedClusterStatus struct { // AvailabilityDomains encapsulates the clusters Availability Domain (AD) information in a map // where the map key is the AD name and the struct is details about the AD. // +optional - AvailabilityDomains map[string]infrastructurev1beta1.OCIAvailabilityDomain `json:"availabilityDomains,omitempty"` + AvailabilityDomains map[string]OCIAvailabilityDomain `json:"availabilityDomains,omitempty"` // +optional Ready bool `json:"ready"` diff --git a/exp/api/v1beta1/ocimanagedclustertemplate_types.go b/api/v1beta1/ocimanagedclustertemplate_types.go similarity index 100% rename from exp/api/v1beta1/ocimanagedclustertemplate_types.go rename to api/v1beta1/ocimanagedclustertemplate_types.go diff --git a/exp/api/v1beta1/ocimanagedcontrolplane_conversion.go b/api/v1beta1/ocimanagedcontrolplane_conversion.go similarity index 96% rename from exp/api/v1beta1/ocimanagedcontrolplane_conversion.go rename to api/v1beta1/ocimanagedcontrolplane_conversion.go index c99359d6..ee01bfdf 100644 --- a/exp/api/v1beta1/ocimanagedcontrolplane_conversion.go +++ b/api/v1beta1/ocimanagedcontrolplane_conversion.go @@ -17,7 +17,7 @@ limitations under the License. package v1beta1 import ( - "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" + "github.com/oracle/cluster-api-provider-oci/api/v1beta2" utilconversion "sigs.k8s.io/cluster-api/util/conversion" "sigs.k8s.io/controller-runtime/pkg/conversion" ) diff --git a/exp/api/v1beta1/ocimanagedcontrolplane_types.go b/api/v1beta1/ocimanagedcontrolplane_types.go similarity index 100% rename from exp/api/v1beta1/ocimanagedcontrolplane_types.go rename to api/v1beta1/ocimanagedcontrolplane_types.go diff --git a/exp/api/v1beta1/ocimanagedcontrolplanetemplate_types.go b/api/v1beta1/ocimanagedcontrolplanetemplate_types.go similarity index 100% rename from exp/api/v1beta1/ocimanagedcontrolplanetemplate_types.go rename to api/v1beta1/ocimanagedcontrolplanetemplate_types.go diff --git a/api/v1beta1/types.go b/api/v1beta1/types.go index 2fc64915..7d6d609f 100644 --- a/api/v1beta1/types.go +++ b/api/v1beta1/types.go @@ -1025,3 +1025,10 @@ type RemotePeeringConnection struct { // RPCConnectionId is the connection ID of the connection between peer and local RPC. RPCConnectionId *string `json:"rpcConnectionId,omitempty"` } + +const ( + VCNNativeCNI CNIOptionEnum = "OCI_VCN_IP_NATIVE" + FlannelCNI CNIOptionEnum = "FLANNEL_OVERLAY" +) + +type CNIOptionEnum string diff --git a/api/v1beta1/zz_generated.conversion.go b/api/v1beta1/zz_generated.conversion.go index e1af8f90..50ee051e 100644 --- a/api/v1beta1/zz_generated.conversion.go +++ b/api/v1beta1/zz_generated.conversion.go @@ -40,6 +40,26 @@ func init() { // RegisterConversions adds conversion functions to the given scheme. // Public to allow building arbitrary schemes. func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*AddOnOptions)(nil), (*v1beta2.AddOnOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_AddOnOptions_To_v1beta2_AddOnOptions(a.(*AddOnOptions), b.(*v1beta2.AddOnOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.AddOnOptions)(nil), (*AddOnOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_AddOnOptions_To_v1beta1_AddOnOptions(a.(*v1beta2.AddOnOptions), b.(*AddOnOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AdmissionControllerOptions)(nil), (*v1beta2.AdmissionControllerOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_AdmissionControllerOptions_To_v1beta2_AdmissionControllerOptions(a.(*AdmissionControllerOptions), b.(*v1beta2.AdmissionControllerOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.AdmissionControllerOptions)(nil), (*AdmissionControllerOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_AdmissionControllerOptions_To_v1beta1_AdmissionControllerOptions(a.(*v1beta2.AdmissionControllerOptions), b.(*AdmissionControllerOptions), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*AllowedNamespaces)(nil), (*v1beta2.AllowedNamespaces)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_AllowedNamespaces_To_v1beta2_AllowedNamespaces(a.(*AllowedNamespaces), b.(*v1beta2.AllowedNamespaces), scope) }); err != nil { @@ -90,6 +110,26 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*ClusterOptions)(nil), (*v1beta2.ClusterOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_ClusterOptions_To_v1beta2_ClusterOptions(a.(*ClusterOptions), b.(*v1beta2.ClusterOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.ClusterOptions)(nil), (*ClusterOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_ClusterOptions_To_v1beta1_ClusterOptions(a.(*v1beta2.ClusterOptions), b.(*ClusterOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterPodNetworkOptions)(nil), (*v1beta2.ClusterPodNetworkOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_ClusterPodNetworkOptions_To_v1beta2_ClusterPodNetworkOptions(a.(*ClusterPodNetworkOptions), b.(*v1beta2.ClusterPodNetworkOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.ClusterPodNetworkOptions)(nil), (*ClusterPodNetworkOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_ClusterPodNetworkOptions_To_v1beta1_ClusterPodNetworkOptions(a.(*v1beta2.ClusterPodNetworkOptions), b.(*ClusterPodNetworkOptions), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*DRG)(nil), (*v1beta2.DRG)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_DRG_To_v1beta2_DRG(a.(*DRG), b.(*v1beta2.DRG), scope) }); err != nil { @@ -115,6 +155,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*EndpointConfig)(nil), (*v1beta2.EndpointConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_EndpointConfig_To_v1beta2_EndpointConfig(a.(*EndpointConfig), b.(*v1beta2.EndpointConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.EndpointConfig)(nil), (*EndpointConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_EndpointConfig_To_v1beta1_EndpointConfig(a.(*v1beta2.EndpointConfig), b.(*EndpointConfig), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*IcmpOptions)(nil), (*v1beta2.IcmpOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_IcmpOptions_To_v1beta2_IcmpOptions(a.(*IcmpOptions), b.(*v1beta2.IcmpOptions), scope) }); err != nil { @@ -125,6 +175,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*ImagePolicyConfig)(nil), (*v1beta2.ImagePolicyConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_ImagePolicyConfig_To_v1beta2_ImagePolicyConfig(a.(*ImagePolicyConfig), b.(*v1beta2.ImagePolicyConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.ImagePolicyConfig)(nil), (*ImagePolicyConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_ImagePolicyConfig_To_v1beta1_ImagePolicyConfig(a.(*v1beta2.ImagePolicyConfig), b.(*ImagePolicyConfig), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*IngressSecurityRule)(nil), (*v1beta2.IngressSecurityRule)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_IngressSecurityRule_To_v1beta2_IngressSecurityRule(a.(*IngressSecurityRule), b.(*v1beta2.IngressSecurityRule), scope) }); err != nil { @@ -200,6 +260,26 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*KeyDetails)(nil), (*v1beta2.KeyDetails)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_KeyDetails_To_v1beta2_KeyDetails(a.(*KeyDetails), b.(*v1beta2.KeyDetails), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.KeyDetails)(nil), (*KeyDetails)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_KeyDetails_To_v1beta1_KeyDetails(a.(*v1beta2.KeyDetails), b.(*KeyDetails), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubernetesNetworkConfig)(nil), (*v1beta2.KubernetesNetworkConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_KubernetesNetworkConfig_To_v1beta2_KubernetesNetworkConfig(a.(*KubernetesNetworkConfig), b.(*v1beta2.KubernetesNetworkConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.KubernetesNetworkConfig)(nil), (*KubernetesNetworkConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_KubernetesNetworkConfig_To_v1beta1_KubernetesNetworkConfig(a.(*v1beta2.KubernetesNetworkConfig), b.(*KubernetesNetworkConfig), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*LaunchInstanceAgentConfig)(nil), (*v1beta2.LaunchInstanceAgentConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_LaunchInstanceAgentConfig_To_v1beta2_LaunchInstanceAgentConfig(a.(*LaunchInstanceAgentConfig), b.(*v1beta2.LaunchInstanceAgentConfig), scope) }); err != nil { @@ -455,6 +535,146 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*OCIManagedCluster)(nil), (*v1beta2.OCIManagedCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedCluster_To_v1beta2_OCIManagedCluster(a.(*OCIManagedCluster), b.(*v1beta2.OCIManagedCluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedCluster)(nil), (*OCIManagedCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedCluster_To_v1beta1_OCIManagedCluster(a.(*v1beta2.OCIManagedCluster), b.(*OCIManagedCluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedClusterList)(nil), (*v1beta2.OCIManagedClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedClusterList_To_v1beta2_OCIManagedClusterList(a.(*OCIManagedClusterList), b.(*v1beta2.OCIManagedClusterList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedClusterList)(nil), (*OCIManagedClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedClusterList_To_v1beta1_OCIManagedClusterList(a.(*v1beta2.OCIManagedClusterList), b.(*OCIManagedClusterList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedClusterSpec)(nil), (*v1beta2.OCIManagedClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedClusterSpec_To_v1beta2_OCIManagedClusterSpec(a.(*OCIManagedClusterSpec), b.(*v1beta2.OCIManagedClusterSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedClusterStatus)(nil), (*OCIManagedClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedClusterStatus_To_v1beta1_OCIManagedClusterStatus(a.(*v1beta2.OCIManagedClusterStatus), b.(*OCIManagedClusterStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedClusterTemplate)(nil), (*v1beta2.OCIManagedClusterTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedClusterTemplate_To_v1beta2_OCIManagedClusterTemplate(a.(*OCIManagedClusterTemplate), b.(*v1beta2.OCIManagedClusterTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedClusterTemplate)(nil), (*OCIManagedClusterTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedClusterTemplate_To_v1beta1_OCIManagedClusterTemplate(a.(*v1beta2.OCIManagedClusterTemplate), b.(*OCIManagedClusterTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedClusterTemplateList)(nil), (*v1beta2.OCIManagedClusterTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedClusterTemplateList_To_v1beta2_OCIManagedClusterTemplateList(a.(*OCIManagedClusterTemplateList), b.(*v1beta2.OCIManagedClusterTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedClusterTemplateList)(nil), (*OCIManagedClusterTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedClusterTemplateList_To_v1beta1_OCIManagedClusterTemplateList(a.(*v1beta2.OCIManagedClusterTemplateList), b.(*OCIManagedClusterTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedClusterTemplateResource)(nil), (*v1beta2.OCIManagedClusterTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedClusterTemplateResource_To_v1beta2_OCIManagedClusterTemplateResource(a.(*OCIManagedClusterTemplateResource), b.(*v1beta2.OCIManagedClusterTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedClusterTemplateResource)(nil), (*OCIManagedClusterTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedClusterTemplateResource_To_v1beta1_OCIManagedClusterTemplateResource(a.(*v1beta2.OCIManagedClusterTemplateResource), b.(*OCIManagedClusterTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedClusterTemplateSpec)(nil), (*v1beta2.OCIManagedClusterTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedClusterTemplateSpec_To_v1beta2_OCIManagedClusterTemplateSpec(a.(*OCIManagedClusterTemplateSpec), b.(*v1beta2.OCIManagedClusterTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedClusterTemplateSpec)(nil), (*OCIManagedClusterTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedClusterTemplateSpec_To_v1beta1_OCIManagedClusterTemplateSpec(a.(*v1beta2.OCIManagedClusterTemplateSpec), b.(*OCIManagedClusterTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedControlPlane)(nil), (*v1beta2.OCIManagedControlPlane)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedControlPlane_To_v1beta2_OCIManagedControlPlane(a.(*OCIManagedControlPlane), b.(*v1beta2.OCIManagedControlPlane), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedControlPlane)(nil), (*OCIManagedControlPlane)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedControlPlane_To_v1beta1_OCIManagedControlPlane(a.(*v1beta2.OCIManagedControlPlane), b.(*OCIManagedControlPlane), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedControlPlaneList)(nil), (*v1beta2.OCIManagedControlPlaneList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedControlPlaneList_To_v1beta2_OCIManagedControlPlaneList(a.(*OCIManagedControlPlaneList), b.(*v1beta2.OCIManagedControlPlaneList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedControlPlaneList)(nil), (*OCIManagedControlPlaneList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedControlPlaneList_To_v1beta1_OCIManagedControlPlaneList(a.(*v1beta2.OCIManagedControlPlaneList), b.(*OCIManagedControlPlaneList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedControlPlaneSpec)(nil), (*v1beta2.OCIManagedControlPlaneSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedControlPlaneSpec_To_v1beta2_OCIManagedControlPlaneSpec(a.(*OCIManagedControlPlaneSpec), b.(*v1beta2.OCIManagedControlPlaneSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedControlPlaneStatus)(nil), (*v1beta2.OCIManagedControlPlaneStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedControlPlaneStatus_To_v1beta2_OCIManagedControlPlaneStatus(a.(*OCIManagedControlPlaneStatus), b.(*v1beta2.OCIManagedControlPlaneStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedControlPlaneTemplate)(nil), (*v1beta2.OCIManagedControlPlaneTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedControlPlaneTemplate_To_v1beta2_OCIManagedControlPlaneTemplate(a.(*OCIManagedControlPlaneTemplate), b.(*v1beta2.OCIManagedControlPlaneTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedControlPlaneTemplate)(nil), (*OCIManagedControlPlaneTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedControlPlaneTemplate_To_v1beta1_OCIManagedControlPlaneTemplate(a.(*v1beta2.OCIManagedControlPlaneTemplate), b.(*OCIManagedControlPlaneTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedControlPlaneTemplateList)(nil), (*v1beta2.OCIManagedControlPlaneTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedControlPlaneTemplateList_To_v1beta2_OCIManagedControlPlaneTemplateList(a.(*OCIManagedControlPlaneTemplateList), b.(*v1beta2.OCIManagedControlPlaneTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedControlPlaneTemplateList)(nil), (*OCIManagedControlPlaneTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedControlPlaneTemplateList_To_v1beta1_OCIManagedControlPlaneTemplateList(a.(*v1beta2.OCIManagedControlPlaneTemplateList), b.(*OCIManagedControlPlaneTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedControlPlaneTemplateResource)(nil), (*v1beta2.OCIManagedControlPlaneTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedControlPlaneTemplateResource_To_v1beta2_OCIManagedControlPlaneTemplateResource(a.(*OCIManagedControlPlaneTemplateResource), b.(*v1beta2.OCIManagedControlPlaneTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedControlPlaneTemplateResource)(nil), (*OCIManagedControlPlaneTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedControlPlaneTemplateResource_To_v1beta1_OCIManagedControlPlaneTemplateResource(a.(*v1beta2.OCIManagedControlPlaneTemplateResource), b.(*OCIManagedControlPlaneTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedControlPlaneTemplateSpec)(nil), (*v1beta2.OCIManagedControlPlaneTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedControlPlaneTemplateSpec_To_v1beta2_OCIManagedControlPlaneTemplateSpec(a.(*OCIManagedControlPlaneTemplateSpec), b.(*v1beta2.OCIManagedControlPlaneTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedControlPlaneTemplateSpec)(nil), (*OCIManagedControlPlaneTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedControlPlaneTemplateSpec_To_v1beta1_OCIManagedControlPlaneTemplateSpec(a.(*v1beta2.OCIManagedControlPlaneTemplateSpec), b.(*OCIManagedControlPlaneTemplateSpec), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*PeerRouteRule)(nil), (*v1beta2.PeerRouteRule)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_PeerRouteRule_To_v1beta2_PeerRouteRule(a.(*PeerRouteRule), b.(*v1beta2.PeerRouteRule), scope) }); err != nil { @@ -610,6 +830,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*OCIManagedClusterStatus)(nil), (*v1beta2.OCIManagedClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedClusterStatus_To_v1beta2_OCIManagedClusterStatus(a.(*OCIManagedClusterStatus), b.(*v1beta2.OCIManagedClusterStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*VCN)(nil), (*v1beta2.VCN)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_VCN_To_v1beta2_VCN(a.(*VCN), b.(*v1beta2.VCN), scope) }); err != nil { @@ -625,6 +850,21 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta2.OCIManagedClusterSpec)(nil), (*OCIManagedClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec(a.(*v1beta2.OCIManagedClusterSpec), b.(*OCIManagedClusterSpec), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1beta2.OCIManagedControlPlaneSpec)(nil), (*OCIManagedControlPlaneSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedControlPlaneSpec_To_v1beta1_OCIManagedControlPlaneSpec(a.(*v1beta2.OCIManagedControlPlaneSpec), b.(*OCIManagedControlPlaneSpec), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1beta2.OCIManagedControlPlaneStatus)(nil), (*OCIManagedControlPlaneStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedControlPlaneStatus_To_v1beta1_OCIManagedControlPlaneStatus(a.(*v1beta2.OCIManagedControlPlaneStatus), b.(*OCIManagedControlPlaneStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta2.VCN)(nil), (*VCN)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta2_VCN_To_v1beta1_VCN(a.(*v1beta2.VCN), b.(*VCN), scope) }); err != nil { @@ -633,6 +873,48 @@ func RegisterConversions(s *runtime.Scheme) error { return nil } +func autoConvert_v1beta1_AddOnOptions_To_v1beta2_AddOnOptions(in *AddOnOptions, out *v1beta2.AddOnOptions, s conversion.Scope) error { + out.IsKubernetesDashboardEnabled = (*bool)(unsafe.Pointer(in.IsKubernetesDashboardEnabled)) + out.IsTillerEnabled = (*bool)(unsafe.Pointer(in.IsTillerEnabled)) + return nil +} + +// Convert_v1beta1_AddOnOptions_To_v1beta2_AddOnOptions is an autogenerated conversion function. +func Convert_v1beta1_AddOnOptions_To_v1beta2_AddOnOptions(in *AddOnOptions, out *v1beta2.AddOnOptions, s conversion.Scope) error { + return autoConvert_v1beta1_AddOnOptions_To_v1beta2_AddOnOptions(in, out, s) +} + +func autoConvert_v1beta2_AddOnOptions_To_v1beta1_AddOnOptions(in *v1beta2.AddOnOptions, out *AddOnOptions, s conversion.Scope) error { + out.IsKubernetesDashboardEnabled = (*bool)(unsafe.Pointer(in.IsKubernetesDashboardEnabled)) + out.IsTillerEnabled = (*bool)(unsafe.Pointer(in.IsTillerEnabled)) + return nil +} + +// Convert_v1beta2_AddOnOptions_To_v1beta1_AddOnOptions is an autogenerated conversion function. +func Convert_v1beta2_AddOnOptions_To_v1beta1_AddOnOptions(in *v1beta2.AddOnOptions, out *AddOnOptions, s conversion.Scope) error { + return autoConvert_v1beta2_AddOnOptions_To_v1beta1_AddOnOptions(in, out, s) +} + +func autoConvert_v1beta1_AdmissionControllerOptions_To_v1beta2_AdmissionControllerOptions(in *AdmissionControllerOptions, out *v1beta2.AdmissionControllerOptions, s conversion.Scope) error { + out.IsPodSecurityPolicyEnabled = (*bool)(unsafe.Pointer(in.IsPodSecurityPolicyEnabled)) + return nil +} + +// Convert_v1beta1_AdmissionControllerOptions_To_v1beta2_AdmissionControllerOptions is an autogenerated conversion function. +func Convert_v1beta1_AdmissionControllerOptions_To_v1beta2_AdmissionControllerOptions(in *AdmissionControllerOptions, out *v1beta2.AdmissionControllerOptions, s conversion.Scope) error { + return autoConvert_v1beta1_AdmissionControllerOptions_To_v1beta2_AdmissionControllerOptions(in, out, s) +} + +func autoConvert_v1beta2_AdmissionControllerOptions_To_v1beta1_AdmissionControllerOptions(in *v1beta2.AdmissionControllerOptions, out *AdmissionControllerOptions, s conversion.Scope) error { + out.IsPodSecurityPolicyEnabled = (*bool)(unsafe.Pointer(in.IsPodSecurityPolicyEnabled)) + return nil +} + +// Convert_v1beta2_AdmissionControllerOptions_To_v1beta1_AdmissionControllerOptions is an autogenerated conversion function. +func Convert_v1beta2_AdmissionControllerOptions_To_v1beta1_AdmissionControllerOptions(in *v1beta2.AdmissionControllerOptions, out *AdmissionControllerOptions, s conversion.Scope) error { + return autoConvert_v1beta2_AdmissionControllerOptions_To_v1beta1_AdmissionControllerOptions(in, out, s) +} + func autoConvert_v1beta1_AllowedNamespaces_To_v1beta2_AllowedNamespaces(in *AllowedNamespaces, out *v1beta2.AllowedNamespaces, s conversion.Scope) error { out.NamespaceList = *(*[]string)(unsafe.Pointer(&in.NamespaceList)) out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector)) @@ -793,6 +1075,48 @@ func Convert_v1beta2_AmdVmPlatformConfig_To_v1beta1_AmdVmPlatformConfig(in *v1be return autoConvert_v1beta2_AmdVmPlatformConfig_To_v1beta1_AmdVmPlatformConfig(in, out, s) } +func autoConvert_v1beta1_ClusterOptions_To_v1beta2_ClusterOptions(in *ClusterOptions, out *v1beta2.ClusterOptions, s conversion.Scope) error { + out.AddOnOptions = (*v1beta2.AddOnOptions)(unsafe.Pointer(in.AddOnOptions)) + out.AdmissionControllerOptions = (*v1beta2.AdmissionControllerOptions)(unsafe.Pointer(in.AdmissionControllerOptions)) + return nil +} + +// Convert_v1beta1_ClusterOptions_To_v1beta2_ClusterOptions is an autogenerated conversion function. +func Convert_v1beta1_ClusterOptions_To_v1beta2_ClusterOptions(in *ClusterOptions, out *v1beta2.ClusterOptions, s conversion.Scope) error { + return autoConvert_v1beta1_ClusterOptions_To_v1beta2_ClusterOptions(in, out, s) +} + +func autoConvert_v1beta2_ClusterOptions_To_v1beta1_ClusterOptions(in *v1beta2.ClusterOptions, out *ClusterOptions, s conversion.Scope) error { + out.AddOnOptions = (*AddOnOptions)(unsafe.Pointer(in.AddOnOptions)) + out.AdmissionControllerOptions = (*AdmissionControllerOptions)(unsafe.Pointer(in.AdmissionControllerOptions)) + return nil +} + +// Convert_v1beta2_ClusterOptions_To_v1beta1_ClusterOptions is an autogenerated conversion function. +func Convert_v1beta2_ClusterOptions_To_v1beta1_ClusterOptions(in *v1beta2.ClusterOptions, out *ClusterOptions, s conversion.Scope) error { + return autoConvert_v1beta2_ClusterOptions_To_v1beta1_ClusterOptions(in, out, s) +} + +func autoConvert_v1beta1_ClusterPodNetworkOptions_To_v1beta2_ClusterPodNetworkOptions(in *ClusterPodNetworkOptions, out *v1beta2.ClusterPodNetworkOptions, s conversion.Scope) error { + out.CniType = v1beta2.CNIOptionEnum(in.CniType) + return nil +} + +// Convert_v1beta1_ClusterPodNetworkOptions_To_v1beta2_ClusterPodNetworkOptions is an autogenerated conversion function. +func Convert_v1beta1_ClusterPodNetworkOptions_To_v1beta2_ClusterPodNetworkOptions(in *ClusterPodNetworkOptions, out *v1beta2.ClusterPodNetworkOptions, s conversion.Scope) error { + return autoConvert_v1beta1_ClusterPodNetworkOptions_To_v1beta2_ClusterPodNetworkOptions(in, out, s) +} + +func autoConvert_v1beta2_ClusterPodNetworkOptions_To_v1beta1_ClusterPodNetworkOptions(in *v1beta2.ClusterPodNetworkOptions, out *ClusterPodNetworkOptions, s conversion.Scope) error { + out.CniType = CNIOptionEnum(in.CniType) + return nil +} + +// Convert_v1beta2_ClusterPodNetworkOptions_To_v1beta1_ClusterPodNetworkOptions is an autogenerated conversion function. +func Convert_v1beta2_ClusterPodNetworkOptions_To_v1beta1_ClusterPodNetworkOptions(in *v1beta2.ClusterPodNetworkOptions, out *ClusterPodNetworkOptions, s conversion.Scope) error { + return autoConvert_v1beta2_ClusterPodNetworkOptions_To_v1beta1_ClusterPodNetworkOptions(in, out, s) +} + func autoConvert_v1beta1_DRG_To_v1beta2_DRG(in *DRG, out *v1beta2.DRG, s conversion.Scope) error { out.Manage = in.Manage out.Name = in.Name @@ -873,6 +1197,26 @@ func Convert_v1beta2_EgressSecurityRuleForNSG_To_v1beta1_EgressSecurityRuleForNS return autoConvert_v1beta2_EgressSecurityRuleForNSG_To_v1beta1_EgressSecurityRuleForNSG(in, out, s) } +func autoConvert_v1beta1_EndpointConfig_To_v1beta2_EndpointConfig(in *EndpointConfig, out *v1beta2.EndpointConfig, s conversion.Scope) error { + out.IsPublicIpEnabled = in.IsPublicIpEnabled + return nil +} + +// Convert_v1beta1_EndpointConfig_To_v1beta2_EndpointConfig is an autogenerated conversion function. +func Convert_v1beta1_EndpointConfig_To_v1beta2_EndpointConfig(in *EndpointConfig, out *v1beta2.EndpointConfig, s conversion.Scope) error { + return autoConvert_v1beta1_EndpointConfig_To_v1beta2_EndpointConfig(in, out, s) +} + +func autoConvert_v1beta2_EndpointConfig_To_v1beta1_EndpointConfig(in *v1beta2.EndpointConfig, out *EndpointConfig, s conversion.Scope) error { + out.IsPublicIpEnabled = in.IsPublicIpEnabled + return nil +} + +// Convert_v1beta2_EndpointConfig_To_v1beta1_EndpointConfig is an autogenerated conversion function. +func Convert_v1beta2_EndpointConfig_To_v1beta1_EndpointConfig(in *v1beta2.EndpointConfig, out *EndpointConfig, s conversion.Scope) error { + return autoConvert_v1beta2_EndpointConfig_To_v1beta1_EndpointConfig(in, out, s) +} + func autoConvert_v1beta1_IcmpOptions_To_v1beta2_IcmpOptions(in *IcmpOptions, out *v1beta2.IcmpOptions, s conversion.Scope) error { out.Type = (*int)(unsafe.Pointer(in.Type)) out.Code = (*int)(unsafe.Pointer(in.Code)) @@ -895,6 +1239,28 @@ func Convert_v1beta2_IcmpOptions_To_v1beta1_IcmpOptions(in *v1beta2.IcmpOptions, return autoConvert_v1beta2_IcmpOptions_To_v1beta1_IcmpOptions(in, out, s) } +func autoConvert_v1beta1_ImagePolicyConfig_To_v1beta2_ImagePolicyConfig(in *ImagePolicyConfig, out *v1beta2.ImagePolicyConfig, s conversion.Scope) error { + out.IsPolicyEnabled = (*bool)(unsafe.Pointer(in.IsPolicyEnabled)) + out.KeyDetails = *(*[]v1beta2.KeyDetails)(unsafe.Pointer(&in.KeyDetails)) + return nil +} + +// Convert_v1beta1_ImagePolicyConfig_To_v1beta2_ImagePolicyConfig is an autogenerated conversion function. +func Convert_v1beta1_ImagePolicyConfig_To_v1beta2_ImagePolicyConfig(in *ImagePolicyConfig, out *v1beta2.ImagePolicyConfig, s conversion.Scope) error { + return autoConvert_v1beta1_ImagePolicyConfig_To_v1beta2_ImagePolicyConfig(in, out, s) +} + +func autoConvert_v1beta2_ImagePolicyConfig_To_v1beta1_ImagePolicyConfig(in *v1beta2.ImagePolicyConfig, out *ImagePolicyConfig, s conversion.Scope) error { + out.IsPolicyEnabled = (*bool)(unsafe.Pointer(in.IsPolicyEnabled)) + out.KeyDetails = *(*[]KeyDetails)(unsafe.Pointer(&in.KeyDetails)) + return nil +} + +// Convert_v1beta2_ImagePolicyConfig_To_v1beta1_ImagePolicyConfig is an autogenerated conversion function. +func Convert_v1beta2_ImagePolicyConfig_To_v1beta1_ImagePolicyConfig(in *v1beta2.ImagePolicyConfig, out *ImagePolicyConfig, s conversion.Scope) error { + return autoConvert_v1beta2_ImagePolicyConfig_To_v1beta1_ImagePolicyConfig(in, out, s) +} + func autoConvert_v1beta1_IngressSecurityRule_To_v1beta2_IngressSecurityRule(in *IngressSecurityRule, out *v1beta2.IngressSecurityRule, s conversion.Scope) error { out.Protocol = (*string)(unsafe.Pointer(in.Protocol)) out.Source = (*string)(unsafe.Pointer(in.Source)) @@ -1099,6 +1465,48 @@ func Convert_v1beta2_IntelVmPlatformConfig_To_v1beta1_IntelVmPlatformConfig(in * return autoConvert_v1beta2_IntelVmPlatformConfig_To_v1beta1_IntelVmPlatformConfig(in, out, s) } +func autoConvert_v1beta1_KeyDetails_To_v1beta2_KeyDetails(in *KeyDetails, out *v1beta2.KeyDetails, s conversion.Scope) error { + out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) + return nil +} + +// Convert_v1beta1_KeyDetails_To_v1beta2_KeyDetails is an autogenerated conversion function. +func Convert_v1beta1_KeyDetails_To_v1beta2_KeyDetails(in *KeyDetails, out *v1beta2.KeyDetails, s conversion.Scope) error { + return autoConvert_v1beta1_KeyDetails_To_v1beta2_KeyDetails(in, out, s) +} + +func autoConvert_v1beta2_KeyDetails_To_v1beta1_KeyDetails(in *v1beta2.KeyDetails, out *KeyDetails, s conversion.Scope) error { + out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) + return nil +} + +// Convert_v1beta2_KeyDetails_To_v1beta1_KeyDetails is an autogenerated conversion function. +func Convert_v1beta2_KeyDetails_To_v1beta1_KeyDetails(in *v1beta2.KeyDetails, out *KeyDetails, s conversion.Scope) error { + return autoConvert_v1beta2_KeyDetails_To_v1beta1_KeyDetails(in, out, s) +} + +func autoConvert_v1beta1_KubernetesNetworkConfig_To_v1beta2_KubernetesNetworkConfig(in *KubernetesNetworkConfig, out *v1beta2.KubernetesNetworkConfig, s conversion.Scope) error { + out.PodsCidr = in.PodsCidr + out.ServicesCidr = in.ServicesCidr + return nil +} + +// Convert_v1beta1_KubernetesNetworkConfig_To_v1beta2_KubernetesNetworkConfig is an autogenerated conversion function. +func Convert_v1beta1_KubernetesNetworkConfig_To_v1beta2_KubernetesNetworkConfig(in *KubernetesNetworkConfig, out *v1beta2.KubernetesNetworkConfig, s conversion.Scope) error { + return autoConvert_v1beta1_KubernetesNetworkConfig_To_v1beta2_KubernetesNetworkConfig(in, out, s) +} + +func autoConvert_v1beta2_KubernetesNetworkConfig_To_v1beta1_KubernetesNetworkConfig(in *v1beta2.KubernetesNetworkConfig, out *KubernetesNetworkConfig, s conversion.Scope) error { + out.PodsCidr = in.PodsCidr + out.ServicesCidr = in.ServicesCidr + return nil +} + +// Convert_v1beta2_KubernetesNetworkConfig_To_v1beta1_KubernetesNetworkConfig is an autogenerated conversion function. +func Convert_v1beta2_KubernetesNetworkConfig_To_v1beta1_KubernetesNetworkConfig(in *v1beta2.KubernetesNetworkConfig, out *KubernetesNetworkConfig, s conversion.Scope) error { + return autoConvert_v1beta2_KubernetesNetworkConfig_To_v1beta1_KubernetesNetworkConfig(in, out, s) +} + func autoConvert_v1beta1_LaunchInstanceAgentConfig_To_v1beta2_LaunchInstanceAgentConfig(in *LaunchInstanceAgentConfig, out *v1beta2.LaunchInstanceAgentConfig, s conversion.Scope) error { out.IsMonitoringDisabled = (*bool)(unsafe.Pointer(in.IsMonitoringDisabled)) out.IsManagementDisabled = (*bool)(unsafe.Pointer(in.IsManagementDisabled)) @@ -1985,6 +2393,496 @@ func Convert_v1beta2_OCIMachineTemplateSpec_To_v1beta1_OCIMachineTemplateSpec(in return autoConvert_v1beta2_OCIMachineTemplateSpec_To_v1beta1_OCIMachineTemplateSpec(in, out, s) } +func autoConvert_v1beta1_OCIManagedCluster_To_v1beta2_OCIManagedCluster(in *OCIManagedCluster, out *v1beta2.OCIManagedCluster, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta1_OCIManagedClusterSpec_To_v1beta2_OCIManagedClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1beta1_OCIManagedClusterStatus_To_v1beta2_OCIManagedClusterStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIManagedCluster_To_v1beta2_OCIManagedCluster is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedCluster_To_v1beta2_OCIManagedCluster(in *OCIManagedCluster, out *v1beta2.OCIManagedCluster, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedCluster_To_v1beta2_OCIManagedCluster(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedCluster_To_v1beta1_OCIManagedCluster(in *v1beta2.OCIManagedCluster, out *OCIManagedCluster, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1beta2_OCIManagedClusterStatus_To_v1beta1_OCIManagedClusterStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIManagedCluster_To_v1beta1_OCIManagedCluster is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedCluster_To_v1beta1_OCIManagedCluster(in *v1beta2.OCIManagedCluster, out *OCIManagedCluster, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedCluster_To_v1beta1_OCIManagedCluster(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedClusterList_To_v1beta2_OCIManagedClusterList(in *OCIManagedClusterList, out *v1beta2.OCIManagedClusterList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1beta2.OCIManagedCluster, len(*in)) + for i := range *in { + if err := Convert_v1beta1_OCIManagedCluster_To_v1beta2_OCIManagedCluster(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta1_OCIManagedClusterList_To_v1beta2_OCIManagedClusterList is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedClusterList_To_v1beta2_OCIManagedClusterList(in *OCIManagedClusterList, out *v1beta2.OCIManagedClusterList, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedClusterList_To_v1beta2_OCIManagedClusterList(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedClusterList_To_v1beta1_OCIManagedClusterList(in *v1beta2.OCIManagedClusterList, out *OCIManagedClusterList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIManagedCluster, len(*in)) + for i := range *in { + if err := Convert_v1beta2_OCIManagedCluster_To_v1beta1_OCIManagedCluster(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta2_OCIManagedClusterList_To_v1beta1_OCIManagedClusterList is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedClusterList_To_v1beta1_OCIManagedClusterList(in *v1beta2.OCIManagedClusterList, out *OCIManagedClusterList, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedClusterList_To_v1beta1_OCIManagedClusterList(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedClusterSpec_To_v1beta2_OCIManagedClusterSpec(in *OCIManagedClusterSpec, out *v1beta2.OCIManagedClusterSpec, s conversion.Scope) error { + out.OCIResourceIdentifier = in.OCIResourceIdentifier + out.IdentityRef = (*corev1.ObjectReference)(unsafe.Pointer(in.IdentityRef)) + if err := Convert_v1beta1_NetworkSpec_To_v1beta2_NetworkSpec(&in.NetworkSpec, &out.NetworkSpec, s); err != nil { + return err + } + out.FreeformTags = *(*map[string]string)(unsafe.Pointer(&in.FreeformTags)) + out.DefinedTags = *(*map[string]map[string]string)(unsafe.Pointer(&in.DefinedTags)) + out.CompartmentId = in.CompartmentId + out.Region = in.Region + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + return nil +} + +// Convert_v1beta1_OCIManagedClusterSpec_To_v1beta2_OCIManagedClusterSpec is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedClusterSpec_To_v1beta2_OCIManagedClusterSpec(in *OCIManagedClusterSpec, out *v1beta2.OCIManagedClusterSpec, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedClusterSpec_To_v1beta2_OCIManagedClusterSpec(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec(in *v1beta2.OCIManagedClusterSpec, out *OCIManagedClusterSpec, s conversion.Scope) error { + out.OCIResourceIdentifier = in.OCIResourceIdentifier + out.IdentityRef = (*corev1.ObjectReference)(unsafe.Pointer(in.IdentityRef)) + if err := Convert_v1beta2_NetworkSpec_To_v1beta1_NetworkSpec(&in.NetworkSpec, &out.NetworkSpec, s); err != nil { + return err + } + out.FreeformTags = *(*map[string]string)(unsafe.Pointer(&in.FreeformTags)) + out.DefinedTags = *(*map[string]map[string]string)(unsafe.Pointer(&in.DefinedTags)) + out.CompartmentId = in.CompartmentId + out.Region = in.Region + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + // WARNING: in.AvailabilityDomains requires manual conversion: does not exist in peer-type + // WARNING: in.ClientOverrides requires manual conversion: does not exist in peer-type + return nil +} + +func autoConvert_v1beta1_OCIManagedClusterStatus_To_v1beta2_OCIManagedClusterStatus(in *OCIManagedClusterStatus, out *v1beta2.OCIManagedClusterStatus, s conversion.Scope) error { + out.FailureDomains = *(*apiv1beta1.FailureDomains)(unsafe.Pointer(&in.FailureDomains)) + // WARNING: in.AvailabilityDomains requires manual conversion: does not exist in peer-type + out.Ready = in.Ready + out.Conditions = *(*apiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +func autoConvert_v1beta2_OCIManagedClusterStatus_To_v1beta1_OCIManagedClusterStatus(in *v1beta2.OCIManagedClusterStatus, out *OCIManagedClusterStatus, s conversion.Scope) error { + out.FailureDomains = *(*apiv1beta1.FailureDomains)(unsafe.Pointer(&in.FailureDomains)) + out.Ready = in.Ready + out.Conditions = *(*apiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1beta2_OCIManagedClusterStatus_To_v1beta1_OCIManagedClusterStatus is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedClusterStatus_To_v1beta1_OCIManagedClusterStatus(in *v1beta2.OCIManagedClusterStatus, out *OCIManagedClusterStatus, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedClusterStatus_To_v1beta1_OCIManagedClusterStatus(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedClusterTemplate_To_v1beta2_OCIManagedClusterTemplate(in *OCIManagedClusterTemplate, out *v1beta2.OCIManagedClusterTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta1_OCIManagedClusterTemplateSpec_To_v1beta2_OCIManagedClusterTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIManagedClusterTemplate_To_v1beta2_OCIManagedClusterTemplate is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedClusterTemplate_To_v1beta2_OCIManagedClusterTemplate(in *OCIManagedClusterTemplate, out *v1beta2.OCIManagedClusterTemplate, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedClusterTemplate_To_v1beta2_OCIManagedClusterTemplate(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedClusterTemplate_To_v1beta1_OCIManagedClusterTemplate(in *v1beta2.OCIManagedClusterTemplate, out *OCIManagedClusterTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta2_OCIManagedClusterTemplateSpec_To_v1beta1_OCIManagedClusterTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIManagedClusterTemplate_To_v1beta1_OCIManagedClusterTemplate is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedClusterTemplate_To_v1beta1_OCIManagedClusterTemplate(in *v1beta2.OCIManagedClusterTemplate, out *OCIManagedClusterTemplate, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedClusterTemplate_To_v1beta1_OCIManagedClusterTemplate(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedClusterTemplateList_To_v1beta2_OCIManagedClusterTemplateList(in *OCIManagedClusterTemplateList, out *v1beta2.OCIManagedClusterTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1beta2.OCIManagedClusterTemplate, len(*in)) + for i := range *in { + if err := Convert_v1beta1_OCIManagedClusterTemplate_To_v1beta2_OCIManagedClusterTemplate(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta1_OCIManagedClusterTemplateList_To_v1beta2_OCIManagedClusterTemplateList is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedClusterTemplateList_To_v1beta2_OCIManagedClusterTemplateList(in *OCIManagedClusterTemplateList, out *v1beta2.OCIManagedClusterTemplateList, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedClusterTemplateList_To_v1beta2_OCIManagedClusterTemplateList(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedClusterTemplateList_To_v1beta1_OCIManagedClusterTemplateList(in *v1beta2.OCIManagedClusterTemplateList, out *OCIManagedClusterTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIManagedClusterTemplate, len(*in)) + for i := range *in { + if err := Convert_v1beta2_OCIManagedClusterTemplate_To_v1beta1_OCIManagedClusterTemplate(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta2_OCIManagedClusterTemplateList_To_v1beta1_OCIManagedClusterTemplateList is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedClusterTemplateList_To_v1beta1_OCIManagedClusterTemplateList(in *v1beta2.OCIManagedClusterTemplateList, out *OCIManagedClusterTemplateList, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedClusterTemplateList_To_v1beta1_OCIManagedClusterTemplateList(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedClusterTemplateResource_To_v1beta2_OCIManagedClusterTemplateResource(in *OCIManagedClusterTemplateResource, out *v1beta2.OCIManagedClusterTemplateResource, s conversion.Scope) error { + if err := Convert_v1beta1_OCIManagedClusterSpec_To_v1beta2_OCIManagedClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIManagedClusterTemplateResource_To_v1beta2_OCIManagedClusterTemplateResource is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedClusterTemplateResource_To_v1beta2_OCIManagedClusterTemplateResource(in *OCIManagedClusterTemplateResource, out *v1beta2.OCIManagedClusterTemplateResource, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedClusterTemplateResource_To_v1beta2_OCIManagedClusterTemplateResource(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedClusterTemplateResource_To_v1beta1_OCIManagedClusterTemplateResource(in *v1beta2.OCIManagedClusterTemplateResource, out *OCIManagedClusterTemplateResource, s conversion.Scope) error { + if err := Convert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIManagedClusterTemplateResource_To_v1beta1_OCIManagedClusterTemplateResource is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedClusterTemplateResource_To_v1beta1_OCIManagedClusterTemplateResource(in *v1beta2.OCIManagedClusterTemplateResource, out *OCIManagedClusterTemplateResource, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedClusterTemplateResource_To_v1beta1_OCIManagedClusterTemplateResource(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedClusterTemplateSpec_To_v1beta2_OCIManagedClusterTemplateSpec(in *OCIManagedClusterTemplateSpec, out *v1beta2.OCIManagedClusterTemplateSpec, s conversion.Scope) error { + if err := Convert_v1beta1_OCIManagedClusterTemplateResource_To_v1beta2_OCIManagedClusterTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIManagedClusterTemplateSpec_To_v1beta2_OCIManagedClusterTemplateSpec is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedClusterTemplateSpec_To_v1beta2_OCIManagedClusterTemplateSpec(in *OCIManagedClusterTemplateSpec, out *v1beta2.OCIManagedClusterTemplateSpec, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedClusterTemplateSpec_To_v1beta2_OCIManagedClusterTemplateSpec(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedClusterTemplateSpec_To_v1beta1_OCIManagedClusterTemplateSpec(in *v1beta2.OCIManagedClusterTemplateSpec, out *OCIManagedClusterTemplateSpec, s conversion.Scope) error { + if err := Convert_v1beta2_OCIManagedClusterTemplateResource_To_v1beta1_OCIManagedClusterTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIManagedClusterTemplateSpec_To_v1beta1_OCIManagedClusterTemplateSpec is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedClusterTemplateSpec_To_v1beta1_OCIManagedClusterTemplateSpec(in *v1beta2.OCIManagedClusterTemplateSpec, out *OCIManagedClusterTemplateSpec, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedClusterTemplateSpec_To_v1beta1_OCIManagedClusterTemplateSpec(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedControlPlane_To_v1beta2_OCIManagedControlPlane(in *OCIManagedControlPlane, out *v1beta2.OCIManagedControlPlane, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta1_OCIManagedControlPlaneSpec_To_v1beta2_OCIManagedControlPlaneSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1beta1_OCIManagedControlPlaneStatus_To_v1beta2_OCIManagedControlPlaneStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIManagedControlPlane_To_v1beta2_OCIManagedControlPlane is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedControlPlane_To_v1beta2_OCIManagedControlPlane(in *OCIManagedControlPlane, out *v1beta2.OCIManagedControlPlane, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedControlPlane_To_v1beta2_OCIManagedControlPlane(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedControlPlane_To_v1beta1_OCIManagedControlPlane(in *v1beta2.OCIManagedControlPlane, out *OCIManagedControlPlane, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta2_OCIManagedControlPlaneSpec_To_v1beta1_OCIManagedControlPlaneSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1beta2_OCIManagedControlPlaneStatus_To_v1beta1_OCIManagedControlPlaneStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIManagedControlPlane_To_v1beta1_OCIManagedControlPlane is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedControlPlane_To_v1beta1_OCIManagedControlPlane(in *v1beta2.OCIManagedControlPlane, out *OCIManagedControlPlane, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedControlPlane_To_v1beta1_OCIManagedControlPlane(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedControlPlaneList_To_v1beta2_OCIManagedControlPlaneList(in *OCIManagedControlPlaneList, out *v1beta2.OCIManagedControlPlaneList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1beta2.OCIManagedControlPlane, len(*in)) + for i := range *in { + if err := Convert_v1beta1_OCIManagedControlPlane_To_v1beta2_OCIManagedControlPlane(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta1_OCIManagedControlPlaneList_To_v1beta2_OCIManagedControlPlaneList is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedControlPlaneList_To_v1beta2_OCIManagedControlPlaneList(in *OCIManagedControlPlaneList, out *v1beta2.OCIManagedControlPlaneList, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedControlPlaneList_To_v1beta2_OCIManagedControlPlaneList(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedControlPlaneList_To_v1beta1_OCIManagedControlPlaneList(in *v1beta2.OCIManagedControlPlaneList, out *OCIManagedControlPlaneList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIManagedControlPlane, len(*in)) + for i := range *in { + if err := Convert_v1beta2_OCIManagedControlPlane_To_v1beta1_OCIManagedControlPlane(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta2_OCIManagedControlPlaneList_To_v1beta1_OCIManagedControlPlaneList is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedControlPlaneList_To_v1beta1_OCIManagedControlPlaneList(in *v1beta2.OCIManagedControlPlaneList, out *OCIManagedControlPlaneList, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedControlPlaneList_To_v1beta1_OCIManagedControlPlaneList(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedControlPlaneSpec_To_v1beta2_OCIManagedControlPlaneSpec(in *OCIManagedControlPlaneSpec, out *v1beta2.OCIManagedControlPlaneSpec, s conversion.Scope) error { + out.ID = (*string)(unsafe.Pointer(in.ID)) + out.ClusterPodNetworkOptions = *(*[]v1beta2.ClusterPodNetworkOptions)(unsafe.Pointer(&in.ClusterPodNetworkOptions)) + out.ImagePolicyConfig = (*v1beta2.ImagePolicyConfig)(unsafe.Pointer(in.ImagePolicyConfig)) + if err := Convert_v1beta1_ClusterOptions_To_v1beta2_ClusterOptions(&in.ClusterOption, &out.ClusterOption, s); err != nil { + return err + } + out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + out.Version = (*string)(unsafe.Pointer(in.Version)) + return nil +} + +// Convert_v1beta1_OCIManagedControlPlaneSpec_To_v1beta2_OCIManagedControlPlaneSpec is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedControlPlaneSpec_To_v1beta2_OCIManagedControlPlaneSpec(in *OCIManagedControlPlaneSpec, out *v1beta2.OCIManagedControlPlaneSpec, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedControlPlaneSpec_To_v1beta2_OCIManagedControlPlaneSpec(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedControlPlaneSpec_To_v1beta1_OCIManagedControlPlaneSpec(in *v1beta2.OCIManagedControlPlaneSpec, out *OCIManagedControlPlaneSpec, s conversion.Scope) error { + out.ID = (*string)(unsafe.Pointer(in.ID)) + out.ClusterPodNetworkOptions = *(*[]ClusterPodNetworkOptions)(unsafe.Pointer(&in.ClusterPodNetworkOptions)) + out.ImagePolicyConfig = (*ImagePolicyConfig)(unsafe.Pointer(in.ImagePolicyConfig)) + if err := Convert_v1beta2_ClusterOptions_To_v1beta1_ClusterOptions(&in.ClusterOption, &out.ClusterOption, s); err != nil { + return err + } + // WARNING: in.ClusterType requires manual conversion: does not exist in peer-type + out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + // WARNING: in.Addons requires manual conversion: does not exist in peer-type + out.Version = (*string)(unsafe.Pointer(in.Version)) + return nil +} + +func autoConvert_v1beta1_OCIManagedControlPlaneStatus_To_v1beta2_OCIManagedControlPlaneStatus(in *OCIManagedControlPlaneStatus, out *v1beta2.OCIManagedControlPlaneStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.Conditions = *(*apiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + out.Version = (*string)(unsafe.Pointer(in.Version)) + out.Initialized = in.Initialized + return nil +} + +// Convert_v1beta1_OCIManagedControlPlaneStatus_To_v1beta2_OCIManagedControlPlaneStatus is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedControlPlaneStatus_To_v1beta2_OCIManagedControlPlaneStatus(in *OCIManagedControlPlaneStatus, out *v1beta2.OCIManagedControlPlaneStatus, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedControlPlaneStatus_To_v1beta2_OCIManagedControlPlaneStatus(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedControlPlaneStatus_To_v1beta1_OCIManagedControlPlaneStatus(in *v1beta2.OCIManagedControlPlaneStatus, out *OCIManagedControlPlaneStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.Conditions = *(*apiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + out.Version = (*string)(unsafe.Pointer(in.Version)) + // WARNING: in.AddonStatus requires manual conversion: does not exist in peer-type + out.Initialized = in.Initialized + return nil +} + +func autoConvert_v1beta1_OCIManagedControlPlaneTemplate_To_v1beta2_OCIManagedControlPlaneTemplate(in *OCIManagedControlPlaneTemplate, out *v1beta2.OCIManagedControlPlaneTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta1_OCIManagedControlPlaneTemplateSpec_To_v1beta2_OCIManagedControlPlaneTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIManagedControlPlaneTemplate_To_v1beta2_OCIManagedControlPlaneTemplate is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedControlPlaneTemplate_To_v1beta2_OCIManagedControlPlaneTemplate(in *OCIManagedControlPlaneTemplate, out *v1beta2.OCIManagedControlPlaneTemplate, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedControlPlaneTemplate_To_v1beta2_OCIManagedControlPlaneTemplate(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedControlPlaneTemplate_To_v1beta1_OCIManagedControlPlaneTemplate(in *v1beta2.OCIManagedControlPlaneTemplate, out *OCIManagedControlPlaneTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta2_OCIManagedControlPlaneTemplateSpec_To_v1beta1_OCIManagedControlPlaneTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIManagedControlPlaneTemplate_To_v1beta1_OCIManagedControlPlaneTemplate is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedControlPlaneTemplate_To_v1beta1_OCIManagedControlPlaneTemplate(in *v1beta2.OCIManagedControlPlaneTemplate, out *OCIManagedControlPlaneTemplate, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedControlPlaneTemplate_To_v1beta1_OCIManagedControlPlaneTemplate(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedControlPlaneTemplateList_To_v1beta2_OCIManagedControlPlaneTemplateList(in *OCIManagedControlPlaneTemplateList, out *v1beta2.OCIManagedControlPlaneTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1beta2.OCIManagedControlPlaneTemplate, len(*in)) + for i := range *in { + if err := Convert_v1beta1_OCIManagedControlPlaneTemplate_To_v1beta2_OCIManagedControlPlaneTemplate(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta1_OCIManagedControlPlaneTemplateList_To_v1beta2_OCIManagedControlPlaneTemplateList is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedControlPlaneTemplateList_To_v1beta2_OCIManagedControlPlaneTemplateList(in *OCIManagedControlPlaneTemplateList, out *v1beta2.OCIManagedControlPlaneTemplateList, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedControlPlaneTemplateList_To_v1beta2_OCIManagedControlPlaneTemplateList(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedControlPlaneTemplateList_To_v1beta1_OCIManagedControlPlaneTemplateList(in *v1beta2.OCIManagedControlPlaneTemplateList, out *OCIManagedControlPlaneTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIManagedControlPlaneTemplate, len(*in)) + for i := range *in { + if err := Convert_v1beta2_OCIManagedControlPlaneTemplate_To_v1beta1_OCIManagedControlPlaneTemplate(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta2_OCIManagedControlPlaneTemplateList_To_v1beta1_OCIManagedControlPlaneTemplateList is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedControlPlaneTemplateList_To_v1beta1_OCIManagedControlPlaneTemplateList(in *v1beta2.OCIManagedControlPlaneTemplateList, out *OCIManagedControlPlaneTemplateList, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedControlPlaneTemplateList_To_v1beta1_OCIManagedControlPlaneTemplateList(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedControlPlaneTemplateResource_To_v1beta2_OCIManagedControlPlaneTemplateResource(in *OCIManagedControlPlaneTemplateResource, out *v1beta2.OCIManagedControlPlaneTemplateResource, s conversion.Scope) error { + if err := Convert_v1beta1_OCIManagedControlPlaneSpec_To_v1beta2_OCIManagedControlPlaneSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIManagedControlPlaneTemplateResource_To_v1beta2_OCIManagedControlPlaneTemplateResource is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedControlPlaneTemplateResource_To_v1beta2_OCIManagedControlPlaneTemplateResource(in *OCIManagedControlPlaneTemplateResource, out *v1beta2.OCIManagedControlPlaneTemplateResource, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedControlPlaneTemplateResource_To_v1beta2_OCIManagedControlPlaneTemplateResource(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedControlPlaneTemplateResource_To_v1beta1_OCIManagedControlPlaneTemplateResource(in *v1beta2.OCIManagedControlPlaneTemplateResource, out *OCIManagedControlPlaneTemplateResource, s conversion.Scope) error { + if err := Convert_v1beta2_OCIManagedControlPlaneSpec_To_v1beta1_OCIManagedControlPlaneSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIManagedControlPlaneTemplateResource_To_v1beta1_OCIManagedControlPlaneTemplateResource is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedControlPlaneTemplateResource_To_v1beta1_OCIManagedControlPlaneTemplateResource(in *v1beta2.OCIManagedControlPlaneTemplateResource, out *OCIManagedControlPlaneTemplateResource, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedControlPlaneTemplateResource_To_v1beta1_OCIManagedControlPlaneTemplateResource(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedControlPlaneTemplateSpec_To_v1beta2_OCIManagedControlPlaneTemplateSpec(in *OCIManagedControlPlaneTemplateSpec, out *v1beta2.OCIManagedControlPlaneTemplateSpec, s conversion.Scope) error { + if err := Convert_v1beta1_OCIManagedControlPlaneTemplateResource_To_v1beta2_OCIManagedControlPlaneTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIManagedControlPlaneTemplateSpec_To_v1beta2_OCIManagedControlPlaneTemplateSpec is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedControlPlaneTemplateSpec_To_v1beta2_OCIManagedControlPlaneTemplateSpec(in *OCIManagedControlPlaneTemplateSpec, out *v1beta2.OCIManagedControlPlaneTemplateSpec, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedControlPlaneTemplateSpec_To_v1beta2_OCIManagedControlPlaneTemplateSpec(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedControlPlaneTemplateSpec_To_v1beta1_OCIManagedControlPlaneTemplateSpec(in *v1beta2.OCIManagedControlPlaneTemplateSpec, out *OCIManagedControlPlaneTemplateSpec, s conversion.Scope) error { + if err := Convert_v1beta2_OCIManagedControlPlaneTemplateResource_To_v1beta1_OCIManagedControlPlaneTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIManagedControlPlaneTemplateSpec_To_v1beta1_OCIManagedControlPlaneTemplateSpec is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedControlPlaneTemplateSpec_To_v1beta1_OCIManagedControlPlaneTemplateSpec(in *v1beta2.OCIManagedControlPlaneTemplateSpec, out *OCIManagedControlPlaneTemplateSpec, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedControlPlaneTemplateSpec_To_v1beta1_OCIManagedControlPlaneTemplateSpec(in, out, s) +} + func autoConvert_v1beta1_PeerRouteRule_To_v1beta2_PeerRouteRule(in *PeerRouteRule, out *v1beta2.PeerRouteRule, s conversion.Scope) error { out.VCNCIDRRange = in.VCNCIDRRange return nil diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 8f0aea45..418ad90f 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -29,6 +29,51 @@ import ( "sigs.k8s.io/cluster-api/errors" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AddOnOptions) DeepCopyInto(out *AddOnOptions) { + *out = *in + if in.IsKubernetesDashboardEnabled != nil { + in, out := &in.IsKubernetesDashboardEnabled, &out.IsKubernetesDashboardEnabled + *out = new(bool) + **out = **in + } + if in.IsTillerEnabled != nil { + in, out := &in.IsTillerEnabled, &out.IsTillerEnabled + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddOnOptions. +func (in *AddOnOptions) DeepCopy() *AddOnOptions { + if in == nil { + return nil + } + out := new(AddOnOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AdmissionControllerOptions) DeepCopyInto(out *AdmissionControllerOptions) { + *out = *in + if in.IsPodSecurityPolicyEnabled != nil { + in, out := &in.IsPodSecurityPolicyEnabled, &out.IsPodSecurityPolicyEnabled + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionControllerOptions. +func (in *AdmissionControllerOptions) DeepCopy() *AdmissionControllerOptions { + if in == nil { + return nil + } + out := new(AdmissionControllerOptions) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AllowedNamespaces) DeepCopyInto(out *AllowedNamespaces) { *out = *in @@ -264,6 +309,46 @@ func (in *AmdVmPlatformConfig) DeepCopy() *AmdVmPlatformConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterOptions) DeepCopyInto(out *ClusterOptions) { + *out = *in + if in.AddOnOptions != nil { + in, out := &in.AddOnOptions, &out.AddOnOptions + *out = new(AddOnOptions) + (*in).DeepCopyInto(*out) + } + if in.AdmissionControllerOptions != nil { + in, out := &in.AdmissionControllerOptions, &out.AdmissionControllerOptions + *out = new(AdmissionControllerOptions) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterOptions. +func (in *ClusterOptions) DeepCopy() *ClusterOptions { + if in == nil { + return nil + } + out := new(ClusterOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterPodNetworkOptions) DeepCopyInto(out *ClusterPodNetworkOptions) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterPodNetworkOptions. +func (in *ClusterPodNetworkOptions) DeepCopy() *ClusterPodNetworkOptions { + if in == nil { + return nil + } + out := new(ClusterPodNetworkOptions) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DRG) DeepCopyInto(out *DRG) { *out = *in @@ -360,6 +445,21 @@ func (in *EgressSecurityRuleForNSG) DeepCopy() *EgressSecurityRuleForNSG { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointConfig) DeepCopyInto(out *EndpointConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointConfig. +func (in *EndpointConfig) DeepCopy() *EndpointConfig { + if in == nil { + return nil + } + out := new(EndpointConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IcmpOptions) DeepCopyInto(out *IcmpOptions) { *out = *in @@ -385,6 +485,33 @@ func (in *IcmpOptions) DeepCopy() *IcmpOptions { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImagePolicyConfig) DeepCopyInto(out *ImagePolicyConfig) { + *out = *in + if in.IsPolicyEnabled != nil { + in, out := &in.IsPolicyEnabled, &out.IsPolicyEnabled + *out = new(bool) + **out = **in + } + if in.KeyDetails != nil { + in, out := &in.KeyDetails, &out.KeyDetails + *out = make([]KeyDetails, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImagePolicyConfig. +func (in *ImagePolicyConfig) DeepCopy() *ImagePolicyConfig { + if in == nil { + return nil + } + out := new(ImagePolicyConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IngressSecurityRule) DeepCopyInto(out *IngressSecurityRule) { *out = *in @@ -641,6 +768,41 @@ func (in *IntelVmPlatformConfig) DeepCopy() *IntelVmPlatformConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeyDetails) DeepCopyInto(out *KeyDetails) { + *out = *in + if in.KmsKeyId != nil { + in, out := &in.KmsKeyId, &out.KmsKeyId + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyDetails. +func (in *KeyDetails) DeepCopy() *KeyDetails { + if in == nil { + return nil + } + out := new(KeyDetails) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubernetesNetworkConfig) DeepCopyInto(out *KubernetesNetworkConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesNetworkConfig. +func (in *KubernetesNetworkConfig) DeepCopy() *KubernetesNetworkConfig { + if in == nil { + return nil + } + out := new(KubernetesNetworkConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchInstanceAgentConfig) DeepCopyInto(out *LaunchInstanceAgentConfig) { *out = *in @@ -1498,6 +1660,455 @@ func (in *OCIMachineTemplateSpec) DeepCopy() *OCIMachineTemplateSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedCluster) DeepCopyInto(out *OCIManagedCluster) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedCluster. +func (in *OCIManagedCluster) DeepCopy() *OCIManagedCluster { + if in == nil { + return nil + } + out := new(OCIManagedCluster) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedCluster) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedClusterList) DeepCopyInto(out *OCIManagedClusterList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIManagedCluster, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterList. +func (in *OCIManagedClusterList) DeepCopy() *OCIManagedClusterList { + if in == nil { + return nil + } + out := new(OCIManagedClusterList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedClusterList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedClusterSpec) DeepCopyInto(out *OCIManagedClusterSpec) { + *out = *in + if in.IdentityRef != nil { + in, out := &in.IdentityRef, &out.IdentityRef + *out = new(v1.ObjectReference) + **out = **in + } + in.NetworkSpec.DeepCopyInto(&out.NetworkSpec) + if in.FreeformTags != nil { + in, out := &in.FreeformTags, &out.FreeformTags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.DefinedTags != nil { + in, out := &in.DefinedTags, &out.DefinedTags + *out = make(map[string]map[string]string, len(*in)) + for key, val := range *in { + var outVal map[string]string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + (*out)[key] = outVal + } + } + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterSpec. +func (in *OCIManagedClusterSpec) DeepCopy() *OCIManagedClusterSpec { + if in == nil { + return nil + } + out := new(OCIManagedClusterSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedClusterStatus) DeepCopyInto(out *OCIManagedClusterStatus) { + *out = *in + if in.FailureDomains != nil { + in, out := &in.FailureDomains, &out.FailureDomains + *out = make(apiv1beta1.FailureDomains, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.AvailabilityDomains != nil { + in, out := &in.AvailabilityDomains, &out.AvailabilityDomains + *out = make(map[string]OCIAvailabilityDomain, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1beta1.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterStatus. +func (in *OCIManagedClusterStatus) DeepCopy() *OCIManagedClusterStatus { + if in == nil { + return nil + } + out := new(OCIManagedClusterStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedClusterTemplate) DeepCopyInto(out *OCIManagedClusterTemplate) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterTemplate. +func (in *OCIManagedClusterTemplate) DeepCopy() *OCIManagedClusterTemplate { + if in == nil { + return nil + } + out := new(OCIManagedClusterTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedClusterTemplate) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedClusterTemplateList) DeepCopyInto(out *OCIManagedClusterTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIManagedClusterTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterTemplateList. +func (in *OCIManagedClusterTemplateList) DeepCopy() *OCIManagedClusterTemplateList { + if in == nil { + return nil + } + out := new(OCIManagedClusterTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedClusterTemplateList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedClusterTemplateResource) DeepCopyInto(out *OCIManagedClusterTemplateResource) { + *out = *in + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterTemplateResource. +func (in *OCIManagedClusterTemplateResource) DeepCopy() *OCIManagedClusterTemplateResource { + if in == nil { + return nil + } + out := new(OCIManagedClusterTemplateResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedClusterTemplateSpec) DeepCopyInto(out *OCIManagedClusterTemplateSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterTemplateSpec. +func (in *OCIManagedClusterTemplateSpec) DeepCopy() *OCIManagedClusterTemplateSpec { + if in == nil { + return nil + } + out := new(OCIManagedClusterTemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedControlPlane) DeepCopyInto(out *OCIManagedControlPlane) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlane. +func (in *OCIManagedControlPlane) DeepCopy() *OCIManagedControlPlane { + if in == nil { + return nil + } + out := new(OCIManagedControlPlane) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedControlPlane) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedControlPlaneList) DeepCopyInto(out *OCIManagedControlPlaneList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIManagedControlPlane, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneList. +func (in *OCIManagedControlPlaneList) DeepCopy() *OCIManagedControlPlaneList { + if in == nil { + return nil + } + out := new(OCIManagedControlPlaneList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedControlPlaneList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedControlPlaneSpec) DeepCopyInto(out *OCIManagedControlPlaneSpec) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.ClusterPodNetworkOptions != nil { + in, out := &in.ClusterPodNetworkOptions, &out.ClusterPodNetworkOptions + *out = make([]ClusterPodNetworkOptions, len(*in)) + copy(*out, *in) + } + if in.ImagePolicyConfig != nil { + in, out := &in.ImagePolicyConfig, &out.ImagePolicyConfig + *out = new(ImagePolicyConfig) + (*in).DeepCopyInto(*out) + } + in.ClusterOption.DeepCopyInto(&out.ClusterOption) + if in.KmsKeyId != nil { + in, out := &in.KmsKeyId, &out.KmsKeyId + *out = new(string) + **out = **in + } + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + if in.Version != nil { + in, out := &in.Version, &out.Version + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneSpec. +func (in *OCIManagedControlPlaneSpec) DeepCopy() *OCIManagedControlPlaneSpec { + if in == nil { + return nil + } + out := new(OCIManagedControlPlaneSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedControlPlaneStatus) DeepCopyInto(out *OCIManagedControlPlaneStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1beta1.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Version != nil { + in, out := &in.Version, &out.Version + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneStatus. +func (in *OCIManagedControlPlaneStatus) DeepCopy() *OCIManagedControlPlaneStatus { + if in == nil { + return nil + } + out := new(OCIManagedControlPlaneStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedControlPlaneTemplate) DeepCopyInto(out *OCIManagedControlPlaneTemplate) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneTemplate. +func (in *OCIManagedControlPlaneTemplate) DeepCopy() *OCIManagedControlPlaneTemplate { + if in == nil { + return nil + } + out := new(OCIManagedControlPlaneTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedControlPlaneTemplate) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedControlPlaneTemplateList) DeepCopyInto(out *OCIManagedControlPlaneTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIManagedControlPlaneTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneTemplateList. +func (in *OCIManagedControlPlaneTemplateList) DeepCopy() *OCIManagedControlPlaneTemplateList { + if in == nil { + return nil + } + out := new(OCIManagedControlPlaneTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedControlPlaneTemplateList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedControlPlaneTemplateResource) DeepCopyInto(out *OCIManagedControlPlaneTemplateResource) { + *out = *in + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneTemplateResource. +func (in *OCIManagedControlPlaneTemplateResource) DeepCopy() *OCIManagedControlPlaneTemplateResource { + if in == nil { + return nil + } + out := new(OCIManagedControlPlaneTemplateResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedControlPlaneTemplateSpec) DeepCopyInto(out *OCIManagedControlPlaneTemplateSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneTemplateSpec. +func (in *OCIManagedControlPlaneTemplateSpec) DeepCopy() *OCIManagedControlPlaneTemplateSpec { + if in == nil { + return nil + } + out := new(OCIManagedControlPlaneTemplateSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PeerRouteRule) DeepCopyInto(out *PeerRouteRule) { *out = *in diff --git a/api/v1beta2/conditions_consts.go b/api/v1beta2/conditions_consts.go index f3b79858..a152b598 100644 --- a/api/v1beta2/conditions_consts.go +++ b/api/v1beta2/conditions_consts.go @@ -101,4 +101,17 @@ const ( FailureDomainEventReady = "FailureDomainsReady" // NamespaceNotAllowedByIdentity used to indicate cluster in a namespace not allowed by identity. NamespaceNotAllowedByIdentity = "NamespaceNotAllowedByIdentity" + + // ControlPlaneReadyCondition Ready indicates the control plane is in a Running state. + ControlPlaneReadyCondition clusterv1.ConditionType = "ControlPlaneReady" + // ControlPlaneProvisionFailedReason used for failures during control plane provisioning. + ControlPlaneProvisionFailedReason = "ControlPlaneProvisionFailed" + // ControlPlaneNotReadyReason used when the control plane is in a pending state. + ControlPlaneNotReadyReason = "ControlPlaneNotReady" + // ControlPlaneDeletionInProgress Control Plane deletion is in progress state. + ControlPlaneDeletionInProgress = "ControlPlaneDeletionInProgress" + // ControlPlaneNotFoundReason used when the control plane couldn't be retrieved. + ControlPlaneNotFoundReason = "ControlPlaneNotFound" + // ControlPlaneDeletedReason used when the control plane has been deleted. + ControlPlaneDeletedReason = "ControlPlaneDeleted" ) diff --git a/api/v1beta2/constants.go b/api/v1beta2/constants.go index 958634f7..99deed06 100644 --- a/api/v1beta2/constants.go +++ b/api/v1beta2/constants.go @@ -28,4 +28,6 @@ const ( ControlPlaneDefaultName = "control-plane" WorkerDefaultName = "worker" ServiceLBDefaultName = "service-lb" + PodDefaultName = "pod" + PodDefaultCIDR = "10.0.128.0/18" ) diff --git a/api/v1beta2/conversion.go b/api/v1beta2/conversion.go index 9b562e76..3f6076d2 100644 --- a/api/v1beta2/conversion.go +++ b/api/v1beta2/conversion.go @@ -45,3 +45,18 @@ func (*OCIClusterIdentity) Hub() {} // Hub marks OCIClusterIdentityList as a conversion hub. func (*OCIClusterIdentityList) Hub() {} + +// Hub marks OCIManagedControlPlane as a conversion hub. +func (*OCIManagedControlPlane) Hub() {} + +// Hub marks OCIManagedCluster as a conversion hub. +func (*OCIManagedCluster) Hub() {} + +// Hub marks OCIManagedClusterTemplate as a conversion hub. +func (*OCIManagedClusterTemplate) Hub() {} + +// Hub marks OCIManagedClusterTemplateList as a conversion hub. +func (*OCIManagedClusterTemplateList) Hub() {} + +// Hub marks OCIManagedControlPlaneList as a conversion hub. +func (*OCIManagedControlPlaneList) Hub() {} diff --git a/exp/api/v1beta2/ocimanagedcluster_types.go b/api/v1beta2/ocimanagedcluster_types.go similarity index 92% rename from exp/api/v1beta2/ocimanagedcluster_types.go rename to api/v1beta2/ocimanagedcluster_types.go index b10f98ba..8df41c37 100644 --- a/exp/api/v1beta2/ocimanagedcluster_types.go +++ b/api/v1beta2/ocimanagedcluster_types.go @@ -17,7 +17,6 @@ limitations under the License. package v1beta2 import ( - infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" @@ -43,7 +42,7 @@ type OCIManagedClusterSpec struct { // NetworkSpec encapsulates all things related to OCI network. // +optional - NetworkSpec infrastructurev1beta2.NetworkSpec `json:"networkSpec,omitempty"` + NetworkSpec NetworkSpec `json:"networkSpec,omitempty"` // Free-form tags for this resource. // +optional @@ -70,13 +69,13 @@ type OCIManagedClusterSpec struct { // AvailabilityDomains encapsulates the clusters Availability Domain (AD) information in a map // where the map key is the AD name and the struct is details about the AD. // +optional - AvailabilityDomains map[string]infrastructurev1beta2.OCIAvailabilityDomain `json:"availabilityDomains,omitempty"` + AvailabilityDomains map[string]OCIAvailabilityDomain `json:"availabilityDomains,omitempty"` // ClientOverrides allows the default client SDK URLs to be changed. // // +optional // +nullable - ClientOverrides *infrastructurev1beta2.ClientOverrides `json:"hostUrl,omitempty"` + ClientOverrides *ClientOverrides `json:"hostUrl,omitempty"` } // OCIManagedClusterStatus defines the observed state of OCICluster diff --git a/exp/api/v1beta2/ocimanagedcluster_webhook.go b/api/v1beta2/ocimanagedcluster_webhook.go similarity index 52% rename from exp/api/v1beta2/ocimanagedcluster_webhook.go rename to api/v1beta2/ocimanagedcluster_webhook.go index 1441cd64..7980f81d 100644 --- a/exp/api/v1beta2/ocimanagedcluster_webhook.go +++ b/api/v1beta2/ocimanagedcluster_webhook.go @@ -20,7 +20,6 @@ import ( "fmt" "reflect" - infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/oci-go-sdk/v65/common" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" @@ -46,56 +45,56 @@ func (c *OCIManagedCluster) Default() { } if !c.Spec.NetworkSpec.SkipNetworkManagement { if len(c.Spec.NetworkSpec.Vcn.Subnets) == 0 { - subnets := make([]*infrastructurev1beta2.Subnet, 4) - subnets[0] = &infrastructurev1beta2.Subnet{ - Role: infrastructurev1beta2.ControlPlaneEndpointRole, - Name: infrastructurev1beta2.ControlPlaneEndpointDefaultName, - CIDR: infrastructurev1beta2.ControlPlaneEndpointSubnetDefaultCIDR, - Type: infrastructurev1beta2.Public, + subnets := make([]*Subnet, 4) + subnets[0] = &Subnet{ + Role: ControlPlaneEndpointRole, + Name: ControlPlaneEndpointDefaultName, + CIDR: ControlPlaneEndpointSubnetDefaultCIDR, + Type: Public, } - subnets[1] = &infrastructurev1beta2.Subnet{ - Role: infrastructurev1beta2.ServiceLoadBalancerRole, - Name: infrastructurev1beta2.ServiceLBDefaultName, - CIDR: infrastructurev1beta2.ServiceLoadBalancerDefaultCIDR, - Type: infrastructurev1beta2.Public, + subnets[1] = &Subnet{ + Role: ServiceLoadBalancerRole, + Name: ServiceLBDefaultName, + CIDR: ServiceLoadBalancerDefaultCIDR, + Type: Public, } - subnets[2] = &infrastructurev1beta2.Subnet{ - Role: infrastructurev1beta2.WorkerRole, - Name: infrastructurev1beta2.WorkerDefaultName, - CIDR: infrastructurev1beta2.WorkerSubnetDefaultCIDR, - Type: infrastructurev1beta2.Private, + subnets[2] = &Subnet{ + Role: WorkerRole, + Name: WorkerDefaultName, + CIDR: WorkerSubnetDefaultCIDR, + Type: Private, } - subnets[3] = &infrastructurev1beta2.Subnet{ - Role: infrastructurev1beta2.PodRole, + subnets[3] = &Subnet{ + Role: PodRole, Name: PodDefaultName, CIDR: PodDefaultCIDR, - Type: infrastructurev1beta2.Private, + Type: Private, } c.Spec.NetworkSpec.Vcn.Subnets = subnets } if len(c.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List) == 0 && !c.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.Skip { - nsgs := make([]*infrastructurev1beta2.NSG, 4) - nsgs[0] = &infrastructurev1beta2.NSG{ - Role: infrastructurev1beta2.ControlPlaneEndpointRole, - Name: infrastructurev1beta2.ControlPlaneEndpointDefaultName, + nsgs := make([]*NSG, 4) + nsgs[0] = &NSG{ + Role: ControlPlaneEndpointRole, + Name: ControlPlaneEndpointDefaultName, IngressRules: c.GetControlPlaneEndpointDefaultIngressRules(), EgressRules: c.GetControlPlaneEndpointDefaultEgressRules(), } - nsgs[1] = &infrastructurev1beta2.NSG{ - Role: infrastructurev1beta2.WorkerRole, - Name: infrastructurev1beta2.WorkerDefaultName, + nsgs[1] = &NSG{ + Role: WorkerRole, + Name: WorkerDefaultName, IngressRules: c.GetWorkerDefaultIngressRules(), EgressRules: c.GetWorkerDefaultEgressRules(), } - nsgs[2] = &infrastructurev1beta2.NSG{ - Role: infrastructurev1beta2.ServiceLoadBalancerRole, - Name: infrastructurev1beta2.ServiceLBDefaultName, + nsgs[2] = &NSG{ + Role: ServiceLoadBalancerRole, + Name: ServiceLBDefaultName, IngressRules: c.GetLBServiceDefaultIngressRules(), EgressRules: c.GetLBServiceDefaultEgressRules(), } - nsgs[3] = &infrastructurev1beta2.NSG{ - Role: infrastructurev1beta2.PodRole, + nsgs[3] = &NSG{ + Role: PodRole, Name: PodDefaultName, IngressRules: c.GetPodDefaultIngressRules(), EgressRules: c.GetPodDefaultEgressRules(), @@ -103,7 +102,7 @@ func (c *OCIManagedCluster) Default() { c.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List = nsgs } if c.Spec.NetworkSpec.Vcn.CIDR == "" { - c.Spec.NetworkSpec.Vcn.CIDR = infrastructurev1beta2.VcnDefaultCidr + c.Spec.NetworkSpec.Vcn.CIDR = VcnDefaultCidr } } } @@ -171,13 +170,13 @@ func (c *OCIManagedCluster) ValidateUpdate(old runtime.Object) error { func (c *OCIManagedCluster) validate(old *OCIManagedCluster) field.ErrorList { var allErrs field.ErrorList - var oldNetworkSpec infrastructurev1beta2.NetworkSpec + var oldNetworkSpec NetworkSpec if old != nil { oldNetworkSpec = old.Spec.NetworkSpec } - allErrs = append(allErrs, infrastructurev1beta2.ValidateNetworkSpec(infrastructurev1beta2.OCIManagedClusterSubnetRoles, c.Spec.NetworkSpec, oldNetworkSpec, field.NewPath("spec").Child("networkSpec"))...) - allErrs = append(allErrs, infrastructurev1beta2.ValidateClusterName(c.Name)...) + allErrs = append(allErrs, ValidateNetworkSpec(OCIManagedClusterSubnetRoles, c.Spec.NetworkSpec, oldNetworkSpec, field.NewPath("spec").Child("networkSpec"))...) + allErrs = append(allErrs, ValidateClusterName(c.Name)...) if len(c.Spec.CompartmentId) <= 0 { allErrs = append( @@ -187,7 +186,7 @@ func (c *OCIManagedCluster) validate(old *OCIManagedCluster) field.ErrorList { // Handle case where CompartmentId exists, but isn't valid // the separate "blank" check above is a more clear error for the user - if len(c.Spec.CompartmentId) > 0 && !infrastructurev1beta2.ValidOcid(c.Spec.CompartmentId) { + if len(c.Spec.CompartmentId) > 0 && !ValidOcid(c.Spec.CompartmentId) { allErrs = append( allErrs, field.Invalid(field.NewPath("spec", "compartmentId"), c.Spec.CompartmentId, "field is invalid")) @@ -199,13 +198,13 @@ func (c *OCIManagedCluster) validate(old *OCIManagedCluster) field.ErrorList { field.Invalid(field.NewPath("spec", "ociResourceIdentifier"), c.Spec.OCIResourceIdentifier, "field is required")) } - if !infrastructurev1beta2.ValidRegion(c.Spec.Region) { + if !ValidRegion(c.Spec.Region) { allErrs = append( allErrs, field.Invalid(field.NewPath("spec", "region"), c.Spec.Region, "field is invalid. See https://docs.oracle.com/en-us/iaas/Content/General/Concepts/regions.htm")) } - if !reflect.DeepEqual(c.Spec.NetworkSpec.APIServerLB, infrastructurev1beta2.LoadBalancer{}) { + if !reflect.DeepEqual(c.Spec.NetworkSpec.APIServerLB, LoadBalancer{}) { allErrs = append( allErrs, field.Invalid(field.NewPath("spec", "networkSpec", "apiServerLoadBalancer"), c.Spec.NetworkSpec.APIServerLB, "cannot set loadbalancer in managed cluster")) @@ -218,391 +217,391 @@ func (c *OCIManagedCluster) validate(old *OCIManagedCluster) field.ErrorList { return allErrs } -func (c *OCIManagedCluster) GetControlPlaneEndpointDefaultIngressRules() []infrastructurev1beta2.IngressSecurityRuleForNSG { - return []infrastructurev1beta2.IngressSecurityRuleForNSG{ +func (c *OCIManagedCluster) GetControlPlaneEndpointDefaultIngressRules() []IngressSecurityRuleForNSG { + return []IngressSecurityRuleForNSG{ { - IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ + IngressSecurityRule: IngressSecurityRule{ Description: common.String("Kubernetes worker to Kubernetes API endpoint communication."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta2.TcpOptions{ - DestinationPortRange: &infrastructurev1beta2.PortRange{ + TcpOptions: &TcpOptions{ + DestinationPortRange: &PortRange{ Max: common.Int(6443), Min: common.Int(6443), }, }, - SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, - Source: common.String(infrastructurev1beta2.WorkerSubnetDefaultCIDR), + SourceType: IngressSecurityRuleSourceTypeCidrBlock, + Source: common.String(WorkerSubnetDefaultCIDR), }, }, { - IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ + IngressSecurityRule: IngressSecurityRule{ Description: common.String("Kubernetes worker to Kubernetes API endpoint communication."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta2.TcpOptions{ - DestinationPortRange: &infrastructurev1beta2.PortRange{ + TcpOptions: &TcpOptions{ + DestinationPortRange: &PortRange{ Max: common.Int(12250), Min: common.Int(12250), }, }, - SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, - Source: common.String(infrastructurev1beta2.WorkerSubnetDefaultCIDR), + SourceType: IngressSecurityRuleSourceTypeCidrBlock, + Source: common.String(WorkerSubnetDefaultCIDR), }, }, { - IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ + IngressSecurityRule: IngressSecurityRule{ Description: common.String("Path Discovery."), Protocol: common.String("1"), - IcmpOptions: &infrastructurev1beta2.IcmpOptions{ + IcmpOptions: &IcmpOptions{ Type: common.Int(3), Code: common.Int(4), }, - SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, - Source: common.String(infrastructurev1beta2.WorkerSubnetDefaultCIDR), + SourceType: IngressSecurityRuleSourceTypeCidrBlock, + Source: common.String(WorkerSubnetDefaultCIDR), }, }, { - IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ + IngressSecurityRule: IngressSecurityRule{ Description: common.String("Pod to Kubernetes API endpoint communication (when using VCN-native pod networking)."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta2.TcpOptions{ - DestinationPortRange: &infrastructurev1beta2.PortRange{ + TcpOptions: &TcpOptions{ + DestinationPortRange: &PortRange{ Max: common.Int(6443), Min: common.Int(6443), }, }, - SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: IngressSecurityRuleSourceTypeCidrBlock, Source: common.String(PodDefaultCIDR), }, }, { - IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ + IngressSecurityRule: IngressSecurityRule{ Description: common.String("Pod to Kubernetes API endpoint communication (when using VCN-native pod networking)."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta2.TcpOptions{ - DestinationPortRange: &infrastructurev1beta2.PortRange{ + TcpOptions: &TcpOptions{ + DestinationPortRange: &PortRange{ Max: common.Int(12250), Min: common.Int(12250), }, }, - SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: IngressSecurityRuleSourceTypeCidrBlock, Source: common.String(PodDefaultCIDR), }, }, { - IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ + IngressSecurityRule: IngressSecurityRule{ Description: common.String("External access to Kubernetes API endpoint."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta2.TcpOptions{ - DestinationPortRange: &infrastructurev1beta2.PortRange{ + TcpOptions: &TcpOptions{ + DestinationPortRange: &PortRange{ Max: common.Int(6443), Min: common.Int(6443), }, }, - SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: IngressSecurityRuleSourceTypeCidrBlock, Source: common.String("0.0.0.0/0"), }, }, } } -func (c *OCIManagedCluster) GetControlPlaneEndpointDefaultEgressRules() []infrastructurev1beta2.EgressSecurityRuleForNSG { - return []infrastructurev1beta2.EgressSecurityRuleForNSG{ +func (c *OCIManagedCluster) GetControlPlaneEndpointDefaultEgressRules() []EgressSecurityRuleForNSG { + return []EgressSecurityRuleForNSG{ { - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + EgressSecurityRule: EgressSecurityRule{ Description: common.String("Allow Kubernetes API endpoint to communicate with OKE."), Protocol: common.String("6"), - DestinationType: infrastructurev1beta2.EgressSecurityRuleSourceTypeServiceCidrBlock, + DestinationType: EgressSecurityRuleSourceTypeServiceCidrBlock, }, }, { - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + EgressSecurityRule: EgressSecurityRule{ Description: common.String("Path Discovery."), Protocol: common.String("1"), - IcmpOptions: &infrastructurev1beta2.IcmpOptions{ + IcmpOptions: &IcmpOptions{ Type: common.Int(3), Code: common.Int(4), }, - DestinationType: infrastructurev1beta2.EgressSecurityRuleSourceTypeServiceCidrBlock, + DestinationType: EgressSecurityRuleSourceTypeServiceCidrBlock, }, }, { - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + EgressSecurityRule: EgressSecurityRule{ Description: common.String("Allow Kubernetes API endpoint to communicate with worker nodes."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta2.TcpOptions{ - DestinationPortRange: &infrastructurev1beta2.PortRange{ + TcpOptions: &TcpOptions{ + DestinationPortRange: &PortRange{ Max: common.Int(10250), Min: common.Int(10250), }, }, - DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, - Destination: common.String(infrastructurev1beta2.WorkerSubnetDefaultCIDR), + DestinationType: EgressSecurityRuleDestinationTypeCidrBlock, + Destination: common.String(WorkerSubnetDefaultCIDR), }, }, { - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + EgressSecurityRule: EgressSecurityRule{ Description: common.String("Path Discovery."), Protocol: common.String("1"), - IcmpOptions: &infrastructurev1beta2.IcmpOptions{ + IcmpOptions: &IcmpOptions{ Type: common.Int(3), Code: common.Int(4), }, - DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, - Destination: common.String(infrastructurev1beta2.WorkerSubnetDefaultCIDR), + DestinationType: EgressSecurityRuleDestinationTypeCidrBlock, + Destination: common.String(WorkerSubnetDefaultCIDR), }, }, { - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + EgressSecurityRule: EgressSecurityRule{ Description: common.String("Allow Kubernetes API endpoint to communicate with pods (when using VCN-native pod networking)."), Protocol: common.String("all"), - DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, + DestinationType: EgressSecurityRuleDestinationTypeCidrBlock, Destination: common.String(PodDefaultCIDR), }, }, } } -func (c *OCIManagedCluster) GetWorkerDefaultIngressRules() []infrastructurev1beta2.IngressSecurityRuleForNSG { - return []infrastructurev1beta2.IngressSecurityRuleForNSG{ +func (c *OCIManagedCluster) GetWorkerDefaultIngressRules() []IngressSecurityRuleForNSG { + return []IngressSecurityRuleForNSG{ { - IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ + IngressSecurityRule: IngressSecurityRule{ Description: common.String("Allow Kubernetes API endpoint to communicate with worker nodes."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta2.TcpOptions{ - DestinationPortRange: &infrastructurev1beta2.PortRange{ + TcpOptions: &TcpOptions{ + DestinationPortRange: &PortRange{ Max: common.Int(10250), Min: common.Int(10250), }, }, - SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, - Source: common.String(infrastructurev1beta2.ControlPlaneEndpointSubnetDefaultCIDR), + SourceType: IngressSecurityRuleSourceTypeCidrBlock, + Source: common.String(ControlPlaneEndpointSubnetDefaultCIDR), }, }, { - IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ + IngressSecurityRule: IngressSecurityRule{ Description: common.String("Path Discovery."), Protocol: common.String("1"), - IcmpOptions: &infrastructurev1beta2.IcmpOptions{ + IcmpOptions: &IcmpOptions{ Type: common.Int(3), Code: common.Int(4), }, - SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: IngressSecurityRuleSourceTypeCidrBlock, Source: common.String("0.0.0.0/0"), }, }, { - IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ + IngressSecurityRule: IngressSecurityRule{ Description: common.String("Load Balancer to Worker nodes node ports."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta2.TcpOptions{ - DestinationPortRange: &infrastructurev1beta2.PortRange{ + TcpOptions: &TcpOptions{ + DestinationPortRange: &PortRange{ Max: common.Int(32767), Min: common.Int(30000), }, }, - SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, - Source: common.String(infrastructurev1beta2.ServiceLoadBalancerDefaultCIDR), + SourceType: IngressSecurityRuleSourceTypeCidrBlock, + Source: common.String(ServiceLoadBalancerDefaultCIDR), }, }, } } -func (c *OCIManagedCluster) GetWorkerDefaultEgressRules() []infrastructurev1beta2.EgressSecurityRuleForNSG { - return []infrastructurev1beta2.EgressSecurityRuleForNSG{ +func (c *OCIManagedCluster) GetWorkerDefaultEgressRules() []EgressSecurityRuleForNSG { + return []EgressSecurityRuleForNSG{ { - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + EgressSecurityRule: EgressSecurityRule{ Description: common.String("Allow worker nodes to communicate with OKE."), Protocol: common.String("6"), - DestinationType: infrastructurev1beta2.EgressSecurityRuleSourceTypeServiceCidrBlock, + DestinationType: EgressSecurityRuleSourceTypeServiceCidrBlock, }, }, { - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + EgressSecurityRule: EgressSecurityRule{ Description: common.String("Allow worker nodes to access pods."), Protocol: common.String("all"), - DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, + DestinationType: EgressSecurityRuleDestinationTypeCidrBlock, Destination: common.String(PodDefaultCIDR), }, }, { - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + EgressSecurityRule: EgressSecurityRule{ Description: common.String("Path Discovery."), Protocol: common.String("1"), - IcmpOptions: &infrastructurev1beta2.IcmpOptions{ + IcmpOptions: &IcmpOptions{ Type: common.Int(3), Code: common.Int(4), }, - DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, + DestinationType: EgressSecurityRuleDestinationTypeCidrBlock, Destination: common.String("0.0.0.0/0"), }, }, { - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + EgressSecurityRule: EgressSecurityRule{ Description: common.String("Kubernetes worker to Kubernetes API endpoint communication."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta2.TcpOptions{ - DestinationPortRange: &infrastructurev1beta2.PortRange{ + TcpOptions: &TcpOptions{ + DestinationPortRange: &PortRange{ Max: common.Int(6443), Min: common.Int(6443), }, }, - DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, - Destination: common.String(infrastructurev1beta2.ControlPlaneEndpointSubnetDefaultCIDR), + DestinationType: EgressSecurityRuleDestinationTypeCidrBlock, + Destination: common.String(ControlPlaneEndpointSubnetDefaultCIDR), }, }, { - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + EgressSecurityRule: EgressSecurityRule{ Description: common.String("Kubernetes worker to Kubernetes API endpoint communication."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta2.TcpOptions{ - DestinationPortRange: &infrastructurev1beta2.PortRange{ + TcpOptions: &TcpOptions{ + DestinationPortRange: &PortRange{ Max: common.Int(12250), Min: common.Int(12250), }, }, - DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, - Destination: common.String(infrastructurev1beta2.ControlPlaneEndpointSubnetDefaultCIDR), + DestinationType: EgressSecurityRuleDestinationTypeCidrBlock, + Destination: common.String(ControlPlaneEndpointSubnetDefaultCIDR), }, }, } } -func (c *OCIManagedCluster) GetPodDefaultIngressRules() []infrastructurev1beta2.IngressSecurityRuleForNSG { - return []infrastructurev1beta2.IngressSecurityRuleForNSG{ +func (c *OCIManagedCluster) GetPodDefaultIngressRules() []IngressSecurityRuleForNSG { + return []IngressSecurityRuleForNSG{ { - IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ + IngressSecurityRule: IngressSecurityRule{ Description: common.String("Allow worker nodes to access pods."), Protocol: common.String("all"), - SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, - Source: common.String(infrastructurev1beta2.WorkerSubnetDefaultCIDR), + SourceType: IngressSecurityRuleSourceTypeCidrBlock, + Source: common.String(WorkerSubnetDefaultCIDR), }, }, { - IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ + IngressSecurityRule: IngressSecurityRule{ Description: common.String("Allow Kubernetes API endpoint to communicate with pods."), Protocol: common.String("all"), - SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, - Source: common.String(infrastructurev1beta2.ControlPlaneEndpointSubnetDefaultCIDR), + SourceType: IngressSecurityRuleSourceTypeCidrBlock, + Source: common.String(ControlPlaneEndpointSubnetDefaultCIDR), }, }, { - IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ + IngressSecurityRule: IngressSecurityRule{ Description: common.String("Allow pods to communicate with other pods."), Protocol: common.String("all"), - SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: IngressSecurityRuleSourceTypeCidrBlock, Source: common.String(PodDefaultCIDR), }, }, } } -func (c *OCIManagedCluster) GetPodDefaultEgressRules() []infrastructurev1beta2.EgressSecurityRuleForNSG { - return []infrastructurev1beta2.EgressSecurityRuleForNSG{ +func (c *OCIManagedCluster) GetPodDefaultEgressRules() []EgressSecurityRuleForNSG { + return []EgressSecurityRuleForNSG{ { - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + EgressSecurityRule: EgressSecurityRule{ Description: common.String("Allow worker nodes to communicate with OCI Services."), Protocol: common.String("6"), - DestinationType: infrastructurev1beta2.EgressSecurityRuleSourceTypeServiceCidrBlock, + DestinationType: EgressSecurityRuleSourceTypeServiceCidrBlock, }, }, { - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + EgressSecurityRule: EgressSecurityRule{ Description: common.String("Path Discovery."), Protocol: common.String("1"), - IcmpOptions: &infrastructurev1beta2.IcmpOptions{ + IcmpOptions: &IcmpOptions{ Type: common.Int(3), Code: common.Int(4), }, - DestinationType: infrastructurev1beta2.EgressSecurityRuleSourceTypeServiceCidrBlock, + DestinationType: EgressSecurityRuleSourceTypeServiceCidrBlock, }, }, { - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + EgressSecurityRule: EgressSecurityRule{ Description: common.String("Allow pods to communicate with other pods."), Protocol: common.String("all"), - DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, + DestinationType: EgressSecurityRuleDestinationTypeCidrBlock, Destination: common.String(PodDefaultCIDR), }, }, { - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + EgressSecurityRule: EgressSecurityRule{ Description: common.String("Pod to Kubernetes API endpoint communication (when using VCN-native pod networking)."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta2.TcpOptions{ - DestinationPortRange: &infrastructurev1beta2.PortRange{ + TcpOptions: &TcpOptions{ + DestinationPortRange: &PortRange{ Max: common.Int(6443), Min: common.Int(6443), }, }, - DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, - Destination: common.String(infrastructurev1beta2.ControlPlaneEndpointSubnetDefaultCIDR), + DestinationType: EgressSecurityRuleDestinationTypeCidrBlock, + Destination: common.String(ControlPlaneEndpointSubnetDefaultCIDR), }, }, { - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + EgressSecurityRule: EgressSecurityRule{ Description: common.String("Pod to Kubernetes API endpoint communication (when using VCN-native pod networking)."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta2.TcpOptions{ - DestinationPortRange: &infrastructurev1beta2.PortRange{ + TcpOptions: &TcpOptions{ + DestinationPortRange: &PortRange{ Max: common.Int(12250), Min: common.Int(12250), }, }, - DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, - Destination: common.String(infrastructurev1beta2.ControlPlaneEndpointSubnetDefaultCIDR), + DestinationType: EgressSecurityRuleDestinationTypeCidrBlock, + Destination: common.String(ControlPlaneEndpointSubnetDefaultCIDR), }, }, } } -func (c *OCIManagedCluster) GetLBServiceDefaultIngressRules() []infrastructurev1beta2.IngressSecurityRuleForNSG { - return []infrastructurev1beta2.IngressSecurityRuleForNSG{ +func (c *OCIManagedCluster) GetLBServiceDefaultIngressRules() []IngressSecurityRuleForNSG { + return []IngressSecurityRuleForNSG{ { - IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ + IngressSecurityRule: IngressSecurityRule{ Description: common.String("Accept http traffic on port 80"), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta2.TcpOptions{ - DestinationPortRange: &infrastructurev1beta2.PortRange{ + TcpOptions: &TcpOptions{ + DestinationPortRange: &PortRange{ Max: common.Int(80), Min: common.Int(80), }, }, - SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: IngressSecurityRuleSourceTypeCidrBlock, Source: common.String("0.0.0.0/0"), }, }, { - IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ + IngressSecurityRule: IngressSecurityRule{ Description: common.String("Accept https traffic on port 443"), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta2.TcpOptions{ - DestinationPortRange: &infrastructurev1beta2.PortRange{ + TcpOptions: &TcpOptions{ + DestinationPortRange: &PortRange{ Max: common.Int(443), Min: common.Int(443), }, }, - SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: IngressSecurityRuleSourceTypeCidrBlock, Source: common.String("0.0.0.0/0"), }, }, } } -func (c *OCIManagedCluster) GetLBServiceDefaultEgressRules() []infrastructurev1beta2.EgressSecurityRuleForNSG { +func (c *OCIManagedCluster) GetLBServiceDefaultEgressRules() []EgressSecurityRuleForNSG { // TODO add service gateway rules - return []infrastructurev1beta2.EgressSecurityRuleForNSG{ + return []EgressSecurityRuleForNSG{ { - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + EgressSecurityRule: EgressSecurityRule{ Description: common.String("Load Balancer to Worker nodes node ports."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta2.TcpOptions{ - DestinationPortRange: &infrastructurev1beta2.PortRange{ + TcpOptions: &TcpOptions{ + DestinationPortRange: &PortRange{ Max: common.Int(32767), Min: common.Int(30000), }, }, - DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, - Destination: common.String(infrastructurev1beta2.WorkerSubnetDefaultCIDR), + DestinationType: EgressSecurityRuleDestinationTypeCidrBlock, + Destination: common.String(WorkerSubnetDefaultCIDR), }, }, } diff --git a/exp/api/v1beta2/ocimanagedcluster_webhook_test.go b/api/v1beta2/ocimanagedcluster_webhook_test.go similarity index 71% rename from exp/api/v1beta2/ocimanagedcluster_webhook_test.go rename to api/v1beta2/ocimanagedcluster_webhook_test.go index 4399dab7..35dfbaea 100644 --- a/exp/api/v1beta2/ocimanagedcluster_webhook_test.go +++ b/api/v1beta2/ocimanagedcluster_webhook_test.go @@ -25,56 +25,55 @@ import ( "github.com/onsi/gomega" . "github.com/onsi/gomega" - infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/oci-go-sdk/v65/common" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) func TestOCIManagedCluster_ValidateCreate(t *testing.T) { - goodSubnets := []*infrastructurev1beta2.Subnet{ - &infrastructurev1beta2.Subnet{ - Role: infrastructurev1beta2.ControlPlaneEndpointRole, + goodSubnets := []*Subnet{ + &Subnet{ + Role: ControlPlaneEndpointRole, Name: "test-subnet", CIDR: "10.0.0.0/16", }, } - badSubnetCidr := []*infrastructurev1beta2.Subnet{ - &infrastructurev1beta2.Subnet{ + badSubnetCidr := []*Subnet{ + &Subnet{ Name: "test-subnet", CIDR: "10.1.0.0/16", }, } - emptySubnetCidr := []*infrastructurev1beta2.Subnet{ - &infrastructurev1beta2.Subnet{ - Role: infrastructurev1beta2.ControlPlaneEndpointRole, + emptySubnetCidr := []*Subnet{ + &Subnet{ + Role: ControlPlaneEndpointRole, Name: "test-subnet", }, } - badSubnetCidrFormat := []*infrastructurev1beta2.Subnet{ - &infrastructurev1beta2.Subnet{ + badSubnetCidrFormat := []*Subnet{ + &Subnet{ Name: "test-subnet", CIDR: "no-a-cidr", }, } - dupSubnetNames := []*infrastructurev1beta2.Subnet{ - &infrastructurev1beta2.Subnet{ + dupSubnetNames := []*Subnet{ + &Subnet{ Name: "dup-name", CIDR: "10.0.0.0/16", }, - &infrastructurev1beta2.Subnet{ + &Subnet{ Name: "dup-name", CIDR: "10.0.0.0/16", }, } - emptySubnetName := []*infrastructurev1beta2.Subnet{ - &infrastructurev1beta2.Subnet{ + emptySubnetName := []*Subnet{ + &Subnet{ Name: "", CIDR: "10.0.0.0/16", - Role: infrastructurev1beta2.ControlPlaneEndpointRole, + Role: ControlPlaneEndpointRole, }, } - badSubnetRole := []*infrastructurev1beta2.Subnet{ - &infrastructurev1beta2.Subnet{ + badSubnetRole := []*Subnet{ + &Subnet{ Role: "not-control-plane", }, } @@ -132,8 +131,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ CIDR: "not-a-cidr", }, }, @@ -162,8 +161,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ CIDR: "10.0.0.0/16", Subnets: badSubnetCidr, }, @@ -182,8 +181,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Spec: OCIManagedClusterSpec{ CompartmentId: "ocid", OCIResourceIdentifier: "uuid", - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ CIDR: "10.0.0.0/16", Subnets: emptySubnetCidr, }, @@ -199,8 +198,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ CIDR: "10.0.0.0/16", Subnets: badSubnetCidrFormat, }, @@ -217,8 +216,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ CIDR: "10.0.0.0/16", Subnets: dupSubnetNames, }, @@ -235,8 +234,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ CIDR: "10.0.0.0/16", Subnets: badSubnetRole, }, @@ -253,12 +252,12 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ CIDR: "10.0.0.0/16", - Subnets: []*infrastructurev1beta2.Subnet{ - &infrastructurev1beta2.Subnet{ - Role: infrastructurev1beta2.ControlPlaneRole, + Subnets: []*Subnet{ + &Subnet{ + Role: ControlPlaneRole, }, }, }, @@ -277,8 +276,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Spec: OCIManagedClusterSpec{ CompartmentId: "ocid", OCIResourceIdentifier: "uuid", - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ CIDR: "10.0.0.0/16", Subnets: emptySubnetName, }, @@ -294,14 +293,14 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ - NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ - List: []*infrastructurev1beta2.NSG{{ - EgressRules: []infrastructurev1beta2.EgressSecurityRuleForNSG{{ - EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ + NetworkSecurityGroup: NetworkSecurityGroup{ + List: []*NSG{{ + EgressRules: []EgressSecurityRuleForNSG{{ + EgressSecurityRule: EgressSecurityRule{ Destination: common.String("bad/15"), - DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, + DestinationType: EgressSecurityRuleDestinationTypeCidrBlock, }, }}, }}, @@ -320,14 +319,14 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ - NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ - List: []*infrastructurev1beta2.NSG{{ - IngressRules: []infrastructurev1beta2.IngressSecurityRuleForNSG{{ - IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ + NetworkSecurityGroup: NetworkSecurityGroup{ + List: []*NSG{{ + IngressRules: []IngressSecurityRuleForNSG{{ + IngressSecurityRule: IngressSecurityRule{ Source: common.String("bad/15"), - SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: IngressSecurityRuleSourceTypeCidrBlock, }, }}, }}, @@ -346,10 +345,10 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ - NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ - List: []*infrastructurev1beta2.NSG{{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ + NetworkSecurityGroup: NetworkSecurityGroup{ + List: []*NSG{{ Role: "bad-role", }}, }, @@ -367,11 +366,11 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ - NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ - List: []*infrastructurev1beta2.NSG{{ - Role: infrastructurev1beta2.ControlPlaneRole, + NetworkSpec: NetworkSpec{ + Vcn: VCN{ + NetworkSecurityGroup: NetworkSecurityGroup{ + List: []*NSG{{ + Role: ControlPlaneRole, }}, }, }, @@ -391,8 +390,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Region: "", CompartmentId: "ocid", OCIResourceIdentifier: "uuid", - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ CIDR: "10.0.0.0/16", Subnets: goodSubnets, }, @@ -409,8 +408,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { }, Spec: OCIManagedClusterSpec{ CompartmentId: "ocid", - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - APIServerLB: infrastructurev1beta2.LoadBalancer{ + NetworkSpec: NetworkSpec{ + APIServerLB: LoadBalancer{ Name: "test", }, }, @@ -429,8 +428,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Region: "us-lexington-1", CompartmentId: "ocid", OCIResourceIdentifier: "uuid", - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ CIDR: "10.0.0.0/16", Subnets: goodSubnets, }, @@ -448,8 +447,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Spec: OCIManagedClusterSpec{ CompartmentId: "ocid", OCIResourceIdentifier: "uuid", - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ CIDR: "10.0.0.0/16", Subnets: emptySubnetName, }, @@ -476,9 +475,9 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { } func TestOCIManagedCluster_ValidateUpdate(t *testing.T) { - goodSubnets := []*infrastructurev1beta2.Subnet{ - &infrastructurev1beta2.Subnet{ - Role: infrastructurev1beta2.ControlPlaneEndpointRole, + goodSubnets := []*Subnet{ + &Subnet{ + Role: ControlPlaneEndpointRole, Name: "test-subnet", CIDR: "10.0.0.0/16", }, @@ -555,8 +554,8 @@ func TestOCIManagedCluster_ValidateUpdate(t *testing.T) { CompartmentId: "ocid", Region: "old-region", OCIResourceIdentifier: "uuid", - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ CIDR: "10.0.0.0/16", Subnets: goodSubnets, }, @@ -571,8 +570,8 @@ func TestOCIManagedCluster_ValidateUpdate(t *testing.T) { Region: "old-region", CompartmentId: "ocid", OCIResourceIdentifier: "uuid", - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ CIDR: "10.0.0.0/16", Subnets: goodSubnets, }, @@ -626,31 +625,31 @@ func TestOCIManagedCluster_CreateDefault(t *testing.T) { }, }, expect: func(g *gomega.WithT, c *OCIManagedCluster) { - subnets := make([]*infrastructurev1beta2.Subnet, 0) - subnets = append(subnets, &infrastructurev1beta2.Subnet{ - Role: infrastructurev1beta2.ControlPlaneEndpointRole, - Name: infrastructurev1beta2.ControlPlaneEndpointDefaultName, - CIDR: infrastructurev1beta2.ControlPlaneEndpointSubnetDefaultCIDR, - Type: infrastructurev1beta2.Public, + subnets := make([]*Subnet, 0) + subnets = append(subnets, &Subnet{ + Role: ControlPlaneEndpointRole, + Name: ControlPlaneEndpointDefaultName, + CIDR: ControlPlaneEndpointSubnetDefaultCIDR, + Type: Public, }) - subnets = append(subnets, &infrastructurev1beta2.Subnet{ - Role: infrastructurev1beta2.ServiceLoadBalancerRole, - Name: infrastructurev1beta2.ServiceLBDefaultName, - CIDR: infrastructurev1beta2.ServiceLoadBalancerDefaultCIDR, - Type: infrastructurev1beta2.Public, + subnets = append(subnets, &Subnet{ + Role: ServiceLoadBalancerRole, + Name: ServiceLBDefaultName, + CIDR: ServiceLoadBalancerDefaultCIDR, + Type: Public, }) - subnets = append(subnets, &infrastructurev1beta2.Subnet{ - Role: infrastructurev1beta2.WorkerRole, - Name: infrastructurev1beta2.WorkerDefaultName, - CIDR: infrastructurev1beta2.WorkerSubnetDefaultCIDR, - Type: infrastructurev1beta2.Private, + subnets = append(subnets, &Subnet{ + Role: WorkerRole, + Name: WorkerDefaultName, + CIDR: WorkerSubnetDefaultCIDR, + Type: Private, }) - subnets = append(subnets, &infrastructurev1beta2.Subnet{ - Role: infrastructurev1beta2.PodRole, + subnets = append(subnets, &Subnet{ + Role: PodRole, Name: PodDefaultName, CIDR: PodDefaultCIDR, - Type: infrastructurev1beta2.Private, + Type: Private, }) g.Expect(c.Spec.NetworkSpec.Vcn.Subnets).To(Equal(subnets)) }, @@ -664,27 +663,27 @@ func TestOCIManagedCluster_CreateDefault(t *testing.T) { }, }, expect: func(g *gomega.WithT, c *OCIManagedCluster) { - nsgs := make([]*infrastructurev1beta2.NSG, 4) - nsgs[0] = &infrastructurev1beta2.NSG{ - Role: infrastructurev1beta2.ControlPlaneEndpointRole, - Name: infrastructurev1beta2.ControlPlaneEndpointDefaultName, + nsgs := make([]*NSG, 4) + nsgs[0] = &NSG{ + Role: ControlPlaneEndpointRole, + Name: ControlPlaneEndpointDefaultName, IngressRules: c.GetControlPlaneEndpointDefaultIngressRules(), EgressRules: c.GetControlPlaneEndpointDefaultEgressRules(), } - nsgs[1] = &infrastructurev1beta2.NSG{ - Role: infrastructurev1beta2.WorkerRole, - Name: infrastructurev1beta2.WorkerDefaultName, + nsgs[1] = &NSG{ + Role: WorkerRole, + Name: WorkerDefaultName, IngressRules: c.GetWorkerDefaultIngressRules(), EgressRules: c.GetWorkerDefaultEgressRules(), } - nsgs[2] = &infrastructurev1beta2.NSG{ - Role: infrastructurev1beta2.ServiceLoadBalancerRole, - Name: infrastructurev1beta2.ServiceLBDefaultName, + nsgs[2] = &NSG{ + Role: ServiceLoadBalancerRole, + Name: ServiceLBDefaultName, IngressRules: c.GetLBServiceDefaultIngressRules(), EgressRules: c.GetLBServiceDefaultEgressRules(), } - nsgs[3] = &infrastructurev1beta2.NSG{ - Role: infrastructurev1beta2.PodRole, + nsgs[3] = &NSG{ + Role: PodRole, Name: PodDefaultName, IngressRules: c.GetPodDefaultIngressRules(), EgressRules: c.GetPodDefaultEgressRules(), @@ -698,9 +697,9 @@ func TestOCIManagedCluster_CreateDefault(t *testing.T) { ObjectMeta: metav1.ObjectMeta{}, Spec: OCIManagedClusterSpec{ CompartmentId: "ocid", - NetworkSpec: infrastructurev1beta2.NetworkSpec{ - Vcn: infrastructurev1beta2.VCN{ - NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + NetworkSpec: NetworkSpec{ + Vcn: VCN{ + NetworkSecurityGroup: NetworkSecurityGroup{ Skip: true, }, }, diff --git a/exp/api/v1beta2/ocimanagedclustertemplate_types.go b/api/v1beta2/ocimanagedclustertemplate_types.go similarity index 100% rename from exp/api/v1beta2/ocimanagedclustertemplate_types.go rename to api/v1beta2/ocimanagedclustertemplate_types.go diff --git a/exp/api/v1beta2/ocimanagedcontrolplane_types.go b/api/v1beta2/ocimanagedcontrolplane_types.go similarity index 100% rename from exp/api/v1beta2/ocimanagedcontrolplane_types.go rename to api/v1beta2/ocimanagedcontrolplane_types.go diff --git a/exp/api/v1beta2/ocimanagedcontrolplane_webhook.go b/api/v1beta2/ocimanagedcontrolplane_webhook.go similarity index 100% rename from exp/api/v1beta2/ocimanagedcontrolplane_webhook.go rename to api/v1beta2/ocimanagedcontrolplane_webhook.go diff --git a/exp/api/v1beta2/ocimanagedcontrolplane_webhook_test.go b/api/v1beta2/ocimanagedcontrolplane_webhook_test.go similarity index 100% rename from exp/api/v1beta2/ocimanagedcontrolplane_webhook_test.go rename to api/v1beta2/ocimanagedcontrolplane_webhook_test.go diff --git a/exp/api/v1beta2/ocimanagedcontrolplanetemplate_types.go b/api/v1beta2/ocimanagedcontrolplanetemplate_types.go similarity index 100% rename from exp/api/v1beta2/ocimanagedcontrolplanetemplate_types.go rename to api/v1beta2/ocimanagedcontrolplanetemplate_types.go diff --git a/api/v1beta2/types.go b/api/v1beta2/types.go index 202280b6..38bcfae4 100644 --- a/api/v1beta2/types.go +++ b/api/v1beta2/types.go @@ -1087,3 +1087,10 @@ type NetworkSecurityGroup struct { // +listMapKey=name List []*NSG `json:"list,omitempty"` } + +const ( + VCNNativeCNI CNIOptionEnum = "OCI_VCN_IP_NATIVE" + FlannelCNI CNIOptionEnum = "FLANNEL_OVERLAY" +) + +type CNIOptionEnum string diff --git a/api/v1beta2/zz_generated.deepcopy.go b/api/v1beta2/zz_generated.deepcopy.go index bcf10632..31b53c5c 100644 --- a/api/v1beta2/zz_generated.deepcopy.go +++ b/api/v1beta2/zz_generated.deepcopy.go @@ -29,6 +29,168 @@ import ( "sigs.k8s.io/cluster-api/errors" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AddOnOptions) DeepCopyInto(out *AddOnOptions) { + *out = *in + if in.IsKubernetesDashboardEnabled != nil { + in, out := &in.IsKubernetesDashboardEnabled, &out.IsKubernetesDashboardEnabled + *out = new(bool) + **out = **in + } + if in.IsTillerEnabled != nil { + in, out := &in.IsTillerEnabled, &out.IsTillerEnabled + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddOnOptions. +func (in *AddOnOptions) DeepCopy() *AddOnOptions { + if in == nil { + return nil + } + out := new(AddOnOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Addon) DeepCopyInto(out *Addon) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Version != nil { + in, out := &in.Version, &out.Version + *out = new(string) + **out = **in + } + if in.Configurations != nil { + in, out := &in.Configurations, &out.Configurations + *out = make([]AddonConfiguration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Addon. +func (in *Addon) DeepCopy() *Addon { + if in == nil { + return nil + } + out := new(Addon) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AddonConfiguration) DeepCopyInto(out *AddonConfiguration) { + *out = *in + if in.Key != nil { + in, out := &in.Key, &out.Key + *out = new(string) + **out = **in + } + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonConfiguration. +func (in *AddonConfiguration) DeepCopy() *AddonConfiguration { + if in == nil { + return nil + } + out := new(AddonConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AddonError) DeepCopyInto(out *AddonError) { + *out = *in + if in.Code != nil { + in, out := &in.Code, &out.Code + *out = new(string) + **out = **in + } + if in.Message != nil { + in, out := &in.Message, &out.Message + *out = new(string) + **out = **in + } + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonError. +func (in *AddonError) DeepCopy() *AddonError { + if in == nil { + return nil + } + out := new(AddonError) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AddonStatus) DeepCopyInto(out *AddonStatus) { + *out = *in + if in.CurrentlyInstalledVersion != nil { + in, out := &in.CurrentlyInstalledVersion, &out.CurrentlyInstalledVersion + *out = new(string) + **out = **in + } + if in.AddonError != nil { + in, out := &in.AddonError, &out.AddonError + *out = new(AddonError) + (*in).DeepCopyInto(*out) + } + if in.LifecycleState != nil { + in, out := &in.LifecycleState, &out.LifecycleState + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonStatus. +func (in *AddonStatus) DeepCopy() *AddonStatus { + if in == nil { + return nil + } + out := new(AddonStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AdmissionControllerOptions) DeepCopyInto(out *AdmissionControllerOptions) { + *out = *in + if in.IsPodSecurityPolicyEnabled != nil { + in, out := &in.IsPodSecurityPolicyEnabled, &out.IsPodSecurityPolicyEnabled + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionControllerOptions. +func (in *AdmissionControllerOptions) DeepCopy() *AdmissionControllerOptions { + if in == nil { + return nil + } + out := new(AdmissionControllerOptions) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AllowedNamespaces) DeepCopyInto(out *AllowedNamespaces) { *out = *in @@ -319,6 +481,46 @@ func (in *ClientOverrides) DeepCopy() *ClientOverrides { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterOptions) DeepCopyInto(out *ClusterOptions) { + *out = *in + if in.AddOnOptions != nil { + in, out := &in.AddOnOptions, &out.AddOnOptions + *out = new(AddOnOptions) + (*in).DeepCopyInto(*out) + } + if in.AdmissionControllerOptions != nil { + in, out := &in.AdmissionControllerOptions, &out.AdmissionControllerOptions + *out = new(AdmissionControllerOptions) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterOptions. +func (in *ClusterOptions) DeepCopy() *ClusterOptions { + if in == nil { + return nil + } + out := new(ClusterOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterPodNetworkOptions) DeepCopyInto(out *ClusterPodNetworkOptions) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterPodNetworkOptions. +func (in *ClusterPodNetworkOptions) DeepCopy() *ClusterPodNetworkOptions { + if in == nil { + return nil + } + out := new(ClusterPodNetworkOptions) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DRG) DeepCopyInto(out *DRG) { *out = *in @@ -410,6 +612,21 @@ func (in *EgressSecurityRuleForNSG) DeepCopy() *EgressSecurityRuleForNSG { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointConfig) DeepCopyInto(out *EndpointConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointConfig. +func (in *EndpointConfig) DeepCopy() *EndpointConfig { + if in == nil { + return nil + } + out := new(EndpointConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IcmpOptions) DeepCopyInto(out *IcmpOptions) { *out = *in @@ -435,6 +652,33 @@ func (in *IcmpOptions) DeepCopy() *IcmpOptions { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImagePolicyConfig) DeepCopyInto(out *ImagePolicyConfig) { + *out = *in + if in.IsPolicyEnabled != nil { + in, out := &in.IsPolicyEnabled, &out.IsPolicyEnabled + *out = new(bool) + **out = **in + } + if in.KeyDetails != nil { + in, out := &in.KeyDetails, &out.KeyDetails + *out = make([]KeyDetails, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImagePolicyConfig. +func (in *ImagePolicyConfig) DeepCopy() *ImagePolicyConfig { + if in == nil { + return nil + } + out := new(ImagePolicyConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IngressSecurityRule) DeepCopyInto(out *IngressSecurityRule) { *out = *in @@ -706,6 +950,41 @@ func (in *InternetGateway) DeepCopy() *InternetGateway { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeyDetails) DeepCopyInto(out *KeyDetails) { + *out = *in + if in.KmsKeyId != nil { + in, out := &in.KmsKeyId, &out.KmsKeyId + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyDetails. +func (in *KeyDetails) DeepCopy() *KeyDetails { + if in == nil { + return nil + } + out := new(KeyDetails) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubernetesNetworkConfig) DeepCopyInto(out *KubernetesNetworkConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesNetworkConfig. +func (in *KubernetesNetworkConfig) DeepCopy() *KubernetesNetworkConfig { + if in == nil { + return nil + } + out := new(KubernetesNetworkConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchInstanceAgentConfig) DeepCopyInto(out *LaunchInstanceAgentConfig) { *out = *in @@ -1614,6 +1893,474 @@ func (in *OCIMachineTemplateSpec) DeepCopy() *OCIMachineTemplateSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedCluster) DeepCopyInto(out *OCIManagedCluster) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedCluster. +func (in *OCIManagedCluster) DeepCopy() *OCIManagedCluster { + if in == nil { + return nil + } + out := new(OCIManagedCluster) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedCluster) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedClusterList) DeepCopyInto(out *OCIManagedClusterList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIManagedCluster, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterList. +func (in *OCIManagedClusterList) DeepCopy() *OCIManagedClusterList { + if in == nil { + return nil + } + out := new(OCIManagedClusterList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedClusterList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedClusterSpec) DeepCopyInto(out *OCIManagedClusterSpec) { + *out = *in + if in.IdentityRef != nil { + in, out := &in.IdentityRef, &out.IdentityRef + *out = new(v1.ObjectReference) + **out = **in + } + in.NetworkSpec.DeepCopyInto(&out.NetworkSpec) + if in.FreeformTags != nil { + in, out := &in.FreeformTags, &out.FreeformTags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.DefinedTags != nil { + in, out := &in.DefinedTags, &out.DefinedTags + *out = make(map[string]map[string]string, len(*in)) + for key, val := range *in { + var outVal map[string]string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + (*out)[key] = outVal + } + } + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + if in.AvailabilityDomains != nil { + in, out := &in.AvailabilityDomains, &out.AvailabilityDomains + *out = make(map[string]OCIAvailabilityDomain, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.ClientOverrides != nil { + in, out := &in.ClientOverrides, &out.ClientOverrides + *out = new(ClientOverrides) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterSpec. +func (in *OCIManagedClusterSpec) DeepCopy() *OCIManagedClusterSpec { + if in == nil { + return nil + } + out := new(OCIManagedClusterSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedClusterStatus) DeepCopyInto(out *OCIManagedClusterStatus) { + *out = *in + if in.FailureDomains != nil { + in, out := &in.FailureDomains, &out.FailureDomains + *out = make(v1beta1.FailureDomains, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(v1beta1.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterStatus. +func (in *OCIManagedClusterStatus) DeepCopy() *OCIManagedClusterStatus { + if in == nil { + return nil + } + out := new(OCIManagedClusterStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedClusterTemplate) DeepCopyInto(out *OCIManagedClusterTemplate) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterTemplate. +func (in *OCIManagedClusterTemplate) DeepCopy() *OCIManagedClusterTemplate { + if in == nil { + return nil + } + out := new(OCIManagedClusterTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedClusterTemplate) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedClusterTemplateList) DeepCopyInto(out *OCIManagedClusterTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIManagedClusterTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterTemplateList. +func (in *OCIManagedClusterTemplateList) DeepCopy() *OCIManagedClusterTemplateList { + if in == nil { + return nil + } + out := new(OCIManagedClusterTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedClusterTemplateList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedClusterTemplateResource) DeepCopyInto(out *OCIManagedClusterTemplateResource) { + *out = *in + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterTemplateResource. +func (in *OCIManagedClusterTemplateResource) DeepCopy() *OCIManagedClusterTemplateResource { + if in == nil { + return nil + } + out := new(OCIManagedClusterTemplateResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedClusterTemplateSpec) DeepCopyInto(out *OCIManagedClusterTemplateSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterTemplateSpec. +func (in *OCIManagedClusterTemplateSpec) DeepCopy() *OCIManagedClusterTemplateSpec { + if in == nil { + return nil + } + out := new(OCIManagedClusterTemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedControlPlane) DeepCopyInto(out *OCIManagedControlPlane) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlane. +func (in *OCIManagedControlPlane) DeepCopy() *OCIManagedControlPlane { + if in == nil { + return nil + } + out := new(OCIManagedControlPlane) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedControlPlane) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedControlPlaneList) DeepCopyInto(out *OCIManagedControlPlaneList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIManagedControlPlane, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneList. +func (in *OCIManagedControlPlaneList) DeepCopy() *OCIManagedControlPlaneList { + if in == nil { + return nil + } + out := new(OCIManagedControlPlaneList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedControlPlaneList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedControlPlaneSpec) DeepCopyInto(out *OCIManagedControlPlaneSpec) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.ClusterPodNetworkOptions != nil { + in, out := &in.ClusterPodNetworkOptions, &out.ClusterPodNetworkOptions + *out = make([]ClusterPodNetworkOptions, len(*in)) + copy(*out, *in) + } + if in.ImagePolicyConfig != nil { + in, out := &in.ImagePolicyConfig, &out.ImagePolicyConfig + *out = new(ImagePolicyConfig) + (*in).DeepCopyInto(*out) + } + in.ClusterOption.DeepCopyInto(&out.ClusterOption) + if in.KmsKeyId != nil { + in, out := &in.KmsKeyId, &out.KmsKeyId + *out = new(string) + **out = **in + } + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + if in.Addons != nil { + in, out := &in.Addons, &out.Addons + *out = make([]Addon, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Version != nil { + in, out := &in.Version, &out.Version + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneSpec. +func (in *OCIManagedControlPlaneSpec) DeepCopy() *OCIManagedControlPlaneSpec { + if in == nil { + return nil + } + out := new(OCIManagedControlPlaneSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedControlPlaneStatus) DeepCopyInto(out *OCIManagedControlPlaneStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(v1beta1.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Version != nil { + in, out := &in.Version, &out.Version + *out = new(string) + **out = **in + } + if in.AddonStatus != nil { + in, out := &in.AddonStatus, &out.AddonStatus + *out = make(map[string]AddonStatus, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneStatus. +func (in *OCIManagedControlPlaneStatus) DeepCopy() *OCIManagedControlPlaneStatus { + if in == nil { + return nil + } + out := new(OCIManagedControlPlaneStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedControlPlaneTemplate) DeepCopyInto(out *OCIManagedControlPlaneTemplate) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneTemplate. +func (in *OCIManagedControlPlaneTemplate) DeepCopy() *OCIManagedControlPlaneTemplate { + if in == nil { + return nil + } + out := new(OCIManagedControlPlaneTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedControlPlaneTemplate) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedControlPlaneTemplateList) DeepCopyInto(out *OCIManagedControlPlaneTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIManagedControlPlaneTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneTemplateList. +func (in *OCIManagedControlPlaneTemplateList) DeepCopy() *OCIManagedControlPlaneTemplateList { + if in == nil { + return nil + } + out := new(OCIManagedControlPlaneTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedControlPlaneTemplateList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedControlPlaneTemplateResource) DeepCopyInto(out *OCIManagedControlPlaneTemplateResource) { + *out = *in + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneTemplateResource. +func (in *OCIManagedControlPlaneTemplateResource) DeepCopy() *OCIManagedControlPlaneTemplateResource { + if in == nil { + return nil + } + out := new(OCIManagedControlPlaneTemplateResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedControlPlaneTemplateSpec) DeepCopyInto(out *OCIManagedControlPlaneTemplateSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneTemplateSpec. +func (in *OCIManagedControlPlaneTemplateSpec) DeepCopy() *OCIManagedControlPlaneTemplateSpec { + if in == nil { + return nil + } + out := new(OCIManagedControlPlaneTemplateSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PeerRouteRule) DeepCopyInto(out *PeerRouteRule) { *out = *in diff --git a/cloud/scope/managed_control_plane.go b/cloud/scope/managed_control_plane.go index f500f551..61af8e43 100644 --- a/cloud/scope/managed_control_plane.go +++ b/cloud/scope/managed_control_plane.go @@ -30,7 +30,6 @@ import ( "github.com/oracle/cluster-api-provider-oci/cloud/ociutil" baseclient "github.com/oracle/cluster-api-provider-oci/cloud/services/base" "github.com/oracle/cluster-api-provider-oci/cloud/services/containerengine" - infrav2exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" "github.com/oracle/oci-go-sdk/v65/common" oke "github.com/oracle/oci-go-sdk/v65/containerengine" "github.com/pkg/errors" @@ -60,7 +59,7 @@ type ManagedControlPlaneScopeParams struct { ContainerEngineClient containerengine.Client BaseClient baseclient.BaseClient ClientProvider *ClientProvider - OCIManagedControlPlane *infrav2exp.OCIManagedControlPlane + OCIManagedControlPlane *infrastructurev1beta2.OCIManagedControlPlane OCIClusterAccessor OCIClusterAccessor RegionIdentifier string } @@ -72,7 +71,7 @@ type ManagedControlPlaneScope struct { ContainerEngineClient containerengine.Client BaseClient baseclient.BaseClient ClientProvider *ClientProvider - OCIManagedControlPlane *infrav2exp.OCIManagedControlPlane + OCIManagedControlPlane *infrastructurev1beta2.OCIManagedControlPlane OCIClusterAccessor OCIClusterAccessor RegionIdentifier string patchHelper *patch.Helper @@ -126,9 +125,9 @@ func (s *ManagedControlPlaneScope) GetOrCreateControlPlane(ctx context.Context) podNetworks := make([]oke.ClusterPodNetworkOptionDetails, 0) if len(controlPlaneSpec.ClusterPodNetworkOptions) > 0 { for _, cniOption := range controlPlaneSpec.ClusterPodNetworkOptions { - if cniOption.CniType == infrav2exp.FlannelCNI { + if cniOption.CniType == infrastructurev1beta2.FlannelCNI { podNetworks = append(podNetworks, oke.FlannelOverlayClusterPodNetworkOptionDetails{}) - } else if cniOption.CniType == infrav2exp.VCNNativeCNI { + } else if cniOption.CniType == infrastructurev1beta2.VCNNativeCNI { podNetworks = append(podNetworks, oke.OciVcnIpNativeClusterPodNetworkOptionDetails{}) } } @@ -225,13 +224,13 @@ func (s *ManagedControlPlaneScope) GetOrCreateControlPlane(ctx context.Context) return s.getOKEClusterFromOCID(ctx, clusterId) } -func getOKEClusterTypeFromSpecType(controlPlaneSpec infrav2exp.OCIManagedControlPlaneSpec) oke.ClusterTypeEnum { +func getOKEClusterTypeFromSpecType(controlPlaneSpec infrastructurev1beta2.OCIManagedControlPlaneSpec) oke.ClusterTypeEnum { if controlPlaneSpec.ClusterType != "" { switch controlPlaneSpec.ClusterType { - case infrav2exp.BasicClusterType: + case infrastructurev1beta2.BasicClusterType: return oke.ClusterTypeBasicCluster break - case infrav2exp.EnhancedClusterType: + case infrastructurev1beta2.EnhancedClusterType: return oke.ClusterTypeEnhancedCluster break default: @@ -654,61 +653,61 @@ func (s *ManagedControlPlaneScope) UpdateControlPlane(ctx context.Context, okeCl // setControlPlaneSpecDefaults sets the defaults in the spec as returned by OKE API. We need to set defaults here rather than webhook as well as // there is a chance user will edit the cluster -func setControlPlaneSpecDefaults(spec *infrav2exp.OCIManagedControlPlaneSpec) { +func setControlPlaneSpecDefaults(spec *infrastructurev1beta2.OCIManagedControlPlaneSpec) { spec.ControlPlaneEndpoint = clusterv1.APIEndpoint{} if spec.ClusterType == "" { - spec.ClusterType = infrav2exp.BasicClusterType + spec.ClusterType = infrastructurev1beta2.BasicClusterType } spec.Addons = nil if spec.ImagePolicyConfig == nil { - spec.ImagePolicyConfig = &infrav2exp.ImagePolicyConfig{ + spec.ImagePolicyConfig = &infrastructurev1beta2.ImagePolicyConfig{ IsPolicyEnabled: common.Bool(false), - KeyDetails: make([]infrav2exp.KeyDetails, 0), + KeyDetails: make([]infrastructurev1beta2.KeyDetails, 0), } } if spec.ClusterOption.AdmissionControllerOptions == nil { - spec.ClusterOption.AdmissionControllerOptions = &infrav2exp.AdmissionControllerOptions{ + spec.ClusterOption.AdmissionControllerOptions = &infrastructurev1beta2.AdmissionControllerOptions{ IsPodSecurityPolicyEnabled: common.Bool(false), } } if spec.ClusterOption.AddOnOptions == nil { - spec.ClusterOption.AddOnOptions = &infrav2exp.AddOnOptions{ + spec.ClusterOption.AddOnOptions = &infrastructurev1beta2.AddOnOptions{ IsTillerEnabled: common.Bool(false), IsKubernetesDashboardEnabled: common.Bool(false), } } } -func (s *ManagedControlPlaneScope) getSpecFromActual(cluster *oke.Cluster) *infrav2exp.OCIManagedControlPlaneSpec { - spec := infrav2exp.OCIManagedControlPlaneSpec{ +func (s *ManagedControlPlaneScope) getSpecFromActual(cluster *oke.Cluster) *infrastructurev1beta2.OCIManagedControlPlaneSpec { + spec := infrastructurev1beta2.OCIManagedControlPlaneSpec{ Version: cluster.KubernetesVersion, KmsKeyId: cluster.KmsKeyId, ID: cluster.Id, Addons: nil, } if cluster.ImagePolicyConfig != nil { - keys := make([]infrav2exp.KeyDetails, 0) + keys := make([]infrastructurev1beta2.KeyDetails, 0) for _, key := range cluster.ImagePolicyConfig.KeyDetails { - keys = append(keys, infrav2exp.KeyDetails{ + keys = append(keys, infrastructurev1beta2.KeyDetails{ KmsKeyId: key.KmsKeyId, }) } - spec.ImagePolicyConfig = &infrav2exp.ImagePolicyConfig{ + spec.ImagePolicyConfig = &infrastructurev1beta2.ImagePolicyConfig{ IsPolicyEnabled: cluster.ImagePolicyConfig.IsPolicyEnabled, KeyDetails: keys, } } if len(cluster.ClusterPodNetworkOptions) > 0 { - podNetworks := make([]infrav2exp.ClusterPodNetworkOptions, 0) + podNetworks := make([]infrastructurev1beta2.ClusterPodNetworkOptions, 0) for _, cniOption := range cluster.ClusterPodNetworkOptions { _, ok := cniOption.(oke.OciVcnIpNativeClusterPodNetworkOptionDetails) if ok { - podNetworks = append(podNetworks, infrav2exp.ClusterPodNetworkOptions{ - CniType: infrav2exp.VCNNativeCNI, + podNetworks = append(podNetworks, infrastructurev1beta2.ClusterPodNetworkOptions{ + CniType: infrastructurev1beta2.VCNNativeCNI, }) } else { - podNetworks = append(podNetworks, infrav2exp.ClusterPodNetworkOptions{ - CniType: infrav2exp.FlannelCNI, + podNetworks = append(podNetworks, infrastructurev1beta2.ClusterPodNetworkOptions{ + CniType: infrastructurev1beta2.FlannelCNI, }) } } @@ -716,12 +715,12 @@ func (s *ManagedControlPlaneScope) getSpecFromActual(cluster *oke.Cluster) *infr } if cluster.Options != nil { if cluster.Options.AdmissionControllerOptions != nil { - spec.ClusterOption.AdmissionControllerOptions = &infrav2exp.AdmissionControllerOptions{ + spec.ClusterOption.AdmissionControllerOptions = &infrastructurev1beta2.AdmissionControllerOptions{ IsPodSecurityPolicyEnabled: cluster.Options.AdmissionControllerOptions.IsPodSecurityPolicyEnabled, } } if cluster.Options.AddOns != nil { - spec.ClusterOption.AddOnOptions = &infrav2exp.AddOnOptions{ + spec.ClusterOption.AddOnOptions = &infrastructurev1beta2.AddOnOptions{ IsTillerEnabled: cluster.Options.AddOns.IsTillerEnabled, IsKubernetesDashboardEnabled: cluster.Options.AddOns.IsKubernetesDashboardEnabled, } @@ -730,13 +729,13 @@ func (s *ManagedControlPlaneScope) getSpecFromActual(cluster *oke.Cluster) *infr if cluster.Type != "" { switch cluster.Type { case oke.ClusterTypeBasicCluster: - spec.ClusterType = infrav2exp.BasicClusterType + spec.ClusterType = infrastructurev1beta2.BasicClusterType break case oke.ClusterTypeEnhancedCluster: - spec.ClusterType = infrav2exp.EnhancedClusterType + spec.ClusterType = infrastructurev1beta2.EnhancedClusterType break default: - spec.ClusterType = infrav2exp.BasicClusterType + spec.ClusterType = infrastructurev1beta2.BasicClusterType break } } @@ -769,7 +768,7 @@ func (s *ManagedControlPlaneScope) ReconcileAddons(ctx context.Context, okeClust return err } // add it to status, details will be reconciled in next loop - status := infrav2exp.AddonStatus{ + status := infrastructurev1beta2.AddonStatus{ LifecycleState: common.String(string(oke.AddonLifecycleStateCreating)), } s.OCIManagedControlPlane.SetAddonStatus(*addon.Name, status) @@ -799,14 +798,14 @@ func (s *ManagedControlPlaneScope) ReconcileAddons(ctx context.Context, okeClust return nil } -func (s *ManagedControlPlaneScope) getStatus(addon oke.Addon) infrav2exp.AddonStatus { +func (s *ManagedControlPlaneScope) getStatus(addon oke.Addon) infrastructurev1beta2.AddonStatus { // update status of the addon - status := infrav2exp.AddonStatus{ + status := infrastructurev1beta2.AddonStatus{ LifecycleState: common.String(string(addon.LifecycleState)), CurrentlyInstalledVersion: addon.CurrentInstalledVersion, } if addon.AddonError != nil { - status.AddonError = &infrav2exp.AddonError{ + status.AddonError = &infrastructurev1beta2.AddonError{ Status: addon.AddonError.Status, Code: addon.AddonError.Code, Message: addon.AddonError.Message, @@ -815,7 +814,7 @@ func (s *ManagedControlPlaneScope) getStatus(addon oke.Addon) infrav2exp.AddonSt return status } -func (s *ManagedControlPlaneScope) handleExistingAddon(ctx context.Context, okeCluster *oke.Cluster, addon oke.Addon, addonInSpec infrav2exp.Addon) error { +func (s *ManagedControlPlaneScope) handleExistingAddon(ctx context.Context, okeCluster *oke.Cluster, addon oke.Addon, addonInSpec infrastructurev1beta2.Addon) error { // if the addon can be updated do so // if the addon is already in updating state, or in failed state, do not update s.Info(fmt.Sprintf("Reconciling addon %s with lifecycle state %s", *addon.Name, string(addon.LifecycleState))) @@ -883,7 +882,7 @@ func (s *ManagedControlPlaneScope) handleDeletedAddon(ctx context.Context, okeCl return nil } -func getAddonConfigurations(configurations []infrav2exp.AddonConfiguration) []oke.AddonConfiguration { +func getAddonConfigurations(configurations []infrastructurev1beta2.AddonConfiguration) []oke.AddonConfiguration { if len(configurations) == 0 { return nil } @@ -897,13 +896,13 @@ func getAddonConfigurations(configurations []infrav2exp.AddonConfiguration) []ok return config } -func getActualAddonConfigurations(addonConfigurations []oke.AddonConfiguration) []infrav2exp.AddonConfiguration { +func getActualAddonConfigurations(addonConfigurations []oke.AddonConfiguration) []infrastructurev1beta2.AddonConfiguration { if len(addonConfigurations) == 0 { return nil } - config := make([]infrav2exp.AddonConfiguration, len(addonConfigurations)) + config := make([]infrastructurev1beta2.AddonConfiguration, len(addonConfigurations)) for i, c := range addonConfigurations { - config[i] = infrav2exp.AddonConfiguration{ + config[i] = infrastructurev1beta2.AddonConfiguration{ Key: c.Key, Value: c.Value, } @@ -911,7 +910,7 @@ func getActualAddonConfigurations(addonConfigurations []oke.AddonConfiguration) return config } -func getAddon(addons []infrav2exp.Addon, name string) *infrav2exp.Addon { +func getAddon(addons []infrastructurev1beta2.Addon, name string) *infrastructurev1beta2.Addon { for i, addon := range addons { if *addon.Name == name { return &addons[i] diff --git a/cloud/scope/managed_control_plane_test.go b/cloud/scope/managed_control_plane_test.go index 17d9be02..66291337 100644 --- a/cloud/scope/managed_control_plane_test.go +++ b/cloud/scope/managed_control_plane_test.go @@ -29,7 +29,6 @@ import ( "github.com/oracle/cluster-api-provider-oci/cloud/ociutil" "github.com/oracle/cluster-api-provider-oci/cloud/services/base/mock_base" "github.com/oracle/cluster-api-provider-oci/cloud/services/containerengine/mock_containerengine" - infrav2exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" "github.com/oracle/oci-go-sdk/v65/common" oke "github.com/oracle/oci-go-sdk/v65/containerengine" corev1 "k8s.io/api/core/v1" @@ -78,11 +77,11 @@ func TestControlPlaneReconciliation(t *testing.T) { mockCtrl = gomock.NewController(t) okeClient = mock_containerengine.NewMockClient(mockCtrl) ociClusterAccessor := OCIManagedCluster{ - &infrav2exp.OCIManagedCluster{ + &infrastructurev1beta2.OCIManagedCluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, - Spec: infrav2exp.OCIManagedClusterSpec{ + Spec: infrastructurev1beta2.OCIManagedClusterSpec{ CompartmentId: "test-compartment", DefinedTags: definedTags, NetworkSpec: infrastructurev1beta2.NetworkSpec{ @@ -115,11 +114,11 @@ func TestControlPlaneReconciliation(t *testing.T) { ociClusterAccessor.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" cs, err = NewManagedControlPlaneScope(ManagedControlPlaneScopeParams{ ContainerEngineClient: okeClient, - OCIManagedControlPlane: &infrav2exp.OCIManagedControlPlane{ + OCIManagedControlPlane: &infrastructurev1beta2.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: infrav2exp.OCIManagedControlPlaneSpec{}, + Spec: infrastructurev1beta2.OCIManagedControlPlaneSpec{}, }, OCIClusterAccessor: ociClusterAccessor, Cluster: &clusterv1.Cluster{ @@ -198,26 +197,26 @@ func TestControlPlaneReconciliation(t *testing.T) { name: "control plane create all params", errorExpected: false, testSpecificSetup: func(cs *ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { - cs.OCIManagedControlPlane.Spec = infrav2exp.OCIManagedControlPlaneSpec{ - ClusterPodNetworkOptions: []infrav2exp.ClusterPodNetworkOptions{ + cs.OCIManagedControlPlane.Spec = infrastructurev1beta2.OCIManagedControlPlaneSpec{ + ClusterPodNetworkOptions: []infrastructurev1beta2.ClusterPodNetworkOptions{ { - CniType: infrav2exp.FlannelCNI, + CniType: infrastructurev1beta2.FlannelCNI, }, { - CniType: infrav2exp.VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, }, }, - ImagePolicyConfig: &infrav2exp.ImagePolicyConfig{ + ImagePolicyConfig: &infrastructurev1beta2.ImagePolicyConfig{ IsPolicyEnabled: common.Bool(true), - KeyDetails: []infrav2exp.KeyDetails{{ + KeyDetails: []infrastructurev1beta2.KeyDetails{{ KmsKeyId: common.String("kms-key-id"), }}, }, - ClusterOption: infrav2exp.ClusterOptions{ - AdmissionControllerOptions: &infrav2exp.AdmissionControllerOptions{ + ClusterOption: infrastructurev1beta2.ClusterOptions{ + AdmissionControllerOptions: &infrastructurev1beta2.AdmissionControllerOptions{ IsPodSecurityPolicyEnabled: common.Bool(true), }, - AddOnOptions: &infrav2exp.AddOnOptions{ + AddOnOptions: &infrastructurev1beta2.AddOnOptions{ IsKubernetesDashboardEnabled: common.Bool(true), IsTillerEnabled: common.Bool(false), }, @@ -366,11 +365,11 @@ func TestControlPlaneUpdation(t *testing.T) { mockCtrl = gomock.NewController(t) okeClient = mock_containerengine.NewMockClient(mockCtrl) ociClusterAccessor := OCIManagedCluster{ - &infrav2exp.OCIManagedCluster{ + &infrastructurev1beta2.OCIManagedCluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, - Spec: infrav2exp.OCIManagedClusterSpec{ + Spec: infrastructurev1beta2.OCIManagedClusterSpec{ CompartmentId: "test-compartment", DefinedTags: definedTags, NetworkSpec: infrastructurev1beta2.NetworkSpec{ @@ -403,11 +402,11 @@ func TestControlPlaneUpdation(t *testing.T) { ociClusterAccessor.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" cs, err = NewManagedControlPlaneScope(ManagedControlPlaneScopeParams{ ContainerEngineClient: okeClient, - OCIManagedControlPlane: &infrav2exp.OCIManagedControlPlane{ + OCIManagedControlPlane: &infrastructurev1beta2.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: infrav2exp.OCIManagedControlPlaneSpec{}, + Spec: infrastructurev1beta2.OCIManagedControlPlaneSpec{}, }, OCIClusterAccessor: ociClusterAccessor, Cluster: &clusterv1.Cluster{ @@ -444,23 +443,23 @@ func TestControlPlaneUpdation(t *testing.T) { name: "control plane no change", errorExpected: false, testSpecificSetup: func(cs *ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { - cs.OCIManagedControlPlane.Spec = infrav2exp.OCIManagedControlPlaneSpec{ - ClusterPodNetworkOptions: []infrav2exp.ClusterPodNetworkOptions{ + cs.OCIManagedControlPlane.Spec = infrastructurev1beta2.OCIManagedControlPlaneSpec{ + ClusterPodNetworkOptions: []infrastructurev1beta2.ClusterPodNetworkOptions{ { - CniType: infrav2exp.FlannelCNI, + CniType: infrastructurev1beta2.FlannelCNI, }, }, - ImagePolicyConfig: &infrav2exp.ImagePolicyConfig{ + ImagePolicyConfig: &infrastructurev1beta2.ImagePolicyConfig{ IsPolicyEnabled: common.Bool(true), - KeyDetails: []infrav2exp.KeyDetails{{ + KeyDetails: []infrastructurev1beta2.KeyDetails{{ KmsKeyId: common.String("kms-key-id"), }}, }, - ClusterOption: infrav2exp.ClusterOptions{ - AdmissionControllerOptions: &infrav2exp.AdmissionControllerOptions{ + ClusterOption: infrastructurev1beta2.ClusterOptions{ + AdmissionControllerOptions: &infrastructurev1beta2.AdmissionControllerOptions{ IsPodSecurityPolicyEnabled: common.Bool(true), }, - AddOnOptions: &infrav2exp.AddOnOptions{ + AddOnOptions: &infrastructurev1beta2.AddOnOptions{ IsKubernetesDashboardEnabled: common.Bool(true), IsTillerEnabled: common.Bool(false), }, @@ -520,26 +519,26 @@ func TestControlPlaneUpdation(t *testing.T) { name: "control plane change", errorExpected: false, testSpecificSetup: func(cs *ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { - cs.OCIManagedControlPlane.Spec = infrav2exp.OCIManagedControlPlaneSpec{ - ClusterPodNetworkOptions: []infrav2exp.ClusterPodNetworkOptions{ + cs.OCIManagedControlPlane.Spec = infrastructurev1beta2.OCIManagedControlPlaneSpec{ + ClusterPodNetworkOptions: []infrastructurev1beta2.ClusterPodNetworkOptions{ { - CniType: infrav2exp.FlannelCNI, + CniType: infrastructurev1beta2.FlannelCNI, }, { - CniType: infrav2exp.VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, }, }, - ImagePolicyConfig: &infrav2exp.ImagePolicyConfig{ + ImagePolicyConfig: &infrastructurev1beta2.ImagePolicyConfig{ IsPolicyEnabled: common.Bool(true), - KeyDetails: []infrav2exp.KeyDetails{{ + KeyDetails: []infrastructurev1beta2.KeyDetails{{ KmsKeyId: common.String("new-kms-key-id"), }}, }, - ClusterOption: infrav2exp.ClusterOptions{ - AdmissionControllerOptions: &infrav2exp.AdmissionControllerOptions{ + ClusterOption: infrastructurev1beta2.ClusterOptions{ + AdmissionControllerOptions: &infrastructurev1beta2.AdmissionControllerOptions{ IsPodSecurityPolicyEnabled: common.Bool(true), }, - AddOnOptions: &infrav2exp.AddOnOptions{ + AddOnOptions: &infrastructurev1beta2.AddOnOptions{ IsKubernetesDashboardEnabled: common.Bool(true), IsTillerEnabled: common.Bool(false), }, @@ -655,17 +654,17 @@ func TestControlPlaneKubeconfigReconcile(t *testing.T) { okeClient = mock_containerengine.NewMockClient(mockCtrl) baseClient = mock_base.NewMockBaseClient(mockCtrl) ociClusterAccessor := OCIManagedCluster{ - &infrav2exp.OCIManagedCluster{}, + &infrastructurev1beta2.OCIManagedCluster{}, } ociClusterAccessor.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" cs, err = NewManagedControlPlaneScope(ManagedControlPlaneScopeParams{ ContainerEngineClient: okeClient, BaseClient: baseClient, - OCIManagedControlPlane: &infrav2exp.OCIManagedControlPlane{ + OCIManagedControlPlane: &infrastructurev1beta2.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: infrav2exp.OCIManagedControlPlaneSpec{}, + Spec: infrastructurev1beta2.OCIManagedControlPlaneSpec{}, }, OCIClusterAccessor: ociClusterAccessor, Cluster: &clusterv1.Cluster{ @@ -810,13 +809,13 @@ func TestAddonReconcile(t *testing.T) { okeClient = mock_containerengine.NewMockClient(mockCtrl) baseClient = mock_base.NewMockBaseClient(mockCtrl) ociClusterAccessor := OCIManagedCluster{ - &infrav2exp.OCIManagedCluster{}, + &infrastructurev1beta2.OCIManagedCluster{}, } ociClusterAccessor.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" cs, err = NewManagedControlPlaneScope(ManagedControlPlaneScopeParams{ ContainerEngineClient: okeClient, BaseClient: baseClient, - OCIManagedControlPlane: &infrav2exp.OCIManagedControlPlane{ + OCIManagedControlPlane: &infrastructurev1beta2.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, @@ -844,14 +843,14 @@ func TestAddonReconcile(t *testing.T) { matchError error errorSubStringMatch bool okeCluster oke.Cluster - matchStatus map[string]infrav2exp.AddonStatus + matchStatus map[string]infrastructurev1beta2.AddonStatus testSpecificSetup func(cs *ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) }{ { name: "install addon", errorExpected: false, testSpecificSetup: func(cs *ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { - cs.OCIManagedControlPlane.Spec.Addons = []infrav2exp.Addon{ + cs.OCIManagedControlPlane.Spec.Addons = []infrastructurev1beta2.Addon{ { Name: common.String("dashboard"), }, @@ -878,11 +877,11 @@ func TestAddonReconcile(t *testing.T) { name: "install addon with config and version", errorExpected: false, testSpecificSetup: func(cs *ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { - cs.OCIManagedControlPlane.Spec.Addons = []infrav2exp.Addon{ + cs.OCIManagedControlPlane.Spec.Addons = []infrastructurev1beta2.Addon{ { Name: common.String("dashboard"), Version: common.String("v0.1.0"), - Configurations: []infrav2exp.AddonConfiguration{ + Configurations: []infrastructurev1beta2.AddonConfiguration{ { Key: common.String("k1"), Value: common.String("v1"), @@ -928,10 +927,10 @@ func TestAddonReconcile(t *testing.T) { name: "update addon", errorExpected: false, testSpecificSetup: func(cs *ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { - cs.OCIManagedControlPlane.Spec.Addons = []infrav2exp.Addon{ + cs.OCIManagedControlPlane.Spec.Addons = []infrastructurev1beta2.Addon{ { Name: common.String("dashboard"), - Configurations: []infrav2exp.AddonConfiguration{ + Configurations: []infrastructurev1beta2.AddonConfiguration{ { Key: common.String("k1"), Value: common.String("v1"), @@ -980,7 +979,7 @@ func TestAddonReconcile(t *testing.T) { name: "delete addon", errorExpected: false, testSpecificSetup: func(cs *ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { - cs.OCIManagedControlPlane.Status.AddonStatus = map[string]infrav2exp.AddonStatus{ + cs.OCIManagedControlPlane.Status.AddonStatus = map[string]infrastructurev1beta2.AddonStatus{ "dashboard": { LifecycleState: common.String("ACTIVE"), }, @@ -1011,7 +1010,7 @@ func TestAddonReconcile(t *testing.T) { name: "delete addon, already deleted", errorExpected: false, testSpecificSetup: func(cs *ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { - cs.OCIManagedControlPlane.Status.AddonStatus = map[string]infrav2exp.AddonStatus{ + cs.OCIManagedControlPlane.Status.AddonStatus = map[string]infrastructurev1beta2.AddonStatus{ "dashboard": { LifecycleState: common.String("ACTIVE"), }, @@ -1031,7 +1030,7 @@ func TestAddonReconcile(t *testing.T) { name: "addon in deleting state", errorExpected: false, testSpecificSetup: func(cs *ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { - cs.OCIManagedControlPlane.Status.AddonStatus = map[string]infrav2exp.AddonStatus{ + cs.OCIManagedControlPlane.Status.AddonStatus = map[string]infrastructurev1beta2.AddonStatus{ "dashboard": { LifecycleState: common.String("ACTIVE"), }, @@ -1056,7 +1055,7 @@ func TestAddonReconcile(t *testing.T) { errorExpected: true, matchError: errors.New("install error"), testSpecificSetup: func(cs *ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { - cs.OCIManagedControlPlane.Spec.Addons = []infrav2exp.Addon{ + cs.OCIManagedControlPlane.Spec.Addons = []infrastructurev1beta2.Addon{ { Name: common.String("dashboard"), }, @@ -1083,7 +1082,7 @@ func TestAddonReconcile(t *testing.T) { name: "addon status error", errorExpected: false, testSpecificSetup: func(cs *ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { - cs.OCIManagedControlPlane.Spec.Addons = []infrav2exp.Addon{ + cs.OCIManagedControlPlane.Spec.Addons = []infrastructurev1beta2.Addon{ { Name: common.String("dashboard"), }, @@ -1114,10 +1113,10 @@ func TestAddonReconcile(t *testing.T) { Id: common.String("id"), Name: common.String("test"), }, - matchStatus: map[string]infrav2exp.AddonStatus{ + matchStatus: map[string]infrastructurev1beta2.AddonStatus{ "dashboard": { LifecycleState: common.String("NEEDS_ATTENTION"), - AddonError: &infrav2exp.AddonError{ + AddonError: &infrastructurev1beta2.AddonError{ Code: common.String("32"), Message: common.String("error"), Status: common.String("status"), diff --git a/cloud/scope/managed_machine_pool.go b/cloud/scope/managed_machine_pool.go index 6221cfe0..e28cd435 100644 --- a/cloud/scope/managed_machine_pool.go +++ b/cloud/scope/managed_machine_pool.go @@ -55,8 +55,8 @@ type ManagedMachinePoolScopeParams struct { MachinePool *expclusterv1.MachinePool Client client.Client ComputeManagementClient computemanagement.Client - OCIManagedCluster *infrav2exp.OCIManagedCluster - OCIManagedControlPlane *infrav2exp.OCIManagedControlPlane + OCIManagedCluster *infrastructurev1beta2.OCIManagedCluster + OCIManagedControlPlane *infrastructurev1beta2.OCIManagedControlPlane OCIManagedMachinePool *expinfra1.OCIManagedMachinePool ContainerEngineClient containerengine.Client } @@ -68,10 +68,10 @@ type ManagedMachinePoolScope struct { Cluster *clusterv1.Cluster MachinePool *expclusterv1.MachinePool ComputeManagementClient computemanagement.Client - OCIManagedCluster *infrav2exp.OCIManagedCluster + OCIManagedCluster *infrastructurev1beta2.OCIManagedCluster OCIManagedMachinePool *expinfra1.OCIManagedMachinePool ContainerEngineClient containerengine.Client - OCIManagedControlPlane *infrav2exp.OCIManagedControlPlane + OCIManagedControlPlane *infrastructurev1beta2.OCIManagedControlPlane } // NewManagedMachinePoolScope creates a ManagedMachinePoolScope given the ManagedMachinePoolScopeParams @@ -280,7 +280,7 @@ func (m *ManagedMachinePoolScope) CreateNodePool(ctx context.Context) (*oke.Node } podNetworkOptions := machinePool.Spec.NodePoolNodeConfig.NodePoolPodNetworkOptionDetails if podNetworkOptions != nil { - if podNetworkOptions.CniType == expinfra1.VCNNativeCNI { + if podNetworkOptions.CniType == infrastructurev1beta2.VCNNativeCNI { npnDetails := oke.OciVcnIpNativeNodePoolPodNetworkOptionDetails{ PodSubnetIds: m.getPodSubnets(podNetworkOptions.VcnIpNativePodNetworkOptions.SubnetNames), PodNsgIds: m.getPodNSGs(podNetworkOptions.VcnIpNativePodNetworkOptions.NSGNames), @@ -289,7 +289,7 @@ func (m *ManagedMachinePoolScope) CreateNodePool(ctx context.Context) (*oke.Node npnDetails.MaxPodsPerNode = podNetworkOptions.VcnIpNativePodNetworkOptions.MaxPodsPerNode } nodeConfigDetails.NodePoolPodNetworkOptionDetails = npnDetails - } else if podNetworkOptions.CniType == expinfra1.FlannelCNI { + } else if podNetworkOptions.CniType == infrastructurev1beta2.FlannelCNI { nodeConfigDetails.NodePoolPodNetworkOptionDetails = oke.FlannelOverlayNodePoolPodNetworkOptionDetails{} } } @@ -665,7 +665,7 @@ func (m *ManagedMachinePoolScope) UpdateNodePool(ctx context.Context, pool *oke. podNetworkOptions := spec.NodePoolNodeConfig.NodePoolPodNetworkOptionDetails if podNetworkOptions != nil { - if podNetworkOptions.CniType == expinfra1.VCNNativeCNI { + if podNetworkOptions.CniType == infrastructurev1beta2.VCNNativeCNI { npnDetails := oke.OciVcnIpNativeNodePoolPodNetworkOptionDetails{ PodSubnetIds: m.getPodSubnets(podNetworkOptions.VcnIpNativePodNetworkOptions.SubnetNames), PodNsgIds: m.getPodNSGs(podNetworkOptions.VcnIpNativePodNetworkOptions.NSGNames), @@ -674,7 +674,7 @@ func (m *ManagedMachinePoolScope) UpdateNodePool(ctx context.Context, pool *oke. npnDetails.MaxPodsPerNode = podNetworkOptions.VcnIpNativePodNetworkOptions.MaxPodsPerNode } nodeConfigDetails.NodePoolPodNetworkOptionDetails = npnDetails - } else if podNetworkOptions.CniType == expinfra1.FlannelCNI { + } else if podNetworkOptions.CniType == infrastructurev1beta2.FlannelCNI { nodeConfigDetails.NodePoolPodNetworkOptionDetails = oke.FlannelOverlayNodePoolPodNetworkOptionDetails{} } } @@ -741,7 +741,7 @@ func setMachinePoolSpecDefaults(spec *infrav2exp.OCIManagedMachinePoolSpec) { } podNetworkOptions := spec.NodePoolNodeConfig.NodePoolPodNetworkOptionDetails if podNetworkOptions != nil { - if podNetworkOptions.CniType == expinfra1.VCNNativeCNI { + if podNetworkOptions.CniType == infrastructurev1beta2.VCNNativeCNI { // 31 is the default max pods per node returned by OKE API spec.NodePoolNodeConfig.NodePoolPodNetworkOptionDetails.VcnIpNativePodNetworkOptions.MaxPodsPerNode = common.Int(31) } @@ -763,7 +763,7 @@ func (m *ManagedMachinePoolScope) getSpecFromAPIObject(pool *oke.NodePool) *expi podDetails, ok := actualNodeConfigDetails.NodePoolPodNetworkOptionDetails.(oke.OciVcnIpNativeNodePoolPodNetworkOptionDetails) if ok { nodePoolNodeConfig.NodePoolPodNetworkOptionDetails = &expinfra1.NodePoolPodNetworkOptionDetails{ - CniType: expinfra1.VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, VcnIpNativePodNetworkOptions: expinfra1.VcnIpNativePodNetworkOptions{ MaxPodsPerNode: podDetails.MaxPodsPerNode, NSGNames: GetNsgNamesFromId(podDetails.PodNsgIds, m.OCIManagedCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List), @@ -772,7 +772,7 @@ func (m *ManagedMachinePoolScope) getSpecFromAPIObject(pool *oke.NodePool) *expi } } else { nodePoolNodeConfig.NodePoolPodNetworkOptionDetails = &expinfra1.NodePoolPodNetworkOptionDetails{ - CniType: expinfra1.FlannelCNI, + CniType: infrastructurev1beta2.FlannelCNI, } } } diff --git a/cloud/scope/managed_machine_pool_test.go b/cloud/scope/managed_machine_pool_test.go index 70e8f782..ef41409b 100644 --- a/cloud/scope/managed_machine_pool_test.go +++ b/cloud/scope/managed_machine_pool_test.go @@ -72,11 +72,11 @@ func TestManagedMachinePoolCreate(t *testing.T) { var err error mockCtrl = gomock.NewController(t) okeClient = mock_containerengine.NewMockClient(mockCtrl) - ociManagedCluster := &infrav2exp.OCIManagedCluster{ + ociManagedCluster := &infrastructurev1beta2.OCIManagedCluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, - Spec: infrav2exp.OCIManagedClusterSpec{ + Spec: infrastructurev1beta2.OCIManagedClusterSpec{ CompartmentId: "test-compartment", DefinedTags: definedTags, NetworkSpec: infrastructurev1beta2.NetworkSpec{ @@ -125,11 +125,11 @@ func TestManagedMachinePoolCreate(t *testing.T) { ms, err = NewManagedMachinePoolScope(ManagedMachinePoolScopeParams{ ContainerEngineClient: okeClient, - OCIManagedControlPlane: &infrav2exp.OCIManagedControlPlane{ + OCIManagedControlPlane: &infrastructurev1beta2.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: infrav2exp.OCIManagedControlPlaneSpec{ + Spec: infrastructurev1beta2.OCIManagedControlPlaneSpec{ ID: common.String("cluster-id"), }, }, @@ -203,7 +203,7 @@ func TestManagedMachinePoolCreate(t *testing.T) { KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav2exp.VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(25), @@ -328,7 +328,7 @@ func TestManagedMachinePoolCreate(t *testing.T) { KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav2exp.VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(25), @@ -475,7 +475,7 @@ func TestManagedMachinePoolCreate(t *testing.T) { KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav2exp.VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(25), @@ -624,7 +624,7 @@ func TestManagedMachinePoolCreate(t *testing.T) { KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav2exp.VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(25), @@ -687,7 +687,7 @@ func TestManagedMachinePoolCreate(t *testing.T) { KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav2exp.VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(15), @@ -866,11 +866,11 @@ func TestManagedMachinePoolUpdate(t *testing.T) { var err error mockCtrl = gomock.NewController(t) okeClient = mock_containerengine.NewMockClient(mockCtrl) - ociManagedCluster := &infrav2exp.OCIManagedCluster{ + ociManagedCluster := &infrastructurev1beta2.OCIManagedCluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, - Spec: infrav2exp.OCIManagedClusterSpec{ + Spec: infrastructurev1beta2.OCIManagedClusterSpec{ CompartmentId: "test-compartment", DefinedTags: definedTags, NetworkSpec: infrastructurev1beta2.NetworkSpec{ @@ -919,11 +919,11 @@ func TestManagedMachinePoolUpdate(t *testing.T) { ms, err = NewManagedMachinePoolScope(ManagedMachinePoolScopeParams{ ContainerEngineClient: okeClient, - OCIManagedControlPlane: &infrav2exp.OCIManagedControlPlane{ + OCIManagedControlPlane: &infrastructurev1beta2.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: infrav2exp.OCIManagedControlPlaneSpec{ + Spec: infrastructurev1beta2.OCIManagedControlPlaneSpec{ ID: common.String("cluster-id"), }, }, @@ -998,7 +998,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) { KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav2exp.VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, NSGNames: []string{"pod-nsg"}, @@ -1096,7 +1096,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) { KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav2exp.VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(31), @@ -1237,7 +1237,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) { KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav2exp.VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(31), @@ -1335,7 +1335,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) { KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav2exp.VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(31), @@ -1471,7 +1471,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) { KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav2exp.VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(31), @@ -1621,7 +1621,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) { KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav2exp.VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(31), diff --git a/cloud/scope/oci_managed_cluster.go b/cloud/scope/oci_managed_cluster.go index 4526aee9..162e491c 100644 --- a/cloud/scope/oci_managed_cluster.go +++ b/cloud/scope/oci_managed_cluster.go @@ -18,7 +18,6 @@ package scope import ( infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" - infrav2exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" corev1 "k8s.io/api/core/v1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/util/conditions" @@ -26,7 +25,7 @@ import ( // OCIManagedCluster is the ClusterAccessor implementation for managed clusters(OKE) type OCIManagedCluster struct { - OCIManagedCluster *infrav2exp.OCIManagedCluster + OCIManagedCluster *infrastructurev1beta2.OCIManagedCluster } func (c OCIManagedCluster) GetNameSpace() string { diff --git a/cloud/scope/virtual_machine_pool.go b/cloud/scope/virtual_machine_pool.go index a70f6205..b86e465d 100644 --- a/cloud/scope/virtual_machine_pool.go +++ b/cloud/scope/virtual_machine_pool.go @@ -52,8 +52,8 @@ type VirtualMachinePoolScopeParams struct { MachinePool *expclusterv1.MachinePool Client client.Client ComputeManagementClient computemanagement.Client - OCIManagedCluster *infrav2exp.OCIManagedCluster - OCIManagedControlPlane *infrav2exp.OCIManagedControlPlane + OCIManagedCluster *infrastructurev1beta2.OCIManagedCluster + OCIManagedControlPlane *infrastructurev1beta2.OCIManagedControlPlane OCIVirtualMachinePool *expinfra1.OCIVirtualMachinePool ContainerEngineClient containerengine.Client } @@ -65,10 +65,10 @@ type VirtualMachinePoolScope struct { Cluster *clusterv1.Cluster MachinePool *expclusterv1.MachinePool ComputeManagementClient computemanagement.Client - OCIManagedCluster *infrav2exp.OCIManagedCluster + OCIManagedCluster *infrastructurev1beta2.OCIManagedCluster OCIVirtualMachinePool *expinfra1.OCIVirtualMachinePool ContainerEngineClient containerengine.Client - OCIManagedControlPlane *infrav2exp.OCIManagedControlPlane + OCIManagedControlPlane *infrastructurev1beta2.OCIManagedControlPlane } // NewVirtualMachinePoolScope creates a VirtualMachinePoolScope given the VirtualMachinePoolScopeParams diff --git a/cloud/scope/virtual_machine_pool_test.go b/cloud/scope/virtual_machine_pool_test.go index 39871028..30848bd2 100644 --- a/cloud/scope/virtual_machine_pool_test.go +++ b/cloud/scope/virtual_machine_pool_test.go @@ -72,11 +72,11 @@ func TestVirtualMachinePoolCreate(t *testing.T) { var err error mockCtrl = gomock.NewController(t) okeClient = mock_containerengine.NewMockClient(mockCtrl) - ociManagedCluster := &infrav2exp.OCIManagedCluster{ + ociManagedCluster := &infrastructurev1beta2.OCIManagedCluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, - Spec: infrav2exp.OCIManagedClusterSpec{ + Spec: infrastructurev1beta2.OCIManagedClusterSpec{ CompartmentId: "test-compartment", DefinedTags: definedTags, NetworkSpec: infrastructurev1beta2.NetworkSpec{ @@ -125,11 +125,11 @@ func TestVirtualMachinePoolCreate(t *testing.T) { ms, err = NewVirtualMachinePoolScope(VirtualMachinePoolScopeParams{ ContainerEngineClient: okeClient, - OCIManagedControlPlane: &infrav2exp.OCIManagedControlPlane{ + OCIManagedControlPlane: &infrastructurev1beta2.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: infrav2exp.OCIManagedControlPlaneSpec{ + Spec: infrastructurev1beta2.OCIManagedControlPlaneSpec{ ID: common.String("cluster-id"), }, }, @@ -427,11 +427,11 @@ func TestVirtualMachinePoolUpdate(t *testing.T) { var err error mockCtrl = gomock.NewController(t) okeClient = mock_containerengine.NewMockClient(mockCtrl) - ociManagedCluster := &infrav2exp.OCIManagedCluster{ + ociManagedCluster := &infrastructurev1beta2.OCIManagedCluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, - Spec: infrav2exp.OCIManagedClusterSpec{ + Spec: infrastructurev1beta2.OCIManagedClusterSpec{ CompartmentId: "test-compartment", DefinedTags: definedTags, NetworkSpec: infrastructurev1beta2.NetworkSpec{ @@ -480,11 +480,11 @@ func TestVirtualMachinePoolUpdate(t *testing.T) { ms, err = NewVirtualMachinePoolScope(VirtualMachinePoolScopeParams{ ContainerEngineClient: okeClient, - OCIManagedControlPlane: &infrav2exp.OCIManagedControlPlane{ + OCIManagedControlPlane: &infrastructurev1beta2.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: infrav2exp.OCIManagedControlPlaneSpec{ + Spec: infrastructurev1beta2.OCIManagedControlPlaneSpec{ ID: common.String("cluster-id"), }, }, diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedclusters.yaml index 501f6c4a..bb6dcead 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedclusters.yaml @@ -108,6 +108,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic networkSpec: description: NetworkSpec encapsulates all things related to OCI network. properties: @@ -1256,6 +1257,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic networkSpec: description: NetworkSpec encapsulates all things related to OCI network. properties: diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedclustertemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedclustertemplates.yaml index 5370e733..a8f3ad43 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedclustertemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedclustertemplates.yaml @@ -121,6 +121,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic networkSpec: description: NetworkSpec encapsulates all things related to OCI network. @@ -1314,6 +1315,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic networkSpec: description: NetworkSpec encapsulates all things related to OCI network. diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 88a3e2aa..b5607d00 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -27,7 +27,7 @@ spec: - /manager args: - "--leader-elect" - - "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=false},OKE=${EXP_OKE:=false}" + - "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=false}" - "--metrics-bind-address=127.0.0.1:8080" - "--logging-format=${LOG_FORMAT:=text}" - "--init-oci-clients-on-startup=${INIT_OCI_CLIENTS_ON_STARTUP:=true}" diff --git a/controllers/ocimachine_controller.go b/controllers/ocimachine_controller.go index 8afff881..ebc72e61 100644 --- a/controllers/ocimachine_controller.go +++ b/controllers/ocimachine_controller.go @@ -19,7 +19,6 @@ package controllers import ( "context" "fmt" - expV1Beta2 "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" "time" "github.com/go-logr/logr" @@ -115,7 +114,7 @@ func (r *OCIMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request) var clusterAccessor scope.OCIClusterAccessor if err := r.Client.Get(ctx, ociClusterName, ociCluster); err != nil { // check for oci managed cluster - ociManagedCluster := &expV1Beta2.OCIManagedCluster{} + ociManagedCluster := &infrastructurev1beta2.OCIManagedCluster{} ociManagedClusterName := client.ObjectKey{ Namespace: cluster.Namespace, Name: cluster.Spec.InfrastructureRef.Name, diff --git a/exp/controllers/ocimanagedcluster_controller.go b/controllers/ocimanagedcluster_controller.go similarity index 96% rename from exp/controllers/ocimanagedcluster_controller.go rename to controllers/ocimanagedcluster_controller.go index 01128e24..c626a573 100644 --- a/exp/controllers/ocimanagedcluster_controller.go +++ b/controllers/ocimanagedcluster_controller.go @@ -25,7 +25,6 @@ import ( infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/cluster-api-provider-oci/cloud/scope" cloudutil "github.com/oracle/cluster-api-provider-oci/cloud/util" - infrav2exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -73,7 +72,7 @@ func (r *OCIManagedClusterReconciler) Reconcile(ctx context.Context, req ctrl.Re logger.Info("Inside cluster reconciler") // Fetch the OCIManagedCluster instance - ociCluster := &infrav2exp.OCIManagedCluster{} + ociCluster := &infrastructurev1beta2.OCIManagedCluster{} err := r.Get(ctx, req.NamespacedName, ociCluster) if err != nil { if apierrors.IsNotFound(err) { @@ -163,7 +162,7 @@ func (r *OCIManagedClusterReconciler) Reconcile(ctx context.Context, req ctrl.Re } -func (r *OCIManagedClusterReconciler) reconcileComponent(ctx context.Context, cluster *infrav2exp.OCIManagedCluster, +func (r *OCIManagedClusterReconciler) reconcileComponent(ctx context.Context, cluster *infrastructurev1beta2.OCIManagedCluster, reconciler func(context.Context) error, componentName string, failReason string, readyEventtype string) error { @@ -183,11 +182,11 @@ func (r *OCIManagedClusterReconciler) reconcileComponent(ctx context.Context, cl return nil } -func (r *OCIManagedClusterReconciler) reconcile(ctx context.Context, logger logr.Logger, clusterScope scope.ClusterScopeClient, ociManagedCluster *infrav2exp.OCIManagedCluster, cluster *clusterv1.Cluster) (ctrl.Result, error) { +func (r *OCIManagedClusterReconciler) reconcile(ctx context.Context, logger logr.Logger, clusterScope scope.ClusterScopeClient, ociManagedCluster *infrastructurev1beta2.OCIManagedCluster, cluster *clusterv1.Cluster) (ctrl.Result, error) { // If the OCIManagedCluster doesn't have our finalizer, add it. - controllerutil.AddFinalizer(ociManagedCluster, infrav2exp.ManagedClusterFinalizer) + controllerutil.AddFinalizer(ociManagedCluster, infrastructurev1beta2.ManagedClusterFinalizer) - controlPlane := &infrav2exp.OCIManagedControlPlane{} + controlPlane := &infrastructurev1beta2.OCIManagedControlPlane{} controlPlaneRef := types.NamespacedName{ Name: cluster.Spec.ControlPlaneRef.Name, Namespace: cluster.Namespace, @@ -279,11 +278,11 @@ func (r *OCIManagedClusterReconciler) SetupWithManager(ctx context.Context, mgr ociManagedControlPlaneMapper, err := OCIManagedControlPlaneToOCIManagedClusterMapper(ctx, r.Client, log) c, err := ctrl.NewControllerManagedBy(mgr). WithOptions(options). - For(&infrav2exp.OCIManagedCluster{}). + For(&infrastructurev1beta2.OCIManagedCluster{}). WithEventFilter(predicates.ResourceNotPaused(log)). // don't queue reconcile if resource is paused // watch OCIManagedControlPlane resources Watches( - &source.Kind{Type: &infrav2exp.OCIManagedControlPlane{}}, + &source.Kind{Type: &infrastructurev1beta2.OCIManagedControlPlane{}}, handler.EnqueueRequestsFromMapFunc(ociManagedControlPlaneMapper), ). Build(r) @@ -324,7 +323,7 @@ func (r *OCIManagedClusterReconciler) clusterToInfrastructureMapFunc(ctx context return nil } - ociCluster := &infrav2exp.OCIManagedCluster{} + ociCluster := &infrastructurev1beta2.OCIManagedCluster{} key := types.NamespacedName{Namespace: c.Spec.InfrastructureRef.Namespace, Name: c.Spec.InfrastructureRef.Name} if err := r.Get(ctx, key, ociCluster); err != nil { @@ -350,7 +349,7 @@ func (r *OCIManagedClusterReconciler) clusterToInfrastructureMapFunc(ctx context } } -func (r *OCIManagedClusterReconciler) reconcileDelete(ctx context.Context, logger logr.Logger, clusterScope scope.ClusterScopeClient, cluster *infrav2exp.OCIManagedCluster) (ctrl.Result, error) { +func (r *OCIManagedClusterReconciler) reconcileDelete(ctx context.Context, logger logr.Logger, clusterScope scope.ClusterScopeClient, cluster *infrastructurev1beta2.OCIManagedCluster) (ctrl.Result, error) { // This below if condition specifies if the network related infrastructure needs to be reconciled. Any new // network related reconcilication should happen in this if condition if !cluster.Spec.NetworkSpec.SkipNetworkManagement { @@ -434,14 +433,14 @@ func (r *OCIManagedClusterReconciler) reconcileDelete(ctx context.Context, logge } else { logger.Info("VCN Reconciliation is skipped, none of the VCN related resources will be deleted") } - controllerutil.RemoveFinalizer(cluster, infrav2exp.ManagedClusterFinalizer) + controllerutil.RemoveFinalizer(cluster, infrastructurev1beta2.ManagedClusterFinalizer) return reconcile.Result{}, nil } func OCIManagedControlPlaneToOCIManagedClusterMapper(ctx context.Context, c client.Client, log logr.Logger) (handler.MapFunc, error) { return func(o client.Object) []ctrl.Request { - ociManagedControlPlane, ok := o.(*infrav2exp.OCIManagedControlPlane) + ociManagedControlPlane, ok := o.(*infrastructurev1beta2.OCIManagedControlPlane) if !ok { log.Error(errors.Errorf("expected an OCIManagedControlPlane, got %T instead", o), "failed to map OCIManagedControlPlane") return nil diff --git a/exp/controllers/ocimanagedcluster_controller_test.go b/controllers/ocimanagedcluster_controller_test.go similarity index 91% rename from exp/controllers/ocimanagedcluster_controller_test.go rename to controllers/ocimanagedcluster_controller_test.go index b34f2963..cb844784 100644 --- a/exp/controllers/ocimanagedcluster_controller_test.go +++ b/controllers/ocimanagedcluster_controller_test.go @@ -24,7 +24,6 @@ import ( . "github.com/onsi/gomega" infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" mock_scope "github.com/oracle/cluster-api-provider-oci/cloud/scope/mocks" - infrav2exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" "github.com/oracle/oci-go-sdk/v65/common" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" @@ -40,11 +39,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" ) -var ( - MockTestRegion = "us-austin-1" -) - -func TestOCIClusterReconciler_Reconcile(t *testing.T) { +func TestOCIManagedClusterReconciler_Reconcile(t *testing.T) { var ( r OCIManagedClusterReconciler mockCtrl *gomock.Controller @@ -110,12 +105,12 @@ func TestOCIClusterReconciler_Reconcile(t *testing.T) { } } -func TestOCIClusterReconciler_reconcile(t *testing.T) { +func TestOCIManagedClusterReconciler_reconcile(t *testing.T) { var ( r OCIManagedClusterReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociCluster *infrav2exp.OCIManagedCluster + ociCluster *infrastructurev1beta2.OCIManagedCluster cluster *clusterv1.Cluster cs *mock_scope.MockClusterScopeClient ) @@ -123,11 +118,11 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { setup := func(t *testing.T, g *WithT) { mockCtrl = gomock.NewController(t) cs = mock_scope.NewMockClusterScopeClient(mockCtrl) - ociCluster = &infrav2exp.OCIManagedCluster{ + ociCluster = &infrastructurev1beta2.OCIManagedCluster{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{}, - Spec: infrav2exp.OCIManagedClusterSpec{}, - Status: infrav2exp.OCIManagedClusterStatus{}, + Spec: infrastructurev1beta2.OCIManagedClusterSpec{}, + Status: infrastructurev1beta2.OCIManagedClusterStatus{}, } cluster = &clusterv1.Cluster{ ObjectMeta: metav1.ObjectMeta{ @@ -141,7 +136,7 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { Paused: true, }, } - controlPlane := infrav2exp.OCIManagedControlPlane{ + controlPlane := infrastructurev1beta2.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "test", @@ -166,13 +161,13 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { expectedEvent string eventNotExpected string conditionAssertion conditionAssertion - testSpecificSetup func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) + testSpecificSetup func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) }{ { name: "all success", expectedEvent: infrastructurev1beta2.DRGRPCAttachmentEventReady, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionTrue, "", ""}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -193,7 +188,7 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { eventNotExpected: infrastructurev1beta2.DrgEventReady, errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DrgReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(errors.New("some error")) }, @@ -204,7 +199,7 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { eventNotExpected: infrastructurev1beta2.VcnEventReady, errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.VcnReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(errors.New("some error")) @@ -216,7 +211,7 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { eventNotExpected: infrastructurev1beta2.InternetGatewayEventReady, errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.InternetGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -229,7 +224,7 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { eventNotExpected: infrastructurev1beta2.NatEventReady, errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.NatGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -243,7 +238,7 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { eventNotExpected: infrastructurev1beta2.ServiceGatewayEventReady, errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.ServiceGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -258,7 +253,7 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { eventNotExpected: infrastructurev1beta2.NetworkSecurityEventReady, errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.NSGReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -274,7 +269,7 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { eventNotExpected: infrastructurev1beta2.RouteTableEventReady, errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.RouteTableReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -291,7 +286,7 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { eventNotExpected: infrastructurev1beta2.SubnetEventReady, errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.SubnetReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -309,7 +304,7 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { eventNotExpected: infrastructurev1beta2.FailureDomainEventReady, errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.FailureDomainFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -330,7 +325,7 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { eventNotExpected: infrastructurev1beta2.DRGVCNAttachmentEventReady, errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DRGVCNAttachmentReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -349,7 +344,7 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { eventNotExpected: infrastructurev1beta2.DRGRPCAttachmentEventReady, errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DRGRPCAttachmentReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -395,23 +390,23 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { } } -func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { +func TestOCIManagedClusterReconciler_reconcileDelete(t *testing.T) { var ( r OCIManagedClusterReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociCluster *infrav2exp.OCIManagedCluster + ociCluster *infrastructurev1beta2.OCIManagedCluster cs *mock_scope.MockClusterScopeClient ) setup := func(t *testing.T, g *WithT) { mockCtrl = gomock.NewController(t) cs = mock_scope.NewMockClusterScopeClient(mockCtrl) - ociCluster = &infrav2exp.OCIManagedCluster{ + ociCluster = &infrastructurev1beta2.OCIManagedCluster{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{}, - Spec: infrav2exp.OCIManagedClusterSpec{}, - Status: infrav2exp.OCIManagedClusterStatus{}, + Spec: infrastructurev1beta2.OCIManagedClusterSpec{}, + Status: infrastructurev1beta2.OCIManagedClusterStatus{}, } recorder = record.NewFakeRecorder(10) client := fake.NewClientBuilder().WithObjects(getSecret()).Build() @@ -430,11 +425,11 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { errorExpected bool expectedEvent string conditionAssertion conditionAssertion - testSpecificSetup func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) + testSpecificSetup func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) }{ { name: "all success", - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -453,7 +448,7 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { expectedEvent: "ReconcileError", errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DRGRPCAttachmentReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(errors.New("some error")) }, }, @@ -462,7 +457,7 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { expectedEvent: "ReconcileError", errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DRGVCNAttachmentReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(errors.New("some error")) }, @@ -472,7 +467,7 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { expectedEvent: "ReconcileError", errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.NSGReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(errors.New("some error")) @@ -483,7 +478,7 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { expectedEvent: "ReconcileError", errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.SubnetReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -495,7 +490,7 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { expectedEvent: "ReconcileError", errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.RouteTableReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -508,7 +503,7 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { expectedEvent: "ReconcileError", errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.SecurityListReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -522,7 +517,7 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { expectedEvent: "ReconcileError", errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.ServiceGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -537,7 +532,7 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { expectedEvent: "ReconcileError", errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.NatGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -553,7 +548,7 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { expectedEvent: "ReconcileError", errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.InternetGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -570,7 +565,7 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { expectedEvent: "ReconcileError", errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.VcnReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -588,7 +583,7 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { expectedEvent: "ReconcileError", errorExpected: true, conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DrgReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -633,13 +628,13 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { } } -func getOCIManagedClusterWithNoOwner() *infrav2exp.OCIManagedCluster { - ociCluster := &infrav2exp.OCIManagedCluster{ +func getOCIManagedClusterWithNoOwner() *infrastructurev1beta2.OCIManagedCluster { + ociCluster := &infrastructurev1beta2.OCIManagedCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test", }, - Spec: infrav2exp.OCIManagedClusterSpec{ + Spec: infrastructurev1beta2.OCIManagedClusterSpec{ CompartmentId: "test", ControlPlaneEndpoint: clusterv1.APIEndpoint{ Port: 6443, @@ -690,7 +685,7 @@ func getOCIManagedClusterWithNoOwner() *infrav2exp.OCIManagedCluster { return ociCluster } -func getOCIManagedClusterWithOwner() *infrav2exp.OCIManagedCluster { +func getOCIManagedClusterWithOwner() *infrastructurev1beta2.OCIManagedCluster { ociCluster := getOCIManagedClusterWithNoOwner() ociCluster.OwnerReferences = []metav1.OwnerReference{ { @@ -701,38 +696,3 @@ func getOCIManagedClusterWithOwner() *infrav2exp.OCIManagedCluster { } return ociCluster } - -func getPausedInfraCluster() *clusterv1.Cluster { - infraRef := corev1.ObjectReference{ - Name: "oci-cluster", - } - return &clusterv1.Cluster{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-cluster", - Namespace: "test", - }, - Spec: clusterv1.ClusterSpec{ - InfrastructureRef: &infraRef, - Paused: true, - }, - } -} - -func getSecret() *corev1.Secret { - return &corev1.Secret{ - ObjectMeta: metav1.ObjectMeta{ - Name: "bootstrap", - Namespace: "test", - }, - Data: map[string][]byte{ - "value": []byte("test"), - }, - } -} - -type conditionAssertion struct { - conditionType clusterv1.ConditionType - status corev1.ConditionStatus - severity clusterv1.ConditionSeverity - reason string -} diff --git a/exp/controllers/ocimanagedcluster_controlplane_controller.go b/controllers/ocimanagedcluster_controlplane_controller.go similarity index 87% rename from exp/controllers/ocimanagedcluster_controlplane_controller.go rename to controllers/ocimanagedcluster_controlplane_controller.go index c8f8d60c..166e0b4c 100644 --- a/exp/controllers/ocimanagedcluster_controlplane_controller.go +++ b/controllers/ocimanagedcluster_controlplane_controller.go @@ -22,10 +22,10 @@ import ( "time" "github.com/go-logr/logr" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/cluster-api-provider-oci/cloud/ociutil" "github.com/oracle/cluster-api-provider-oci/cloud/scope" cloudutil "github.com/oracle/cluster-api-provider-oci/cloud/util" - infrav2exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" "github.com/oracle/oci-go-sdk/v65/containerengine" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" @@ -74,7 +74,7 @@ func (r *OCIManagedClusterControlPlaneReconciler) Reconcile(ctx context.Context, logger.Info("Inside managed control plane reconciler") // Fetch the OCI managed control plane - controlPlane := &infrav2exp.OCIManagedControlPlane{} + controlPlane := &infrastructurev1beta2.OCIManagedControlPlane{} err := r.Get(ctx, req.NamespacedName, controlPlane) if err != nil { if apierrors.IsNotFound(err) { @@ -100,7 +100,7 @@ func (r *OCIManagedClusterControlPlaneReconciler) Reconcile(ctx context.Context, return ctrl.Result{}, nil } - ociManagedCluster := &infrav2exp.OCIManagedCluster{} + ociManagedCluster := &infrastructurev1beta2.OCIManagedCluster{} ociClusterName := client.ObjectKey{ Namespace: cluster.Namespace, Name: cluster.Spec.InfrastructureRef.Name, @@ -179,9 +179,9 @@ func (r *OCIManagedClusterControlPlaneReconciler) Reconcile(ctx context.Context, } -func (r *OCIManagedClusterControlPlaneReconciler) reconcile(ctx context.Context, controlPlaneScope *scope.ManagedControlPlaneScope, controlPlane *infrav2exp.OCIManagedControlPlane) (ctrl.Result, error) { +func (r *OCIManagedClusterControlPlaneReconciler) reconcile(ctx context.Context, controlPlaneScope *scope.ManagedControlPlaneScope, controlPlane *infrastructurev1beta2.OCIManagedControlPlane) (ctrl.Result, error) { // If the OCIManagedControlPlane doesn't have our finalizer, add it. - controllerutil.AddFinalizer(controlPlane, infrav2exp.ControlPlaneFinalizer) + controllerutil.AddFinalizer(controlPlane, infrastructurev1beta2.ControlPlaneFinalizer) okeControlPlane, err := controlPlaneScope.GetOrCreateControlPlane(ctx) if err != nil { @@ -193,13 +193,13 @@ func (r *OCIManagedClusterControlPlaneReconciler) reconcile(ctx context.Context, switch okeControlPlane.LifecycleState { case containerengine.ClusterLifecycleStateCreating: controlPlaneScope.Info("Managed control plane is pending") - conditions.MarkFalse(controlPlane, infrav2exp.ControlPlaneReadyCondition, infrav2exp.ControlPlaneNotReadyReason, clusterv1.ConditionSeverityInfo, "") + conditions.MarkFalse(controlPlane, infrastructurev1beta2.ControlPlaneReadyCondition, infrastructurev1beta2.ControlPlaneNotReadyReason, clusterv1.ConditionSeverityInfo, "") return reconcile.Result{RequeueAfter: 30 * time.Second}, nil case containerengine.ClusterLifecycleStateUpdating: controlPlaneScope.Info("Managed control plane is updating") r.Recorder.Eventf(controlPlane, corev1.EventTypeNormal, "ControlPlaneUpdating", "Managed control plane is in updating state") - conditions.MarkTrue(controlPlane, infrav2exp.ControlPlaneReadyCondition) + conditions.MarkTrue(controlPlane, infrastructurev1beta2.ControlPlaneReadyCondition) return reconcile.Result{RequeueAfter: 30 * time.Second}, nil case containerengine.ClusterLifecycleStateActive: controlPlaneScope.Info("Managed control plane is active", "endpoints", okeControlPlane.Endpoints) @@ -218,7 +218,7 @@ func (r *OCIManagedClusterControlPlaneReconciler) reconcile(ctx context.Context, // record the event only when machine goes from not ready to ready state r.Recorder.Eventf(controlPlane, corev1.EventTypeNormal, "ControlPlaneReady", "Managed control plane is in ready state") - conditions.MarkTrue(controlPlane, infrav2exp.ControlPlaneReadyCondition) + conditions.MarkTrue(controlPlane, infrastructurev1beta2.ControlPlaneReadyCondition) controlPlaneScope.OCIManagedControlPlane.Status.Ready = true err := controlPlaneScope.ReconcileKubeconfig(ctx, okeControlPlane) @@ -242,7 +242,7 @@ func (r *OCIManagedClusterControlPlaneReconciler) reconcile(ctx context.Context, } return reconcile.Result{RequeueAfter: 180 * time.Second}, nil default: - conditions.MarkFalse(controlPlane, infrav2exp.ControlPlaneReadyCondition, infrav2exp.ControlPlaneProvisionFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(controlPlane, infrastructurev1beta2.ControlPlaneReadyCondition, infrastructurev1beta2.ControlPlaneProvisionFailedReason, clusterv1.ConditionSeverityError, "") r.Recorder.Eventf(controlPlane, corev1.EventTypeWarning, "ReconcileError", "Managed control plane has invalid lifecycle state %s", okeControlPlane.LifecycleState) return reconcile.Result{}, errors.New(fmt.Sprintf("Control plane has invalid lifecycle state %s", okeControlPlane.LifecycleState)) @@ -255,9 +255,9 @@ func (r *OCIManagedClusterControlPlaneReconciler) SetupWithManager(ctx context.C ociManagedClusterMapper, err := OCIManagedClusterToOCIManagedControlPlaneMapper(ctx, r.Client, log) c, err := ctrl.NewControllerManagedBy(mgr). WithOptions(options). - For(&infrav2exp.OCIManagedControlPlane{}). + For(&infrastructurev1beta2.OCIManagedControlPlane{}). Watches( - &source.Kind{Type: &infrav2exp.OCIManagedCluster{}}, + &source.Kind{Type: &infrastructurev1beta2.OCIManagedCluster{}}, handler.EnqueueRequestsFromMapFunc(ociManagedClusterMapper), ). Build(r) @@ -296,7 +296,7 @@ func (r *OCIManagedClusterControlPlaneReconciler) clusterToInfrastructureMapFunc return nil } - ociCluster := &infrav2exp.OCIManagedCluster{} + ociCluster := &infrastructurev1beta2.OCIManagedCluster{} key := types.NamespacedName{Namespace: c.Spec.InfrastructureRef.Namespace, Name: c.Spec.InfrastructureRef.Name} if err := r.Get(ctx, key, ociCluster); err != nil { @@ -323,15 +323,15 @@ func (r *OCIManagedClusterControlPlaneReconciler) clusterToInfrastructureMapFunc } func (r *OCIManagedClusterControlPlaneReconciler) reconcileDelete(ctx context.Context, - controlPlaneScope *scope.ManagedControlPlaneScope, controlPlane *infrav2exp.OCIManagedControlPlane) (ctrl.Result, error) { + controlPlaneScope *scope.ManagedControlPlaneScope, controlPlane *infrastructurev1beta2.OCIManagedControlPlane) (ctrl.Result, error) { controlPlaneScope.Info("Handling deleted OCiManagedControlPlane") cluster, err := controlPlaneScope.GetOKECluster(ctx) if err != nil { if ociutil.IsNotFound(err) { - controllerutil.RemoveFinalizer(controlPlaneScope.OCIManagedControlPlane, infrav2exp.ControlPlaneFinalizer) + controllerutil.RemoveFinalizer(controlPlaneScope.OCIManagedControlPlane, infrastructurev1beta2.ControlPlaneFinalizer) controlPlaneScope.Info("Cluster is not found, may have been deleted") - conditions.MarkTrue(controlPlaneScope.OCIManagedControlPlane, infrav2exp.ControlPlaneNotFoundReason) + conditions.MarkTrue(controlPlaneScope.OCIManagedControlPlane, infrastructurev1beta2.ControlPlaneNotFoundReason) controlPlaneScope.OCIManagedControlPlane.Status.Ready = false return reconcile.Result{}, nil } else { @@ -343,20 +343,20 @@ func (r *OCIManagedClusterControlPlaneReconciler) reconcileDelete(ctx context.Co } if cluster == nil { controlPlaneScope.Info("Cluster is not found, may have been deleted") - controllerutil.RemoveFinalizer(controlPlane, infrav2exp.ControlPlaneFinalizer) + controllerutil.RemoveFinalizer(controlPlane, infrastructurev1beta2.ControlPlaneFinalizer) return reconcile.Result{}, nil } switch cluster.LifecycleState { case containerengine.ClusterLifecycleStateDeleting: controlPlane.Status.Ready = false - conditions.MarkFalse(controlPlane, infrav2exp.ControlPlaneReadyCondition, infrav2exp.ControlPlaneDeletionInProgress, clusterv1.ConditionSeverityWarning, "") + conditions.MarkFalse(controlPlane, infrastructurev1beta2.ControlPlaneReadyCondition, infrastructurev1beta2.ControlPlaneDeletionInProgress, clusterv1.ConditionSeverityWarning, "") r.Recorder.Eventf(controlPlane, corev1.EventTypeWarning, "DeletionInProgress", "Managed control plane deletion in progress") controlPlaneScope.Info("Managed control plane is deleting") return reconcile.Result{RequeueAfter: 30 * time.Second}, nil case containerengine.ClusterLifecycleStateDeleted: - conditions.MarkFalse(controlPlane, infrav2exp.ControlPlaneReadyCondition, infrav2exp.ControlPlaneDeletedReason, clusterv1.ConditionSeverityWarning, "") - controllerutil.RemoveFinalizer(controlPlane, infrav2exp.ControlPlaneFinalizer) + conditions.MarkFalse(controlPlane, infrastructurev1beta2.ControlPlaneReadyCondition, infrastructurev1beta2.ControlPlaneDeletedReason, clusterv1.ConditionSeverityWarning, "") + controllerutil.RemoveFinalizer(controlPlane, infrastructurev1beta2.ControlPlaneFinalizer) controlPlaneScope.Info("Managed control plane is deleted") return reconcile.Result{}, nil default: @@ -364,14 +364,14 @@ func (r *OCIManagedClusterControlPlaneReconciler) reconcileDelete(ctx context.Co controlPlaneScope.Error(err, "Error deleting managed control plane") return ctrl.Result{}, errors.Wrapf(err, "error deleting cluster %s", controlPlaneScope.GetClusterName()) } - conditions.MarkFalse(controlPlane, infrav2exp.ControlPlaneReadyCondition, infrav2exp.ControlPlaneDeletionInProgress, clusterv1.ConditionSeverityWarning, "") + conditions.MarkFalse(controlPlane, infrastructurev1beta2.ControlPlaneReadyCondition, infrastructurev1beta2.ControlPlaneDeletionInProgress, clusterv1.ConditionSeverityWarning, "") return reconcile.Result{RequeueAfter: 30 * time.Second}, nil } } func OCIManagedClusterToOCIManagedControlPlaneMapper(ctx context.Context, c client.Client, log logr.Logger) (handler.MapFunc, error) { return func(o client.Object) []ctrl.Request { - ociCluster, ok := o.(*infrav2exp.OCIManagedCluster) + ociCluster, ok := o.(*infrastructurev1beta2.OCIManagedCluster) if !ok { log.Error(errors.Errorf("expected an OCIManagedCluster, got %T instead", o), "failed to map OCIManagedCluster") return nil diff --git a/exp/controllers/ocimanagedcluster_controlplane_controller_test.go b/controllers/ocimanagedcluster_controlplane_controller_test.go similarity index 88% rename from exp/controllers/ocimanagedcluster_controlplane_controller_test.go rename to controllers/ocimanagedcluster_controlplane_controller_test.go index 06de0f46..b5d9e4e8 100644 --- a/exp/controllers/ocimanagedcluster_controlplane_controller_test.go +++ b/controllers/ocimanagedcluster_controlplane_controller_test.go @@ -24,11 +24,11 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/gomega" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/cluster-api-provider-oci/cloud/ociutil" "github.com/oracle/cluster-api-provider-oci/cloud/scope" "github.com/oracle/cluster-api-provider-oci/cloud/services/base/mock_base" "github.com/oracle/cluster-api-provider-oci/cloud/services/containerengine/mock_containerengine" - infrav2exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" "github.com/oracle/oci-go-sdk/v65/common" oke "github.com/oracle/oci-go-sdk/v65/containerengine" corev1 "k8s.io/api/core/v1" @@ -61,12 +61,12 @@ func TestControlPlaneReconciliation(t *testing.T) { teardown := func(t *testing.T, g *WithT) { mockCtrl.Finish() } - notReadyCluster := &infrav2exp.OCIManagedCluster{ + notReadyCluster := &infrastructurev1beta2.OCIManagedCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "oci-cluster", Namespace: "test", }, - Status: infrav2exp.OCIManagedClusterStatus{ + Status: infrastructurev1beta2.OCIManagedClusterStatus{ Ready: false, }, } @@ -160,7 +160,7 @@ func TestControlPlaneReconciliationFunction(t *testing.T) { r OCIManagedClusterControlPlaneReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociManagedControlPlane *infrav2exp.OCIManagedControlPlane + ociManagedControlPlane *infrastructurev1beta2.OCIManagedControlPlane okeClient *mock_containerengine.MockClient ms *scope.ManagedControlPlaneScope baseClient *mock_base.MockBaseClient @@ -229,7 +229,7 @@ func TestControlPlaneReconciliationFunction(t *testing.T) { { name: "control plane in creating state", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav2exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrav2exp.ControlPlaneNotReadyReason}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrastructurev1beta2.ControlPlaneNotReadyReason}}, testSpecificSetup: func(controlPlaneScope *scope.ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetCluster(gomock.Any(), gomock.Eq(oke.GetClusterRequest{ ClusterId: common.String("test"), @@ -246,7 +246,7 @@ func TestControlPlaneReconciliationFunction(t *testing.T) { { name: "control plane create", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav2exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrav2exp.ControlPlaneNotReadyReason}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrastructurev1beta2.ControlPlaneNotReadyReason}}, testSpecificSetup: func(controlPlaneScope *scope.ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { ociManagedControlPlane.Spec.ID = nil okeClient.EXPECT().ListClusters(gomock.Any(), gomock.Any()). @@ -275,7 +275,7 @@ func TestControlPlaneReconciliationFunction(t *testing.T) { { name: "control plane is created, no update", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav2exp.ControlPlaneReadyCondition, corev1.ConditionTrue, "", ""}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.ControlPlaneReadyCondition, corev1.ConditionTrue, "", ""}}, testSpecificSetup: func(controlPlaneScope *scope.ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetCluster(gomock.Any(), gomock.Eq(oke.GetClusterRequest{ ClusterId: common.String("test"), @@ -345,7 +345,7 @@ func TestControlPlaneReconciliationFunction(t *testing.T) { { name: "control plane in created, update", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav2exp.ControlPlaneReadyCondition, corev1.ConditionTrue, "", ""}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.ControlPlaneReadyCondition, corev1.ConditionTrue, "", ""}}, testSpecificSetup: func(controlPlaneScope *scope.ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetCluster(gomock.Any(), gomock.Eq(oke.GetClusterRequest{ ClusterId: common.String("test"), @@ -416,7 +416,7 @@ func TestControlPlaneReconciliationFunction(t *testing.T) { { name: "control plane in error state", errorExpected: true, - conditionAssertion: []conditionAssertion{{infrav2exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrav2exp.ControlPlaneProvisionFailedReason}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.ControlPlaneProvisionFailedReason}}, testSpecificSetup: func(controlPlaneScope *scope.ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetCluster(gomock.Any(), gomock.Eq(oke.GetClusterRequest{ ClusterId: common.String("test"), @@ -476,7 +476,7 @@ func TestControlPlaneDeletionFunction(t *testing.T) { r OCIManagedClusterControlPlaneReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociManagedControlPlane *infrav2exp.OCIManagedControlPlane + ociManagedControlPlane *infrastructurev1beta2.OCIManagedControlPlane okeClient *mock_containerengine.MockClient ms *scope.ManagedControlPlaneScope baseClient *mock_base.MockBaseClient @@ -529,7 +529,7 @@ func TestControlPlaneDeletionFunction(t *testing.T) { { name: "control plane to be deleted", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav2exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav2exp.ControlPlaneDeletionInProgress}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrastructurev1beta2.ControlPlaneDeletionInProgress}}, testSpecificSetup: func(controlPlaneScope *scope.ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetCluster(gomock.Any(), gomock.Eq(oke.GetClusterRequest{ ClusterId: common.String("test"), @@ -550,7 +550,7 @@ func TestControlPlaneDeletionFunction(t *testing.T) { { name: "control plane not found", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav2exp.ControlPlaneNotFoundReason, corev1.ConditionTrue, "", ""}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.ControlPlaneNotFoundReason, corev1.ConditionTrue, "", ""}}, testSpecificSetup: func(controlPlaneScope *scope.ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetCluster(gomock.Any(), gomock.Eq(oke.GetClusterRequest{ ClusterId: common.String("test"), @@ -561,7 +561,7 @@ func TestControlPlaneDeletionFunction(t *testing.T) { { name: "control plane deleting", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav2exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav2exp.ControlPlaneDeletionInProgress}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrastructurev1beta2.ControlPlaneDeletionInProgress}}, testSpecificSetup: func(controlPlaneScope *scope.ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetCluster(gomock.Any(), gomock.Eq(oke.GetClusterRequest{ ClusterId: common.String("test"), @@ -578,7 +578,7 @@ func TestControlPlaneDeletionFunction(t *testing.T) { { name: "control plane deleted", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav2exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav2exp.ControlPlaneDeletedReason}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrastructurev1beta2.ControlPlaneDeletedReason}}, testSpecificSetup: func(controlPlaneScope *scope.ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetCluster(gomock.Any(), gomock.Eq(oke.GetClusterRequest{ ClusterId: common.String("test"), @@ -617,14 +617,14 @@ func TestControlPlaneDeletionFunction(t *testing.T) { } } -func getControlPlanePoolWithNoOwner() *infrav2exp.OCIManagedControlPlane { +func getControlPlanePoolWithNoOwner() *infrastructurev1beta2.OCIManagedControlPlane { ociControlplane := getOCIManagedControlPlane() ociControlplane.OwnerReferences = []metav1.OwnerReference{} return ociControlplane } -func getOCIManagedControlPlane() *infrav2exp.OCIManagedControlPlane { - return &infrav2exp.OCIManagedControlPlane{ +func getOCIManagedControlPlane() *infrastructurev1beta2.OCIManagedControlPlane { + return &infrastructurev1beta2.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "test", @@ -645,24 +645,24 @@ func getOCIManagedControlPlane() *infrav2exp.OCIManagedControlPlane { }, }, }, - Spec: infrav2exp.OCIManagedControlPlaneSpec{ + Spec: infrastructurev1beta2.OCIManagedControlPlaneSpec{ ID: common.String("test"), - ClusterPodNetworkOptions: []infrav2exp.ClusterPodNetworkOptions{ + ClusterPodNetworkOptions: []infrastructurev1beta2.ClusterPodNetworkOptions{ { - CniType: infrav2exp.FlannelCNI, + CniType: infrastructurev1beta2.FlannelCNI, }, }, - ImagePolicyConfig: &infrav2exp.ImagePolicyConfig{ + ImagePolicyConfig: &infrastructurev1beta2.ImagePolicyConfig{ IsPolicyEnabled: common.Bool(true), - KeyDetails: []infrav2exp.KeyDetails{{ + KeyDetails: []infrastructurev1beta2.KeyDetails{{ KmsKeyId: common.String("kms-key-id"), }}, }, - ClusterOption: infrav2exp.ClusterOptions{ - AdmissionControllerOptions: &infrav2exp.AdmissionControllerOptions{ + ClusterOption: infrastructurev1beta2.ClusterOptions{ + AdmissionControllerOptions: &infrastructurev1beta2.AdmissionControllerOptions{ IsPodSecurityPolicyEnabled: common.Bool(true), }, - AddOnOptions: &infrav2exp.AddOnOptions{ + AddOnOptions: &infrastructurev1beta2.AddOnOptions{ IsKubernetesDashboardEnabled: common.Bool(true), IsTillerEnabled: common.Bool(false), }, @@ -673,7 +673,7 @@ func getOCIManagedControlPlane() *infrav2exp.OCIManagedControlPlane { } } -func expectControlPlaneConditions(g *WithT, m *infrav2exp.OCIManagedControlPlane, expected []conditionAssertion) { +func expectControlPlaneConditions(g *WithT, m *infrastructurev1beta2.OCIManagedControlPlane, expected []conditionAssertion) { g.Expect(len(m.Status.Conditions)).To(BeNumerically(">=", len(expected)), "number of conditions") for _, c := range expected { actual := conditions.Get(m, c.conditionType) diff --git a/exp/api/v1beta1/constants.go b/exp/api/v1beta1/constants.go index 93830eae..bfb51b8b 100644 --- a/exp/api/v1beta1/constants.go +++ b/exp/api/v1beta1/constants.go @@ -16,7 +16,4 @@ package v1beta1 -const ( - PodDefaultName = "pod" - PodDefaultCIDR = "10.0.128.0/18" -) +const () diff --git a/exp/api/v1beta1/conversion.go b/exp/api/v1beta1/conversion.go index ed1892f7..18d9b6e5 100644 --- a/exp/api/v1beta1/conversion.go +++ b/exp/api/v1beta1/conversion.go @@ -28,34 +28,16 @@ func Convert_v1beta1_NetworkSpec_To_v1beta2_NetworkSpec(in *infrastructurev1beta return infrastructurev1beta1.Convert_v1beta1_NetworkSpec_To_v1beta2_NetworkSpec(in, out, s) } -// Convert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec converts v1beta1 OCIManagedClusterSpec to v1beta2 OCIManagedClusterSpec -func Convert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec(in *v1beta2.OCIManagedClusterSpec, out *OCIManagedClusterSpec, s conversion.Scope) error { - return autoConvert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec(in, out, s) -} - // Convert_v1beta2_NetworkSpec_To_v1beta1_NetworkSpec converts v1beta2 NetworkSpec to v1beta1 NetworkSpec func Convert_v1beta2_NetworkSpec_To_v1beta1_NetworkSpec(in *infrastructurev1beta2.NetworkSpec, out *infrastructurev1beta1.NetworkSpec, s conversion.Scope) error { return infrastructurev1beta1.Convert_v1beta2_NetworkSpec_To_v1beta1_NetworkSpec(in, out, s) } -// Convert_v1beta1_OCIManagedClusterStatus_To_v1beta2_OCIManagedClusterStatus converts v1beta1 OCIManagedClusterStatus to v1beta2 OCIManagedClusterStatus -func Convert_v1beta1_OCIManagedClusterStatus_To_v1beta2_OCIManagedClusterStatus(in *OCIManagedClusterStatus, out *v1beta2.OCIManagedClusterStatus, s conversion.Scope) error { - return autoConvert_v1beta1_OCIManagedClusterStatus_To_v1beta2_OCIManagedClusterStatus(in, out, s) -} - // Convert_v1beta2_NetworkDetails_To_v1beta1_NetworkDetails converts v1beta2 NetworkDetails to v1beta1 NetworkDetails func Convert_v1beta2_NetworkDetails_To_v1beta1_NetworkDetails(in *infrastructurev1beta2.NetworkDetails, out *infrastructurev1beta1.NetworkDetails, s conversion.Scope) error { return infrastructurev1beta1.Convert_v1beta2_NetworkDetails_To_v1beta1_NetworkDetails(in, out, s) } -func Convert_v1beta2_OCIManagedControlPlaneSpec_To_v1beta1_OCIManagedControlPlaneSpec(in *v1beta2.OCIManagedControlPlaneSpec, out *OCIManagedControlPlaneSpec, s conversion.Scope) error { - return autoConvert_v1beta2_OCIManagedControlPlaneSpec_To_v1beta1_OCIManagedControlPlaneSpec(in, out, s) -} - func Convert_v1beta2_OCIManagedMachinePoolSpec_To_v1beta1_OCIManagedMachinePoolSpec(in *v1beta2.OCIManagedMachinePoolSpec, out *OCIManagedMachinePoolSpec, s conversion.Scope) error { return autoConvert_v1beta2_OCIManagedMachinePoolSpec_To_v1beta1_OCIManagedMachinePoolSpec(in, out, s) } - -func Convert_v1beta2_OCIManagedControlPlaneStatus_To_v1beta1_OCIManagedControlPlaneStatus(in *v1beta2.OCIManagedControlPlaneStatus, out *OCIManagedControlPlaneStatus, s conversion.Scope) error { - return autoConvert_v1beta2_OCIManagedControlPlaneStatus_To_v1beta1_OCIManagedControlPlaneStatus(in, out, s) -} diff --git a/exp/api/v1beta1/conversion_test.go b/exp/api/v1beta1/conversion_test.go index cafd3c65..47747839 100644 --- a/exp/api/v1beta1/conversion_test.go +++ b/exp/api/v1beta1/conversion_test.go @@ -21,7 +21,6 @@ import ( fuzz "github.com/google/gofuzz" . "github.com/onsi/gomega" - infrav1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" "k8s.io/apimachinery/pkg/api/apitesting/fuzzer" "k8s.io/apimachinery/pkg/runtime" @@ -32,7 +31,6 @@ import ( func fuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} { return []interface{}{ OCIMachinePoolFuzzer, - OCIClusterFuzzer, } } @@ -45,41 +43,12 @@ func OCIMachinePoolFuzzer(obj *OCIMachinePool, c fuzz.Continue) { } } -func OCIClusterFuzzer(obj *OCIManagedCluster, c fuzz.Continue) { - c.FuzzNoCustom(obj) - // nil fields which have been removed so that tests dont fail - for _, nsg := range obj.Spec.NetworkSpec.Vcn.NetworkSecurityGroups { - if nsg != nil { - ingressRules := make([]infrav1beta1.IngressSecurityRuleForNSG, len(nsg.IngressRules)) - for _, rule := range nsg.IngressRules { - rule.ID = nil - ingressRules = append(ingressRules, rule) - } - nsg.IngressRules = ingressRules - - egressRules := make([]infrav1beta1.EgressSecurityRuleForNSG, len(nsg.EgressRules)) - for _, rule := range nsg.EgressRules { - (&rule).ID = nil - egressRules = append(egressRules, rule) - } - nsg.EgressRules = egressRules - } - } -} - func TestFuzzyConversion(t *testing.T) { g := NewWithT(t) scheme := runtime.NewScheme() g.Expect(AddToScheme(scheme)).To(Succeed()) g.Expect(v1beta2.AddToScheme(scheme)).To(Succeed()) - t.Run("for OCIManagedCluster", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &v1beta2.OCIManagedCluster{}, - Spoke: &OCIManagedCluster{}, - FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, - })) - t.Run("for OCIMachinePool", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ Scheme: scheme, Hub: &v1beta2.OCIMachinePool{}, @@ -94,11 +63,4 @@ func TestFuzzyConversion(t *testing.T) { FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, })) - t.Run("for OCIManagedControlPlane", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &v1beta2.OCIManagedControlPlane{}, - Spoke: &OCIManagedControlPlane{}, - FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, - })) - } diff --git a/exp/api/v1beta1/ocimanagedmachinepool_types.go b/exp/api/v1beta1/ocimanagedmachinepool_types.go index b9e0aca0..fc694eee 100644 --- a/exp/api/v1beta1/ocimanagedmachinepool_types.go +++ b/exp/api/v1beta1/ocimanagedmachinepool_types.go @@ -1,6 +1,7 @@ package v1beta1 import ( + infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/errors" @@ -89,19 +90,12 @@ type NodePoolNodeConfig struct { NodePoolPodNetworkOptionDetails *NodePoolPodNetworkOptionDetails `json:"nodePoolPodNetworkOptionDetails,omitempty"` } -const ( - VCNNativeCNI CNIOptionEnum = "OCI_VCN_IP_NATIVE" - FlannelCNI CNIOptionEnum = "FLANNEL_OVERLAY" -) - -type CNIOptionEnum string - // NodePoolPodNetworkOptionDetails describes the CNI related configuration of pods in the node pool. type NodePoolPodNetworkOptionDetails struct { // CniType describes the CNI plugin used by this node pool. Allowed values are OCI_VCN_IP_NATIVE and FLANNEL_OVERLAY. // +optional - CniType CNIOptionEnum `json:"cniType,omitempty"` + CniType infrastructurev1beta1.CNIOptionEnum `json:"cniType,omitempty"` // VcnIpNativePodNetworkOptions describes the network options specific to using the OCI VCN Native CNI // +optional diff --git a/exp/api/v1beta1/zz_generated.conversion.go b/exp/api/v1beta1/zz_generated.conversion.go index 060a497b..ca21e436 100644 --- a/exp/api/v1beta1/zz_generated.conversion.go +++ b/exp/api/v1beta1/zz_generated.conversion.go @@ -27,7 +27,6 @@ import ( apiv1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" apiv1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" v1beta2 "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" - v1 "k8s.io/api/core/v1" conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" clusterapiapiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" @@ -41,66 +40,6 @@ func init() { // RegisterConversions adds conversion functions to the given scheme. // Public to allow building arbitrary schemes. func RegisterConversions(s *runtime.Scheme) error { - if err := s.AddGeneratedConversionFunc((*AddOnOptions)(nil), (*v1beta2.AddOnOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AddOnOptions_To_v1beta2_AddOnOptions(a.(*AddOnOptions), b.(*v1beta2.AddOnOptions), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.AddOnOptions)(nil), (*AddOnOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_AddOnOptions_To_v1beta1_AddOnOptions(a.(*v1beta2.AddOnOptions), b.(*AddOnOptions), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AdmissionControllerOptions)(nil), (*v1beta2.AdmissionControllerOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AdmissionControllerOptions_To_v1beta2_AdmissionControllerOptions(a.(*AdmissionControllerOptions), b.(*v1beta2.AdmissionControllerOptions), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.AdmissionControllerOptions)(nil), (*AdmissionControllerOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_AdmissionControllerOptions_To_v1beta1_AdmissionControllerOptions(a.(*v1beta2.AdmissionControllerOptions), b.(*AdmissionControllerOptions), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*ClusterOptions)(nil), (*v1beta2.ClusterOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ClusterOptions_To_v1beta2_ClusterOptions(a.(*ClusterOptions), b.(*v1beta2.ClusterOptions), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.ClusterOptions)(nil), (*ClusterOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_ClusterOptions_To_v1beta1_ClusterOptions(a.(*v1beta2.ClusterOptions), b.(*ClusterOptions), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*ClusterPodNetworkOptions)(nil), (*v1beta2.ClusterPodNetworkOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ClusterPodNetworkOptions_To_v1beta2_ClusterPodNetworkOptions(a.(*ClusterPodNetworkOptions), b.(*v1beta2.ClusterPodNetworkOptions), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.ClusterPodNetworkOptions)(nil), (*ClusterPodNetworkOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_ClusterPodNetworkOptions_To_v1beta1_ClusterPodNetworkOptions(a.(*v1beta2.ClusterPodNetworkOptions), b.(*ClusterPodNetworkOptions), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*EndpointConfig)(nil), (*v1beta2.EndpointConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_EndpointConfig_To_v1beta2_EndpointConfig(a.(*EndpointConfig), b.(*v1beta2.EndpointConfig), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.EndpointConfig)(nil), (*EndpointConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_EndpointConfig_To_v1beta1_EndpointConfig(a.(*v1beta2.EndpointConfig), b.(*EndpointConfig), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*ImagePolicyConfig)(nil), (*v1beta2.ImagePolicyConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ImagePolicyConfig_To_v1beta2_ImagePolicyConfig(a.(*ImagePolicyConfig), b.(*v1beta2.ImagePolicyConfig), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.ImagePolicyConfig)(nil), (*ImagePolicyConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_ImagePolicyConfig_To_v1beta1_ImagePolicyConfig(a.(*v1beta2.ImagePolicyConfig), b.(*ImagePolicyConfig), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*InstanceConfiguration)(nil), (*v1beta2.InstanceConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_InstanceConfiguration_To_v1beta2_InstanceConfiguration(a.(*InstanceConfiguration), b.(*v1beta2.InstanceConfiguration), scope) }); err != nil { @@ -131,16 +70,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*KeyDetails)(nil), (*v1beta2.KeyDetails)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_KeyDetails_To_v1beta2_KeyDetails(a.(*KeyDetails), b.(*v1beta2.KeyDetails), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.KeyDetails)(nil), (*KeyDetails)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_KeyDetails_To_v1beta1_KeyDetails(a.(*v1beta2.KeyDetails), b.(*KeyDetails), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*KeyValue)(nil), (*v1beta2.KeyValue)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_KeyValue_To_v1beta2_KeyValue(a.(*KeyValue), b.(*v1beta2.KeyValue), scope) }); err != nil { @@ -151,16 +80,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*KubernetesNetworkConfig)(nil), (*v1beta2.KubernetesNetworkConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_KubernetesNetworkConfig_To_v1beta2_KubernetesNetworkConfig(a.(*KubernetesNetworkConfig), b.(*v1beta2.KubernetesNetworkConfig), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.KubernetesNetworkConfig)(nil), (*KubernetesNetworkConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_KubernetesNetworkConfig_To_v1beta1_KubernetesNetworkConfig(a.(*v1beta2.KubernetesNetworkConfig), b.(*KubernetesNetworkConfig), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*LaunchDetails)(nil), (*v1beta2.LaunchDetails)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_LaunchDetails_To_v1beta2_LaunchDetails(a.(*LaunchDetails), b.(*v1beta2.LaunchDetails), scope) }); err != nil { @@ -261,146 +180,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*OCIManagedCluster)(nil), (*v1beta2.OCIManagedCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OCIManagedCluster_To_v1beta2_OCIManagedCluster(a.(*OCIManagedCluster), b.(*v1beta2.OCIManagedCluster), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedCluster)(nil), (*OCIManagedCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_OCIManagedCluster_To_v1beta1_OCIManagedCluster(a.(*v1beta2.OCIManagedCluster), b.(*OCIManagedCluster), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*OCIManagedClusterList)(nil), (*v1beta2.OCIManagedClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OCIManagedClusterList_To_v1beta2_OCIManagedClusterList(a.(*OCIManagedClusterList), b.(*v1beta2.OCIManagedClusterList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedClusterList)(nil), (*OCIManagedClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_OCIManagedClusterList_To_v1beta1_OCIManagedClusterList(a.(*v1beta2.OCIManagedClusterList), b.(*OCIManagedClusterList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*OCIManagedClusterSpec)(nil), (*v1beta2.OCIManagedClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OCIManagedClusterSpec_To_v1beta2_OCIManagedClusterSpec(a.(*OCIManagedClusterSpec), b.(*v1beta2.OCIManagedClusterSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedClusterStatus)(nil), (*OCIManagedClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_OCIManagedClusterStatus_To_v1beta1_OCIManagedClusterStatus(a.(*v1beta2.OCIManagedClusterStatus), b.(*OCIManagedClusterStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*OCIManagedClusterTemplate)(nil), (*v1beta2.OCIManagedClusterTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OCIManagedClusterTemplate_To_v1beta2_OCIManagedClusterTemplate(a.(*OCIManagedClusterTemplate), b.(*v1beta2.OCIManagedClusterTemplate), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedClusterTemplate)(nil), (*OCIManagedClusterTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_OCIManagedClusterTemplate_To_v1beta1_OCIManagedClusterTemplate(a.(*v1beta2.OCIManagedClusterTemplate), b.(*OCIManagedClusterTemplate), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*OCIManagedClusterTemplateList)(nil), (*v1beta2.OCIManagedClusterTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OCIManagedClusterTemplateList_To_v1beta2_OCIManagedClusterTemplateList(a.(*OCIManagedClusterTemplateList), b.(*v1beta2.OCIManagedClusterTemplateList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedClusterTemplateList)(nil), (*OCIManagedClusterTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_OCIManagedClusterTemplateList_To_v1beta1_OCIManagedClusterTemplateList(a.(*v1beta2.OCIManagedClusterTemplateList), b.(*OCIManagedClusterTemplateList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*OCIManagedClusterTemplateResource)(nil), (*v1beta2.OCIManagedClusterTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OCIManagedClusterTemplateResource_To_v1beta2_OCIManagedClusterTemplateResource(a.(*OCIManagedClusterTemplateResource), b.(*v1beta2.OCIManagedClusterTemplateResource), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedClusterTemplateResource)(nil), (*OCIManagedClusterTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_OCIManagedClusterTemplateResource_To_v1beta1_OCIManagedClusterTemplateResource(a.(*v1beta2.OCIManagedClusterTemplateResource), b.(*OCIManagedClusterTemplateResource), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*OCIManagedClusterTemplateSpec)(nil), (*v1beta2.OCIManagedClusterTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OCIManagedClusterTemplateSpec_To_v1beta2_OCIManagedClusterTemplateSpec(a.(*OCIManagedClusterTemplateSpec), b.(*v1beta2.OCIManagedClusterTemplateSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedClusterTemplateSpec)(nil), (*OCIManagedClusterTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_OCIManagedClusterTemplateSpec_To_v1beta1_OCIManagedClusterTemplateSpec(a.(*v1beta2.OCIManagedClusterTemplateSpec), b.(*OCIManagedClusterTemplateSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*OCIManagedControlPlane)(nil), (*v1beta2.OCIManagedControlPlane)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OCIManagedControlPlane_To_v1beta2_OCIManagedControlPlane(a.(*OCIManagedControlPlane), b.(*v1beta2.OCIManagedControlPlane), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedControlPlane)(nil), (*OCIManagedControlPlane)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_OCIManagedControlPlane_To_v1beta1_OCIManagedControlPlane(a.(*v1beta2.OCIManagedControlPlane), b.(*OCIManagedControlPlane), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*OCIManagedControlPlaneList)(nil), (*v1beta2.OCIManagedControlPlaneList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OCIManagedControlPlaneList_To_v1beta2_OCIManagedControlPlaneList(a.(*OCIManagedControlPlaneList), b.(*v1beta2.OCIManagedControlPlaneList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedControlPlaneList)(nil), (*OCIManagedControlPlaneList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_OCIManagedControlPlaneList_To_v1beta1_OCIManagedControlPlaneList(a.(*v1beta2.OCIManagedControlPlaneList), b.(*OCIManagedControlPlaneList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*OCIManagedControlPlaneSpec)(nil), (*v1beta2.OCIManagedControlPlaneSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OCIManagedControlPlaneSpec_To_v1beta2_OCIManagedControlPlaneSpec(a.(*OCIManagedControlPlaneSpec), b.(*v1beta2.OCIManagedControlPlaneSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*OCIManagedControlPlaneStatus)(nil), (*v1beta2.OCIManagedControlPlaneStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OCIManagedControlPlaneStatus_To_v1beta2_OCIManagedControlPlaneStatus(a.(*OCIManagedControlPlaneStatus), b.(*v1beta2.OCIManagedControlPlaneStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*OCIManagedControlPlaneTemplate)(nil), (*v1beta2.OCIManagedControlPlaneTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OCIManagedControlPlaneTemplate_To_v1beta2_OCIManagedControlPlaneTemplate(a.(*OCIManagedControlPlaneTemplate), b.(*v1beta2.OCIManagedControlPlaneTemplate), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedControlPlaneTemplate)(nil), (*OCIManagedControlPlaneTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_OCIManagedControlPlaneTemplate_To_v1beta1_OCIManagedControlPlaneTemplate(a.(*v1beta2.OCIManagedControlPlaneTemplate), b.(*OCIManagedControlPlaneTemplate), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*OCIManagedControlPlaneTemplateList)(nil), (*v1beta2.OCIManagedControlPlaneTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OCIManagedControlPlaneTemplateList_To_v1beta2_OCIManagedControlPlaneTemplateList(a.(*OCIManagedControlPlaneTemplateList), b.(*v1beta2.OCIManagedControlPlaneTemplateList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedControlPlaneTemplateList)(nil), (*OCIManagedControlPlaneTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_OCIManagedControlPlaneTemplateList_To_v1beta1_OCIManagedControlPlaneTemplateList(a.(*v1beta2.OCIManagedControlPlaneTemplateList), b.(*OCIManagedControlPlaneTemplateList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*OCIManagedControlPlaneTemplateResource)(nil), (*v1beta2.OCIManagedControlPlaneTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OCIManagedControlPlaneTemplateResource_To_v1beta2_OCIManagedControlPlaneTemplateResource(a.(*OCIManagedControlPlaneTemplateResource), b.(*v1beta2.OCIManagedControlPlaneTemplateResource), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedControlPlaneTemplateResource)(nil), (*OCIManagedControlPlaneTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_OCIManagedControlPlaneTemplateResource_To_v1beta1_OCIManagedControlPlaneTemplateResource(a.(*v1beta2.OCIManagedControlPlaneTemplateResource), b.(*OCIManagedControlPlaneTemplateResource), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*OCIManagedControlPlaneTemplateSpec)(nil), (*v1beta2.OCIManagedControlPlaneTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OCIManagedControlPlaneTemplateSpec_To_v1beta2_OCIManagedControlPlaneTemplateSpec(a.(*OCIManagedControlPlaneTemplateSpec), b.(*v1beta2.OCIManagedControlPlaneTemplateSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedControlPlaneTemplateSpec)(nil), (*OCIManagedControlPlaneTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_OCIManagedControlPlaneTemplateSpec_To_v1beta1_OCIManagedControlPlaneTemplateSpec(a.(*v1beta2.OCIManagedControlPlaneTemplateSpec), b.(*OCIManagedControlPlaneTemplateSpec), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*OCIManagedMachinePool)(nil), (*v1beta2.OCIManagedMachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_OCIManagedMachinePool_To_v1beta2_OCIManagedMachinePool(a.(*OCIManagedMachinePool), b.(*v1beta2.OCIManagedMachinePool), scope) }); err != nil { @@ -591,11 +370,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddConversionFunc((*OCIManagedClusterStatus)(nil), (*v1beta2.OCIManagedClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OCIManagedClusterStatus_To_v1beta2_OCIManagedClusterStatus(a.(*OCIManagedClusterStatus), b.(*v1beta2.OCIManagedClusterStatus), scope) - }); err != nil { - return err - } if err := s.AddConversionFunc((*apiv1beta2.NetworkDetails)(nil), (*apiv1beta1.NetworkDetails)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta2_NetworkDetails_To_v1beta1_NetworkDetails(a.(*apiv1beta2.NetworkDetails), b.(*apiv1beta1.NetworkDetails), scope) }); err != nil { @@ -606,21 +380,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddConversionFunc((*v1beta2.OCIManagedClusterSpec)(nil), (*OCIManagedClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec(a.(*v1beta2.OCIManagedClusterSpec), b.(*OCIManagedClusterSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta2.OCIManagedControlPlaneSpec)(nil), (*OCIManagedControlPlaneSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_OCIManagedControlPlaneSpec_To_v1beta1_OCIManagedControlPlaneSpec(a.(*v1beta2.OCIManagedControlPlaneSpec), b.(*OCIManagedControlPlaneSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta2.OCIManagedControlPlaneStatus)(nil), (*OCIManagedControlPlaneStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_OCIManagedControlPlaneStatus_To_v1beta1_OCIManagedControlPlaneStatus(a.(*v1beta2.OCIManagedControlPlaneStatus), b.(*OCIManagedControlPlaneStatus), scope) - }); err != nil { - return err - } if err := s.AddConversionFunc((*v1beta2.OCIManagedMachinePoolSpec)(nil), (*OCIManagedMachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta2_OCIManagedMachinePoolSpec_To_v1beta1_OCIManagedMachinePoolSpec(a.(*v1beta2.OCIManagedMachinePoolSpec), b.(*OCIManagedMachinePoolSpec), scope) }); err != nil { @@ -629,132 +388,6 @@ func RegisterConversions(s *runtime.Scheme) error { return nil } -func autoConvert_v1beta1_AddOnOptions_To_v1beta2_AddOnOptions(in *AddOnOptions, out *v1beta2.AddOnOptions, s conversion.Scope) error { - out.IsKubernetesDashboardEnabled = (*bool)(unsafe.Pointer(in.IsKubernetesDashboardEnabled)) - out.IsTillerEnabled = (*bool)(unsafe.Pointer(in.IsTillerEnabled)) - return nil -} - -// Convert_v1beta1_AddOnOptions_To_v1beta2_AddOnOptions is an autogenerated conversion function. -func Convert_v1beta1_AddOnOptions_To_v1beta2_AddOnOptions(in *AddOnOptions, out *v1beta2.AddOnOptions, s conversion.Scope) error { - return autoConvert_v1beta1_AddOnOptions_To_v1beta2_AddOnOptions(in, out, s) -} - -func autoConvert_v1beta2_AddOnOptions_To_v1beta1_AddOnOptions(in *v1beta2.AddOnOptions, out *AddOnOptions, s conversion.Scope) error { - out.IsKubernetesDashboardEnabled = (*bool)(unsafe.Pointer(in.IsKubernetesDashboardEnabled)) - out.IsTillerEnabled = (*bool)(unsafe.Pointer(in.IsTillerEnabled)) - return nil -} - -// Convert_v1beta2_AddOnOptions_To_v1beta1_AddOnOptions is an autogenerated conversion function. -func Convert_v1beta2_AddOnOptions_To_v1beta1_AddOnOptions(in *v1beta2.AddOnOptions, out *AddOnOptions, s conversion.Scope) error { - return autoConvert_v1beta2_AddOnOptions_To_v1beta1_AddOnOptions(in, out, s) -} - -func autoConvert_v1beta1_AdmissionControllerOptions_To_v1beta2_AdmissionControllerOptions(in *AdmissionControllerOptions, out *v1beta2.AdmissionControllerOptions, s conversion.Scope) error { - out.IsPodSecurityPolicyEnabled = (*bool)(unsafe.Pointer(in.IsPodSecurityPolicyEnabled)) - return nil -} - -// Convert_v1beta1_AdmissionControllerOptions_To_v1beta2_AdmissionControllerOptions is an autogenerated conversion function. -func Convert_v1beta1_AdmissionControllerOptions_To_v1beta2_AdmissionControllerOptions(in *AdmissionControllerOptions, out *v1beta2.AdmissionControllerOptions, s conversion.Scope) error { - return autoConvert_v1beta1_AdmissionControllerOptions_To_v1beta2_AdmissionControllerOptions(in, out, s) -} - -func autoConvert_v1beta2_AdmissionControllerOptions_To_v1beta1_AdmissionControllerOptions(in *v1beta2.AdmissionControllerOptions, out *AdmissionControllerOptions, s conversion.Scope) error { - out.IsPodSecurityPolicyEnabled = (*bool)(unsafe.Pointer(in.IsPodSecurityPolicyEnabled)) - return nil -} - -// Convert_v1beta2_AdmissionControllerOptions_To_v1beta1_AdmissionControllerOptions is an autogenerated conversion function. -func Convert_v1beta2_AdmissionControllerOptions_To_v1beta1_AdmissionControllerOptions(in *v1beta2.AdmissionControllerOptions, out *AdmissionControllerOptions, s conversion.Scope) error { - return autoConvert_v1beta2_AdmissionControllerOptions_To_v1beta1_AdmissionControllerOptions(in, out, s) -} - -func autoConvert_v1beta1_ClusterOptions_To_v1beta2_ClusterOptions(in *ClusterOptions, out *v1beta2.ClusterOptions, s conversion.Scope) error { - out.AddOnOptions = (*v1beta2.AddOnOptions)(unsafe.Pointer(in.AddOnOptions)) - out.AdmissionControllerOptions = (*v1beta2.AdmissionControllerOptions)(unsafe.Pointer(in.AdmissionControllerOptions)) - return nil -} - -// Convert_v1beta1_ClusterOptions_To_v1beta2_ClusterOptions is an autogenerated conversion function. -func Convert_v1beta1_ClusterOptions_To_v1beta2_ClusterOptions(in *ClusterOptions, out *v1beta2.ClusterOptions, s conversion.Scope) error { - return autoConvert_v1beta1_ClusterOptions_To_v1beta2_ClusterOptions(in, out, s) -} - -func autoConvert_v1beta2_ClusterOptions_To_v1beta1_ClusterOptions(in *v1beta2.ClusterOptions, out *ClusterOptions, s conversion.Scope) error { - out.AddOnOptions = (*AddOnOptions)(unsafe.Pointer(in.AddOnOptions)) - out.AdmissionControllerOptions = (*AdmissionControllerOptions)(unsafe.Pointer(in.AdmissionControllerOptions)) - return nil -} - -// Convert_v1beta2_ClusterOptions_To_v1beta1_ClusterOptions is an autogenerated conversion function. -func Convert_v1beta2_ClusterOptions_To_v1beta1_ClusterOptions(in *v1beta2.ClusterOptions, out *ClusterOptions, s conversion.Scope) error { - return autoConvert_v1beta2_ClusterOptions_To_v1beta1_ClusterOptions(in, out, s) -} - -func autoConvert_v1beta1_ClusterPodNetworkOptions_To_v1beta2_ClusterPodNetworkOptions(in *ClusterPodNetworkOptions, out *v1beta2.ClusterPodNetworkOptions, s conversion.Scope) error { - out.CniType = v1beta2.CNIOptionEnum(in.CniType) - return nil -} - -// Convert_v1beta1_ClusterPodNetworkOptions_To_v1beta2_ClusterPodNetworkOptions is an autogenerated conversion function. -func Convert_v1beta1_ClusterPodNetworkOptions_To_v1beta2_ClusterPodNetworkOptions(in *ClusterPodNetworkOptions, out *v1beta2.ClusterPodNetworkOptions, s conversion.Scope) error { - return autoConvert_v1beta1_ClusterPodNetworkOptions_To_v1beta2_ClusterPodNetworkOptions(in, out, s) -} - -func autoConvert_v1beta2_ClusterPodNetworkOptions_To_v1beta1_ClusterPodNetworkOptions(in *v1beta2.ClusterPodNetworkOptions, out *ClusterPodNetworkOptions, s conversion.Scope) error { - out.CniType = CNIOptionEnum(in.CniType) - return nil -} - -// Convert_v1beta2_ClusterPodNetworkOptions_To_v1beta1_ClusterPodNetworkOptions is an autogenerated conversion function. -func Convert_v1beta2_ClusterPodNetworkOptions_To_v1beta1_ClusterPodNetworkOptions(in *v1beta2.ClusterPodNetworkOptions, out *ClusterPodNetworkOptions, s conversion.Scope) error { - return autoConvert_v1beta2_ClusterPodNetworkOptions_To_v1beta1_ClusterPodNetworkOptions(in, out, s) -} - -func autoConvert_v1beta1_EndpointConfig_To_v1beta2_EndpointConfig(in *EndpointConfig, out *v1beta2.EndpointConfig, s conversion.Scope) error { - out.IsPublicIpEnabled = in.IsPublicIpEnabled - return nil -} - -// Convert_v1beta1_EndpointConfig_To_v1beta2_EndpointConfig is an autogenerated conversion function. -func Convert_v1beta1_EndpointConfig_To_v1beta2_EndpointConfig(in *EndpointConfig, out *v1beta2.EndpointConfig, s conversion.Scope) error { - return autoConvert_v1beta1_EndpointConfig_To_v1beta2_EndpointConfig(in, out, s) -} - -func autoConvert_v1beta2_EndpointConfig_To_v1beta1_EndpointConfig(in *v1beta2.EndpointConfig, out *EndpointConfig, s conversion.Scope) error { - out.IsPublicIpEnabled = in.IsPublicIpEnabled - return nil -} - -// Convert_v1beta2_EndpointConfig_To_v1beta1_EndpointConfig is an autogenerated conversion function. -func Convert_v1beta2_EndpointConfig_To_v1beta1_EndpointConfig(in *v1beta2.EndpointConfig, out *EndpointConfig, s conversion.Scope) error { - return autoConvert_v1beta2_EndpointConfig_To_v1beta1_EndpointConfig(in, out, s) -} - -func autoConvert_v1beta1_ImagePolicyConfig_To_v1beta2_ImagePolicyConfig(in *ImagePolicyConfig, out *v1beta2.ImagePolicyConfig, s conversion.Scope) error { - out.IsPolicyEnabled = (*bool)(unsafe.Pointer(in.IsPolicyEnabled)) - out.KeyDetails = *(*[]v1beta2.KeyDetails)(unsafe.Pointer(&in.KeyDetails)) - return nil -} - -// Convert_v1beta1_ImagePolicyConfig_To_v1beta2_ImagePolicyConfig is an autogenerated conversion function. -func Convert_v1beta1_ImagePolicyConfig_To_v1beta2_ImagePolicyConfig(in *ImagePolicyConfig, out *v1beta2.ImagePolicyConfig, s conversion.Scope) error { - return autoConvert_v1beta1_ImagePolicyConfig_To_v1beta2_ImagePolicyConfig(in, out, s) -} - -func autoConvert_v1beta2_ImagePolicyConfig_To_v1beta1_ImagePolicyConfig(in *v1beta2.ImagePolicyConfig, out *ImagePolicyConfig, s conversion.Scope) error { - out.IsPolicyEnabled = (*bool)(unsafe.Pointer(in.IsPolicyEnabled)) - out.KeyDetails = *(*[]KeyDetails)(unsafe.Pointer(&in.KeyDetails)) - return nil -} - -// Convert_v1beta2_ImagePolicyConfig_To_v1beta1_ImagePolicyConfig is an autogenerated conversion function. -func Convert_v1beta2_ImagePolicyConfig_To_v1beta1_ImagePolicyConfig(in *v1beta2.ImagePolicyConfig, out *ImagePolicyConfig, s conversion.Scope) error { - return autoConvert_v1beta2_ImagePolicyConfig_To_v1beta1_ImagePolicyConfig(in, out, s) -} - func autoConvert_v1beta1_InstanceConfiguration_To_v1beta2_InstanceConfiguration(in *InstanceConfiguration, out *v1beta2.InstanceConfiguration, s conversion.Scope) error { out.InstanceConfigurationId = (*string)(unsafe.Pointer(in.InstanceConfigurationId)) out.Shape = (*string)(unsafe.Pointer(in.Shape)) @@ -879,26 +512,6 @@ func Convert_v1beta2_InstanceVnicConfiguration_To_v1beta1_InstanceVnicConfigurat return autoConvert_v1beta2_InstanceVnicConfiguration_To_v1beta1_InstanceVnicConfiguration(in, out, s) } -func autoConvert_v1beta1_KeyDetails_To_v1beta2_KeyDetails(in *KeyDetails, out *v1beta2.KeyDetails, s conversion.Scope) error { - out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) - return nil -} - -// Convert_v1beta1_KeyDetails_To_v1beta2_KeyDetails is an autogenerated conversion function. -func Convert_v1beta1_KeyDetails_To_v1beta2_KeyDetails(in *KeyDetails, out *v1beta2.KeyDetails, s conversion.Scope) error { - return autoConvert_v1beta1_KeyDetails_To_v1beta2_KeyDetails(in, out, s) -} - -func autoConvert_v1beta2_KeyDetails_To_v1beta1_KeyDetails(in *v1beta2.KeyDetails, out *KeyDetails, s conversion.Scope) error { - out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) - return nil -} - -// Convert_v1beta2_KeyDetails_To_v1beta1_KeyDetails is an autogenerated conversion function. -func Convert_v1beta2_KeyDetails_To_v1beta1_KeyDetails(in *v1beta2.KeyDetails, out *KeyDetails, s conversion.Scope) error { - return autoConvert_v1beta2_KeyDetails_To_v1beta1_KeyDetails(in, out, s) -} - func autoConvert_v1beta1_KeyValue_To_v1beta2_KeyValue(in *KeyValue, out *v1beta2.KeyValue, s conversion.Scope) error { out.Key = (*string)(unsafe.Pointer(in.Key)) out.Value = (*string)(unsafe.Pointer(in.Value)) @@ -921,28 +534,6 @@ func Convert_v1beta2_KeyValue_To_v1beta1_KeyValue(in *v1beta2.KeyValue, out *Key return autoConvert_v1beta2_KeyValue_To_v1beta1_KeyValue(in, out, s) } -func autoConvert_v1beta1_KubernetesNetworkConfig_To_v1beta2_KubernetesNetworkConfig(in *KubernetesNetworkConfig, out *v1beta2.KubernetesNetworkConfig, s conversion.Scope) error { - out.PodsCidr = in.PodsCidr - out.ServicesCidr = in.ServicesCidr - return nil -} - -// Convert_v1beta1_KubernetesNetworkConfig_To_v1beta2_KubernetesNetworkConfig is an autogenerated conversion function. -func Convert_v1beta1_KubernetesNetworkConfig_To_v1beta2_KubernetesNetworkConfig(in *KubernetesNetworkConfig, out *v1beta2.KubernetesNetworkConfig, s conversion.Scope) error { - return autoConvert_v1beta1_KubernetesNetworkConfig_To_v1beta2_KubernetesNetworkConfig(in, out, s) -} - -func autoConvert_v1beta2_KubernetesNetworkConfig_To_v1beta1_KubernetesNetworkConfig(in *v1beta2.KubernetesNetworkConfig, out *KubernetesNetworkConfig, s conversion.Scope) error { - out.PodsCidr = in.PodsCidr - out.ServicesCidr = in.ServicesCidr - return nil -} - -// Convert_v1beta2_KubernetesNetworkConfig_To_v1beta1_KubernetesNetworkConfig is an autogenerated conversion function. -func Convert_v1beta2_KubernetesNetworkConfig_To_v1beta1_KubernetesNetworkConfig(in *v1beta2.KubernetesNetworkConfig, out *KubernetesNetworkConfig, s conversion.Scope) error { - return autoConvert_v1beta2_KubernetesNetworkConfig_To_v1beta1_KubernetesNetworkConfig(in, out, s) -} - func autoConvert_v1beta1_LaunchDetails_To_v1beta2_LaunchDetails(in *LaunchDetails, out *v1beta2.LaunchDetails, s conversion.Scope) error { out.Metadata = *(*map[string]string)(unsafe.Pointer(&in.Metadata)) out.Shape = in.Shape @@ -1016,7 +607,7 @@ func Convert_v1beta2_NodePoolNodeConfig_To_v1beta1_NodePoolNodeConfig(in *v1beta } func autoConvert_v1beta1_NodePoolPodNetworkOptionDetails_To_v1beta2_NodePoolPodNetworkOptionDetails(in *NodePoolPodNetworkOptionDetails, out *v1beta2.NodePoolPodNetworkOptionDetails, s conversion.Scope) error { - out.CniType = v1beta2.CNIOptionEnum(in.CniType) + out.CniType = apiv1beta2.CNIOptionEnum(in.CniType) if err := Convert_v1beta1_VcnIpNativePodNetworkOptions_To_v1beta2_VcnIpNativePodNetworkOptions(&in.VcnIpNativePodNetworkOptions, &out.VcnIpNativePodNetworkOptions, s); err != nil { return err } @@ -1029,7 +620,7 @@ func Convert_v1beta1_NodePoolPodNetworkOptionDetails_To_v1beta2_NodePoolPodNetwo } func autoConvert_v1beta2_NodePoolPodNetworkOptionDetails_To_v1beta1_NodePoolPodNetworkOptionDetails(in *v1beta2.NodePoolPodNetworkOptionDetails, out *NodePoolPodNetworkOptionDetails, s conversion.Scope) error { - out.CniType = CNIOptionEnum(in.CniType) + out.CniType = apiv1beta1.CNIOptionEnum(in.CniType) if err := Convert_v1beta2_VcnIpNativePodNetworkOptions_To_v1beta1_VcnIpNativePodNetworkOptions(&in.VcnIpNativePodNetworkOptions, &out.VcnIpNativePodNetworkOptions, s); err != nil { return err } @@ -1219,496 +810,6 @@ func Convert_v1beta2_OCIMachinePoolStatus_To_v1beta1_OCIMachinePoolStatus(in *v1 return autoConvert_v1beta2_OCIMachinePoolStatus_To_v1beta1_OCIMachinePoolStatus(in, out, s) } -func autoConvert_v1beta1_OCIManagedCluster_To_v1beta2_OCIManagedCluster(in *OCIManagedCluster, out *v1beta2.OCIManagedCluster, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_OCIManagedClusterSpec_To_v1beta2_OCIManagedClusterSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_OCIManagedClusterStatus_To_v1beta2_OCIManagedClusterStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_OCIManagedCluster_To_v1beta2_OCIManagedCluster is an autogenerated conversion function. -func Convert_v1beta1_OCIManagedCluster_To_v1beta2_OCIManagedCluster(in *OCIManagedCluster, out *v1beta2.OCIManagedCluster, s conversion.Scope) error { - return autoConvert_v1beta1_OCIManagedCluster_To_v1beta2_OCIManagedCluster(in, out, s) -} - -func autoConvert_v1beta2_OCIManagedCluster_To_v1beta1_OCIManagedCluster(in *v1beta2.OCIManagedCluster, out *OCIManagedCluster, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta2_OCIManagedClusterStatus_To_v1beta1_OCIManagedClusterStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta2_OCIManagedCluster_To_v1beta1_OCIManagedCluster is an autogenerated conversion function. -func Convert_v1beta2_OCIManagedCluster_To_v1beta1_OCIManagedCluster(in *v1beta2.OCIManagedCluster, out *OCIManagedCluster, s conversion.Scope) error { - return autoConvert_v1beta2_OCIManagedCluster_To_v1beta1_OCIManagedCluster(in, out, s) -} - -func autoConvert_v1beta1_OCIManagedClusterList_To_v1beta2_OCIManagedClusterList(in *OCIManagedClusterList, out *v1beta2.OCIManagedClusterList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta2.OCIManagedCluster, len(*in)) - for i := range *in { - if err := Convert_v1beta1_OCIManagedCluster_To_v1beta2_OCIManagedCluster(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_OCIManagedClusterList_To_v1beta2_OCIManagedClusterList is an autogenerated conversion function. -func Convert_v1beta1_OCIManagedClusterList_To_v1beta2_OCIManagedClusterList(in *OCIManagedClusterList, out *v1beta2.OCIManagedClusterList, s conversion.Scope) error { - return autoConvert_v1beta1_OCIManagedClusterList_To_v1beta2_OCIManagedClusterList(in, out, s) -} - -func autoConvert_v1beta2_OCIManagedClusterList_To_v1beta1_OCIManagedClusterList(in *v1beta2.OCIManagedClusterList, out *OCIManagedClusterList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]OCIManagedCluster, len(*in)) - for i := range *in { - if err := Convert_v1beta2_OCIManagedCluster_To_v1beta1_OCIManagedCluster(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta2_OCIManagedClusterList_To_v1beta1_OCIManagedClusterList is an autogenerated conversion function. -func Convert_v1beta2_OCIManagedClusterList_To_v1beta1_OCIManagedClusterList(in *v1beta2.OCIManagedClusterList, out *OCIManagedClusterList, s conversion.Scope) error { - return autoConvert_v1beta2_OCIManagedClusterList_To_v1beta1_OCIManagedClusterList(in, out, s) -} - -func autoConvert_v1beta1_OCIManagedClusterSpec_To_v1beta2_OCIManagedClusterSpec(in *OCIManagedClusterSpec, out *v1beta2.OCIManagedClusterSpec, s conversion.Scope) error { - out.OCIResourceIdentifier = in.OCIResourceIdentifier - out.IdentityRef = (*v1.ObjectReference)(unsafe.Pointer(in.IdentityRef)) - if err := Convert_v1beta1_NetworkSpec_To_v1beta2_NetworkSpec(&in.NetworkSpec, &out.NetworkSpec, s); err != nil { - return err - } - out.FreeformTags = *(*map[string]string)(unsafe.Pointer(&in.FreeformTags)) - out.DefinedTags = *(*map[string]map[string]string)(unsafe.Pointer(&in.DefinedTags)) - out.CompartmentId = in.CompartmentId - out.Region = in.Region - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint - return nil -} - -// Convert_v1beta1_OCIManagedClusterSpec_To_v1beta2_OCIManagedClusterSpec is an autogenerated conversion function. -func Convert_v1beta1_OCIManagedClusterSpec_To_v1beta2_OCIManagedClusterSpec(in *OCIManagedClusterSpec, out *v1beta2.OCIManagedClusterSpec, s conversion.Scope) error { - return autoConvert_v1beta1_OCIManagedClusterSpec_To_v1beta2_OCIManagedClusterSpec(in, out, s) -} - -func autoConvert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec(in *v1beta2.OCIManagedClusterSpec, out *OCIManagedClusterSpec, s conversion.Scope) error { - out.OCIResourceIdentifier = in.OCIResourceIdentifier - out.IdentityRef = (*v1.ObjectReference)(unsafe.Pointer(in.IdentityRef)) - if err := Convert_v1beta2_NetworkSpec_To_v1beta1_NetworkSpec(&in.NetworkSpec, &out.NetworkSpec, s); err != nil { - return err - } - out.FreeformTags = *(*map[string]string)(unsafe.Pointer(&in.FreeformTags)) - out.DefinedTags = *(*map[string]map[string]string)(unsafe.Pointer(&in.DefinedTags)) - out.CompartmentId = in.CompartmentId - out.Region = in.Region - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint - // WARNING: in.AvailabilityDomains requires manual conversion: does not exist in peer-type - // WARNING: in.ClientOverrides requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1beta1_OCIManagedClusterStatus_To_v1beta2_OCIManagedClusterStatus(in *OCIManagedClusterStatus, out *v1beta2.OCIManagedClusterStatus, s conversion.Scope) error { - out.FailureDomains = *(*clusterapiapiv1beta1.FailureDomains)(unsafe.Pointer(&in.FailureDomains)) - // WARNING: in.AvailabilityDomains requires manual conversion: does not exist in peer-type - out.Ready = in.Ready - out.Conditions = *(*clusterapiapiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) - return nil -} - -func autoConvert_v1beta2_OCIManagedClusterStatus_To_v1beta1_OCIManagedClusterStatus(in *v1beta2.OCIManagedClusterStatus, out *OCIManagedClusterStatus, s conversion.Scope) error { - out.FailureDomains = *(*clusterapiapiv1beta1.FailureDomains)(unsafe.Pointer(&in.FailureDomains)) - out.Ready = in.Ready - out.Conditions = *(*clusterapiapiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) - return nil -} - -// Convert_v1beta2_OCIManagedClusterStatus_To_v1beta1_OCIManagedClusterStatus is an autogenerated conversion function. -func Convert_v1beta2_OCIManagedClusterStatus_To_v1beta1_OCIManagedClusterStatus(in *v1beta2.OCIManagedClusterStatus, out *OCIManagedClusterStatus, s conversion.Scope) error { - return autoConvert_v1beta2_OCIManagedClusterStatus_To_v1beta1_OCIManagedClusterStatus(in, out, s) -} - -func autoConvert_v1beta1_OCIManagedClusterTemplate_To_v1beta2_OCIManagedClusterTemplate(in *OCIManagedClusterTemplate, out *v1beta2.OCIManagedClusterTemplate, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_OCIManagedClusterTemplateSpec_To_v1beta2_OCIManagedClusterTemplateSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_OCIManagedClusterTemplate_To_v1beta2_OCIManagedClusterTemplate is an autogenerated conversion function. -func Convert_v1beta1_OCIManagedClusterTemplate_To_v1beta2_OCIManagedClusterTemplate(in *OCIManagedClusterTemplate, out *v1beta2.OCIManagedClusterTemplate, s conversion.Scope) error { - return autoConvert_v1beta1_OCIManagedClusterTemplate_To_v1beta2_OCIManagedClusterTemplate(in, out, s) -} - -func autoConvert_v1beta2_OCIManagedClusterTemplate_To_v1beta1_OCIManagedClusterTemplate(in *v1beta2.OCIManagedClusterTemplate, out *OCIManagedClusterTemplate, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta2_OCIManagedClusterTemplateSpec_To_v1beta1_OCIManagedClusterTemplateSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta2_OCIManagedClusterTemplate_To_v1beta1_OCIManagedClusterTemplate is an autogenerated conversion function. -func Convert_v1beta2_OCIManagedClusterTemplate_To_v1beta1_OCIManagedClusterTemplate(in *v1beta2.OCIManagedClusterTemplate, out *OCIManagedClusterTemplate, s conversion.Scope) error { - return autoConvert_v1beta2_OCIManagedClusterTemplate_To_v1beta1_OCIManagedClusterTemplate(in, out, s) -} - -func autoConvert_v1beta1_OCIManagedClusterTemplateList_To_v1beta2_OCIManagedClusterTemplateList(in *OCIManagedClusterTemplateList, out *v1beta2.OCIManagedClusterTemplateList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta2.OCIManagedClusterTemplate, len(*in)) - for i := range *in { - if err := Convert_v1beta1_OCIManagedClusterTemplate_To_v1beta2_OCIManagedClusterTemplate(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_OCIManagedClusterTemplateList_To_v1beta2_OCIManagedClusterTemplateList is an autogenerated conversion function. -func Convert_v1beta1_OCIManagedClusterTemplateList_To_v1beta2_OCIManagedClusterTemplateList(in *OCIManagedClusterTemplateList, out *v1beta2.OCIManagedClusterTemplateList, s conversion.Scope) error { - return autoConvert_v1beta1_OCIManagedClusterTemplateList_To_v1beta2_OCIManagedClusterTemplateList(in, out, s) -} - -func autoConvert_v1beta2_OCIManagedClusterTemplateList_To_v1beta1_OCIManagedClusterTemplateList(in *v1beta2.OCIManagedClusterTemplateList, out *OCIManagedClusterTemplateList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]OCIManagedClusterTemplate, len(*in)) - for i := range *in { - if err := Convert_v1beta2_OCIManagedClusterTemplate_To_v1beta1_OCIManagedClusterTemplate(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta2_OCIManagedClusterTemplateList_To_v1beta1_OCIManagedClusterTemplateList is an autogenerated conversion function. -func Convert_v1beta2_OCIManagedClusterTemplateList_To_v1beta1_OCIManagedClusterTemplateList(in *v1beta2.OCIManagedClusterTemplateList, out *OCIManagedClusterTemplateList, s conversion.Scope) error { - return autoConvert_v1beta2_OCIManagedClusterTemplateList_To_v1beta1_OCIManagedClusterTemplateList(in, out, s) -} - -func autoConvert_v1beta1_OCIManagedClusterTemplateResource_To_v1beta2_OCIManagedClusterTemplateResource(in *OCIManagedClusterTemplateResource, out *v1beta2.OCIManagedClusterTemplateResource, s conversion.Scope) error { - if err := Convert_v1beta1_OCIManagedClusterSpec_To_v1beta2_OCIManagedClusterSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_OCIManagedClusterTemplateResource_To_v1beta2_OCIManagedClusterTemplateResource is an autogenerated conversion function. -func Convert_v1beta1_OCIManagedClusterTemplateResource_To_v1beta2_OCIManagedClusterTemplateResource(in *OCIManagedClusterTemplateResource, out *v1beta2.OCIManagedClusterTemplateResource, s conversion.Scope) error { - return autoConvert_v1beta1_OCIManagedClusterTemplateResource_To_v1beta2_OCIManagedClusterTemplateResource(in, out, s) -} - -func autoConvert_v1beta2_OCIManagedClusterTemplateResource_To_v1beta1_OCIManagedClusterTemplateResource(in *v1beta2.OCIManagedClusterTemplateResource, out *OCIManagedClusterTemplateResource, s conversion.Scope) error { - if err := Convert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta2_OCIManagedClusterTemplateResource_To_v1beta1_OCIManagedClusterTemplateResource is an autogenerated conversion function. -func Convert_v1beta2_OCIManagedClusterTemplateResource_To_v1beta1_OCIManagedClusterTemplateResource(in *v1beta2.OCIManagedClusterTemplateResource, out *OCIManagedClusterTemplateResource, s conversion.Scope) error { - return autoConvert_v1beta2_OCIManagedClusterTemplateResource_To_v1beta1_OCIManagedClusterTemplateResource(in, out, s) -} - -func autoConvert_v1beta1_OCIManagedClusterTemplateSpec_To_v1beta2_OCIManagedClusterTemplateSpec(in *OCIManagedClusterTemplateSpec, out *v1beta2.OCIManagedClusterTemplateSpec, s conversion.Scope) error { - if err := Convert_v1beta1_OCIManagedClusterTemplateResource_To_v1beta2_OCIManagedClusterTemplateResource(&in.Template, &out.Template, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_OCIManagedClusterTemplateSpec_To_v1beta2_OCIManagedClusterTemplateSpec is an autogenerated conversion function. -func Convert_v1beta1_OCIManagedClusterTemplateSpec_To_v1beta2_OCIManagedClusterTemplateSpec(in *OCIManagedClusterTemplateSpec, out *v1beta2.OCIManagedClusterTemplateSpec, s conversion.Scope) error { - return autoConvert_v1beta1_OCIManagedClusterTemplateSpec_To_v1beta2_OCIManagedClusterTemplateSpec(in, out, s) -} - -func autoConvert_v1beta2_OCIManagedClusterTemplateSpec_To_v1beta1_OCIManagedClusterTemplateSpec(in *v1beta2.OCIManagedClusterTemplateSpec, out *OCIManagedClusterTemplateSpec, s conversion.Scope) error { - if err := Convert_v1beta2_OCIManagedClusterTemplateResource_To_v1beta1_OCIManagedClusterTemplateResource(&in.Template, &out.Template, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta2_OCIManagedClusterTemplateSpec_To_v1beta1_OCIManagedClusterTemplateSpec is an autogenerated conversion function. -func Convert_v1beta2_OCIManagedClusterTemplateSpec_To_v1beta1_OCIManagedClusterTemplateSpec(in *v1beta2.OCIManagedClusterTemplateSpec, out *OCIManagedClusterTemplateSpec, s conversion.Scope) error { - return autoConvert_v1beta2_OCIManagedClusterTemplateSpec_To_v1beta1_OCIManagedClusterTemplateSpec(in, out, s) -} - -func autoConvert_v1beta1_OCIManagedControlPlane_To_v1beta2_OCIManagedControlPlane(in *OCIManagedControlPlane, out *v1beta2.OCIManagedControlPlane, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_OCIManagedControlPlaneSpec_To_v1beta2_OCIManagedControlPlaneSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_OCIManagedControlPlaneStatus_To_v1beta2_OCIManagedControlPlaneStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_OCIManagedControlPlane_To_v1beta2_OCIManagedControlPlane is an autogenerated conversion function. -func Convert_v1beta1_OCIManagedControlPlane_To_v1beta2_OCIManagedControlPlane(in *OCIManagedControlPlane, out *v1beta2.OCIManagedControlPlane, s conversion.Scope) error { - return autoConvert_v1beta1_OCIManagedControlPlane_To_v1beta2_OCIManagedControlPlane(in, out, s) -} - -func autoConvert_v1beta2_OCIManagedControlPlane_To_v1beta1_OCIManagedControlPlane(in *v1beta2.OCIManagedControlPlane, out *OCIManagedControlPlane, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta2_OCIManagedControlPlaneSpec_To_v1beta1_OCIManagedControlPlaneSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta2_OCIManagedControlPlaneStatus_To_v1beta1_OCIManagedControlPlaneStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta2_OCIManagedControlPlane_To_v1beta1_OCIManagedControlPlane is an autogenerated conversion function. -func Convert_v1beta2_OCIManagedControlPlane_To_v1beta1_OCIManagedControlPlane(in *v1beta2.OCIManagedControlPlane, out *OCIManagedControlPlane, s conversion.Scope) error { - return autoConvert_v1beta2_OCIManagedControlPlane_To_v1beta1_OCIManagedControlPlane(in, out, s) -} - -func autoConvert_v1beta1_OCIManagedControlPlaneList_To_v1beta2_OCIManagedControlPlaneList(in *OCIManagedControlPlaneList, out *v1beta2.OCIManagedControlPlaneList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta2.OCIManagedControlPlane, len(*in)) - for i := range *in { - if err := Convert_v1beta1_OCIManagedControlPlane_To_v1beta2_OCIManagedControlPlane(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_OCIManagedControlPlaneList_To_v1beta2_OCIManagedControlPlaneList is an autogenerated conversion function. -func Convert_v1beta1_OCIManagedControlPlaneList_To_v1beta2_OCIManagedControlPlaneList(in *OCIManagedControlPlaneList, out *v1beta2.OCIManagedControlPlaneList, s conversion.Scope) error { - return autoConvert_v1beta1_OCIManagedControlPlaneList_To_v1beta2_OCIManagedControlPlaneList(in, out, s) -} - -func autoConvert_v1beta2_OCIManagedControlPlaneList_To_v1beta1_OCIManagedControlPlaneList(in *v1beta2.OCIManagedControlPlaneList, out *OCIManagedControlPlaneList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]OCIManagedControlPlane, len(*in)) - for i := range *in { - if err := Convert_v1beta2_OCIManagedControlPlane_To_v1beta1_OCIManagedControlPlane(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta2_OCIManagedControlPlaneList_To_v1beta1_OCIManagedControlPlaneList is an autogenerated conversion function. -func Convert_v1beta2_OCIManagedControlPlaneList_To_v1beta1_OCIManagedControlPlaneList(in *v1beta2.OCIManagedControlPlaneList, out *OCIManagedControlPlaneList, s conversion.Scope) error { - return autoConvert_v1beta2_OCIManagedControlPlaneList_To_v1beta1_OCIManagedControlPlaneList(in, out, s) -} - -func autoConvert_v1beta1_OCIManagedControlPlaneSpec_To_v1beta2_OCIManagedControlPlaneSpec(in *OCIManagedControlPlaneSpec, out *v1beta2.OCIManagedControlPlaneSpec, s conversion.Scope) error { - out.ID = (*string)(unsafe.Pointer(in.ID)) - out.ClusterPodNetworkOptions = *(*[]v1beta2.ClusterPodNetworkOptions)(unsafe.Pointer(&in.ClusterPodNetworkOptions)) - out.ImagePolicyConfig = (*v1beta2.ImagePolicyConfig)(unsafe.Pointer(in.ImagePolicyConfig)) - if err := Convert_v1beta1_ClusterOptions_To_v1beta2_ClusterOptions(&in.ClusterOption, &out.ClusterOption, s); err != nil { - return err - } - out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint - out.Version = (*string)(unsafe.Pointer(in.Version)) - return nil -} - -// Convert_v1beta1_OCIManagedControlPlaneSpec_To_v1beta2_OCIManagedControlPlaneSpec is an autogenerated conversion function. -func Convert_v1beta1_OCIManagedControlPlaneSpec_To_v1beta2_OCIManagedControlPlaneSpec(in *OCIManagedControlPlaneSpec, out *v1beta2.OCIManagedControlPlaneSpec, s conversion.Scope) error { - return autoConvert_v1beta1_OCIManagedControlPlaneSpec_To_v1beta2_OCIManagedControlPlaneSpec(in, out, s) -} - -func autoConvert_v1beta2_OCIManagedControlPlaneSpec_To_v1beta1_OCIManagedControlPlaneSpec(in *v1beta2.OCIManagedControlPlaneSpec, out *OCIManagedControlPlaneSpec, s conversion.Scope) error { - out.ID = (*string)(unsafe.Pointer(in.ID)) - out.ClusterPodNetworkOptions = *(*[]ClusterPodNetworkOptions)(unsafe.Pointer(&in.ClusterPodNetworkOptions)) - out.ImagePolicyConfig = (*ImagePolicyConfig)(unsafe.Pointer(in.ImagePolicyConfig)) - if err := Convert_v1beta2_ClusterOptions_To_v1beta1_ClusterOptions(&in.ClusterOption, &out.ClusterOption, s); err != nil { - return err - } - // WARNING: in.ClusterType requires manual conversion: does not exist in peer-type - out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint - // WARNING: in.Addons requires manual conversion: does not exist in peer-type - out.Version = (*string)(unsafe.Pointer(in.Version)) - return nil -} - -func autoConvert_v1beta1_OCIManagedControlPlaneStatus_To_v1beta2_OCIManagedControlPlaneStatus(in *OCIManagedControlPlaneStatus, out *v1beta2.OCIManagedControlPlaneStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Conditions = *(*clusterapiapiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) - out.Version = (*string)(unsafe.Pointer(in.Version)) - out.Initialized = in.Initialized - return nil -} - -// Convert_v1beta1_OCIManagedControlPlaneStatus_To_v1beta2_OCIManagedControlPlaneStatus is an autogenerated conversion function. -func Convert_v1beta1_OCIManagedControlPlaneStatus_To_v1beta2_OCIManagedControlPlaneStatus(in *OCIManagedControlPlaneStatus, out *v1beta2.OCIManagedControlPlaneStatus, s conversion.Scope) error { - return autoConvert_v1beta1_OCIManagedControlPlaneStatus_To_v1beta2_OCIManagedControlPlaneStatus(in, out, s) -} - -func autoConvert_v1beta2_OCIManagedControlPlaneStatus_To_v1beta1_OCIManagedControlPlaneStatus(in *v1beta2.OCIManagedControlPlaneStatus, out *OCIManagedControlPlaneStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Conditions = *(*clusterapiapiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) - out.Version = (*string)(unsafe.Pointer(in.Version)) - // WARNING: in.AddonStatus requires manual conversion: does not exist in peer-type - out.Initialized = in.Initialized - return nil -} - -func autoConvert_v1beta1_OCIManagedControlPlaneTemplate_To_v1beta2_OCIManagedControlPlaneTemplate(in *OCIManagedControlPlaneTemplate, out *v1beta2.OCIManagedControlPlaneTemplate, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_OCIManagedControlPlaneTemplateSpec_To_v1beta2_OCIManagedControlPlaneTemplateSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_OCIManagedControlPlaneTemplate_To_v1beta2_OCIManagedControlPlaneTemplate is an autogenerated conversion function. -func Convert_v1beta1_OCIManagedControlPlaneTemplate_To_v1beta2_OCIManagedControlPlaneTemplate(in *OCIManagedControlPlaneTemplate, out *v1beta2.OCIManagedControlPlaneTemplate, s conversion.Scope) error { - return autoConvert_v1beta1_OCIManagedControlPlaneTemplate_To_v1beta2_OCIManagedControlPlaneTemplate(in, out, s) -} - -func autoConvert_v1beta2_OCIManagedControlPlaneTemplate_To_v1beta1_OCIManagedControlPlaneTemplate(in *v1beta2.OCIManagedControlPlaneTemplate, out *OCIManagedControlPlaneTemplate, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta2_OCIManagedControlPlaneTemplateSpec_To_v1beta1_OCIManagedControlPlaneTemplateSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta2_OCIManagedControlPlaneTemplate_To_v1beta1_OCIManagedControlPlaneTemplate is an autogenerated conversion function. -func Convert_v1beta2_OCIManagedControlPlaneTemplate_To_v1beta1_OCIManagedControlPlaneTemplate(in *v1beta2.OCIManagedControlPlaneTemplate, out *OCIManagedControlPlaneTemplate, s conversion.Scope) error { - return autoConvert_v1beta2_OCIManagedControlPlaneTemplate_To_v1beta1_OCIManagedControlPlaneTemplate(in, out, s) -} - -func autoConvert_v1beta1_OCIManagedControlPlaneTemplateList_To_v1beta2_OCIManagedControlPlaneTemplateList(in *OCIManagedControlPlaneTemplateList, out *v1beta2.OCIManagedControlPlaneTemplateList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta2.OCIManagedControlPlaneTemplate, len(*in)) - for i := range *in { - if err := Convert_v1beta1_OCIManagedControlPlaneTemplate_To_v1beta2_OCIManagedControlPlaneTemplate(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_OCIManagedControlPlaneTemplateList_To_v1beta2_OCIManagedControlPlaneTemplateList is an autogenerated conversion function. -func Convert_v1beta1_OCIManagedControlPlaneTemplateList_To_v1beta2_OCIManagedControlPlaneTemplateList(in *OCIManagedControlPlaneTemplateList, out *v1beta2.OCIManagedControlPlaneTemplateList, s conversion.Scope) error { - return autoConvert_v1beta1_OCIManagedControlPlaneTemplateList_To_v1beta2_OCIManagedControlPlaneTemplateList(in, out, s) -} - -func autoConvert_v1beta2_OCIManagedControlPlaneTemplateList_To_v1beta1_OCIManagedControlPlaneTemplateList(in *v1beta2.OCIManagedControlPlaneTemplateList, out *OCIManagedControlPlaneTemplateList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]OCIManagedControlPlaneTemplate, len(*in)) - for i := range *in { - if err := Convert_v1beta2_OCIManagedControlPlaneTemplate_To_v1beta1_OCIManagedControlPlaneTemplate(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta2_OCIManagedControlPlaneTemplateList_To_v1beta1_OCIManagedControlPlaneTemplateList is an autogenerated conversion function. -func Convert_v1beta2_OCIManagedControlPlaneTemplateList_To_v1beta1_OCIManagedControlPlaneTemplateList(in *v1beta2.OCIManagedControlPlaneTemplateList, out *OCIManagedControlPlaneTemplateList, s conversion.Scope) error { - return autoConvert_v1beta2_OCIManagedControlPlaneTemplateList_To_v1beta1_OCIManagedControlPlaneTemplateList(in, out, s) -} - -func autoConvert_v1beta1_OCIManagedControlPlaneTemplateResource_To_v1beta2_OCIManagedControlPlaneTemplateResource(in *OCIManagedControlPlaneTemplateResource, out *v1beta2.OCIManagedControlPlaneTemplateResource, s conversion.Scope) error { - if err := Convert_v1beta1_OCIManagedControlPlaneSpec_To_v1beta2_OCIManagedControlPlaneSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_OCIManagedControlPlaneTemplateResource_To_v1beta2_OCIManagedControlPlaneTemplateResource is an autogenerated conversion function. -func Convert_v1beta1_OCIManagedControlPlaneTemplateResource_To_v1beta2_OCIManagedControlPlaneTemplateResource(in *OCIManagedControlPlaneTemplateResource, out *v1beta2.OCIManagedControlPlaneTemplateResource, s conversion.Scope) error { - return autoConvert_v1beta1_OCIManagedControlPlaneTemplateResource_To_v1beta2_OCIManagedControlPlaneTemplateResource(in, out, s) -} - -func autoConvert_v1beta2_OCIManagedControlPlaneTemplateResource_To_v1beta1_OCIManagedControlPlaneTemplateResource(in *v1beta2.OCIManagedControlPlaneTemplateResource, out *OCIManagedControlPlaneTemplateResource, s conversion.Scope) error { - if err := Convert_v1beta2_OCIManagedControlPlaneSpec_To_v1beta1_OCIManagedControlPlaneSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta2_OCIManagedControlPlaneTemplateResource_To_v1beta1_OCIManagedControlPlaneTemplateResource is an autogenerated conversion function. -func Convert_v1beta2_OCIManagedControlPlaneTemplateResource_To_v1beta1_OCIManagedControlPlaneTemplateResource(in *v1beta2.OCIManagedControlPlaneTemplateResource, out *OCIManagedControlPlaneTemplateResource, s conversion.Scope) error { - return autoConvert_v1beta2_OCIManagedControlPlaneTemplateResource_To_v1beta1_OCIManagedControlPlaneTemplateResource(in, out, s) -} - -func autoConvert_v1beta1_OCIManagedControlPlaneTemplateSpec_To_v1beta2_OCIManagedControlPlaneTemplateSpec(in *OCIManagedControlPlaneTemplateSpec, out *v1beta2.OCIManagedControlPlaneTemplateSpec, s conversion.Scope) error { - if err := Convert_v1beta1_OCIManagedControlPlaneTemplateResource_To_v1beta2_OCIManagedControlPlaneTemplateResource(&in.Template, &out.Template, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_OCIManagedControlPlaneTemplateSpec_To_v1beta2_OCIManagedControlPlaneTemplateSpec is an autogenerated conversion function. -func Convert_v1beta1_OCIManagedControlPlaneTemplateSpec_To_v1beta2_OCIManagedControlPlaneTemplateSpec(in *OCIManagedControlPlaneTemplateSpec, out *v1beta2.OCIManagedControlPlaneTemplateSpec, s conversion.Scope) error { - return autoConvert_v1beta1_OCIManagedControlPlaneTemplateSpec_To_v1beta2_OCIManagedControlPlaneTemplateSpec(in, out, s) -} - -func autoConvert_v1beta2_OCIManagedControlPlaneTemplateSpec_To_v1beta1_OCIManagedControlPlaneTemplateSpec(in *v1beta2.OCIManagedControlPlaneTemplateSpec, out *OCIManagedControlPlaneTemplateSpec, s conversion.Scope) error { - if err := Convert_v1beta2_OCIManagedControlPlaneTemplateResource_To_v1beta1_OCIManagedControlPlaneTemplateResource(&in.Template, &out.Template, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta2_OCIManagedControlPlaneTemplateSpec_To_v1beta1_OCIManagedControlPlaneTemplateSpec is an autogenerated conversion function. -func Convert_v1beta2_OCIManagedControlPlaneTemplateSpec_To_v1beta1_OCIManagedControlPlaneTemplateSpec(in *v1beta2.OCIManagedControlPlaneTemplateSpec, out *OCIManagedControlPlaneTemplateSpec, s conversion.Scope) error { - return autoConvert_v1beta2_OCIManagedControlPlaneTemplateSpec_To_v1beta1_OCIManagedControlPlaneTemplateSpec(in, out, s) -} - func autoConvert_v1beta1_OCIManagedMachinePool_To_v1beta2_OCIManagedMachinePool(in *OCIManagedMachinePool, out *v1beta2.OCIManagedMachinePool, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1beta1_OCIManagedMachinePoolSpec_To_v1beta2_OCIManagedMachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { diff --git a/exp/api/v1beta1/zz_generated.deepcopy.go b/exp/api/v1beta1/zz_generated.deepcopy.go index 96810bc8..467c6095 100644 --- a/exp/api/v1beta1/zz_generated.deepcopy.go +++ b/exp/api/v1beta1/zz_generated.deepcopy.go @@ -23,139 +23,11 @@ package v1beta1 import ( apiv1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" - "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" cluster_apiapiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/errors" ) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AddOnOptions) DeepCopyInto(out *AddOnOptions) { - *out = *in - if in.IsKubernetesDashboardEnabled != nil { - in, out := &in.IsKubernetesDashboardEnabled, &out.IsKubernetesDashboardEnabled - *out = new(bool) - **out = **in - } - if in.IsTillerEnabled != nil { - in, out := &in.IsTillerEnabled, &out.IsTillerEnabled - *out = new(bool) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddOnOptions. -func (in *AddOnOptions) DeepCopy() *AddOnOptions { - if in == nil { - return nil - } - out := new(AddOnOptions) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AdmissionControllerOptions) DeepCopyInto(out *AdmissionControllerOptions) { - *out = *in - if in.IsPodSecurityPolicyEnabled != nil { - in, out := &in.IsPodSecurityPolicyEnabled, &out.IsPodSecurityPolicyEnabled - *out = new(bool) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionControllerOptions. -func (in *AdmissionControllerOptions) DeepCopy() *AdmissionControllerOptions { - if in == nil { - return nil - } - out := new(AdmissionControllerOptions) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterOptions) DeepCopyInto(out *ClusterOptions) { - *out = *in - if in.AddOnOptions != nil { - in, out := &in.AddOnOptions, &out.AddOnOptions - *out = new(AddOnOptions) - (*in).DeepCopyInto(*out) - } - if in.AdmissionControllerOptions != nil { - in, out := &in.AdmissionControllerOptions, &out.AdmissionControllerOptions - *out = new(AdmissionControllerOptions) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterOptions. -func (in *ClusterOptions) DeepCopy() *ClusterOptions { - if in == nil { - return nil - } - out := new(ClusterOptions) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterPodNetworkOptions) DeepCopyInto(out *ClusterPodNetworkOptions) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterPodNetworkOptions. -func (in *ClusterPodNetworkOptions) DeepCopy() *ClusterPodNetworkOptions { - if in == nil { - return nil - } - out := new(ClusterPodNetworkOptions) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointConfig) DeepCopyInto(out *EndpointConfig) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointConfig. -func (in *EndpointConfig) DeepCopy() *EndpointConfig { - if in == nil { - return nil - } - out := new(EndpointConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ImagePolicyConfig) DeepCopyInto(out *ImagePolicyConfig) { - *out = *in - if in.IsPolicyEnabled != nil { - in, out := &in.IsPolicyEnabled, &out.IsPolicyEnabled - *out = new(bool) - **out = **in - } - if in.KeyDetails != nil { - in, out := &in.KeyDetails, &out.KeyDetails - *out = make([]KeyDetails, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImagePolicyConfig. -func (in *ImagePolicyConfig) DeepCopy() *ImagePolicyConfig { - if in == nil { - return nil - } - out := new(ImagePolicyConfig) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InstanceConfiguration) DeepCopyInto(out *InstanceConfiguration) { *out = *in @@ -328,26 +200,6 @@ func (in *InstanceVnicConfiguration) DeepCopy() *InstanceVnicConfiguration { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KeyDetails) DeepCopyInto(out *KeyDetails) { - *out = *in - if in.KmsKeyId != nil { - in, out := &in.KmsKeyId, &out.KmsKeyId - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyDetails. -func (in *KeyDetails) DeepCopy() *KeyDetails { - if in == nil { - return nil - } - out := new(KeyDetails) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KeyValue) DeepCopyInto(out *KeyValue) { *out = *in @@ -373,21 +225,6 @@ func (in *KeyValue) DeepCopy() *KeyValue { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KubernetesNetworkConfig) DeepCopyInto(out *KubernetesNetworkConfig) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesNetworkConfig. -func (in *KubernetesNetworkConfig) DeepCopy() *KubernetesNetworkConfig { - if in == nil { - return nil - } - out := new(KubernetesNetworkConfig) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchDetails) DeepCopyInto(out *LaunchDetails) { *out = *in @@ -670,455 +507,6 @@ func (in *OCIMachinePoolStatus) DeepCopy() *OCIMachinePoolStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedCluster) DeepCopyInto(out *OCIManagedCluster) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedCluster. -func (in *OCIManagedCluster) DeepCopy() *OCIManagedCluster { - if in == nil { - return nil - } - out := new(OCIManagedCluster) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OCIManagedCluster) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedClusterList) DeepCopyInto(out *OCIManagedClusterList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]OCIManagedCluster, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterList. -func (in *OCIManagedClusterList) DeepCopy() *OCIManagedClusterList { - if in == nil { - return nil - } - out := new(OCIManagedClusterList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OCIManagedClusterList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedClusterSpec) DeepCopyInto(out *OCIManagedClusterSpec) { - *out = *in - if in.IdentityRef != nil { - in, out := &in.IdentityRef, &out.IdentityRef - *out = new(v1.ObjectReference) - **out = **in - } - in.NetworkSpec.DeepCopyInto(&out.NetworkSpec) - if in.FreeformTags != nil { - in, out := &in.FreeformTags, &out.FreeformTags - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.DefinedTags != nil { - in, out := &in.DefinedTags, &out.DefinedTags - *out = make(map[string]map[string]string, len(*in)) - for key, val := range *in { - var outVal map[string]string - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - (*out)[key] = outVal - } - } - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterSpec. -func (in *OCIManagedClusterSpec) DeepCopy() *OCIManagedClusterSpec { - if in == nil { - return nil - } - out := new(OCIManagedClusterSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedClusterStatus) DeepCopyInto(out *OCIManagedClusterStatus) { - *out = *in - if in.FailureDomains != nil { - in, out := &in.FailureDomains, &out.FailureDomains - *out = make(cluster_apiapiv1beta1.FailureDomains, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - if in.AvailabilityDomains != nil { - in, out := &in.AvailabilityDomains, &out.AvailabilityDomains - *out = make(map[string]apiv1beta1.OCIAvailabilityDomain, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(cluster_apiapiv1beta1.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterStatus. -func (in *OCIManagedClusterStatus) DeepCopy() *OCIManagedClusterStatus { - if in == nil { - return nil - } - out := new(OCIManagedClusterStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedClusterTemplate) DeepCopyInto(out *OCIManagedClusterTemplate) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterTemplate. -func (in *OCIManagedClusterTemplate) DeepCopy() *OCIManagedClusterTemplate { - if in == nil { - return nil - } - out := new(OCIManagedClusterTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OCIManagedClusterTemplate) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedClusterTemplateList) DeepCopyInto(out *OCIManagedClusterTemplateList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]OCIManagedClusterTemplate, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterTemplateList. -func (in *OCIManagedClusterTemplateList) DeepCopy() *OCIManagedClusterTemplateList { - if in == nil { - return nil - } - out := new(OCIManagedClusterTemplateList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OCIManagedClusterTemplateList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedClusterTemplateResource) DeepCopyInto(out *OCIManagedClusterTemplateResource) { - *out = *in - in.Spec.DeepCopyInto(&out.Spec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterTemplateResource. -func (in *OCIManagedClusterTemplateResource) DeepCopy() *OCIManagedClusterTemplateResource { - if in == nil { - return nil - } - out := new(OCIManagedClusterTemplateResource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedClusterTemplateSpec) DeepCopyInto(out *OCIManagedClusterTemplateSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterTemplateSpec. -func (in *OCIManagedClusterTemplateSpec) DeepCopy() *OCIManagedClusterTemplateSpec { - if in == nil { - return nil - } - out := new(OCIManagedClusterTemplateSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedControlPlane) DeepCopyInto(out *OCIManagedControlPlane) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlane. -func (in *OCIManagedControlPlane) DeepCopy() *OCIManagedControlPlane { - if in == nil { - return nil - } - out := new(OCIManagedControlPlane) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OCIManagedControlPlane) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedControlPlaneList) DeepCopyInto(out *OCIManagedControlPlaneList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]OCIManagedControlPlane, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneList. -func (in *OCIManagedControlPlaneList) DeepCopy() *OCIManagedControlPlaneList { - if in == nil { - return nil - } - out := new(OCIManagedControlPlaneList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OCIManagedControlPlaneList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedControlPlaneSpec) DeepCopyInto(out *OCIManagedControlPlaneSpec) { - *out = *in - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(string) - **out = **in - } - if in.ClusterPodNetworkOptions != nil { - in, out := &in.ClusterPodNetworkOptions, &out.ClusterPodNetworkOptions - *out = make([]ClusterPodNetworkOptions, len(*in)) - copy(*out, *in) - } - if in.ImagePolicyConfig != nil { - in, out := &in.ImagePolicyConfig, &out.ImagePolicyConfig - *out = new(ImagePolicyConfig) - (*in).DeepCopyInto(*out) - } - in.ClusterOption.DeepCopyInto(&out.ClusterOption) - if in.KmsKeyId != nil { - in, out := &in.KmsKeyId, &out.KmsKeyId - *out = new(string) - **out = **in - } - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint - if in.Version != nil { - in, out := &in.Version, &out.Version - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneSpec. -func (in *OCIManagedControlPlaneSpec) DeepCopy() *OCIManagedControlPlaneSpec { - if in == nil { - return nil - } - out := new(OCIManagedControlPlaneSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedControlPlaneStatus) DeepCopyInto(out *OCIManagedControlPlaneStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(cluster_apiapiv1beta1.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Version != nil { - in, out := &in.Version, &out.Version - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneStatus. -func (in *OCIManagedControlPlaneStatus) DeepCopy() *OCIManagedControlPlaneStatus { - if in == nil { - return nil - } - out := new(OCIManagedControlPlaneStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedControlPlaneTemplate) DeepCopyInto(out *OCIManagedControlPlaneTemplate) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneTemplate. -func (in *OCIManagedControlPlaneTemplate) DeepCopy() *OCIManagedControlPlaneTemplate { - if in == nil { - return nil - } - out := new(OCIManagedControlPlaneTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OCIManagedControlPlaneTemplate) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedControlPlaneTemplateList) DeepCopyInto(out *OCIManagedControlPlaneTemplateList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]OCIManagedControlPlaneTemplate, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneTemplateList. -func (in *OCIManagedControlPlaneTemplateList) DeepCopy() *OCIManagedControlPlaneTemplateList { - if in == nil { - return nil - } - out := new(OCIManagedControlPlaneTemplateList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OCIManagedControlPlaneTemplateList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedControlPlaneTemplateResource) DeepCopyInto(out *OCIManagedControlPlaneTemplateResource) { - *out = *in - in.Spec.DeepCopyInto(&out.Spec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneTemplateResource. -func (in *OCIManagedControlPlaneTemplateResource) DeepCopy() *OCIManagedControlPlaneTemplateResource { - if in == nil { - return nil - } - out := new(OCIManagedControlPlaneTemplateResource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedControlPlaneTemplateSpec) DeepCopyInto(out *OCIManagedControlPlaneTemplateSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneTemplateSpec. -func (in *OCIManagedControlPlaneTemplateSpec) DeepCopy() *OCIManagedControlPlaneTemplateSpec { - if in == nil { - return nil - } - out := new(OCIManagedControlPlaneTemplateSpec) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OCIManagedMachinePool) DeepCopyInto(out *OCIManagedMachinePool) { *out = *in diff --git a/exp/api/v1beta2/conditions_consts.go b/exp/api/v1beta2/conditions_consts.go index 47edc988..c59aa565 100644 --- a/exp/api/v1beta2/conditions_consts.go +++ b/exp/api/v1beta2/conditions_consts.go @@ -62,17 +62,4 @@ const ( LaunchTemplateNotFoundReason = "LaunchTemplateNotFound" // LaunchTemplateCreateFailedReason used for failures during Launch Template creation. LaunchTemplateCreateFailedReason = "LaunchTemplateCreateFailed" - - // ControlPlaneReadyCondition Ready indicates the control plane is in a Running state. - ControlPlaneReadyCondition clusterv1.ConditionType = "ControlPlaneReady" - // ControlPlaneProvisionFailedReason used for failures during control plane provisioning. - ControlPlaneProvisionFailedReason = "ControlPlaneProvisionFailed" - // ControlPlaneNotReadyReason used when the control plane is in a pending state. - ControlPlaneNotReadyReason = "ControlPlaneNotReady" - // ControlPlaneDeletionInProgress Control Plane deletion is in progress state. - ControlPlaneDeletionInProgress = "ControlPlaneDeletionInProgress" - // ControlPlaneNotFoundReason used when the control plane couldn't be retrieved. - ControlPlaneNotFoundReason = "ControlPlaneNotFound" - // ControlPlaneDeletedReason used when the control plane has been deleted. - ControlPlaneDeletedReason = "ControlPlaneDeleted" ) diff --git a/exp/api/v1beta2/conversion.go b/exp/api/v1beta2/conversion.go index 13fbbc9a..d4080ebf 100644 --- a/exp/api/v1beta2/conversion.go +++ b/exp/api/v1beta2/conversion.go @@ -16,21 +16,6 @@ limitations under the License. package v1beta2 -// Hub marks OCIManagedControlPlane as a conversion hub. -func (*OCIManagedControlPlane) Hub() {} - -// Hub marks OCIManagedCluster as a conversion hub. -func (*OCIManagedCluster) Hub() {} - -// Hub marks OCIManagedClusterTemplate as a conversion hub. -func (*OCIManagedClusterTemplate) Hub() {} - -// Hub marks OCIManagedClusterTemplateList as a conversion hub. -func (*OCIManagedClusterTemplateList) Hub() {} - -// Hub marks OCIManagedControlPlaneList as a conversion hub. -func (*OCIManagedControlPlaneList) Hub() {} - // Hub marks OCIManagedMachinePool as a conversion hub. func (*OCIManagedMachinePool) Hub() {} diff --git a/exp/api/v1beta2/ocimanagedmachinepool_types.go b/exp/api/v1beta2/ocimanagedmachinepool_types.go index 5937da90..9691e58c 100644 --- a/exp/api/v1beta2/ocimanagedmachinepool_types.go +++ b/exp/api/v1beta2/ocimanagedmachinepool_types.go @@ -1,6 +1,7 @@ package v1beta2 import ( + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/errors" @@ -93,19 +94,12 @@ type NodePoolNodeConfig struct { NodePoolPodNetworkOptionDetails *NodePoolPodNetworkOptionDetails `json:"nodePoolPodNetworkOptionDetails,omitempty"` } -const ( - VCNNativeCNI CNIOptionEnum = "OCI_VCN_IP_NATIVE" - FlannelCNI CNIOptionEnum = "FLANNEL_OVERLAY" -) - -type CNIOptionEnum string - // NodePoolPodNetworkOptionDetails describes the CNI related configuration of pods in the node pool. type NodePoolPodNetworkOptionDetails struct { // CniType describes the CNI plugin used by this node pool. Allowed values are OCI_VCN_IP_NATIVE and FLANNEL_OVERLAY. // +optional - CniType CNIOptionEnum `json:"cniType,omitempty"` + CniType infrastructurev1beta2.CNIOptionEnum `json:"cniType,omitempty"` // VcnIpNativePodNetworkOptions describes the network options specific to using the OCI VCN Native CNI // +optional diff --git a/exp/api/v1beta2/ocimanagedmachinepool_webhook.go b/exp/api/v1beta2/ocimanagedmachinepool_webhook.go index 716e9bd1..ae754ec2 100644 --- a/exp/api/v1beta2/ocimanagedmachinepool_webhook.go +++ b/exp/api/v1beta2/ocimanagedmachinepool_webhook.go @@ -18,6 +18,7 @@ package v1beta2 import ( "fmt" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "reflect" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -50,7 +51,7 @@ func (m *OCIManagedMachinePool) Default() { } if m.Spec.NodePoolNodeConfig.NodePoolPodNetworkOptionDetails == nil { m.Spec.NodePoolNodeConfig.NodePoolPodNetworkOptionDetails = &NodePoolPodNetworkOptionDetails{ - CniType: VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, VcnIpNativePodNetworkOptions: VcnIpNativePodNetworkOptions{ SubnetNames: []string{PodDefaultName}, NSGNames: []string{PodDefaultName}, diff --git a/exp/api/v1beta2/zz_generated.deepcopy.go b/exp/api/v1beta2/zz_generated.deepcopy.go index 60851135..bd6f4d1c 100644 --- a/exp/api/v1beta2/zz_generated.deepcopy.go +++ b/exp/api/v1beta2/zz_generated.deepcopy.go @@ -23,256 +23,11 @@ package v1beta2 import ( apiv1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" - "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/errors" ) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AddOnOptions) DeepCopyInto(out *AddOnOptions) { - *out = *in - if in.IsKubernetesDashboardEnabled != nil { - in, out := &in.IsKubernetesDashboardEnabled, &out.IsKubernetesDashboardEnabled - *out = new(bool) - **out = **in - } - if in.IsTillerEnabled != nil { - in, out := &in.IsTillerEnabled, &out.IsTillerEnabled - *out = new(bool) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddOnOptions. -func (in *AddOnOptions) DeepCopy() *AddOnOptions { - if in == nil { - return nil - } - out := new(AddOnOptions) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Addon) DeepCopyInto(out *Addon) { - *out = *in - if in.Name != nil { - in, out := &in.Name, &out.Name - *out = new(string) - **out = **in - } - if in.Version != nil { - in, out := &in.Version, &out.Version - *out = new(string) - **out = **in - } - if in.Configurations != nil { - in, out := &in.Configurations, &out.Configurations - *out = make([]AddonConfiguration, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Addon. -func (in *Addon) DeepCopy() *Addon { - if in == nil { - return nil - } - out := new(Addon) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AddonConfiguration) DeepCopyInto(out *AddonConfiguration) { - *out = *in - if in.Key != nil { - in, out := &in.Key, &out.Key - *out = new(string) - **out = **in - } - if in.Value != nil { - in, out := &in.Value, &out.Value - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonConfiguration. -func (in *AddonConfiguration) DeepCopy() *AddonConfiguration { - if in == nil { - return nil - } - out := new(AddonConfiguration) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AddonError) DeepCopyInto(out *AddonError) { - *out = *in - if in.Code != nil { - in, out := &in.Code, &out.Code - *out = new(string) - **out = **in - } - if in.Message != nil { - in, out := &in.Message, &out.Message - *out = new(string) - **out = **in - } - if in.Status != nil { - in, out := &in.Status, &out.Status - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonError. -func (in *AddonError) DeepCopy() *AddonError { - if in == nil { - return nil - } - out := new(AddonError) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AddonStatus) DeepCopyInto(out *AddonStatus) { - *out = *in - if in.CurrentlyInstalledVersion != nil { - in, out := &in.CurrentlyInstalledVersion, &out.CurrentlyInstalledVersion - *out = new(string) - **out = **in - } - if in.AddonError != nil { - in, out := &in.AddonError, &out.AddonError - *out = new(AddonError) - (*in).DeepCopyInto(*out) - } - if in.LifecycleState != nil { - in, out := &in.LifecycleState, &out.LifecycleState - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonStatus. -func (in *AddonStatus) DeepCopy() *AddonStatus { - if in == nil { - return nil - } - out := new(AddonStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AdmissionControllerOptions) DeepCopyInto(out *AdmissionControllerOptions) { - *out = *in - if in.IsPodSecurityPolicyEnabled != nil { - in, out := &in.IsPodSecurityPolicyEnabled, &out.IsPodSecurityPolicyEnabled - *out = new(bool) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionControllerOptions. -func (in *AdmissionControllerOptions) DeepCopy() *AdmissionControllerOptions { - if in == nil { - return nil - } - out := new(AdmissionControllerOptions) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterOptions) DeepCopyInto(out *ClusterOptions) { - *out = *in - if in.AddOnOptions != nil { - in, out := &in.AddOnOptions, &out.AddOnOptions - *out = new(AddOnOptions) - (*in).DeepCopyInto(*out) - } - if in.AdmissionControllerOptions != nil { - in, out := &in.AdmissionControllerOptions, &out.AdmissionControllerOptions - *out = new(AdmissionControllerOptions) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterOptions. -func (in *ClusterOptions) DeepCopy() *ClusterOptions { - if in == nil { - return nil - } - out := new(ClusterOptions) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterPodNetworkOptions) DeepCopyInto(out *ClusterPodNetworkOptions) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterPodNetworkOptions. -func (in *ClusterPodNetworkOptions) DeepCopy() *ClusterPodNetworkOptions { - if in == nil { - return nil - } - out := new(ClusterPodNetworkOptions) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointConfig) DeepCopyInto(out *EndpointConfig) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointConfig. -func (in *EndpointConfig) DeepCopy() *EndpointConfig { - if in == nil { - return nil - } - out := new(EndpointConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ImagePolicyConfig) DeepCopyInto(out *ImagePolicyConfig) { - *out = *in - if in.IsPolicyEnabled != nil { - in, out := &in.IsPolicyEnabled, &out.IsPolicyEnabled - *out = new(bool) - **out = **in - } - if in.KeyDetails != nil { - in, out := &in.KeyDetails, &out.KeyDetails - *out = make([]KeyDetails, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImagePolicyConfig. -func (in *ImagePolicyConfig) DeepCopy() *ImagePolicyConfig { - if in == nil { - return nil - } - out := new(ImagePolicyConfig) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InstanceConfiguration) DeepCopyInto(out *InstanceConfiguration) { *out = *in @@ -445,26 +200,6 @@ func (in *InstanceVnicConfiguration) DeepCopy() *InstanceVnicConfiguration { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KeyDetails) DeepCopyInto(out *KeyDetails) { - *out = *in - if in.KmsKeyId != nil { - in, out := &in.KmsKeyId, &out.KmsKeyId - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyDetails. -func (in *KeyDetails) DeepCopy() *KeyDetails { - if in == nil { - return nil - } - out := new(KeyDetails) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KeyValue) DeepCopyInto(out *KeyValue) { *out = *in @@ -490,21 +225,6 @@ func (in *KeyValue) DeepCopy() *KeyValue { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KubernetesNetworkConfig) DeepCopyInto(out *KubernetesNetworkConfig) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesNetworkConfig. -func (in *KubernetesNetworkConfig) DeepCopy() *KubernetesNetworkConfig { - if in == nil { - return nil - } - out := new(KubernetesNetworkConfig) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchDetails) DeepCopyInto(out *LaunchDetails) { *out = *in @@ -817,474 +537,6 @@ func (in *OCIMachinePoolStatus) DeepCopy() *OCIMachinePoolStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedCluster) DeepCopyInto(out *OCIManagedCluster) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedCluster. -func (in *OCIManagedCluster) DeepCopy() *OCIManagedCluster { - if in == nil { - return nil - } - out := new(OCIManagedCluster) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OCIManagedCluster) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedClusterList) DeepCopyInto(out *OCIManagedClusterList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]OCIManagedCluster, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterList. -func (in *OCIManagedClusterList) DeepCopy() *OCIManagedClusterList { - if in == nil { - return nil - } - out := new(OCIManagedClusterList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OCIManagedClusterList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedClusterSpec) DeepCopyInto(out *OCIManagedClusterSpec) { - *out = *in - if in.IdentityRef != nil { - in, out := &in.IdentityRef, &out.IdentityRef - *out = new(v1.ObjectReference) - **out = **in - } - in.NetworkSpec.DeepCopyInto(&out.NetworkSpec) - if in.FreeformTags != nil { - in, out := &in.FreeformTags, &out.FreeformTags - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.DefinedTags != nil { - in, out := &in.DefinedTags, &out.DefinedTags - *out = make(map[string]map[string]string, len(*in)) - for key, val := range *in { - var outVal map[string]string - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - (*out)[key] = outVal - } - } - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint - if in.AvailabilityDomains != nil { - in, out := &in.AvailabilityDomains, &out.AvailabilityDomains - *out = make(map[string]apiv1beta2.OCIAvailabilityDomain, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - if in.ClientOverrides != nil { - in, out := &in.ClientOverrides, &out.ClientOverrides - *out = new(apiv1beta2.ClientOverrides) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterSpec. -func (in *OCIManagedClusterSpec) DeepCopy() *OCIManagedClusterSpec { - if in == nil { - return nil - } - out := new(OCIManagedClusterSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedClusterStatus) DeepCopyInto(out *OCIManagedClusterStatus) { - *out = *in - if in.FailureDomains != nil { - in, out := &in.FailureDomains, &out.FailureDomains - *out = make(v1beta1.FailureDomains, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(v1beta1.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterStatus. -func (in *OCIManagedClusterStatus) DeepCopy() *OCIManagedClusterStatus { - if in == nil { - return nil - } - out := new(OCIManagedClusterStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedClusterTemplate) DeepCopyInto(out *OCIManagedClusterTemplate) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterTemplate. -func (in *OCIManagedClusterTemplate) DeepCopy() *OCIManagedClusterTemplate { - if in == nil { - return nil - } - out := new(OCIManagedClusterTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OCIManagedClusterTemplate) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedClusterTemplateList) DeepCopyInto(out *OCIManagedClusterTemplateList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]OCIManagedClusterTemplate, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterTemplateList. -func (in *OCIManagedClusterTemplateList) DeepCopy() *OCIManagedClusterTemplateList { - if in == nil { - return nil - } - out := new(OCIManagedClusterTemplateList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OCIManagedClusterTemplateList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedClusterTemplateResource) DeepCopyInto(out *OCIManagedClusterTemplateResource) { - *out = *in - in.Spec.DeepCopyInto(&out.Spec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterTemplateResource. -func (in *OCIManagedClusterTemplateResource) DeepCopy() *OCIManagedClusterTemplateResource { - if in == nil { - return nil - } - out := new(OCIManagedClusterTemplateResource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedClusterTemplateSpec) DeepCopyInto(out *OCIManagedClusterTemplateSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedClusterTemplateSpec. -func (in *OCIManagedClusterTemplateSpec) DeepCopy() *OCIManagedClusterTemplateSpec { - if in == nil { - return nil - } - out := new(OCIManagedClusterTemplateSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedControlPlane) DeepCopyInto(out *OCIManagedControlPlane) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlane. -func (in *OCIManagedControlPlane) DeepCopy() *OCIManagedControlPlane { - if in == nil { - return nil - } - out := new(OCIManagedControlPlane) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OCIManagedControlPlane) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedControlPlaneList) DeepCopyInto(out *OCIManagedControlPlaneList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]OCIManagedControlPlane, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneList. -func (in *OCIManagedControlPlaneList) DeepCopy() *OCIManagedControlPlaneList { - if in == nil { - return nil - } - out := new(OCIManagedControlPlaneList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OCIManagedControlPlaneList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedControlPlaneSpec) DeepCopyInto(out *OCIManagedControlPlaneSpec) { - *out = *in - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(string) - **out = **in - } - if in.ClusterPodNetworkOptions != nil { - in, out := &in.ClusterPodNetworkOptions, &out.ClusterPodNetworkOptions - *out = make([]ClusterPodNetworkOptions, len(*in)) - copy(*out, *in) - } - if in.ImagePolicyConfig != nil { - in, out := &in.ImagePolicyConfig, &out.ImagePolicyConfig - *out = new(ImagePolicyConfig) - (*in).DeepCopyInto(*out) - } - in.ClusterOption.DeepCopyInto(&out.ClusterOption) - if in.KmsKeyId != nil { - in, out := &in.KmsKeyId, &out.KmsKeyId - *out = new(string) - **out = **in - } - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint - if in.Addons != nil { - in, out := &in.Addons, &out.Addons - *out = make([]Addon, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Version != nil { - in, out := &in.Version, &out.Version - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneSpec. -func (in *OCIManagedControlPlaneSpec) DeepCopy() *OCIManagedControlPlaneSpec { - if in == nil { - return nil - } - out := new(OCIManagedControlPlaneSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedControlPlaneStatus) DeepCopyInto(out *OCIManagedControlPlaneStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(v1beta1.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Version != nil { - in, out := &in.Version, &out.Version - *out = new(string) - **out = **in - } - if in.AddonStatus != nil { - in, out := &in.AddonStatus, &out.AddonStatus - *out = make(map[string]AddonStatus, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneStatus. -func (in *OCIManagedControlPlaneStatus) DeepCopy() *OCIManagedControlPlaneStatus { - if in == nil { - return nil - } - out := new(OCIManagedControlPlaneStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedControlPlaneTemplate) DeepCopyInto(out *OCIManagedControlPlaneTemplate) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneTemplate. -func (in *OCIManagedControlPlaneTemplate) DeepCopy() *OCIManagedControlPlaneTemplate { - if in == nil { - return nil - } - out := new(OCIManagedControlPlaneTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OCIManagedControlPlaneTemplate) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedControlPlaneTemplateList) DeepCopyInto(out *OCIManagedControlPlaneTemplateList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]OCIManagedControlPlaneTemplate, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneTemplateList. -func (in *OCIManagedControlPlaneTemplateList) DeepCopy() *OCIManagedControlPlaneTemplateList { - if in == nil { - return nil - } - out := new(OCIManagedControlPlaneTemplateList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *OCIManagedControlPlaneTemplateList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedControlPlaneTemplateResource) DeepCopyInto(out *OCIManagedControlPlaneTemplateResource) { - *out = *in - in.Spec.DeepCopyInto(&out.Spec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneTemplateResource. -func (in *OCIManagedControlPlaneTemplateResource) DeepCopy() *OCIManagedControlPlaneTemplateResource { - if in == nil { - return nil - } - out := new(OCIManagedControlPlaneTemplateResource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OCIManagedControlPlaneTemplateSpec) DeepCopyInto(out *OCIManagedControlPlaneTemplateSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedControlPlaneTemplateSpec. -func (in *OCIManagedControlPlaneTemplateSpec) DeepCopy() *OCIManagedControlPlaneTemplateSpec { - if in == nil { - return nil - } - out := new(OCIManagedControlPlaneTemplateSpec) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OCIManagedMachinePool) DeepCopyInto(out *OCIManagedMachinePool) { *out = *in diff --git a/exp/controllers/ocimachinepool_controller.go b/exp/controllers/ocimachinepool_controller.go index 58e30fa0..5b28be13 100644 --- a/exp/controllers/ocimachinepool_controller.go +++ b/exp/controllers/ocimachinepool_controller.go @@ -121,7 +121,7 @@ func (r *OCIMachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Reque var clusterAccessor scope.OCIClusterAccessor if err := r.Client.Get(ctx, ociClusterName, ociCluster); err != nil { - ociManagedCluster := &infrav2exp.OCIManagedCluster{} + ociManagedCluster := &infrastructurev1beta2.OCIManagedCluster{} ociManagedClusterName := client.ObjectKey{ Namespace: cluster.Namespace, Name: cluster.Spec.InfrastructureRef.Name, diff --git a/exp/controllers/ocimachinepool_controller_test.go b/exp/controllers/ocimachinepool_controller_test.go index 35118377..44b1d33d 100644 --- a/exp/controllers/ocimachinepool_controller_test.go +++ b/exp/controllers/ocimachinepool_controller_test.go @@ -43,6 +43,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" ) +var ( + MockTestRegion = "us-austin-1" +) + func TestMachinePoolReconciliation(t *testing.T) { var ( r OCIMachinePoolReconciler @@ -657,3 +661,22 @@ func expectMachinePoolConditions(g *WithT, m *infrav2exp.OCIMachinePool, expecte g.Expect(actual.Reason).To(Equal(c.reason)) } } + +type conditionAssertion struct { + conditionType clusterv1.ConditionType + status corev1.ConditionStatus + severity clusterv1.ConditionSeverity + reason string +} + +func getSecret() *corev1.Secret { + return &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: "bootstrap", + Namespace: "default", + }, + Data: map[string][]byte{ + "value": []byte("test"), + }, + } +} diff --git a/exp/controllers/ocimanaged_machinepool_controller.go b/exp/controllers/ocimanaged_machinepool_controller.go index 3158b131..7803077d 100644 --- a/exp/controllers/ocimanaged_machinepool_controller.go +++ b/exp/controllers/ocimanaged_machinepool_controller.go @@ -113,7 +113,7 @@ func (r *OCIManagedMachinePoolReconciler) Reconcile(ctx context.Context, req ctr return ctrl.Result{}, nil } - ociManagedCluster := &infrav2exp.OCIManagedCluster{} + ociManagedCluster := &infrastructurev1beta2.OCIManagedCluster{} ociClusterName := client.ObjectKey{ Namespace: cluster.Namespace, Name: cluster.Name, @@ -134,7 +134,7 @@ func (r *OCIManagedMachinePoolReconciler) Reconcile(ctx context.Context, req ctr return ctrl.Result{}, err } - controlPlane := &infrav2exp.OCIManagedControlPlane{} + controlPlane := &infrastructurev1beta2.OCIManagedControlPlane{} controlPlaneRef := types.NamespacedName{ Name: cluster.Spec.ControlPlaneRef.Name, Namespace: cluster.Namespace, @@ -193,7 +193,7 @@ func (r *OCIManagedMachinePoolReconciler) SetupWithManager(ctx context.Context, GroupVersion.WithKind(scope.OCIManagedMachinePoolKind), logger)), ). Watches( - &source.Kind{Type: &infrav2exp.OCIManagedCluster{}}, + &source.Kind{Type: &infrastructurev1beta2.OCIManagedCluster{}}, handler.EnqueueRequestsFromMapFunc(managedControlPlaneToManagedMachinePoolMap), ). WithEventFilter(predicates.ResourceNotPaused(ctrl.LoggerFrom(ctx))). @@ -203,7 +203,7 @@ func (r *OCIManagedMachinePoolReconciler) SetupWithManager(ctx context.Context, func managedClusterToManagedMachinePoolMapFunc(c client.Client, gvk schema.GroupVersionKind, log logr.Logger) handler.MapFunc { return func(o client.Object) []reconcile.Request { ctx := context.Background() - ociCluster, ok := o.(*infrav2exp.OCIManagedCluster) + ociCluster, ok := o.(*infrastructurev1beta2.OCIManagedCluster) if !ok { panic(fmt.Sprintf("Expected a OCIManagedControlPlane but got a %T", o)) } diff --git a/exp/controllers/ocimanaged_machinepool_controller_test.go b/exp/controllers/ocimanaged_machinepool_controller_test.go index 44d41131..61d8617c 100644 --- a/exp/controllers/ocimanaged_machinepool_controller_test.go +++ b/exp/controllers/ocimanaged_machinepool_controller_test.go @@ -18,6 +18,7 @@ package controllers import ( "context" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "testing" "github.com/golang/mock/gomock" @@ -159,11 +160,11 @@ func TestNormalReconciliationFunction(t *testing.T) { machinePool := getMachinePool() ociManagedMachinePool = getOCIManagedMachinePool() ociCluster := getOCIManagedClusterWithOwner() - ociManagedControlPlane := infrav2exp.OCIManagedControlPlane{ - Spec: infrav2exp.OCIManagedControlPlaneSpec{ + ociManagedControlPlane := infrastructurev1beta2.OCIManagedControlPlane{ + Spec: infrastructurev1beta2.OCIManagedControlPlaneSpec{ ID: common.String("cluster-id"), }, - Status: infrav2exp.OCIManagedControlPlaneStatus{ + Status: infrastructurev1beta2.OCIManagedControlPlaneStatus{ Ready: true, }, } @@ -455,11 +456,11 @@ func TestDeletionFunction(t *testing.T) { machinePool := getMachinePool() ociManagedMachinePool = getOCIManagedMachinePool() ociCluster := getOCIManagedClusterWithOwner() - ociManagedControlPlane := infrav2exp.OCIManagedControlPlane{ - Spec: infrav2exp.OCIManagedControlPlaneSpec{ + ociManagedControlPlane := infrastructurev1beta2.OCIManagedControlPlane{ + Spec: infrastructurev1beta2.OCIManagedControlPlaneSpec{ ID: common.String("cluster-id"), }, - Status: infrav2exp.OCIManagedControlPlaneStatus{ + Status: infrastructurev1beta2.OCIManagedControlPlaneStatus{ Ready: true, }, } @@ -656,7 +657,7 @@ func getOCIManagedMachinePool() *infrav2exp.OCIManagedMachinePool { KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav2exp.VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(31), diff --git a/exp/controllers/ocivirtual_machinepool_controller.go b/exp/controllers/ocivirtual_machinepool_controller.go index 8675d6f1..5835479b 100644 --- a/exp/controllers/ocivirtual_machinepool_controller.go +++ b/exp/controllers/ocivirtual_machinepool_controller.go @@ -113,7 +113,7 @@ func (r *OCIVirtualMachinePoolReconciler) Reconcile(ctx context.Context, req ctr return ctrl.Result{}, nil } - ociManagedCluster := &infrav2exp.OCIManagedCluster{} + ociManagedCluster := &infrastructurev1beta2.OCIManagedCluster{} ociClusterName := client.ObjectKey{ Namespace: cluster.Namespace, Name: cluster.Name, @@ -134,7 +134,7 @@ func (r *OCIVirtualMachinePoolReconciler) Reconcile(ctx context.Context, req ctr return ctrl.Result{}, err } - controlPlane := &infrav2exp.OCIManagedControlPlane{} + controlPlane := &infrastructurev1beta2.OCIManagedControlPlane{} controlPlaneRef := types.NamespacedName{ Name: cluster.Spec.ControlPlaneRef.Name, Namespace: cluster.Namespace, @@ -193,7 +193,7 @@ func (r *OCIVirtualMachinePoolReconciler) SetupWithManager(ctx context.Context, GroupVersion.WithKind(scope.OCIVirtualMachinePoolKind), logger)), ). Watches( - &source.Kind{Type: &infrav2exp.OCIManagedCluster{}}, + &source.Kind{Type: &infrastructurev1beta2.OCIManagedCluster{}}, handler.EnqueueRequestsFromMapFunc(managedClusterToVirtualMachinePoolMapFunc), ). WithEventFilter(predicates.ResourceNotPaused(ctrl.LoggerFrom(ctx))). @@ -203,7 +203,7 @@ func (r *OCIVirtualMachinePoolReconciler) SetupWithManager(ctx context.Context, func managedClusterToVirtualMachinePoolMapFunc(c client.Client, gvk schema.GroupVersionKind, log logr.Logger) handler.MapFunc { return func(o client.Object) []reconcile.Request { ctx := context.Background() - ociCluster, ok := o.(*infrav2exp.OCIManagedCluster) + ociCluster, ok := o.(*infrastructurev1beta2.OCIManagedCluster) if !ok { panic(fmt.Sprintf("Expected a OCIManagedControlPlane but got a %T", o)) } diff --git a/exp/controllers/ocivirtual_machinepool_controller_test.go b/exp/controllers/ocivirtual_machinepool_controller_test.go index 49c46afb..8c48ba67 100644 --- a/exp/controllers/ocivirtual_machinepool_controller_test.go +++ b/exp/controllers/ocivirtual_machinepool_controller_test.go @@ -18,6 +18,7 @@ package controllers import ( "context" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "testing" "github.com/golang/mock/gomock" @@ -159,11 +160,11 @@ func TestNormalReconciliationFunctionForVirtualMP(t *testing.T) { machinePool := getMachinePool() ociVirtualMachinePool = getOCIVirtualMachinePool() ociCluster := getOCIManagedClusterWithOwner() - ociManagedControlPlane := infrav2exp.OCIManagedControlPlane{ - Spec: infrav2exp.OCIManagedControlPlaneSpec{ + ociManagedControlPlane := infrastructurev1beta2.OCIManagedControlPlane{ + Spec: infrastructurev1beta2.OCIManagedControlPlaneSpec{ ID: common.String("cluster-id"), }, - Status: infrav2exp.OCIManagedControlPlaneStatus{ + Status: infrastructurev1beta2.OCIManagedControlPlaneStatus{ Ready: true, }, } @@ -424,11 +425,11 @@ func TestVMPDeletionFunction(t *testing.T) { machinePool := getMachinePool() ociVirtualMachinePool = getOCIVirtualMachinePool() ociCluster := getOCIManagedClusterWithOwner() - ociManagedControlPlane := infrav2exp.OCIManagedControlPlane{ - Spec: infrav2exp.OCIManagedControlPlaneSpec{ + ociManagedControlPlane := infrastructurev1beta2.OCIManagedControlPlane{ + Spec: infrastructurev1beta2.OCIManagedControlPlaneSpec{ ID: common.String("cluster-id"), }, - Status: infrav2exp.OCIManagedControlPlaneStatus{ + Status: infrastructurev1beta2.OCIManagedControlPlaneStatus{ Ready: true, }, } @@ -634,3 +635,72 @@ func expectVMPConditions(g *WithT, m *infrav2exp.OCIVirtualMachinePool, expected g.Expect(actual.Reason).To(Equal(c.reason)) } } + +func getOCIManagedClusterWithOwner() *infrastructurev1beta2.OCIManagedCluster { + ociCluster := getOCIManagedClusterWithNoOwner() + ociCluster.OwnerReferences = []metav1.OwnerReference{ + { + Name: "test-cluster", + Kind: "Cluster", + APIVersion: clusterv1.GroupVersion.String(), + }, + } + return ociCluster +} + +func getOCIManagedClusterWithNoOwner() *infrastructurev1beta2.OCIManagedCluster { + ociCluster := &infrastructurev1beta2.OCIManagedCluster{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-cluster", + Namespace: "test", + }, + Spec: infrastructurev1beta2.OCIManagedClusterSpec{ + CompartmentId: "test", + ControlPlaneEndpoint: clusterv1.APIEndpoint{ + Port: 6443, + }, + OCIResourceIdentifier: "resource_uid", + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + ID: common.String("vcn-id"), + Subnets: []*infrastructurev1beta2.Subnet{ + { + Role: infrastructurev1beta2.ControlPlaneEndpointRole, + ID: common.String("subnet-id"), + Type: infrastructurev1beta2.Private, + Name: "worker-subnet", + }, + { + Role: infrastructurev1beta2.PodRole, + ID: common.String("pod-subnet-id"), + Type: infrastructurev1beta2.Private, + Name: "pod-subnet", + }, + }, + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + Role: infrastructurev1beta2.ControlPlaneEndpointRole, + ID: common.String("nsg-id"), + Name: "worker-nsg", + }, + { + Role: infrastructurev1beta2.PodRole, + ID: common.String("pod-nsg-id"), + Name: "pod-nsg", + }, + }, + }, + }, + }, + AvailabilityDomains: map[string]infrastructurev1beta2.OCIAvailabilityDomain{ + "ad-1": { + Name: "ad-1", + FaultDomains: []string{"fd-5", "fd-6"}, + }, + }, + }, + } + ociCluster.OwnerReferences = []metav1.OwnerReference{} + return ociCluster +} diff --git a/main.go b/main.go index c2511890..7b7e515b 100644 --- a/main.go +++ b/main.go @@ -262,6 +262,28 @@ func main() { os.Exit(1) } + if err = (&controllers.OCIManagedClusterReconciler{ + Client: mgr.GetClient(), + Scheme: mgr.GetScheme(), + Region: region, + ClientProvider: clientProvider, + Recorder: mgr.GetEventRecorderFor("ocimanagedcluster-controller"), + }).SetupWithManager(ctx, mgr, controller.Options{MaxConcurrentReconciles: ociClusterConcurrency}); err != nil { + setupLog.Error(err, "unable to create controller", "controller", scope.OCIManagedClusterKind) + os.Exit(1) + } + + if err = (&controllers.OCIManagedClusterControlPlaneReconciler{ + Client: mgr.GetClient(), + Scheme: mgr.GetScheme(), + Region: region, + ClientProvider: clientProvider, + Recorder: mgr.GetEventRecorderFor("ocimanagedclustercontrolplane-controller"), + }).SetupWithManager(ctx, mgr, controller.Options{MaxConcurrentReconciles: ociClusterConcurrency}); err != nil { + setupLog.Error(err, "unable to create controller", "controller", scope.OCIManagedClusterControlPlaneKind) + os.Exit(1) + } + if feature.Gates.Enabled(feature.MachinePool) { setupLog.Info("MACHINE POOL experimental feature enabled") setupLog.V(1).Info("enabling machine pool controller") @@ -275,8 +297,7 @@ func main() { setupLog.Error(err, "unable to create controller", "controller", scope.OCIMachinePoolKind) os.Exit(1) } - } - if feature.Gates.Enabled(feature.OKE) { + setupLog.Info("OKE experimental feature enabled") setupLog.V(1).Info("enabling managed machine pool controller") if err = (&expcontrollers.OCIManagedMachinePoolReconciler{ @@ -290,28 +311,6 @@ func main() { os.Exit(1) } - if err = (&expcontrollers.OCIManagedClusterReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - Region: region, - ClientProvider: clientProvider, - Recorder: mgr.GetEventRecorderFor("ocimanagedcluster-controller"), - }).SetupWithManager(ctx, mgr, controller.Options{MaxConcurrentReconciles: ociClusterConcurrency}); err != nil { - setupLog.Error(err, "unable to create controller", "controller", scope.OCIManagedClusterKind) - os.Exit(1) - } - - if err = (&expcontrollers.OCIManagedClusterControlPlaneReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - Region: region, - ClientProvider: clientProvider, - Recorder: mgr.GetEventRecorderFor("ocimanagedclustercontrolplane-controller"), - }).SetupWithManager(ctx, mgr, controller.Options{MaxConcurrentReconciles: ociClusterConcurrency}); err != nil { - setupLog.Error(err, "unable to create controller", "controller", scope.OCIManagedClusterControlPlaneKind) - os.Exit(1) - } - if err = (&expcontrollers.OCIVirtualMachinePoolReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), @@ -334,12 +333,12 @@ func main() { os.Exit(1) } - if err = (&expV1Beta2.OCIManagedCluster{}).SetupWebhookWithManager(mgr); err != nil { + if err = (&infrastructurev1beta2.OCIManagedCluster{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "OCIManagedCluster") os.Exit(1) } - if err = (&expV1Beta2.OCIManagedControlPlane{}).SetupWebhookWithManager(mgr); err != nil { + if err = (&infrastructurev1beta2.OCIManagedControlPlane{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "OCIManagedControlPlane") os.Exit(1) } diff --git a/test/e2e/config/e2e_conf.yaml b/test/e2e/config/e2e_conf.yaml index 1d377bc9..612cfcad 100644 --- a/test/e2e/config/e2e_conf.yaml +++ b/test/e2e/config/e2e_conf.yaml @@ -72,6 +72,7 @@ providers: - sourcePath: "../data/infrastructure-oci/v1beta2/cluster-template-machine-pool.yaml" - sourcePath: "../data/infrastructure-oci/v1beta2/cluster-template-managed.yaml" - sourcePath: "../data/infrastructure-oci/v1beta2/cluster-template-managed-node-recycling.yaml" + - sourcePath: "../data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes.yaml" - sourcePath: "../data/infrastructure-oci/v1beta2/cluster-template-managed-virtual.yaml" - sourcePath: "../data/infrastructure-oci/v1beta2/cluster-template-managed-cluster-identity.yaml" - sourcePath: "../data/infrastructure-oci/v1beta2/cluster-template-cluster-identity.yaml" diff --git a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/cluster.yaml b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/cluster.yaml new file mode 100644 index 00000000..c5370726 --- /dev/null +++ b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/cluster.yaml @@ -0,0 +1,36 @@ +apiVersion: cluster.x-k8s.io/v1beta1 +kind: Cluster +metadata: + labels: + cluster.x-k8s.io/cluster-name: "${CLUSTER_NAME}" + name: "${CLUSTER_NAME}" + namespace: "${NAMESPACE}" +spec: + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: OCIManagedCluster + name: "${CLUSTER_NAME}" + namespace: "${NAMESPACE}" + controlPlaneRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: OCIManagedControlPlane + name: "${CLUSTER_NAME}" + namespace: "${NAMESPACE}" +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: OCIManagedCluster +metadata: + labels: + cluster.x-k8s.io/cluster-name: "${CLUSTER_NAME}" + name: "${CLUSTER_NAME}" +spec: + compartmentId: "${OCI_COMPARTMENT_ID}" +--- +kind: OCIManagedControlPlane +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +metadata: + name: "${CLUSTER_NAME}" + namespace: "${NAMESPACE}" +spec: + version: "${OCI_MANAGED_KUBERNETES_VERSION}" +--- \ No newline at end of file diff --git a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/kustomization.yaml b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/kustomization.yaml new file mode 100644 index 00000000..f2dc7cb4 --- /dev/null +++ b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/kustomization.yaml @@ -0,0 +1,4 @@ +resources: + - ./cluster.yaml + - ./md.yaml + diff --git a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/md.yaml b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/md.yaml new file mode 100644 index 00000000..9a476d21 --- /dev/null +++ b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/md.yaml @@ -0,0 +1,35 @@ +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: OCIMachineTemplate +metadata: + name: "${CLUSTER_NAME}-md-0" +spec: + template: + spec: + imageId: "${OCI_MANAGED_NODE_IMAGE_ID}" + compartmentId: "${OCI_COMPARTMENT_ID}" + shape: "${OCI_NODE_MACHINE_TYPE}" + isPvEncryptionInTransitEnabled: true + shapeConfig: + ocpus: "1" + metadata: + ssh_authorized_keys: "${OCI_SSH_KEY}" +--- +apiVersion: cluster.x-k8s.io/v1beta1 +kind: MachineDeployment +metadata: + name: "${CLUSTER_NAME}-md-0" +spec: + clusterName: "${CLUSTER_NAME}" + replicas: ${WORKER_MACHINE_COUNT} + selector: + matchLabels: + template: + spec: + clusterName: "${CLUSTER_NAME}" + version: "${KUBERNETES_VERSION}" + bootstrap: + dataSecretName: "${CLUSTER_NAME}-self-managed" + infrastructureRef: + name: "${CLUSTER_NAME}-md-0" + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: OCIMachineTemplate \ No newline at end of file diff --git a/test/e2e/managed_cluster_test.go b/test/e2e/managed_cluster_test.go index 206a2518..cde7d72e 100644 --- a/test/e2e/managed_cluster_test.go +++ b/test/e2e/managed_cluster_test.go @@ -22,6 +22,7 @@ package e2e import ( "context" "fmt" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "os" "path/filepath" "reflect" @@ -30,7 +31,6 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - infrav1exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1" infrav2exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" "github.com/oracle/oci-go-sdk/v65/common" oke "github.com/oracle/oci-go-sdk/v65/containerengine" @@ -145,7 +145,7 @@ var _ = Describe("Managed Workload cluster creation", func() { Expect(ctx).NotTo(BeNil(), "ctx is required for DiscoveryAndWaitForControlPlaneInitialized") lister := input.ClusterProxy.GetClient() Expect(lister).ToNot(BeNil(), "Invalid argument. input.Lister can't be nil when calling DiscoveryAndWaitForControlPlaneInitialized") - var controlPlane *infrav1exp.OCIManagedControlPlane + var controlPlane *infrastructurev1beta2.OCIManagedControlPlane Eventually(func(g Gomega) { controlPlane = GetOCIManagedControlPlaneByCluster(ctx, lister, result.Cluster.Name, result.Cluster.Namespace) if controlPlane != nil { @@ -207,7 +207,7 @@ var _ = Describe("Managed Workload cluster creation", func() { Expect(ctx).NotTo(BeNil(), "ctx is required for DiscoveryAndWaitForControlPlaneInitialized") lister := input.ClusterProxy.GetClient() Expect(lister).ToNot(BeNil(), "Invalid argument. input.Lister can't be nil when calling DiscoveryAndWaitForControlPlaneInitialized") - var controlPlane *infrav1exp.OCIManagedControlPlane + var controlPlane *infrastructurev1beta2.OCIManagedControlPlane Eventually(func(g Gomega) { controlPlane = GetOCIManagedControlPlaneByCluster(ctx, lister, result.Cluster.Name, result.Cluster.Namespace) if controlPlane != nil { @@ -249,7 +249,7 @@ var _ = Describe("Managed Workload cluster creation", func() { Expect(ctx).NotTo(BeNil(), "ctx is required for DiscoveryAndWaitForControlPlaneInitialized") lister := input.ClusterProxy.GetClient() Expect(lister).ToNot(BeNil(), "Invalid argument. input.Lister can't be nil when calling DiscoveryAndWaitForControlPlaneInitialized") - var controlPlane *infrav1exp.OCIManagedControlPlane + var controlPlane *infrastructurev1beta2.OCIManagedControlPlane Eventually(func(g Gomega) { controlPlane = GetOCIManagedControlPlaneByCluster(ctx, lister, result.Cluster.Name, result.Cluster.Namespace) if controlPlane != nil { @@ -294,7 +294,7 @@ var _ = Describe("Managed Workload cluster creation", func() { Expect(ctx).NotTo(BeNil(), "ctx is required for DiscoveryAndWaitForControlPlaneInitialized") lister := input.ClusterProxy.GetClient() Expect(lister).ToNot(BeNil(), "Invalid argument. input.Lister can't be nil when calling DiscoveryAndWaitForControlPlaneInitialized") - var controlPlane *infrav1exp.OCIManagedControlPlane + var controlPlane *infrastructurev1beta2.OCIManagedControlPlane Eventually(func(g Gomega) { controlPlane = GetOCIManagedControlPlaneByCluster(ctx, lister, result.Cluster.Name, result.Cluster.Namespace) if controlPlane != nil { @@ -321,13 +321,54 @@ var _ = Describe("Managed Workload cluster creation", func() { return err }, retryableOperationTimeout, retryableOperationInterval).Should(Succeed(), "Failed to install Addon") }) + + It("Managed Cluster - Self managed nodes", func() { + clusterName = getClusterName(clusterNamePrefix, "virtual") + input := clusterctl.ApplyClusterTemplateAndWaitInput{ + ClusterProxy: bootstrapClusterProxy, + ConfigCluster: clusterctl.ConfigClusterInput{ + LogFolder: filepath.Join(artifactFolder, "clusters", bootstrapClusterProxy.GetName()), + ClusterctlConfigPath: clusterctlConfigPath, + KubeconfigPath: bootstrapClusterProxy.GetKubeconfigPath(), + InfrastructureProvider: clusterctl.DefaultInfrastructureProvider, + Flavor: "managed-self-managed-nodes", + Namespace: namespace.Name, + ClusterName: clusterName, + ControlPlaneMachineCount: pointer.Int64(1), + WorkerMachineCount: pointer.Int64(1), + KubernetesVersion: e2eConfig.GetVariable(capi_e2e.KubernetesVersion), + }, + WaitForClusterIntervals: e2eConfig.GetIntervals(specName, "wait-cluster"), + WaitForControlPlaneIntervals: e2eConfig.GetIntervals(specName, "wait-control-plane"), + WaitForMachineDeployments: e2eConfig.GetIntervals(specName, "wait-worker-nodes"), + } + input.WaitForControlPlaneInitialized = func(ctx context.Context, input clusterctl.ApplyClusterTemplateAndWaitInput, result *clusterctl.ApplyClusterTemplateAndWaitResult) { + Expect(ctx).NotTo(BeNil(), "ctx is required for DiscoveryAndWaitForControlPlaneInitialized") + lister := input.ClusterProxy.GetClient() + Expect(lister).ToNot(BeNil(), "Invalid argument. input.Lister can't be nil when calling DiscoveryAndWaitForControlPlaneInitialized") + var controlPlane *infrastructurev1beta2.OCIManagedControlPlane + Eventually(func(g Gomega) { + controlPlane = GetOCIManagedControlPlaneByCluster(ctx, lister, result.Cluster.Name, result.Cluster.Namespace) + if controlPlane != nil { + Log(fmt.Sprintf("Control plane is not nil, status is %t", controlPlane.Status.Ready)) + } + g.Expect(controlPlane).ToNot(BeNil()) + g.Expect(controlPlane.Status.Ready).To(BeTrue()) + }, input.WaitForControlPlaneIntervals...).Should(Succeed(), "Couldn't get the control plane ready status for the cluster %s", klog.KObj(result.Cluster)) + } + input.WaitForControlPlaneMachinesReady = func(ctx context.Context, input clusterctl.ApplyClusterTemplateAndWaitInput, result *clusterctl.ApplyClusterTemplateAndWaitResult) { + // Not applicable + } + + clusterctl.ApplyClusterTemplateAndWait(ctx, input, result) + }) }) // GetKubeadmControlPlaneByCluster returns the KubeadmControlPlane objects for a cluster. // Important! this method relies on labels that are created by the CAPI controllers during the first reconciliation, so // it is necessary to ensure this is already happened before calling it. -func GetOCIManagedControlPlaneByCluster(ctx context.Context, lister client.Client, clusterName string, namespaceName string) *infrav1exp.OCIManagedControlPlane { - controlPlaneList := &infrav1exp.OCIManagedControlPlaneList{} +func GetOCIManagedControlPlaneByCluster(ctx context.Context, lister client.Client, clusterName string, namespaceName string) *infrastructurev1beta2.OCIManagedControlPlane { + controlPlaneList := &infrastructurev1beta2.OCIManagedControlPlaneList{} Eventually(func() error { return lister.List(ctx, controlPlaneList, byClusterOptions(clusterName, namespaceName)...) }, retryableOperationTimeout, retryableOperationInterval).Should(Succeed(), "Failed to list OCIManagedControlPlane object for Cluster %s", klog.KRef(namespaceName, clusterName)) From d713ded24e27af4fd283b440d69ea2df70fb7b98 Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Mon, 3 Jul 2023 07:40:21 +0530 Subject: [PATCH 03/14] OKE self managed nodes and rmove OKE out of experimental --- cloud/scope/machine_pool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud/scope/machine_pool.go b/cloud/scope/machine_pool.go index 9176ff8e..da12b19c 100644 --- a/cloud/scope/machine_pool.go +++ b/cloud/scope/machine_pool.go @@ -196,7 +196,7 @@ func (m *MachinePoolScope) SetListandSetMachinePoolInstances(ctx context.Context for i, instance := range poolInstanceSummaries { if *instance.State == "Running" { - providerIDList[i] = fmt.Sprintf("oci://%s", *instance.Id) + providerIDList[i] = m.OCIClusterAccesor.GetProviderID(*instance.Id) } } From 05adaf920617afbcbaad21e9fc778e299431744a Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Mon, 3 Jul 2023 08:41:35 +0530 Subject: [PATCH 04/14] OKE self managed nodes and rmove OKE out of experimental --- .../cluster.yaml | 211 ++++++++++++++++++ 1 file changed, 211 insertions(+) diff --git a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/cluster.yaml b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/cluster.yaml index c5370726..b5d517b5 100644 --- a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/cluster.yaml +++ b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/cluster.yaml @@ -25,6 +25,214 @@ metadata: name: "${CLUSTER_NAME}" spec: compartmentId: "${OCI_COMPARTMENT_ID}" + networkSpec: + apiServerLoadBalancer: + name: "" + vcn: + cidr: 10.0.0.0/16 + networkSecurityGroup: + list: + - egressRules: + - egressRule: + description: Allow Kubernetes API endpoint to communicate with OKE. + destination: all-iad-services-in-oracle-services-network + destinationType: SERVICE_CIDR_BLOCK + isStateless: false + protocol: "6" + - egressRule: + description: Path Discovery. + destination: all-iad-services-in-oracle-services-network + destinationType: SERVICE_CIDR_BLOCK + icmpOptions: + code: 4 + type: 3 + isStateless: false + protocol: "1" + - egressRule: + description: Allow Kubernetes API endpoint to communicate with worker + nodes. + destination: 10.0.64.0/20 + destinationType: CIDR_BLOCK + isStateless: false + protocol: "6" + tcpOptions: + destinationPortRange: + max: 10250 + min: 10250 + - egressRule: + description: Path Discovery. + destination: 10.0.64.0/20 + destinationType: CIDR_BLOCK + icmpOptions: + code: 4 + type: 3 + isStateless: false + protocol: "1" + ingressRules: + - ingressRule: + description: Kubernetes worker to Kubernetes API endpoint communication. + isStateless: false + protocol: "6" + source: 10.0.64.0/20 + sourceType: CIDR_BLOCK + tcpOptions: + destinationPortRange: + max: 6443 + min: 6443 + - ingressRule: + description: Kubernetes worker to Kubernetes API endpoint communication. + isStateless: false + protocol: "6" + source: 10.0.64.0/20 + sourceType: CIDR_BLOCK + tcpOptions: + destinationPortRange: + max: 12250 + min: 12250 + - ingressRule: + description: Path Discovery. + icmpOptions: + code: 4 + type: 3 + isStateless: false + protocol: "1" + source: 10.0.64.0/20 + sourceType: CIDR_BLOCK + - ingressRule: + description: External access to Kubernetes API endpoint. + isStateless: false + protocol: "6" + source: 0.0.0.0/0 + sourceType: CIDR_BLOCK + tcpOptions: + destinationPortRange: + max: 6443 + min: 6443 + name: control-plane-endpoint + role: control-plane-endpoint + - egressRules: + - egressRule: + description: Allow pods on one worker node to communicate with pods on other worker nodes. + destination: "10.0.64.0/20" + destinationType: CIDR_BLOCK + isStateless: false + protocol: "all" + - egressRule: + description: Allow worker nodes to communicate with OKE. + destination: all-iad-services-in-oracle-services-network + destinationType: SERVICE_CIDR_BLOCK + isStateless: false + protocol: "6" + - egressRule: + description: Path Discovery. + destination: 0.0.0.0/0 + destinationType: CIDR_BLOCK + icmpOptions: + code: 4 + type: 3 + isStateless: false + protocol: "1" + - egressRule: + description: Kubernetes worker to Kubernetes API endpoint communication. + destination: 10.0.0.8/29 + destinationType: CIDR_BLOCK + isStateless: false + protocol: "6" + tcpOptions: + destinationPortRange: + max: 6443 + min: 6443 + - egressRule: + description: Kubernetes worker to Kubernetes API endpoint communication. + destination: 10.0.0.8/29 + destinationType: CIDR_BLOCK + isStateless: false + protocol: "6" + tcpOptions: + destinationPortRange: + max: 12250 + min: 12250 + ingressRules: + - ingressRule: + description: Allow pods on one worker node to communicate with pods on other worker nodes. + isStateless: false + protocol: "all" + source: 10.0.64.0/20 + sourceType: CIDR_BLOCK + - ingressRule: + description: Allow Kubernetes API endpoint to communicate with worker nodes. + isStateless: false + protocol: "6" + source: 10.0.0.8/29 + sourceType: CIDR_BLOCK + - ingressRule: + description: Path Discovery. + icmpOptions: + code: 4 + type: 3 + isStateless: false + protocol: "1" + source: 0.0.0.0/0 + sourceType: CIDR_BLOCK + - ingressRule: + description: Load Balancer to Worker nodes node ports. + isStateless: false + protocol: "6" + source: 10.0.0.32/27 + sourceType: CIDR_BLOCK + tcpOptions: + destinationPortRange: + max: 32767 + min: 30000 + name: worker + role: worker + - egressRules: + - egressRule: + description: Load Balancer to Worker nodes node ports. + destination: 10.0.64.0/20 + destinationType: CIDR_BLOCK + isStateless: false + protocol: "6" + tcpOptions: + destinationPortRange: + max: 32767 + min: 30000 + ingressRules: + - ingressRule: + description: Accept http traffic on port 80 + isStateless: false + protocol: "6" + source: 0.0.0.0/0 + sourceType: CIDR_BLOCK + tcpOptions: + destinationPortRange: + max: 80 + min: 80 + - ingressRule: + description: Accept https traffic on port 443 + isStateless: false + protocol: "6" + source: 0.0.0.0/0 + sourceType: CIDR_BLOCK + tcpOptions: + destinationPortRange: + max: 443 + min: 443 + name: service-lb + role: service-lb + subnets: + - cidr: 10.0.0.8/29 + name: control-plane-endpoint + role: control-plane-endpoint + type: public + - cidr: 10.0.0.32/27 + name: service-lb + role: service-lb + type: public + - cidr: 10.0.64.0/20 + name: worker + role: worker + type: private --- kind: OCIManagedControlPlane apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 @@ -33,4 +241,7 @@ metadata: namespace: "${NAMESPACE}" spec: version: "${OCI_MANAGED_KUBERNETES_VERSION}" + clusterType: "ENHANCED_CLUSTER" + clusterPodNetworkOptions: + - cniType: "FLANNEL_OVERLAY" --- \ No newline at end of file From 01aa8fd0672b28c0d61f1ddac8acb020cef0fdd2 Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Mon, 3 Jul 2023 09:10:17 +0530 Subject: [PATCH 05/14] OKE self managed nodes and rmove OKE out of experimental --- .../kustomization.yaml | 2 +- .../machinepool.yaml | 34 +++++++++++++++++++ test/e2e/managed_cluster_test.go | 1 + 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/machinepool.yaml diff --git a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/kustomization.yaml b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/kustomization.yaml index f2dc7cb4..aa3e3f65 100644 --- a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/kustomization.yaml +++ b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/kustomization.yaml @@ -1,4 +1,4 @@ resources: - ./cluster.yaml - ./md.yaml - + - ./machinepool.yaml diff --git a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/machinepool.yaml b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/machinepool.yaml new file mode 100644 index 00000000..c63efa38 --- /dev/null +++ b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/machinepool.yaml @@ -0,0 +1,34 @@ +--- +apiVersion: cluster.x-k8s.io/v1beta1 +kind: MachinePool +metadata: + name: "${CLUSTER_NAME}-mp-0" + namespace: default +spec: + clusterName: "${CLUSTER_NAME}" + replicas: "${WORKER_MACHINE_COUNT}" + template: + spec: + bootstrap: + dataSecretName: "${CLUSTER_NAME}-self-managed" + clusterName: "${CLUSTER_NAME}" + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: OCIMachinePool + name: "${CLUSTER_NAME}-mp-0" + version: "${KUBERNETES_VERSION}" +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: OCIMachinePool +metadata: + name: "${CLUSTER_NAME}-mp-0" + namespace: default +spec: + instanceConfiguration: + metadata: + ssh_authorized_keys: "${OCI_SSH_KEY}" + instanceSourceViaImageConfig: + imageId: "${OCI_MANAGED_NODE_IMAGE_ID}" + shape: "${OCI_NODE_MACHINE_TYPE=VM.Standard.E4.Flex}" + shapeConfig: + ocpus: "1" \ No newline at end of file diff --git a/test/e2e/managed_cluster_test.go b/test/e2e/managed_cluster_test.go index cde7d72e..7df2f7fb 100644 --- a/test/e2e/managed_cluster_test.go +++ b/test/e2e/managed_cluster_test.go @@ -341,6 +341,7 @@ var _ = Describe("Managed Workload cluster creation", func() { WaitForClusterIntervals: e2eConfig.GetIntervals(specName, "wait-cluster"), WaitForControlPlaneIntervals: e2eConfig.GetIntervals(specName, "wait-control-plane"), WaitForMachineDeployments: e2eConfig.GetIntervals(specName, "wait-worker-nodes"), + WaitForMachinePools: e2eConfig.GetIntervals(specName, "wait-machine-pool-nodes"), } input.WaitForControlPlaneInitialized = func(ctx context.Context, input clusterctl.ApplyClusterTemplateAndWaitInput, result *clusterctl.ApplyClusterTemplateAndWaitResult) { Expect(ctx).NotTo(BeNil(), "ctx is required for DiscoveryAndWaitForControlPlaneInitialized") From 4c5aadd7e9009f651408f9d344f6f92db28755d6 Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Mon, 3 Jul 2023 09:19:55 +0530 Subject: [PATCH 06/14] OKE self managed nodes and rmove OKE out of experimental --- .../kustomization.yaml | 2 +- .../{machinepool.yaml => machine-pool.yaml} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/{machinepool.yaml => machine-pool.yaml} (100%) diff --git a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/kustomization.yaml b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/kustomization.yaml index aa3e3f65..87c37e7b 100644 --- a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/kustomization.yaml +++ b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/kustomization.yaml @@ -1,4 +1,4 @@ resources: - ./cluster.yaml - ./md.yaml - - ./machinepool.yaml + - machine-pool.yaml diff --git a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/machinepool.yaml b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/machine-pool.yaml similarity index 100% rename from test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/machinepool.yaml rename to test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/machine-pool.yaml From 21d31f438ba9488804b6e32aaacfbaca6eda9633 Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Mon, 3 Jul 2023 12:02:07 +0530 Subject: [PATCH 07/14] OKE self managed nodes and rmove OKE out of experimental --- exp/controllers/ocimachinepool_controller.go | 22 ++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/exp/controllers/ocimachinepool_controller.go b/exp/controllers/ocimachinepool_controller.go index 5b28be13..79067b42 100644 --- a/exp/controllers/ocimachinepool_controller.go +++ b/exp/controllers/ocimachinepool_controller.go @@ -19,6 +19,7 @@ package controllers import ( "context" "fmt" + expV1Beta1 "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1" "time" "github.com/go-logr/logr" @@ -179,7 +180,7 @@ func (r *OCIMachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Reque // SetupWithManager sets up the controller with the Manager. func (r *OCIMachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error { logger := log.FromContext(ctx) - return ctrl.NewControllerManagedBy(mgr). + c, err := ctrl.NewControllerManagedBy(mgr). WithOptions(options). For(&infrav2exp.OCIMachinePool{}). Watches( @@ -188,7 +189,24 @@ func (r *OCIMachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctr GroupVersion.WithKind(scope.OCIMachinePoolKind), logger)), ). WithEventFilter(predicates.ResourceNotPaused(ctrl.LoggerFrom(ctx))). - Complete(r) + Build(r) + + if err != nil { + return errors.Wrapf(err, "error creating controller") + } + clusterToObjectFunc, err := util.ClusterToObjectsMapper(r.Client, &expV1Beta1.OCIManagedMachinePoolList{}, mgr.GetScheme()) + if err != nil { + return errors.Wrapf(err, "failed to create mapper for Cluster to OCIMachines") + } + // Add a watch on clusterv1.Cluster object for unpause & ready notifications. + if err := c.Watch( + &source.Kind{Type: &clusterv1.Cluster{}}, + handler.EnqueueRequestsFromMapFunc(clusterToObjectFunc), + predicates.ClusterUnpausedAndInfrastructureReady(ctrl.LoggerFrom(ctx)), + ); err != nil { + return errors.Wrapf(err, "failed adding a watch for ready clusters") + } + return nil } func machinePoolToInfrastructureMapFunc(gvk schema.GroupVersionKind, logger logr.Logger) handler.MapFunc { From 3320ed9897d05d2234da1a3a16e1bf490c7ba050 Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Mon, 3 Jul 2023 12:35:02 +0530 Subject: [PATCH 08/14] OKE self managed nodes and rmove OKE out of experimental --- exp/controllers/ocimachinepool_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exp/controllers/ocimachinepool_controller.go b/exp/controllers/ocimachinepool_controller.go index 79067b42..56389a70 100644 --- a/exp/controllers/ocimachinepool_controller.go +++ b/exp/controllers/ocimachinepool_controller.go @@ -194,7 +194,7 @@ func (r *OCIMachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctr if err != nil { return errors.Wrapf(err, "error creating controller") } - clusterToObjectFunc, err := util.ClusterToObjectsMapper(r.Client, &expV1Beta1.OCIManagedMachinePoolList{}, mgr.GetScheme()) + clusterToObjectFunc, err := util.ClusterToObjectsMapper(r.Client, &expV1Beta1.OCIMachinePoolList{}, mgr.GetScheme()) if err != nil { return errors.Wrapf(err, "failed to create mapper for Cluster to OCIMachines") } From 23735b72bbadb82ea86e422fe5683bec6ca249bb Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Mon, 3 Jul 2023 16:43:10 +0530 Subject: [PATCH 09/14] OKE self managed nodes and rmove OKE out of experimental --- exp/api/v1beta1/constants.go | 19 ------------------- .../ocimanagedmachinepool_webhook_test.go | 7 ++++--- .../ocimachinepool_controller_test.go | 2 +- templates/cluster-template.yaml | 18 +----------------- 4 files changed, 6 insertions(+), 40 deletions(-) delete mode 100644 exp/api/v1beta1/constants.go diff --git a/exp/api/v1beta1/constants.go b/exp/api/v1beta1/constants.go deleted file mode 100644 index bfb51b8b..00000000 --- a/exp/api/v1beta1/constants.go +++ /dev/null @@ -1,19 +0,0 @@ -/* - Copyright (c) 2021, 2022 Oracle and/or its affiliates. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package v1beta1 - -const () diff --git a/exp/api/v1beta2/ocimanagedmachinepool_webhook_test.go b/exp/api/v1beta2/ocimanagedmachinepool_webhook_test.go index b7797e16..0fd0bcd5 100644 --- a/exp/api/v1beta2/ocimanagedmachinepool_webhook_test.go +++ b/exp/api/v1beta2/ocimanagedmachinepool_webhook_test.go @@ -17,6 +17,7 @@ limitations under the License. package v1beta2 import ( + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "strings" "testing" @@ -37,7 +38,7 @@ func TestOCIManagedMachinePool_CreateDefault(t *testing.T) { m: &OCIManagedMachinePool{}, expect: func(g *gomega.WithT, c *OCIManagedMachinePool) { g.Expect(c.Spec.NodePoolNodeConfig.NodePoolPodNetworkOptionDetails).To(Equal(&NodePoolPodNetworkOptionDetails{ - CniType: VCNNativeCNI, + CniType: infrastructurev1beta2.VCNNativeCNI, VcnIpNativePodNetworkOptions: VcnIpNativePodNetworkOptions{ SubnetNames: []string{PodDefaultName}, NSGNames: []string{PodDefaultName}, @@ -51,14 +52,14 @@ func TestOCIManagedMachinePool_CreateDefault(t *testing.T) { Spec: OCIManagedMachinePoolSpec{ NodePoolNodeConfig: &NodePoolNodeConfig{ NodePoolPodNetworkOptionDetails: &NodePoolPodNetworkOptionDetails{ - CniType: FlannelCNI, + CniType: infrastructurev1beta2.FlannelCNI, }, }, }, }, expect: func(g *gomega.WithT, c *OCIManagedMachinePool) { g.Expect(c.Spec.NodePoolNodeConfig.NodePoolPodNetworkOptionDetails).To(Equal(&NodePoolPodNetworkOptionDetails{ - CniType: FlannelCNI, + CniType: infrastructurev1beta2.FlannelCNI, })) }, }, diff --git a/exp/controllers/ocimachinepool_controller_test.go b/exp/controllers/ocimachinepool_controller_test.go index 44b1d33d..f6909bc2 100644 --- a/exp/controllers/ocimachinepool_controller_test.go +++ b/exp/controllers/ocimachinepool_controller_test.go @@ -673,7 +673,7 @@ func getSecret() *corev1.Secret { return &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "bootstrap", - Namespace: "default", + Namespace: "test", }, Data: map[string][]byte{ "value": []byte("test"), diff --git a/templates/cluster-template.yaml b/templates/cluster-template.yaml index 637bd706..668b6e3f 100644 --- a/templates/cluster-template.yaml +++ b/templates/cluster-template.yaml @@ -137,20 +137,4 @@ spec: infrastructureRef: name: "${CLUSTER_NAME}-md-0" apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 - kind: OCIMachineTemplate ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 -kind: OCIMachineTemplate -metadata: - name: "${CLUSTER_NAME}-md-0" -spec: - template: - spec: - imageId: "${OCI_IMAGE_ID}" - compartmentId: "${OCI_COMPARTMENT_ID}" - shape: "${OCI_NODE_MACHINE_TYPE=VM.Standard.E4.Flex}" - shapeConfig: - ocpus: "${OCI_NODE_MACHINE_TYPE_OCPUS=1}" - metadata: - ssh_authorized_keys: "${OCI_SSH_KEY}" - isPvEncryptionInTransitEnabled: ${OCI_NODE_PV_TRANSIT_ENCRYPTION=true} \ No newline at end of file + kind: OCIMachineTemplate \ No newline at end of file From a0504ea525b85e4e67c7f68cadac9bafcb1f8212 Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Tue, 4 Jul 2023 08:11:05 +0530 Subject: [PATCH 10/14] OKE self managed nodes and rmove OKE out of experimental --- ...r-template-managed-self-managed-nodes.yaml | 282 ++++++++++++++++++ .../cluster.yaml | 1 - 2 files changed, 282 insertions(+), 1 deletion(-) create mode 100644 templates/cluster-template-managed-self-managed-nodes.yaml diff --git a/templates/cluster-template-managed-self-managed-nodes.yaml b/templates/cluster-template-managed-self-managed-nodes.yaml new file mode 100644 index 00000000..7b50e277 --- /dev/null +++ b/templates/cluster-template-managed-self-managed-nodes.yaml @@ -0,0 +1,282 @@ +apiVersion: cluster.x-k8s.io/v1beta1 +kind: Cluster +metadata: + labels: + cluster.x-k8s.io/cluster-name: "${CLUSTER_NAME}" + name: "${CLUSTER_NAME}" + namespace: "${NAMESPACE}" +spec: + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: OCIManagedCluster + name: "${CLUSTER_NAME}" + namespace: "${NAMESPACE}" + controlPlaneRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: OCIManagedControlPlane + name: "${CLUSTER_NAME}" + namespace: "${NAMESPACE}" +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: OCIManagedCluster +metadata: + labels: + cluster.x-k8s.io/cluster-name: "${CLUSTER_NAME}" + name: "${CLUSTER_NAME}" +spec: + compartmentId: "${OCI_COMPARTMENT_ID}" + networkSpec: + apiServerLoadBalancer: + name: "" + vcn: + cidr: 10.0.0.0/16 + networkSecurityGroup: + list: + - egressRules: + - egressRule: + description: Allow Kubernetes API endpoint to communicate with OKE. + destination: all-iad-services-in-oracle-services-network + destinationType: SERVICE_CIDR_BLOCK + isStateless: false + protocol: "6" + - egressRule: + description: Path Discovery. + destination: all-iad-services-in-oracle-services-network + destinationType: SERVICE_CIDR_BLOCK + icmpOptions: + code: 4 + type: 3 + isStateless: false + protocol: "1" + - egressRule: + description: Allow Kubernetes API endpoint to communicate with worker + nodes. + destination: 10.0.64.0/20 + destinationType: CIDR_BLOCK + isStateless: false + protocol: "6" + tcpOptions: + destinationPortRange: + max: 10250 + min: 10250 + - egressRule: + description: Path Discovery. + destination: 10.0.64.0/20 + destinationType: CIDR_BLOCK + icmpOptions: + code: 4 + type: 3 + isStateless: false + protocol: "1" + ingressRules: + - ingressRule: + description: Kubernetes worker to Kubernetes API endpoint communication. + isStateless: false + protocol: "6" + source: 10.0.64.0/20 + sourceType: CIDR_BLOCK + tcpOptions: + destinationPortRange: + max: 6443 + min: 6443 + - ingressRule: + description: Kubernetes worker to Kubernetes API endpoint communication. + isStateless: false + protocol: "6" + source: 10.0.64.0/20 + sourceType: CIDR_BLOCK + tcpOptions: + destinationPortRange: + max: 12250 + min: 12250 + - ingressRule: + description: Path Discovery. + icmpOptions: + code: 4 + type: 3 + isStateless: false + protocol: "1" + source: 10.0.64.0/20 + sourceType: CIDR_BLOCK + - ingressRule: + description: External access to Kubernetes API endpoint. + isStateless: false + protocol: "6" + source: 0.0.0.0/0 + sourceType: CIDR_BLOCK + tcpOptions: + destinationPortRange: + max: 6443 + min: 6443 + name: control-plane-endpoint + role: control-plane-endpoint + - egressRules: + - egressRule: + description: Allow pods on one worker node to communicate with pods on other worker nodes. + destination: "10.0.64.0/20" + destinationType: CIDR_BLOCK + isStateless: false + protocol: "all" + - egressRule: + description: Allow worker nodes to communicate with OKE. + destination: all-iad-services-in-oracle-services-network + destinationType: SERVICE_CIDR_BLOCK + isStateless: false + protocol: "6" + - egressRule: + description: Path Discovery. + destination: 0.0.0.0/0 + destinationType: CIDR_BLOCK + icmpOptions: + code: 4 + type: 3 + isStateless: false + protocol: "1" + - egressRule: + description: Kubernetes worker to Kubernetes API endpoint communication. + destination: 10.0.0.8/29 + destinationType: CIDR_BLOCK + isStateless: false + protocol: "6" + tcpOptions: + destinationPortRange: + max: 6443 + min: 6443 + - egressRule: + description: Kubernetes worker to Kubernetes API endpoint communication. + destination: 10.0.0.8/29 + destinationType: CIDR_BLOCK + isStateless: false + protocol: "6" + tcpOptions: + destinationPortRange: + max: 12250 + min: 12250 + ingressRules: + - ingressRule: + description: Allow pods on one worker node to communicate with pods on other worker nodes. + isStateless: false + protocol: "all" + source: 10.0.64.0/20 + sourceType: CIDR_BLOCK + - ingressRule: + description: Allow Kubernetes API endpoint to communicate with worker nodes. + isStateless: false + protocol: "6" + source: 10.0.0.8/29 + sourceType: CIDR_BLOCK + - ingressRule: + description: Path Discovery. + icmpOptions: + code: 4 + type: 3 + isStateless: false + protocol: "1" + source: 0.0.0.0/0 + sourceType: CIDR_BLOCK + - ingressRule: + description: Load Balancer to Worker nodes node ports. + isStateless: false + protocol: "6" + source: 10.0.0.32/27 + sourceType: CIDR_BLOCK + tcpOptions: + destinationPortRange: + max: 32767 + min: 30000 + name: worker + role: worker + - egressRules: + - egressRule: + description: Load Balancer to Worker nodes node ports. + destination: 10.0.64.0/20 + destinationType: CIDR_BLOCK + isStateless: false + protocol: "6" + tcpOptions: + destinationPortRange: + max: 32767 + min: 30000 + ingressRules: + - ingressRule: + description: Accept http traffic on port 80 + isStateless: false + protocol: "6" + source: 0.0.0.0/0 + sourceType: CIDR_BLOCK + tcpOptions: + destinationPortRange: + max: 80 + min: 80 + - ingressRule: + description: Accept https traffic on port 443 + isStateless: false + protocol: "6" + source: 0.0.0.0/0 + sourceType: CIDR_BLOCK + tcpOptions: + destinationPortRange: + max: 443 + min: 443 + name: service-lb + role: service-lb + subnets: + - cidr: 10.0.0.8/29 + name: control-plane-endpoint + role: control-plane-endpoint + type: public + - cidr: 10.0.0.32/27 + name: service-lb + role: service-lb + type: public + - cidr: 10.0.64.0/20 + name: worker + role: worker + type: private +--- +kind: OCIManagedControlPlane +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +metadata: + name: "${CLUSTER_NAME}" + namespace: "${NAMESPACE}" +spec: + version: "${KUBERNETES_VERSION}" + clusterPodNetworkOptions: + - cniType: "FLANNEL_OVERLAY" +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: OCIMachineTemplate +metadata: + name: "${CLUSTER_NAME}-md-0" +spec: + template: + spec: + imageId: "${OCI_MANAGED_NODE_IMAGE_ID}" + compartmentId: "${OCI_COMPARTMENT_ID}" + shape: "${OCI_NODE_MACHINE_TYPE=VM.Standard.E4.Flex}" + shapeConfig: + ocpus: "${OCI_NODE_MACHINE_TYPE_OCPUS=1}" + metadata: + ssh_authorized_keys: "${OCI_SSH_KEY}" + isPvEncryptionInTransitEnabled: ${OCI_NODE_PV_TRANSIT_ENCRYPTION=true} +--- +apiVersion: cluster.x-k8s.io/v1beta1 +kind: MachineDeployment +metadata: + name: "${CLUSTER_NAME}-md-0" +spec: + clusterName: "${CLUSTER_NAME}" + replicas: ${WORKER_MACHINE_COUNT} + selector: + matchLabels: + template: + spec: + clusterName: "${CLUSTER_NAME}" + version: "${KUBERNETES_VERSION}" + bootstrap: + dataSecretName: "${CLUSTER_NAME}-self-managed" + infrastructureRef: + name: "${CLUSTER_NAME}-md-0" + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: OCIMachineTemplate +--- \ No newline at end of file diff --git a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/cluster.yaml b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/cluster.yaml index b5d517b5..053ffad1 100644 --- a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/cluster.yaml +++ b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/cluster.yaml @@ -241,7 +241,6 @@ metadata: namespace: "${NAMESPACE}" spec: version: "${OCI_MANAGED_KUBERNETES_VERSION}" - clusterType: "ENHANCED_CLUSTER" clusterPodNetworkOptions: - cniType: "FLANNEL_OVERLAY" --- \ No newline at end of file From c05e283761229f83d2dc43faef88e428b0e77c40 Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Tue, 4 Jul 2023 10:06:02 +0530 Subject: [PATCH 11/14] OKE self managed nodes and rmove OKE out of experimental --- docs/src/SUMMARY.md | 1 + docs/src/managed/managedcluster.md | 5 +++-- docs/src/managed/self-managed-nodes.md | 18 ++++++++++++++++++ test/e2e/managed_cluster_test.go | 2 +- 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 docs/src/managed/self-managed-nodes.md diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index be965112..29485749 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -38,6 +38,7 @@ - [Private Cluster](./networking/private-cluster.md) - [Managed Clusters (OKE)](./managed/managedcluster.md) - [Virtual Nodes and Enhanced Clusters](./managed/virtual-nodes-and-enhanced-clusters.md) + - [Self managed nodes](./managed/self-managed-nodes.md) - [Boot volume expansion](./managed/boot-volume-expansion.md) - [Networking customizations](./managed/networking.md) - [Features](./managed/features.md) diff --git a/docs/src/managed/managedcluster.md b/docs/src/managed/managedcluster.md index 4638ac61..81304a26 100644 --- a/docs/src/managed/managedcluster.md +++ b/docs/src/managed/managedcluster.md @@ -1,6 +1,7 @@ # Managed Clusters (OKE) -- **Feature status:** Experimental -- **Feature gate:** OKE=true,MachinePool=true +- **Feature status:** As of CAPOCI v0.12.0, OKE has been moved out of experimental mode with self managed nodes. + Virtual Node Pool and Mnagaed Node Pool are still experimental due to underlying CAPI dependencies. +- **Feature gate:** MachinePool=true Cluster API Provider for OCI (CAPOCI) experimentally supports managing OCI Container Engine for Kubernetes (OKE) clusters. CAPOCI implements this with three diff --git a/docs/src/managed/self-managed-nodes.md b/docs/src/managed/self-managed-nodes.md new file mode 100644 index 00000000..b22d5f37 --- /dev/null +++ b/docs/src/managed/self-managed-nodes.md @@ -0,0 +1,18 @@ +# Self managed nodes +CAPOCI supports OKE self managed nodes. With this feature, CAPI features such as [rolling update][capi-upgrade], +[health checks][health-check] can be used to make management of self managed nodes easier. CAPOCI supports two +flavours fo self managed nodes. It also allows full range of [OCI Compute API][oci-compute-api] to be used while +creating worker nodes. + +# Self managed nodes backed by CAPI Machine Deployment +Use the template `cluster-template-managed-self-managed-nodes.yaml` as an example for creating + +# Self managed nodes backed by OCI Instance Pool + + + + +[self-managed-nodes]: https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contengworkingwithselfmanagednodes.htm +[capi-upgrade]:https://cluster-api.sigs.k8s.io/tasks/upgrading-clusters.html#upgrading-machines-managed-by-a-machinedeployment +[health-check]: https://cluster-api.sigs.k8s.io/tasks/automated-machine-management/healthchecking.html +[oci-compute-api]: https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/Instance/LaunchInstance \ No newline at end of file diff --git a/test/e2e/managed_cluster_test.go b/test/e2e/managed_cluster_test.go index 7df2f7fb..dfad1e43 100644 --- a/test/e2e/managed_cluster_test.go +++ b/test/e2e/managed_cluster_test.go @@ -323,7 +323,7 @@ var _ = Describe("Managed Workload cluster creation", func() { }) It("Managed Cluster - Self managed nodes", func() { - clusterName = getClusterName(clusterNamePrefix, "virtual") + clusterName = getClusterName(clusterNamePrefix, "self") input := clusterctl.ApplyClusterTemplateAndWaitInput{ ClusterProxy: bootstrapClusterProxy, ConfigCluster: clusterctl.ConfigClusterInput{ From e3425f7683bb2c83eac319ab09176c1695c6404e Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Tue, 4 Jul 2023 11:26:15 +0530 Subject: [PATCH 12/14] OKE self managed nodes and rmove OKE out of experimental --- docs/src/managed/self-managed-nodes.md | 82 ++++++++++++++++++- .../cluster.yaml | 1 + 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/docs/src/managed/self-managed-nodes.md b/docs/src/managed/self-managed-nodes.md index b22d5f37..d97629fc 100644 --- a/docs/src/managed/self-managed-nodes.md +++ b/docs/src/managed/self-managed-nodes.md @@ -4,10 +4,85 @@ CAPOCI supports OKE self managed nodes. With this feature, CAPI features such as flavours fo self managed nodes. It also allows full range of [OCI Compute API][oci-compute-api] to be used while creating worker nodes. +Please read the prerequisites related to [Dynamic Group and policy][policy] before creating self managed OKE nodes. + # Self managed nodes backed by CAPI Machine Deployment -Use the template `cluster-template-managed-self-managed-nodes.yaml` as an example for creating +Use the template `cluster-template-managed-self-managed-nodes.yaml` as an example for creating and OKE cluster +with a self managed CAPI machine deployment. Self managed nodes are only supported if flannel +is used as CNI provider. The following snippet shows the relevant part of the template. +```yaml +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: OCIMachineTemplate +metadata: + name: "${CLUSTER_NAME}-md-0" +spec: + template: + spec: + imageId: "${OCI_MANAGED_NODE_IMAGE_ID}" +--- +apiVersion: cluster.x-k8s.io/v1beta1 +kind: MachineDeployment +metadata: + name: "${CLUSTER_NAME}-md-0" +spec: + clusterName: "${CLUSTER_NAME}" + replicas: ${WORKER_MACHINE_COUNT} + selector: + matchLabels: + template: + spec: + clusterName: "${CLUSTER_NAME}" + version: "${KUBERNETES_VERSION}" + bootstrap: + dataSecretName: "${CLUSTER_NAME}-self-managed" + infrastructureRef: + name: "${CLUSTER_NAME}-md-0" + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: OCIMachineTemplate +``` +Note that CAPOCI will populate a bootstrap secret with the relevant [cloud-init][cloud-init] script required +for the node to join the OKE cluster # Self managed nodes backed by OCI Instance Pool +> Note: MachinePool is still an experimental feature in CAPI + +The following snippet can be used to create self managed OKE nodes backed by OCI Instance Pool[instance-pool]. +```yaml +--- +apiVersion: cluster.x-k8s.io/v1beta1 +kind: MachinePool +metadata: + name: "${CLUSTER_NAME}-mp-0" + namespace: default +spec: + clusterName: "${CLUSTER_NAME}" + replicas: "${WORKER_MACHINE_COUNT}" + template: + spec: + bootstrap: + dataSecretName: "${CLUSTER_NAME}-self-managed" + clusterName: "${CLUSTER_NAME}" + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: OCIMachinePool + name: "${CLUSTER_NAME}-mp-0" + version: "${KUBERNETES_VERSION}" +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: OCIMachinePool +metadata: + name: "${CLUSTER_NAME}-mp-0" + namespace: default +spec: + instanceConfiguration: + metadata: + ssh_authorized_keys: "${OCI_SSH_KEY}" + instanceSourceViaImageConfig: + imageId: "${OCI_MANAGED_NODE_IMAGE_ID}" + shape: "${OCI_NODE_MACHINE_TYPE=VM.Standard.E4.Flex}" + shapeConfig: + ocpus: "1" +``` @@ -15,4 +90,7 @@ Use the template `cluster-template-managed-self-managed-nodes.yaml` as an exampl [self-managed-nodes]: https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contengworkingwithselfmanagednodes.htm [capi-upgrade]:https://cluster-api.sigs.k8s.io/tasks/upgrading-clusters.html#upgrading-machines-managed-by-a-machinedeployment [health-check]: https://cluster-api.sigs.k8s.io/tasks/automated-machine-management/healthchecking.html -[oci-compute-api]: https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/Instance/LaunchInstance \ No newline at end of file +[oci-compute-api]: https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/Instance/LaunchInstance +[cloud-init]: https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contengcloudinitforselfmanagednodes.htm +[policy]: https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contengprereqsforselfmanagednodes.htm +[instance-pool]: https://docs.oracle.com/en-us/iaas/Content/Compute/Concepts/instancemanagement.htm#Instance \ No newline at end of file diff --git a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/cluster.yaml b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/cluster.yaml index 053ffad1..b5d517b5 100644 --- a/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/cluster.yaml +++ b/test/e2e/data/infrastructure-oci/v1beta2/cluster-template-managed-self-managed-nodes/cluster.yaml @@ -241,6 +241,7 @@ metadata: namespace: "${NAMESPACE}" spec: version: "${OCI_MANAGED_KUBERNETES_VERSION}" + clusterType: "ENHANCED_CLUSTER" clusterPodNetworkOptions: - cniType: "FLANNEL_OVERLAY" --- \ No newline at end of file From 0e7bed86d8bb6992c5dde98a730db13ae0b62845 Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Tue, 4 Jul 2023 12:22:56 +0530 Subject: [PATCH 13/14] OKE self managed nodes and rmove OKE out of experimental --- exp/controllers/ocimachinepool_controller.go | 2 +- templates/cluster-template-managed-self-managed-nodes.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/exp/controllers/ocimachinepool_controller.go b/exp/controllers/ocimachinepool_controller.go index 56389a70..8471049b 100644 --- a/exp/controllers/ocimachinepool_controller.go +++ b/exp/controllers/ocimachinepool_controller.go @@ -315,7 +315,7 @@ func (r *OCIMachinePoolReconciler) reconcileNormal(ctx context.Context, logger l conditions.MarkFalse(machinePoolScope.OCIMachinePool, infrav2exp.InstancePoolReadyCondition, infrav2exp.InstancePoolProvisionFailedReason, clusterv1.ConditionSeverityError, err.Error()) return ctrl.Result{}, err } - r.Recorder.Eventf(machinePoolScope.OCIMachinePool, "SuccessfulCreate", "Created new Instance Pool: %s", machinePoolScope.OCIMachinePool.GetName()) + r.Recorder.Eventf(machinePoolScope.OCIMachinePool, corev1.EventTypeNormal, "InstancePoolCreated", "Created new Instance Pool: %s", machinePoolScope.OCIMachinePool.GetName()) return ctrl.Result{}, nil } diff --git a/templates/cluster-template-managed-self-managed-nodes.yaml b/templates/cluster-template-managed-self-managed-nodes.yaml index 7b50e277..352ebdbf 100644 --- a/templates/cluster-template-managed-self-managed-nodes.yaml +++ b/templates/cluster-template-managed-self-managed-nodes.yaml @@ -241,6 +241,7 @@ metadata: namespace: "${NAMESPACE}" spec: version: "${KUBERNETES_VERSION}" + clusterType: "ENHANCED_CLUSTER" clusterPodNetworkOptions: - cniType: "FLANNEL_OVERLAY" --- From 2f09f0f2434055bbefb7c31f440878ad6301e42a Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Thu, 6 Jul 2023 10:09:24 +0530 Subject: [PATCH 14/14] OKE self managed nodes and rmove OKE out of experimental --- Dockerfile | 2 +- cloud/scope/managed_control_plane.go | 2 ++ docs/src/managed/self-managed-nodes.md | 2 +- exp/api/v1beta2/ocimanagedmachinepool_webhook.go | 2 +- exp/api/v1beta2/ocimanagedmachinepool_webhook_test.go | 2 +- exp/controllers/ocimachinepool_controller.go | 2 +- exp/controllers/ocivirtual_machinepool_controller_test.go | 2 +- test/e2e/managed_cluster_test.go | 2 +- 8 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 93640c0f..29aa8075 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ COPY version/ version/ # Build RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -ldflags "${LDFLAGS} -extldflags '-static'" -o manager ${package} -FROM ghcr.io/oracle/oraclelinux:8-slim +FROM ghcr.io/oracle/oraclelinux:9-slim WORKDIR / COPY --from=builder /workspace/manager . USER 65532:65532 diff --git a/cloud/scope/managed_control_plane.go b/cloud/scope/managed_control_plane.go index 61af8e43..d1e665bc 100644 --- a/cloud/scope/managed_control_plane.go +++ b/cloud/scope/managed_control_plane.go @@ -48,6 +48,8 @@ import ( ) const ( + // OKEInitScript is the cloud init script of OKE slef managed node: + // Reference : https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contengcloudinitforselfmanagednodes.htm OKEInitScript = "#!/usr/bin/env bash\nbash /etc/oke/oke-install.sh \\\n --apiserver-endpoint \"CLUSTER_ENDPOINT\" \\\n --kubelet-ca-cert \"BASE_64_CA\"" ) diff --git a/docs/src/managed/self-managed-nodes.md b/docs/src/managed/self-managed-nodes.md index d97629fc..6c88aca1 100644 --- a/docs/src/managed/self-managed-nodes.md +++ b/docs/src/managed/self-managed-nodes.md @@ -1,5 +1,5 @@ # Self managed nodes -CAPOCI supports OKE self managed nodes. With this feature, CAPI features such as [rolling update][capi-upgrade], +CAPOCI supports [OKE self managed nodes][self-managed-nodes]. With this feature, CAPI features such as [rolling update][capi-upgrade], [health checks][health-check] can be used to make management of self managed nodes easier. CAPOCI supports two flavours fo self managed nodes. It also allows full range of [OCI Compute API][oci-compute-api] to be used while creating worker nodes. diff --git a/exp/api/v1beta2/ocimanagedmachinepool_webhook.go b/exp/api/v1beta2/ocimanagedmachinepool_webhook.go index ae754ec2..2cf43230 100644 --- a/exp/api/v1beta2/ocimanagedmachinepool_webhook.go +++ b/exp/api/v1beta2/ocimanagedmachinepool_webhook.go @@ -18,9 +18,9 @@ package v1beta2 import ( "fmt" - infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "reflect" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/validation/field" diff --git a/exp/api/v1beta2/ocimanagedmachinepool_webhook_test.go b/exp/api/v1beta2/ocimanagedmachinepool_webhook_test.go index 0fd0bcd5..9f538f7f 100644 --- a/exp/api/v1beta2/ocimanagedmachinepool_webhook_test.go +++ b/exp/api/v1beta2/ocimanagedmachinepool_webhook_test.go @@ -17,12 +17,12 @@ limitations under the License. package v1beta2 import ( - infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "strings" "testing" "github.com/onsi/gomega" . "github.com/onsi/gomega" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/oci-go-sdk/v65/common" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/exp/controllers/ocimachinepool_controller.go b/exp/controllers/ocimachinepool_controller.go index 8471049b..19eb8e8a 100644 --- a/exp/controllers/ocimachinepool_controller.go +++ b/exp/controllers/ocimachinepool_controller.go @@ -19,7 +19,6 @@ package controllers import ( "context" "fmt" - expV1Beta1 "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1" "time" "github.com/go-logr/logr" @@ -27,6 +26,7 @@ import ( "github.com/oracle/cluster-api-provider-oci/cloud/ociutil" "github.com/oracle/cluster-api-provider-oci/cloud/scope" cloudutil "github.com/oracle/cluster-api-provider-oci/cloud/util" + expV1Beta1 "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1" infrav2exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" "github.com/oracle/oci-go-sdk/v65/common" "github.com/oracle/oci-go-sdk/v65/core" diff --git a/exp/controllers/ocivirtual_machinepool_controller_test.go b/exp/controllers/ocivirtual_machinepool_controller_test.go index 8c48ba67..c0308f4b 100644 --- a/exp/controllers/ocivirtual_machinepool_controller_test.go +++ b/exp/controllers/ocivirtual_machinepool_controller_test.go @@ -18,11 +18,11 @@ package controllers import ( "context" - infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/cluster-api-provider-oci/cloud/ociutil" "github.com/oracle/cluster-api-provider-oci/cloud/scope" "github.com/oracle/cluster-api-provider-oci/cloud/services/containerengine/mock_containerengine" diff --git a/test/e2e/managed_cluster_test.go b/test/e2e/managed_cluster_test.go index dfad1e43..0ad796f3 100644 --- a/test/e2e/managed_cluster_test.go +++ b/test/e2e/managed_cluster_test.go @@ -22,7 +22,6 @@ package e2e import ( "context" "fmt" - infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "os" "path/filepath" "reflect" @@ -31,6 +30,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" infrav2exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" "github.com/oracle/oci-go-sdk/v65/common" oke "github.com/oracle/oci-go-sdk/v65/containerengine"