diff --git a/Makefile b/Makefile index d34baf1a..2400aab0 100644 --- a/Makefile +++ b/Makefile @@ -79,6 +79,16 @@ GINKGO := $(BIN_DIR)/$(GINKGO_BIN) CONTROLLER_GEN_BIN = controller-gen CONTROLLER_GEN := $(BIN_DIR)/$(CONTROLLER_GEN_BIN) +CONVERSION_GEN_BIN := conversion-gen +CONVERSION_GEN := $(BIN_DIR)/conversion-gen + +# set up `setup-envtest` to install kubebuilder dependency +export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.24.2 +SETUP_ENVTEST_VER := v0.0.0-20230131074648-f5014c077fc3 +SETUP_ENVTEST_BIN := setup-envtest +SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER)) +SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest + # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) GOBIN=$(shell go env GOPATH)/bin @@ -92,6 +102,11 @@ endif SHELL = /usr/bin/env bash -o pipefail .SHELLFLAGS = -ec +# set --output-base used for conversion-gen which needs to be different for in GOPATH and outside GOPATH dev +ifneq ($(abspath $(ROOT_DIR)),$(GOPATH)/src/github.com/oracle/cluster-api-provider-oci) + OUTPUT_BASE := --output-base=$(ROOT_DIR) +endif + all: build ##@ General @@ -119,28 +134,49 @@ manifests: $(CONTROLLER_GEN) ## Generate WebhookConfiguration, ClusterRole and C paths="./exp/api/..." \ output:crd:artifacts:config=config/crd/bases -generate: $(CONTROLLER_GEN) ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. +generate: $(CONTROLLER_GEN) $(CONVERSION_GEN) ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./api/..." paths="./exp/api/..." + $(CONVERSION_GEN) \ + --input-dirs=./api/v1beta1 \ + --extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \ + --build-tag=ignore_autogenerated_conversions \ + --output-file-base=zz_generated.conversion \ + --go-header-file=hack/boilerplate.go.txt $(OUTPUT_BASE) + $(CONVERSION_GEN) \ + --input-dirs=./exp/api/v1beta1 \ + --extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \ + --extra-peer-dirs=github.com/oracle/cluster-api-provider-oci/api/v1beta1 \ + --build-tag=ignore_autogenerated_conversions \ + --output-file-base=zz_generated.conversion \ + --go-header-file=hack/boilerplate.go.txt $(OUTPUT_BASE) fmt: ## Run go fmt against code. go fmt ./... -vet: ## Run go vet against code. - go vet ./... +##@ test: + +.PHONY: install-setup-envtest +install-setup-envtest: # Install setup-envtest so that setup-envtest's eval is executed after the tool has been installed. + GOBIN=$(abspath $(TOOLS_BIN_DIR)) $(GO_INSTALL) $(SETUP_ENVTEST_PKG) $(SETUP_ENVTEST_BIN) $(SETUP_ENVTEST_VER) -ENVTEST_ASSETS_DIR=$(shell pwd)/testbin -test: manifests generate fmt vet ## Run tests. - mkdir -p ${ENVTEST_ASSETS_DIR} - test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.8.3/hack/setup-envtest.sh - source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out && go tool cover -html=cover.out -o cover.html +.PHONY: setup-envtest +setup-envtest: install-setup-envtest # Build setup-envtest from tools folder. + @$(eval KUBEBUILDER_ASSETS := $(shell $(SETUP_ENVTEST) use --use-env -p path $(KUBEBUILDER_ENVTEST_KUBERNETES_VERSION))) \ + if [ -z "$(KUBEBUILDER_ASSETS)" ]; then echo "Failed to find kubebuilder assets, see errors above"; exit 1; fi; \ + echo "kube-builder assets: $(KUBEBUILDER_ASSETS)" +.PHONY: test +test: setup-envtest ## Run tests + KUBEBUILDER_ASSETS="$(KUBEBUILDER_ASSETS)" go test -coverprofile=coverage.out ./... $(TEST_ARGS) + go tool cover -func=coverage.out -o coverage.txt + go tool cover -html=coverage.out -o coverage.html ##@ Build -build: generate fmt vet ## Build manager binary. +build: generate fmt ## Build manager binary. CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS} -extldflags '-static'" -o bin/manager . -run: manifests generate fmt vet ## Run a controller from your host. +run: manifests generate fmt ## Run a controller from your host. go run ./main.go --feature-gates=MachinePool=${EXP_MACHINE_POOL} ## -------------------------------------- @@ -332,6 +368,9 @@ kubectl: $(KUBECTL) ## Build a local copy of kubectl. $(CONTROLLER_GEN): ## Download controller-gen locally if necessary. GOBIN=$(BIN_DIR)/ $(GO_INSTALL) sigs.k8s.io/controller-tools/cmd/controller-gen $(CONTROLLER_GEN_BIN) v0.10.0 +$(CONVERSION_GEN): ## Download controller-gen locally if necessary. + GOBIN=$(BIN_DIR)/ $(GO_INSTALL) k8s.io/code-generator/cmd/conversion-gen $(CONVERSION_GEN_BIN) v0.23.1 + $(KUSTOMIZE): ## Download kustomize locally if necessary. GOBIN=$(BIN_DIR)/ $(GO_INSTALL) sigs.k8s.io/kustomize/kustomize/v4 $(KUSTOMIZE_BIN) v4.5.2 diff --git a/api/v1beta1/conversion.go b/api/v1beta1/conversion.go new file mode 100644 index 00000000..43481282 --- /dev/null +++ b/api/v1beta1/conversion.go @@ -0,0 +1,122 @@ +/* + Copyright (c) 2023 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 + +import ( + "errors" + "github.com/oracle/cluster-api-provider-oci/api/v1beta2" + "k8s.io/apimachinery/pkg/conversion" +) + +// Convert_v1beta1_VCN_To_v1beta2_VCN converts v1beta1 VCN to v1beta2 VCN +func Convert_v1beta1_VCN_To_v1beta2_VCN(in *VCN, out *v1beta2.VCN, s conversion.Scope) error { + autoConvert_v1beta1_VCN_To_v1beta2_VCN(in, out, s) + if in.InternetGatewayId != nil { + out.InternetGateway.Id = in.InternetGatewayId + } + if in.NatGatewayId != nil { + out.NATGateway.Id = in.NatGatewayId + } + if in.ServiceGatewayId != nil { + out.ServiceGateway.Id = in.ServiceGatewayId + } + if in.PrivateRouteTableId != nil { + out.RouteTable.PrivateRouteTableId = in.PrivateRouteTableId + } + if in.PublicRouteTableId != nil { + out.RouteTable.PublicRouteTableId = in.PublicRouteTableId + } + if in.NetworkSecurityGroups != nil { + nsgList, err := convertv1beta1NSGListTov1beta2NSGList(in.NetworkSecurityGroups) + if err != nil { + return err + } + out.NetworkSecurityGroup.List = nsgList + } + return nil +} + +// Convert_v1beta2_VCN_To_v1beta1_VCN converts v1beta2 VCN to v1beta1 VCN +func Convert_v1beta2_VCN_To_v1beta1_VCN(in *v1beta2.VCN, out *VCN, s conversion.Scope) error { + autoConvert_v1beta2_VCN_To_v1beta1_VCN(in, out, s) + if in.InternetGateway.Id != nil { + out.InternetGatewayId = in.InternetGateway.Id + } + if in.NATGateway.Id != nil { + out.NatGatewayId = in.NATGateway.Id + } + if in.ServiceGateway.Id != nil { + out.ServiceGatewayId = in.ServiceGateway.Id + } + if in.RouteTable.PublicRouteTableId != nil { + out.PublicRouteTableId = in.RouteTable.PublicRouteTableId + } + if in.RouteTable.PrivateRouteTableId != nil { + out.PrivateRouteTableId = in.RouteTable.PrivateRouteTableId + } + if in.NetworkSecurityGroup.List != nil { + nsgList, err := convertv1beta2NSGListTov1beta1NSGList(in.NetworkSecurityGroup.List) + if err != nil { + return err + } + out.NetworkSecurityGroups = nsgList + } + return nil +} + +// Convert_v1beta1_OCIClusterStatus_To_v1beta2_OCIClusterStatus converts v1beta1 OCIClusterStatus to v1beta2 OCIClusterStatus +func Convert_v1beta1_OCIClusterStatus_To_v1beta2_OCIClusterStatus(in *OCIClusterStatus, out *v1beta2.OCIClusterStatus, s conversion.Scope) error { + return autoConvert_v1beta1_OCIClusterStatus_To_v1beta2_OCIClusterStatus(in, out, s) +} + +// Convert_v1beta2_OCIClusterSpec_To_v1beta1_OCIClusterSpec converts v1beta2 OCIClusterStatus to v1beta1 OCIClusterStatus +func Convert_v1beta2_OCIClusterSpec_To_v1beta1_OCIClusterSpec(in *v1beta2.OCIClusterSpec, out *OCIClusterSpec, s conversion.Scope) error { + return autoConvert_v1beta2_OCIClusterSpec_To_v1beta1_OCIClusterSpec(in, out, s) +} + +// Convert_v1beta1_EgressSecurityRuleForNSG_To_v1beta2_EgressSecurityRuleForNSG converts v1beta1 EgressSecurityRuleForNSG to v1beta2 EgressSecurityRuleForNSG +func Convert_v1beta1_EgressSecurityRuleForNSG_To_v1beta2_EgressSecurityRuleForNSG(in *EgressSecurityRuleForNSG, out *v1beta2.EgressSecurityRuleForNSG, s conversion.Scope) error { + return autoConvert_v1beta1_EgressSecurityRuleForNSG_To_v1beta2_EgressSecurityRuleForNSG(in, out, s) +} + +// Convert_v1beta1_IngressSecurityRuleForNSG_To_v1beta2_IngressSecurityRuleForNSG converts v1beta1 IngressSecurityRuleForNSG to v1beta2 IngressSecurityRuleForNSG +func Convert_v1beta1_IngressSecurityRuleForNSG_To_v1beta2_IngressSecurityRuleForNSG(in *IngressSecurityRuleForNSG, out *v1beta2.IngressSecurityRuleForNSG, s conversion.Scope) error { + return autoConvert_v1beta1_IngressSecurityRuleForNSG_To_v1beta2_IngressSecurityRuleForNSG(in, out, s) +} + +// Convert_v1beta1_NetworkDetails_To_v1beta2_NetworkDetails converts v1beta1 NetworkDetails to v1beta2 NetworkDetails +func Convert_v1beta1_NetworkDetails_To_v1beta2_NetworkDetails(in *NetworkDetails, out *v1beta2.NetworkDetails, s conversion.Scope) error { + return autoConvert_v1beta1_NetworkDetails_To_v1beta2_NetworkDetails(in, out, s) +} + +// Convert_v1beta1_OCIMachineSpec_To_v1beta2_OCIMachineSpec converts v1beta1 OCIMachineSpec to v1beta2 OCIMachineSpec +func Convert_v1beta1_OCIMachineSpec_To_v1beta2_OCIMachineSpec(in *OCIMachineSpec, out *v1beta2.OCIMachineSpec, s conversion.Scope) error { + err := autoConvert_v1beta1_OCIMachineSpec_To_v1beta2_OCIMachineSpec(in, out, s) + if err != nil { + return err + } + if in.NetworkDetails.SubnetId != nil { + return errors.New("deprecated field NetworkDetails.SubnetId is present in OCIMachineSpec") + } + if in.NetworkDetails.NSGId != nil { + return errors.New("deprecated field NetworkDetails.NSGId is present in OCIMachineSpec") + } + if in.NSGName != "" && len(in.NetworkDetails.NsgNames) == 0 { + out.NetworkDetails.NsgNames = []string{in.NSGName} + } + return nil +} diff --git a/api/v1beta1/conversion_test.go b/api/v1beta1/conversion_test.go new file mode 100644 index 00000000..5d6883b1 --- /dev/null +++ b/api/v1beta1/conversion_test.go @@ -0,0 +1,141 @@ +/* + Copyright (c) 2023 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 + +import ( + "k8s.io/apimachinery/pkg/api/apitesting/fuzzer" + "testing" + + fuzz "github.com/google/gofuzz" + . "github.com/onsi/gomega" + "github.com/oracle/cluster-api-provider-oci/api/v1beta2" + "k8s.io/apimachinery/pkg/runtime" + runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilconversion "sigs.k8s.io/cluster-api/util/conversion" +) + +func fuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} { + return []interface{}{ + OCIMachineFuzzer, + OCIMachineTemplateFuzzer, + OCIClusterFuzzer, + OCIClusterTemplateFuzzer, + } +} + +func OCIMachineFuzzer(obj *OCIMachine, c fuzz.Continue) { + c.FuzzNoCustom(obj) + // nil fields which have been removed so that tests dont fail + obj.Spec.NetworkDetails.NSGId = nil + obj.Spec.NetworkDetails.SubnetId = nil + obj.Spec.NSGName = "" +} + +func OCIClusterFuzzer(obj *OCICluster, 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 OCIClusterTemplateFuzzer(obj *OCIClusterTemplate, c fuzz.Continue) { + c.FuzzNoCustom(obj) + // nil fields which have been removed so that tests dont fail + for _, nsg := range obj.Spec.Template.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 OCIMachineTemplateFuzzer(obj *OCIMachineTemplate, c fuzz.Continue) { + c.FuzzNoCustom(obj) + // nil fields which ave been removed so that tests dont fail + obj.Spec.Template.Spec.NetworkDetails.NSGId = nil + obj.Spec.Template.Spec.NetworkDetails.SubnetId = nil + obj.Spec.Template.Spec.NSGName = "" +} + +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 OCICluster", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ + Scheme: scheme, + Hub: &v1beta2.OCICluster{}, + Spoke: &OCICluster{}, + FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, + })) + + t.Run("for OCIClusterTemplate", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ + Scheme: scheme, + Hub: &v1beta2.OCIClusterTemplate{}, + Spoke: &OCIClusterTemplate{}, + FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, + })) + + t.Run("for OCIMachine", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ + Scheme: scheme, + Hub: &v1beta2.OCIMachine{}, + Spoke: &OCIMachine{}, + FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, + })) + + t.Run("for OCIMachineTemplate", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ + Scheme: scheme, + Hub: &v1beta2.OCIMachineTemplate{}, + Spoke: &OCIMachineTemplate{}, + FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, + })) + + t.Run("for OCIClusterIdentity", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ + Scheme: scheme, + Hub: &v1beta2.OCIClusterIdentity{}, + Spoke: &OCIClusterIdentity{}, + FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, + })) + +} diff --git a/api/v1beta1/doc.go b/api/v1beta1/doc.go new file mode 100644 index 00000000..a539191f --- /dev/null +++ b/api/v1beta1/doc.go @@ -0,0 +1,19 @@ +/* + Copyright (c) 2023 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. +*/ + +// +k8s:conversion-gen=github.com/oracle/cluster-api-provider-oci/api/v1beta2 + +package v1beta1 diff --git a/api/v1beta1/groupversion_info.go b/api/v1beta1/groupversion_info.go index 1437cb8a..1dc0d93f 100644 --- a/api/v1beta1/groupversion_info.go +++ b/api/v1beta1/groupversion_info.go @@ -33,4 +33,6 @@ var ( // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme + + localSchemeBuilder = SchemeBuilder.SchemeBuilder ) diff --git a/api/v1beta1/ocicluster_conversion.go b/api/v1beta1/ocicluster_conversion.go new file mode 100644 index 00000000..1468dce0 --- /dev/null +++ b/api/v1beta1/ocicluster_conversion.go @@ -0,0 +1,145 @@ +/* + Copyright (c) 2023 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 + +import ( + "github.com/oracle/cluster-api-provider-oci/api/v1beta2" + utilconversion "sigs.k8s.io/cluster-api/util/conversion" + "sigs.k8s.io/controller-runtime/pkg/conversion" +) + +// ConvertTo converts the v1beta1 AWSCluster receiver to a v1beta2 AWSCluster. +func (src *OCICluster) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1beta2.OCICluster) + + if err := Convert_v1beta1_OCICluster_To_v1beta2_OCICluster(src, dst, nil); err != nil { + return err + } + + ad, err := Convertv1beta1AdMapTov1beta2AdMap(src.Status.AvailabilityDomains) + if err != nil { + return err + } + dst.Spec.AvailabilityDomains = ad + + // Manually restore data. + restored := &v1beta2.OCICluster{} + if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { + return err + } + + dst.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.Skip = restored.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.Skip + dst.Spec.NetworkSpec.Vcn.NATGateway.Skip = restored.Spec.NetworkSpec.Vcn.NATGateway.Skip + dst.Spec.NetworkSpec.Vcn.ServiceGateway.Skip = restored.Spec.NetworkSpec.Vcn.ServiceGateway.Skip + dst.Spec.NetworkSpec.Vcn.InternetGateway.Skip = restored.Spec.NetworkSpec.Vcn.InternetGateway.Skip + dst.Spec.NetworkSpec.Vcn.RouteTable.Skip = restored.Spec.NetworkSpec.Vcn.RouteTable.Skip + + return nil +} + +func convertv1beta1NSGListTov1beta2NSGList(in []*NSG) ([]*v1beta2.NSG, error) { + out := make([]*v1beta2.NSG, len(in)) + for i, nsg := range in { + if nsg == nil { + out[i] = nil + continue + } + out[i] = &v1beta2.NSG{} + err := Convert_v1beta1_NSG_To_v1beta2_NSG(nsg, out[i], nil) + if err != nil { + return nil, err + } + } + return out, nil +} +func convertv1beta2NSGListTov1beta1NSGList(in []*v1beta2.NSG) ([]*NSG, error) { + out := make([]*NSG, len(in)) + for i, nsg := range in { + if nsg == nil { + out[i] = nil + continue + } + out[i] = &NSG{} + err := Convert_v1beta2_NSG_To_v1beta1_NSG(nsg, out[i], nil) + if err != nil { + return nil, err + } + } + return out, nil +} + +func Convertv1beta1AdMapTov1beta2AdMap(in map[string]OCIAvailabilityDomain) (map[string]v1beta2.OCIAvailabilityDomain, error) { + out := make(map[string]v1beta2.OCIAvailabilityDomain) + for k, v := range in { + outV := &v1beta2.OCIAvailabilityDomain{} + err := Convert_v1beta1_OCIAvailabilityDomain_To_v1beta2_OCIAvailabilityDomain(&v, outV, nil) + if err != nil { + return nil, err + } + out[k] = *outV + } + return out, nil +} + +func Convertv1beta2AdMapTov1beta1AdMap(in map[string]v1beta2.OCIAvailabilityDomain) (map[string]OCIAvailabilityDomain, error) { + out := make(map[string]OCIAvailabilityDomain) + for k, v := range in { + outV := &OCIAvailabilityDomain{} + err := Convert_v1beta2_OCIAvailabilityDomain_To_v1beta1_OCIAvailabilityDomain(&v, outV, nil) + if err != nil { + return nil, err + } + out[k] = *outV + } + return out, nil +} + +// ConvertFrom converts receiver to a v1beta2 OCICluster. +func (r *OCICluster) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1beta2.OCICluster) + + if err := Convert_v1beta2_OCICluster_To_v1beta1_OCICluster(src, r, nil); err != nil { + return err + } + + ad, err := Convertv1beta2AdMapTov1beta1AdMap(src.Spec.AvailabilityDomains) + if err != nil { + return err + } + r.Status.AvailabilityDomains = ad + + // Preserve Hub data on down-conversion. + if err := utilconversion.MarshalData(src, r); err != nil { + return err + } + + return nil +} + +// ConvertTo converts the v1beta1 OCIClusterList receiver to a v1beta2 OCIClusterList. +func (src *OCIClusterList) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1beta2.OCIClusterList) + + return Convert_v1beta1_OCIClusterList_To_v1beta2_OCIClusterList(src, dst, nil) +} + +// ConvertFrom converts the v1beta2 AWSClusterList receiver to a v1beta1 OCIClusterList. +func (r *OCIClusterList) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1beta2.OCIClusterList) + + return Convert_v1beta2_OCIClusterList_To_v1beta1_OCIClusterList(src, r, nil) +} diff --git a/api/v1beta1/ocicluster_types.go b/api/v1beta1/ocicluster_types.go index a717a1dd..03406f0b 100644 --- a/api/v1beta1/ocicluster_types.go +++ b/api/v1beta1/ocicluster_types.go @@ -90,6 +90,7 @@ type OCIClusterStatus struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status +// +kubebuilder:storageversion // OCICluster is the Schema for the ociclusters API. type OCICluster struct { @@ -101,6 +102,7 @@ type OCICluster struct { } //+kubebuilder:object:root=true +// +kubebuilder:storageversion // OCIClusterList contains a list of OCICluster. type OCIClusterList struct { diff --git a/api/v1beta1/ociclusteridentity_conversion.go b/api/v1beta1/ociclusteridentity_conversion.go new file mode 100644 index 00000000..f99ba502 --- /dev/null +++ b/api/v1beta1/ociclusteridentity_conversion.go @@ -0,0 +1,51 @@ +/* +Copyright (c) 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 + + http://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 + +import ( + "github.com/oracle/cluster-api-provider-oci/api/v1beta2" + utilconversion "sigs.k8s.io/cluster-api/util/conversion" + "sigs.k8s.io/controller-runtime/pkg/conversion" +) + +// ConvertTo converts the v1beta1 OCIClusterIdentity receiver to a v1beta2 OCIClusterIdentity. +func (src *OCIClusterIdentity) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1beta2.OCIClusterIdentity) + if err := Convert_v1beta1_OCIClusterIdentity_To_v1beta2_OCIClusterIdentity(src, dst, nil); err != nil { + return err + } + + // Manually restore data. + restored := &v1beta2.OCIClusterIdentity{} + if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { + return err + } + + return nil +} + +// ConvertFrom converts the v1beta2 OCIClusterIdentity to a v1beta1 OCIClusterIdentity. +func (dst *OCIClusterIdentity) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1beta2.OCIClusterIdentity) + + if err := Convert_v1beta2_OCIClusterIdentity_To_v1beta1_OCIClusterIdentity(src, dst, nil); err != nil { + return err + } + + // Preserve Hub data on down-conversion except for metadata. + return utilconversion.MarshalData(src, dst) +} diff --git a/api/v1beta1/ociclustertemplate_conversion.go b/api/v1beta1/ociclustertemplate_conversion.go new file mode 100644 index 00000000..be3ffc83 --- /dev/null +++ b/api/v1beta1/ociclustertemplate_conversion.go @@ -0,0 +1,70 @@ +/* +Copyright (c) 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 + + http://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 + +import ( + "github.com/oracle/cluster-api-provider-oci/api/v1beta2" + utilconversion "sigs.k8s.io/cluster-api/util/conversion" + "sigs.k8s.io/controller-runtime/pkg/conversion" +) + +// ConvertTo converts the v1beta1 OCIClusterTemplate receiver to a v1beta2 OCIClusterTemplate. +func (src *OCIClusterTemplate) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1beta2.OCIClusterTemplate) + if err := Convert_v1beta1_OCIClusterTemplate_To_v1beta2_OCIClusterTemplate(src, dst, nil); err != nil { + return err + } + + // Manually restore data. + restored := &v1beta2.OCIClusterTemplate{} + if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { + return err + } + + dst.Spec.Template.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.Skip = restored.Spec.Template.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.Skip + dst.Spec.Template.Spec.NetworkSpec.Vcn.NATGateway.Skip = restored.Spec.Template.Spec.NetworkSpec.Vcn.NATGateway.Skip + dst.Spec.Template.Spec.NetworkSpec.Vcn.ServiceGateway.Skip = restored.Spec.Template.Spec.NetworkSpec.Vcn.ServiceGateway.Skip + dst.Spec.Template.Spec.NetworkSpec.Vcn.InternetGateway.Skip = restored.Spec.Template.Spec.NetworkSpec.Vcn.InternetGateway.Skip + dst.Spec.Template.Spec.NetworkSpec.Vcn.RouteTable.Skip = restored.Spec.Template.Spec.NetworkSpec.Vcn.RouteTable.Skip + dst.Spec.Template.Spec.AvailabilityDomains = restored.Spec.Template.Spec.AvailabilityDomains + return nil +} + +// ConvertFrom converts the v1beta2 OCIClusterTemplate to a v1beta1 OCIClusterTemplate. +func (dst *OCIClusterTemplate) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1beta2.OCIClusterTemplate) + + if err := Convert_v1beta2_OCIClusterTemplate_To_v1beta1_OCIClusterTemplate(src, dst, nil); err != nil { + return err + } + + // Preserve Hub data on down-conversion except for metadata. + return utilconversion.MarshalData(src, dst) +} + +// ConvertTo converts the v1beta1 OCIMachineTemplateList receiver to a v1beta2 OCIMachineTemplateList. +func (src *OCIClusterTemplateList) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1beta2.OCIClusterTemplateList) + return Convert_v1beta1_OCIClusterTemplateList_To_v1beta2_OCIClusterTemplateList(src, dst, nil) +} + +// ConvertFrom converts the v1beta2 OCIMachineTemplateList to a v1beta1 OCIMachineTemplateList. +func (dst *OCIClusterTemplateList) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1beta2.OCIClusterTemplateList) + + return Convert_v1beta2_OCIClusterTemplateList_To_v1beta1_OCIClusterTemplateList(src, dst, nil) +} diff --git a/api/v1beta1/ociclustertemplate_types.go b/api/v1beta1/ociclustertemplate_types.go index b5fab31c..49b7d6d5 100644 --- a/api/v1beta1/ociclustertemplate_types.go +++ b/api/v1beta1/ociclustertemplate_types.go @@ -27,7 +27,6 @@ type OCIClusterTemplateSpec struct { // +kubebuilder:object:root=true // +kubebuilder:resource:path=ociclustertemplates,scope=Namespaced,categories=cluster-api -// +kubebuilder:storageversion // OCIClusterTemplate is the Schema for the ociclustertemplates API. type OCIClusterTemplate struct { diff --git a/api/v1beta1/ocimachine_conversion.go b/api/v1beta1/ocimachine_conversion.go new file mode 100644 index 00000000..c6a9ce9d --- /dev/null +++ b/api/v1beta1/ocimachine_conversion.go @@ -0,0 +1,110 @@ +/* +Copyright (c) 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 + + http://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 + +import ( + "github.com/oracle/cluster-api-provider-oci/api/v1beta2" + utilconversion "sigs.k8s.io/cluster-api/util/conversion" + "sigs.k8s.io/controller-runtime/pkg/conversion" +) + +// ConvertTo converts the v1beta1 OCIMachine receiver to a v1beta2 OCIMachine. +func (src *OCIMachine) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1beta2.OCIMachine) + if err := Convert_v1beta1_OCIMachine_To_v1beta2_OCIMachine(src, dst, nil); err != nil { + return err + } + + // Manually restore data. + restored := &v1beta2.OCIMachine{} + if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { + return err + } + + return nil +} + +// ConvertFrom converts the v1beta2 OCIMachine to a v1beta1 OCIMachine. +func (dst *OCIMachine) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1beta2.OCIMachine) + + if err := Convert_v1beta2_OCIMachine_To_v1beta1_OCIMachine(src, dst, nil); err != nil { + return err + } + + // Preserve Hub data on down-conversion except for metadata. + return utilconversion.MarshalData(src, dst) +} + +// ConvertTo converts the v1beta1 OCIMachineList receiver to a v1beta2 OCIMachineList. +func (src *OCIMachineList) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1beta2.OCIMachineList) + return Convert_v1beta1_OCIMachineList_To_v1beta2_OCIMachineList(src, dst, nil) +} + +// ConvertFrom converts the v1beta2 OCIMachineList to a v1beta1 OCIMachineList. +func (dst *OCIMachineList) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1beta2.OCIMachineList) + + return Convert_v1beta2_OCIMachineList_To_v1beta1_OCIMachineList(src, dst, nil) +} + +// ConvertTo converts the v1beta1 OCIMachineTemplate receiver to a v1beta2 OCIMachineTemplate. +func (r *OCIMachineTemplate) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1beta2.OCIMachineTemplate) + + if err := Convert_v1beta1_OCIMachineTemplate_To_v1beta2_OCIMachineTemplate(r, dst, nil); err != nil { + return err + } + + // Manually restore data. + restored := &v1beta2.OCIMachineTemplate{} + if ok, err := utilconversion.UnmarshalData(r, restored); err != nil || !ok { + return err + } + + return nil +} + +// ConvertFrom converts the v1beta2 OCIMachineTemplate receiver to a v1beta1 OCIMachineTemplate. +func (r *OCIMachineTemplate) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1beta2.OCIMachineTemplate) + + if err := Convert_v1beta2_OCIMachineTemplate_To_v1beta1_OCIMachineTemplate(src, r, nil); err != nil { + return err + } + + // Preserve Hub data on down-conversion. + if err := utilconversion.MarshalData(src, r); err != nil { + return err + } + + return nil +} + +// ConvertTo converts the v1beta1 OCIMachineTemplateList receiver to a v1beta2 OCIMachineTemplateList. +func (src *OCIMachineTemplateList) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1beta2.OCIMachineTemplateList) + return Convert_v1beta1_OCIMachineTemplateList_To_v1beta2_OCIMachineTemplateList(src, dst, nil) +} + +// ConvertFrom converts the v1beta2 OCIMachineTemplateList to a v1beta1 OCIMachineTemplateList. +func (dst *OCIMachineTemplateList) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1beta2.OCIMachineTemplateList) + + return Convert_v1beta2_OCIMachineTemplateList_To_v1beta1_OCIMachineTemplateList(src, dst, nil) +} diff --git a/api/v1beta1/ocimachinetemplate_types.go b/api/v1beta1/ocimachinetemplate_types.go index e7a90d1e..79bfd554 100644 --- a/api/v1beta1/ocimachinetemplate_types.go +++ b/api/v1beta1/ocimachinetemplate_types.go @@ -33,7 +33,6 @@ type OCIMachineTemplateResource struct { // +kubebuilder:object:root=true // +kubebuilder:resource:path=ocimachinetemplates,scope=Namespaced,categories=cluster-api -// +kubebuilder:storageversion // OCIMachineTemplate is the schema for the OCI compute instance machine template. type OCIMachineTemplate struct { diff --git a/api/v1beta1/zz_generated.conversion.go b/api/v1beta1/zz_generated.conversion.go new file mode 100644 index 00000000..14dfc7ae --- /dev/null +++ b/api/v1beta1/zz_generated.conversion.go @@ -0,0 +1,2364 @@ +//go:build !ignore_autogenerated_conversions +// +build !ignore_autogenerated_conversions + +/* +Copyright (c) 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 + + http://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. +*/ + +// Code generated by conversion-gen. DO NOT EDIT. + +package v1beta1 + +import ( + unsafe "unsafe" + + v1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + apiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" + errors "sigs.k8s.io/cluster-api/errors" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + 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 { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.AllowedNamespaces)(nil), (*AllowedNamespaces)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_AllowedNamespaces_To_v1beta1_AllowedNamespaces(a.(*v1beta2.AllowedNamespaces), b.(*AllowedNamespaces), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AmdMilanBmPlatformConfig)(nil), (*v1beta2.AmdMilanBmPlatformConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_AmdMilanBmPlatformConfig_To_v1beta2_AmdMilanBmPlatformConfig(a.(*AmdMilanBmPlatformConfig), b.(*v1beta2.AmdMilanBmPlatformConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.AmdMilanBmPlatformConfig)(nil), (*AmdMilanBmPlatformConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_AmdMilanBmPlatformConfig_To_v1beta1_AmdMilanBmPlatformConfig(a.(*v1beta2.AmdMilanBmPlatformConfig), b.(*AmdMilanBmPlatformConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AmdRomeBmGpuPlatformConfig)(nil), (*v1beta2.AmdRomeBmGpuPlatformConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_AmdRomeBmGpuPlatformConfig_To_v1beta2_AmdRomeBmGpuPlatformConfig(a.(*AmdRomeBmGpuPlatformConfig), b.(*v1beta2.AmdRomeBmGpuPlatformConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.AmdRomeBmGpuPlatformConfig)(nil), (*AmdRomeBmGpuPlatformConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_AmdRomeBmGpuPlatformConfig_To_v1beta1_AmdRomeBmGpuPlatformConfig(a.(*v1beta2.AmdRomeBmGpuPlatformConfig), b.(*AmdRomeBmGpuPlatformConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AmdRomeBmPlatformConfig)(nil), (*v1beta2.AmdRomeBmPlatformConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_AmdRomeBmPlatformConfig_To_v1beta2_AmdRomeBmPlatformConfig(a.(*AmdRomeBmPlatformConfig), b.(*v1beta2.AmdRomeBmPlatformConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.AmdRomeBmPlatformConfig)(nil), (*AmdRomeBmPlatformConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_AmdRomeBmPlatformConfig_To_v1beta1_AmdRomeBmPlatformConfig(a.(*v1beta2.AmdRomeBmPlatformConfig), b.(*AmdRomeBmPlatformConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AmdVmPlatformConfig)(nil), (*v1beta2.AmdVmPlatformConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_AmdVmPlatformConfig_To_v1beta2_AmdVmPlatformConfig(a.(*AmdVmPlatformConfig), b.(*v1beta2.AmdVmPlatformConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.AmdVmPlatformConfig)(nil), (*AmdVmPlatformConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_AmdVmPlatformConfig_To_v1beta1_AmdVmPlatformConfig(a.(*v1beta2.AmdVmPlatformConfig), b.(*AmdVmPlatformConfig), 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 { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.DRG)(nil), (*DRG)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_DRG_To_v1beta1_DRG(a.(*v1beta2.DRG), b.(*DRG), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EgressSecurityRule)(nil), (*v1beta2.EgressSecurityRule)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_EgressSecurityRule_To_v1beta2_EgressSecurityRule(a.(*EgressSecurityRule), b.(*v1beta2.EgressSecurityRule), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.EgressSecurityRule)(nil), (*EgressSecurityRule)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_EgressSecurityRule_To_v1beta1_EgressSecurityRule(a.(*v1beta2.EgressSecurityRule), b.(*EgressSecurityRule), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.EgressSecurityRuleForNSG)(nil), (*EgressSecurityRuleForNSG)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_EgressSecurityRuleForNSG_To_v1beta1_EgressSecurityRuleForNSG(a.(*v1beta2.EgressSecurityRuleForNSG), b.(*EgressSecurityRuleForNSG), 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 { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.IcmpOptions)(nil), (*IcmpOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_IcmpOptions_To_v1beta1_IcmpOptions(a.(*v1beta2.IcmpOptions), b.(*IcmpOptions), 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 { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.IngressSecurityRule)(nil), (*IngressSecurityRule)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_IngressSecurityRule_To_v1beta1_IngressSecurityRule(a.(*v1beta2.IngressSecurityRule), b.(*IngressSecurityRule), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.IngressSecurityRuleForNSG)(nil), (*IngressSecurityRuleForNSG)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_IngressSecurityRuleForNSG_To_v1beta1_IngressSecurityRuleForNSG(a.(*v1beta2.IngressSecurityRuleForNSG), b.(*IngressSecurityRuleForNSG), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstanceAgentPluginConfig)(nil), (*v1beta2.InstanceAgentPluginConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_InstanceAgentPluginConfig_To_v1beta2_InstanceAgentPluginConfig(a.(*InstanceAgentPluginConfig), b.(*v1beta2.InstanceAgentPluginConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.InstanceAgentPluginConfig)(nil), (*InstanceAgentPluginConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_InstanceAgentPluginConfig_To_v1beta1_InstanceAgentPluginConfig(a.(*v1beta2.InstanceAgentPluginConfig), b.(*InstanceAgentPluginConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstanceOptions)(nil), (*v1beta2.InstanceOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_InstanceOptions_To_v1beta2_InstanceOptions(a.(*InstanceOptions), b.(*v1beta2.InstanceOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.InstanceOptions)(nil), (*InstanceOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_InstanceOptions_To_v1beta1_InstanceOptions(a.(*v1beta2.InstanceOptions), b.(*InstanceOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstanceSourceViaImageConfig)(nil), (*v1beta2.InstanceSourceViaImageConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_InstanceSourceViaImageConfig_To_v1beta2_InstanceSourceViaImageConfig(a.(*InstanceSourceViaImageConfig), b.(*v1beta2.InstanceSourceViaImageConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.InstanceSourceViaImageConfig)(nil), (*InstanceSourceViaImageConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_InstanceSourceViaImageConfig_To_v1beta1_InstanceSourceViaImageConfig(a.(*v1beta2.InstanceSourceViaImageConfig), b.(*InstanceSourceViaImageConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IntelIcelakeBmPlatformConfig)(nil), (*v1beta2.IntelIcelakeBmPlatformConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_IntelIcelakeBmPlatformConfig_To_v1beta2_IntelIcelakeBmPlatformConfig(a.(*IntelIcelakeBmPlatformConfig), b.(*v1beta2.IntelIcelakeBmPlatformConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.IntelIcelakeBmPlatformConfig)(nil), (*IntelIcelakeBmPlatformConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_IntelIcelakeBmPlatformConfig_To_v1beta1_IntelIcelakeBmPlatformConfig(a.(*v1beta2.IntelIcelakeBmPlatformConfig), b.(*IntelIcelakeBmPlatformConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IntelSkylakeBmPlatformConfig)(nil), (*v1beta2.IntelSkylakeBmPlatformConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_IntelSkylakeBmPlatformConfig_To_v1beta2_IntelSkylakeBmPlatformConfig(a.(*IntelSkylakeBmPlatformConfig), b.(*v1beta2.IntelSkylakeBmPlatformConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.IntelSkylakeBmPlatformConfig)(nil), (*IntelSkylakeBmPlatformConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_IntelSkylakeBmPlatformConfig_To_v1beta1_IntelSkylakeBmPlatformConfig(a.(*v1beta2.IntelSkylakeBmPlatformConfig), b.(*IntelSkylakeBmPlatformConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IntelVmPlatformConfig)(nil), (*v1beta2.IntelVmPlatformConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_IntelVmPlatformConfig_To_v1beta2_IntelVmPlatformConfig(a.(*IntelVmPlatformConfig), b.(*v1beta2.IntelVmPlatformConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.IntelVmPlatformConfig)(nil), (*IntelVmPlatformConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_IntelVmPlatformConfig_To_v1beta1_IntelVmPlatformConfig(a.(*v1beta2.IntelVmPlatformConfig), b.(*IntelVmPlatformConfig), 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 { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.LaunchInstanceAgentConfig)(nil), (*LaunchInstanceAgentConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_LaunchInstanceAgentConfig_To_v1beta1_LaunchInstanceAgentConfig(a.(*v1beta2.LaunchInstanceAgentConfig), b.(*LaunchInstanceAgentConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LaunchInstanceAvailabilityConfig)(nil), (*v1beta2.LaunchInstanceAvailabilityConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_LaunchInstanceAvailabilityConfig_To_v1beta2_LaunchInstanceAvailabilityConfig(a.(*LaunchInstanceAvailabilityConfig), b.(*v1beta2.LaunchInstanceAvailabilityConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.LaunchInstanceAvailabilityConfig)(nil), (*LaunchInstanceAvailabilityConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_LaunchInstanceAvailabilityConfig_To_v1beta1_LaunchInstanceAvailabilityConfig(a.(*v1beta2.LaunchInstanceAvailabilityConfig), b.(*LaunchInstanceAvailabilityConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LaunchOptions)(nil), (*v1beta2.LaunchOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_LaunchOptions_To_v1beta2_LaunchOptions(a.(*LaunchOptions), b.(*v1beta2.LaunchOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.LaunchOptions)(nil), (*LaunchOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_LaunchOptions_To_v1beta1_LaunchOptions(a.(*v1beta2.LaunchOptions), b.(*LaunchOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LoadBalancer)(nil), (*v1beta2.LoadBalancer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_LoadBalancer_To_v1beta2_LoadBalancer(a.(*LoadBalancer), b.(*v1beta2.LoadBalancer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.LoadBalancer)(nil), (*LoadBalancer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_LoadBalancer_To_v1beta1_LoadBalancer(a.(*v1beta2.LoadBalancer), b.(*LoadBalancer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NSG)(nil), (*v1beta2.NSG)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NSG_To_v1beta2_NSG(a.(*NSG), b.(*v1beta2.NSG), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.NSG)(nil), (*NSG)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_NSG_To_v1beta1_NSG(a.(*v1beta2.NSG), b.(*NSG), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.NetworkDetails)(nil), (*NetworkDetails)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_NetworkDetails_To_v1beta1_NetworkDetails(a.(*v1beta2.NetworkDetails), b.(*NetworkDetails), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NetworkSpec)(nil), (*v1beta2.NetworkSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NetworkSpec_To_v1beta2_NetworkSpec(a.(*NetworkSpec), b.(*v1beta2.NetworkSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.NetworkSpec)(nil), (*NetworkSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_NetworkSpec_To_v1beta1_NetworkSpec(a.(*v1beta2.NetworkSpec), b.(*NetworkSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIAvailabilityDomain)(nil), (*v1beta2.OCIAvailabilityDomain)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIAvailabilityDomain_To_v1beta2_OCIAvailabilityDomain(a.(*OCIAvailabilityDomain), b.(*v1beta2.OCIAvailabilityDomain), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIAvailabilityDomain)(nil), (*OCIAvailabilityDomain)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIAvailabilityDomain_To_v1beta1_OCIAvailabilityDomain(a.(*v1beta2.OCIAvailabilityDomain), b.(*OCIAvailabilityDomain), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCICluster)(nil), (*v1beta2.OCICluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCICluster_To_v1beta2_OCICluster(a.(*OCICluster), b.(*v1beta2.OCICluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCICluster)(nil), (*OCICluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCICluster_To_v1beta1_OCICluster(a.(*v1beta2.OCICluster), b.(*OCICluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIClusterIdentity)(nil), (*v1beta2.OCIClusterIdentity)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIClusterIdentity_To_v1beta2_OCIClusterIdentity(a.(*OCIClusterIdentity), b.(*v1beta2.OCIClusterIdentity), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIClusterIdentity)(nil), (*OCIClusterIdentity)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIClusterIdentity_To_v1beta1_OCIClusterIdentity(a.(*v1beta2.OCIClusterIdentity), b.(*OCIClusterIdentity), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIClusterIdentityList)(nil), (*v1beta2.OCIClusterIdentityList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIClusterIdentityList_To_v1beta2_OCIClusterIdentityList(a.(*OCIClusterIdentityList), b.(*v1beta2.OCIClusterIdentityList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIClusterIdentityList)(nil), (*OCIClusterIdentityList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIClusterIdentityList_To_v1beta1_OCIClusterIdentityList(a.(*v1beta2.OCIClusterIdentityList), b.(*OCIClusterIdentityList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIClusterIdentitySpec)(nil), (*v1beta2.OCIClusterIdentitySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIClusterIdentitySpec_To_v1beta2_OCIClusterIdentitySpec(a.(*OCIClusterIdentitySpec), b.(*v1beta2.OCIClusterIdentitySpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIClusterIdentitySpec)(nil), (*OCIClusterIdentitySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIClusterIdentitySpec_To_v1beta1_OCIClusterIdentitySpec(a.(*v1beta2.OCIClusterIdentitySpec), b.(*OCIClusterIdentitySpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIClusterIdentityStatus)(nil), (*v1beta2.OCIClusterIdentityStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIClusterIdentityStatus_To_v1beta2_OCIClusterIdentityStatus(a.(*OCIClusterIdentityStatus), b.(*v1beta2.OCIClusterIdentityStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIClusterIdentityStatus)(nil), (*OCIClusterIdentityStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIClusterIdentityStatus_To_v1beta1_OCIClusterIdentityStatus(a.(*v1beta2.OCIClusterIdentityStatus), b.(*OCIClusterIdentityStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIClusterList)(nil), (*v1beta2.OCIClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIClusterList_To_v1beta2_OCIClusterList(a.(*OCIClusterList), b.(*v1beta2.OCIClusterList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIClusterList)(nil), (*OCIClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIClusterList_To_v1beta1_OCIClusterList(a.(*v1beta2.OCIClusterList), b.(*OCIClusterList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIClusterSpec)(nil), (*v1beta2.OCIClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIClusterSpec_To_v1beta2_OCIClusterSpec(a.(*OCIClusterSpec), b.(*v1beta2.OCIClusterSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIClusterStatus)(nil), (*OCIClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIClusterStatus_To_v1beta1_OCIClusterStatus(a.(*v1beta2.OCIClusterStatus), b.(*OCIClusterStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIClusterTemplate)(nil), (*v1beta2.OCIClusterTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIClusterTemplate_To_v1beta2_OCIClusterTemplate(a.(*OCIClusterTemplate), b.(*v1beta2.OCIClusterTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIClusterTemplate)(nil), (*OCIClusterTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIClusterTemplate_To_v1beta1_OCIClusterTemplate(a.(*v1beta2.OCIClusterTemplate), b.(*OCIClusterTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIClusterTemplateList)(nil), (*v1beta2.OCIClusterTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIClusterTemplateList_To_v1beta2_OCIClusterTemplateList(a.(*OCIClusterTemplateList), b.(*v1beta2.OCIClusterTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIClusterTemplateList)(nil), (*OCIClusterTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIClusterTemplateList_To_v1beta1_OCIClusterTemplateList(a.(*v1beta2.OCIClusterTemplateList), b.(*OCIClusterTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIClusterTemplateResource)(nil), (*v1beta2.OCIClusterTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIClusterTemplateResource_To_v1beta2_OCIClusterTemplateResource(a.(*OCIClusterTemplateResource), b.(*v1beta2.OCIClusterTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIClusterTemplateResource)(nil), (*OCIClusterTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIClusterTemplateResource_To_v1beta1_OCIClusterTemplateResource(a.(*v1beta2.OCIClusterTemplateResource), b.(*OCIClusterTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIClusterTemplateSpec)(nil), (*v1beta2.OCIClusterTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIClusterTemplateSpec_To_v1beta2_OCIClusterTemplateSpec(a.(*OCIClusterTemplateSpec), b.(*v1beta2.OCIClusterTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIClusterTemplateSpec)(nil), (*OCIClusterTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIClusterTemplateSpec_To_v1beta1_OCIClusterTemplateSpec(a.(*v1beta2.OCIClusterTemplateSpec), b.(*OCIClusterTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIMachine)(nil), (*v1beta2.OCIMachine)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIMachine_To_v1beta2_OCIMachine(a.(*OCIMachine), b.(*v1beta2.OCIMachine), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIMachine)(nil), (*OCIMachine)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIMachine_To_v1beta1_OCIMachine(a.(*v1beta2.OCIMachine), b.(*OCIMachine), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIMachineList)(nil), (*v1beta2.OCIMachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIMachineList_To_v1beta2_OCIMachineList(a.(*OCIMachineList), b.(*v1beta2.OCIMachineList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIMachineList)(nil), (*OCIMachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIMachineList_To_v1beta1_OCIMachineList(a.(*v1beta2.OCIMachineList), b.(*OCIMachineList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIMachineSpec)(nil), (*OCIMachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIMachineSpec_To_v1beta1_OCIMachineSpec(a.(*v1beta2.OCIMachineSpec), b.(*OCIMachineSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIMachineStatus)(nil), (*v1beta2.OCIMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIMachineStatus_To_v1beta2_OCIMachineStatus(a.(*OCIMachineStatus), b.(*v1beta2.OCIMachineStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIMachineStatus)(nil), (*OCIMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIMachineStatus_To_v1beta1_OCIMachineStatus(a.(*v1beta2.OCIMachineStatus), b.(*OCIMachineStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIMachineTemplate)(nil), (*v1beta2.OCIMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIMachineTemplate_To_v1beta2_OCIMachineTemplate(a.(*OCIMachineTemplate), b.(*v1beta2.OCIMachineTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIMachineTemplate)(nil), (*OCIMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIMachineTemplate_To_v1beta1_OCIMachineTemplate(a.(*v1beta2.OCIMachineTemplate), b.(*OCIMachineTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIMachineTemplateList)(nil), (*v1beta2.OCIMachineTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIMachineTemplateList_To_v1beta2_OCIMachineTemplateList(a.(*OCIMachineTemplateList), b.(*v1beta2.OCIMachineTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIMachineTemplateList)(nil), (*OCIMachineTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIMachineTemplateList_To_v1beta1_OCIMachineTemplateList(a.(*v1beta2.OCIMachineTemplateList), b.(*OCIMachineTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIMachineTemplateResource)(nil), (*v1beta2.OCIMachineTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIMachineTemplateResource_To_v1beta2_OCIMachineTemplateResource(a.(*OCIMachineTemplateResource), b.(*v1beta2.OCIMachineTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIMachineTemplateResource)(nil), (*OCIMachineTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIMachineTemplateResource_To_v1beta1_OCIMachineTemplateResource(a.(*v1beta2.OCIMachineTemplateResource), b.(*OCIMachineTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIMachineTemplateSpec)(nil), (*v1beta2.OCIMachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIMachineTemplateSpec_To_v1beta2_OCIMachineTemplateSpec(a.(*OCIMachineTemplateSpec), b.(*v1beta2.OCIMachineTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIMachineTemplateSpec)(nil), (*OCIMachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIMachineTemplateSpec_To_v1beta1_OCIMachineTemplateSpec(a.(*v1beta2.OCIMachineTemplateSpec), b.(*OCIMachineTemplateSpec), 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 { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.PeerRouteRule)(nil), (*PeerRouteRule)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_PeerRouteRule_To_v1beta1_PeerRouteRule(a.(*v1beta2.PeerRouteRule), b.(*PeerRouteRule), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PlatformConfig)(nil), (*v1beta2.PlatformConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_PlatformConfig_To_v1beta2_PlatformConfig(a.(*PlatformConfig), b.(*v1beta2.PlatformConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.PlatformConfig)(nil), (*PlatformConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_PlatformConfig_To_v1beta1_PlatformConfig(a.(*v1beta2.PlatformConfig), b.(*PlatformConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PortRange)(nil), (*v1beta2.PortRange)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_PortRange_To_v1beta2_PortRange(a.(*PortRange), b.(*v1beta2.PortRange), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.PortRange)(nil), (*PortRange)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_PortRange_To_v1beta1_PortRange(a.(*v1beta2.PortRange), b.(*PortRange), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PreemptibleInstanceConfig)(nil), (*v1beta2.PreemptibleInstanceConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_PreemptibleInstanceConfig_To_v1beta2_PreemptibleInstanceConfig(a.(*PreemptibleInstanceConfig), b.(*v1beta2.PreemptibleInstanceConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.PreemptibleInstanceConfig)(nil), (*PreemptibleInstanceConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_PreemptibleInstanceConfig_To_v1beta1_PreemptibleInstanceConfig(a.(*v1beta2.PreemptibleInstanceConfig), b.(*PreemptibleInstanceConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*RemotePeeringConnection)(nil), (*v1beta2.RemotePeeringConnection)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_RemotePeeringConnection_To_v1beta2_RemotePeeringConnection(a.(*RemotePeeringConnection), b.(*v1beta2.RemotePeeringConnection), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.RemotePeeringConnection)(nil), (*RemotePeeringConnection)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_RemotePeeringConnection_To_v1beta1_RemotePeeringConnection(a.(*v1beta2.RemotePeeringConnection), b.(*RemotePeeringConnection), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*SecurityList)(nil), (*v1beta2.SecurityList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_SecurityList_To_v1beta2_SecurityList(a.(*SecurityList), b.(*v1beta2.SecurityList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.SecurityList)(nil), (*SecurityList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_SecurityList_To_v1beta1_SecurityList(a.(*v1beta2.SecurityList), b.(*SecurityList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ShapeConfig)(nil), (*v1beta2.ShapeConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_ShapeConfig_To_v1beta2_ShapeConfig(a.(*ShapeConfig), b.(*v1beta2.ShapeConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.ShapeConfig)(nil), (*ShapeConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_ShapeConfig_To_v1beta1_ShapeConfig(a.(*v1beta2.ShapeConfig), b.(*ShapeConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Subnet)(nil), (*v1beta2.Subnet)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_Subnet_To_v1beta2_Subnet(a.(*Subnet), b.(*v1beta2.Subnet), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.Subnet)(nil), (*Subnet)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_Subnet_To_v1beta1_Subnet(a.(*v1beta2.Subnet), b.(*Subnet), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*TcpOptions)(nil), (*v1beta2.TcpOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_TcpOptions_To_v1beta2_TcpOptions(a.(*TcpOptions), b.(*v1beta2.TcpOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.TcpOptions)(nil), (*TcpOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_TcpOptions_To_v1beta1_TcpOptions(a.(*v1beta2.TcpOptions), b.(*TcpOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*TerminatePreemptionAction)(nil), (*v1beta2.TerminatePreemptionAction)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_TerminatePreemptionAction_To_v1beta2_TerminatePreemptionAction(a.(*TerminatePreemptionAction), b.(*v1beta2.TerminatePreemptionAction), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.TerminatePreemptionAction)(nil), (*TerminatePreemptionAction)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_TerminatePreemptionAction_To_v1beta1_TerminatePreemptionAction(a.(*v1beta2.TerminatePreemptionAction), b.(*TerminatePreemptionAction), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*UdpOptions)(nil), (*v1beta2.UdpOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_UdpOptions_To_v1beta2_UdpOptions(a.(*UdpOptions), b.(*v1beta2.UdpOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.UdpOptions)(nil), (*UdpOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_UdpOptions_To_v1beta1_UdpOptions(a.(*v1beta2.UdpOptions), b.(*UdpOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VCNPeering)(nil), (*v1beta2.VCNPeering)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_VCNPeering_To_v1beta2_VCNPeering(a.(*VCNPeering), b.(*v1beta2.VCNPeering), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.VCNPeering)(nil), (*VCNPeering)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_VCNPeering_To_v1beta1_VCNPeering(a.(*v1beta2.VCNPeering), b.(*VCNPeering), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VnicAttachment)(nil), (*v1beta2.VnicAttachment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_VnicAttachment_To_v1beta2_VnicAttachment(a.(*VnicAttachment), b.(*v1beta2.VnicAttachment), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.VnicAttachment)(nil), (*VnicAttachment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_VnicAttachment_To_v1beta1_VnicAttachment(a.(*v1beta2.VnicAttachment), b.(*VnicAttachment), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*EgressSecurityRuleForNSG)(nil), (*v1beta2.EgressSecurityRuleForNSG)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_EgressSecurityRuleForNSG_To_v1beta2_EgressSecurityRuleForNSG(a.(*EgressSecurityRuleForNSG), b.(*v1beta2.EgressSecurityRuleForNSG), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*IngressSecurityRuleForNSG)(nil), (*v1beta2.IngressSecurityRuleForNSG)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_IngressSecurityRuleForNSG_To_v1beta2_IngressSecurityRuleForNSG(a.(*IngressSecurityRuleForNSG), b.(*v1beta2.IngressSecurityRuleForNSG), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*NetworkDetails)(nil), (*v1beta2.NetworkDetails)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NetworkDetails_To_v1beta2_NetworkDetails(a.(*NetworkDetails), b.(*v1beta2.NetworkDetails), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*OCIClusterStatus)(nil), (*v1beta2.OCIClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIClusterStatus_To_v1beta2_OCIClusterStatus(a.(*OCIClusterStatus), b.(*v1beta2.OCIClusterStatus), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*OCIMachineSpec)(nil), (*v1beta2.OCIMachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIMachineSpec_To_v1beta2_OCIMachineSpec(a.(*OCIMachineSpec), b.(*v1beta2.OCIMachineSpec), 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 { + return err + } + if err := s.AddConversionFunc((*v1beta2.OCIClusterSpec)(nil), (*OCIClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIClusterSpec_To_v1beta1_OCIClusterSpec(a.(*v1beta2.OCIClusterSpec), b.(*OCIClusterSpec), 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 { + return err + } + return nil +} + +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)) + return nil +} + +// Convert_v1beta1_AllowedNamespaces_To_v1beta2_AllowedNamespaces is an autogenerated conversion function. +func Convert_v1beta1_AllowedNamespaces_To_v1beta2_AllowedNamespaces(in *AllowedNamespaces, out *v1beta2.AllowedNamespaces, s conversion.Scope) error { + return autoConvert_v1beta1_AllowedNamespaces_To_v1beta2_AllowedNamespaces(in, out, s) +} + +func autoConvert_v1beta2_AllowedNamespaces_To_v1beta1_AllowedNamespaces(in *v1beta2.AllowedNamespaces, out *AllowedNamespaces, s conversion.Scope) error { + out.NamespaceList = *(*[]string)(unsafe.Pointer(&in.NamespaceList)) + out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector)) + return nil +} + +// Convert_v1beta2_AllowedNamespaces_To_v1beta1_AllowedNamespaces is an autogenerated conversion function. +func Convert_v1beta2_AllowedNamespaces_To_v1beta1_AllowedNamespaces(in *v1beta2.AllowedNamespaces, out *AllowedNamespaces, s conversion.Scope) error { + return autoConvert_v1beta2_AllowedNamespaces_To_v1beta1_AllowedNamespaces(in, out, s) +} + +func autoConvert_v1beta1_AmdMilanBmPlatformConfig_To_v1beta2_AmdMilanBmPlatformConfig(in *AmdMilanBmPlatformConfig, out *v1beta2.AmdMilanBmPlatformConfig, s conversion.Scope) error { + out.IsSecureBootEnabled = (*bool)(unsafe.Pointer(in.IsSecureBootEnabled)) + out.IsTrustedPlatformModuleEnabled = (*bool)(unsafe.Pointer(in.IsTrustedPlatformModuleEnabled)) + out.IsMeasuredBootEnabled = (*bool)(unsafe.Pointer(in.IsMeasuredBootEnabled)) + out.IsMemoryEncryptionEnabled = (*bool)(unsafe.Pointer(in.IsMemoryEncryptionEnabled)) + out.IsSymmetricMultiThreadingEnabled = (*bool)(unsafe.Pointer(in.IsSymmetricMultiThreadingEnabled)) + out.IsAccessControlServiceEnabled = (*bool)(unsafe.Pointer(in.IsAccessControlServiceEnabled)) + out.AreVirtualInstructionsEnabled = (*bool)(unsafe.Pointer(in.AreVirtualInstructionsEnabled)) + out.IsInputOutputMemoryManagementUnitEnabled = (*bool)(unsafe.Pointer(in.IsInputOutputMemoryManagementUnitEnabled)) + out.PercentageOfCoresEnabled = (*int)(unsafe.Pointer(in.PercentageOfCoresEnabled)) + out.NumaNodesPerSocket = v1beta2.AmdMilanBmPlatformConfigNumaNodesPerSocketEnum(in.NumaNodesPerSocket) + return nil +} + +// Convert_v1beta1_AmdMilanBmPlatformConfig_To_v1beta2_AmdMilanBmPlatformConfig is an autogenerated conversion function. +func Convert_v1beta1_AmdMilanBmPlatformConfig_To_v1beta2_AmdMilanBmPlatformConfig(in *AmdMilanBmPlatformConfig, out *v1beta2.AmdMilanBmPlatformConfig, s conversion.Scope) error { + return autoConvert_v1beta1_AmdMilanBmPlatformConfig_To_v1beta2_AmdMilanBmPlatformConfig(in, out, s) +} + +func autoConvert_v1beta2_AmdMilanBmPlatformConfig_To_v1beta1_AmdMilanBmPlatformConfig(in *v1beta2.AmdMilanBmPlatformConfig, out *AmdMilanBmPlatformConfig, s conversion.Scope) error { + out.IsSecureBootEnabled = (*bool)(unsafe.Pointer(in.IsSecureBootEnabled)) + out.IsTrustedPlatformModuleEnabled = (*bool)(unsafe.Pointer(in.IsTrustedPlatformModuleEnabled)) + out.IsMeasuredBootEnabled = (*bool)(unsafe.Pointer(in.IsMeasuredBootEnabled)) + out.IsMemoryEncryptionEnabled = (*bool)(unsafe.Pointer(in.IsMemoryEncryptionEnabled)) + out.IsSymmetricMultiThreadingEnabled = (*bool)(unsafe.Pointer(in.IsSymmetricMultiThreadingEnabled)) + out.IsAccessControlServiceEnabled = (*bool)(unsafe.Pointer(in.IsAccessControlServiceEnabled)) + out.AreVirtualInstructionsEnabled = (*bool)(unsafe.Pointer(in.AreVirtualInstructionsEnabled)) + out.IsInputOutputMemoryManagementUnitEnabled = (*bool)(unsafe.Pointer(in.IsInputOutputMemoryManagementUnitEnabled)) + out.PercentageOfCoresEnabled = (*int)(unsafe.Pointer(in.PercentageOfCoresEnabled)) + out.NumaNodesPerSocket = AmdMilanBmPlatformConfigNumaNodesPerSocketEnum(in.NumaNodesPerSocket) + return nil +} + +// Convert_v1beta2_AmdMilanBmPlatformConfig_To_v1beta1_AmdMilanBmPlatformConfig is an autogenerated conversion function. +func Convert_v1beta2_AmdMilanBmPlatformConfig_To_v1beta1_AmdMilanBmPlatformConfig(in *v1beta2.AmdMilanBmPlatformConfig, out *AmdMilanBmPlatformConfig, s conversion.Scope) error { + return autoConvert_v1beta2_AmdMilanBmPlatformConfig_To_v1beta1_AmdMilanBmPlatformConfig(in, out, s) +} + +func autoConvert_v1beta1_AmdRomeBmGpuPlatformConfig_To_v1beta2_AmdRomeBmGpuPlatformConfig(in *AmdRomeBmGpuPlatformConfig, out *v1beta2.AmdRomeBmGpuPlatformConfig, s conversion.Scope) error { + out.IsSecureBootEnabled = (*bool)(unsafe.Pointer(in.IsSecureBootEnabled)) + out.IsTrustedPlatformModuleEnabled = (*bool)(unsafe.Pointer(in.IsTrustedPlatformModuleEnabled)) + out.IsMeasuredBootEnabled = (*bool)(unsafe.Pointer(in.IsMeasuredBootEnabled)) + out.IsMemoryEncryptionEnabled = (*bool)(unsafe.Pointer(in.IsMemoryEncryptionEnabled)) + out.IsSymmetricMultiThreadingEnabled = (*bool)(unsafe.Pointer(in.IsSymmetricMultiThreadingEnabled)) + out.IsAccessControlServiceEnabled = (*bool)(unsafe.Pointer(in.IsAccessControlServiceEnabled)) + out.AreVirtualInstructionsEnabled = (*bool)(unsafe.Pointer(in.AreVirtualInstructionsEnabled)) + out.IsInputOutputMemoryManagementUnitEnabled = (*bool)(unsafe.Pointer(in.IsInputOutputMemoryManagementUnitEnabled)) + out.NumaNodesPerSocket = v1beta2.AmdRomeBmGpuPlatformConfigNumaNodesPerSocketEnum(in.NumaNodesPerSocket) + return nil +} + +// Convert_v1beta1_AmdRomeBmGpuPlatformConfig_To_v1beta2_AmdRomeBmGpuPlatformConfig is an autogenerated conversion function. +func Convert_v1beta1_AmdRomeBmGpuPlatformConfig_To_v1beta2_AmdRomeBmGpuPlatformConfig(in *AmdRomeBmGpuPlatformConfig, out *v1beta2.AmdRomeBmGpuPlatformConfig, s conversion.Scope) error { + return autoConvert_v1beta1_AmdRomeBmGpuPlatformConfig_To_v1beta2_AmdRomeBmGpuPlatformConfig(in, out, s) +} + +func autoConvert_v1beta2_AmdRomeBmGpuPlatformConfig_To_v1beta1_AmdRomeBmGpuPlatformConfig(in *v1beta2.AmdRomeBmGpuPlatformConfig, out *AmdRomeBmGpuPlatformConfig, s conversion.Scope) error { + out.IsSecureBootEnabled = (*bool)(unsafe.Pointer(in.IsSecureBootEnabled)) + out.IsTrustedPlatformModuleEnabled = (*bool)(unsafe.Pointer(in.IsTrustedPlatformModuleEnabled)) + out.IsMeasuredBootEnabled = (*bool)(unsafe.Pointer(in.IsMeasuredBootEnabled)) + out.IsMemoryEncryptionEnabled = (*bool)(unsafe.Pointer(in.IsMemoryEncryptionEnabled)) + out.IsSymmetricMultiThreadingEnabled = (*bool)(unsafe.Pointer(in.IsSymmetricMultiThreadingEnabled)) + out.IsAccessControlServiceEnabled = (*bool)(unsafe.Pointer(in.IsAccessControlServiceEnabled)) + out.AreVirtualInstructionsEnabled = (*bool)(unsafe.Pointer(in.AreVirtualInstructionsEnabled)) + out.IsInputOutputMemoryManagementUnitEnabled = (*bool)(unsafe.Pointer(in.IsInputOutputMemoryManagementUnitEnabled)) + out.NumaNodesPerSocket = AmdRomeBmGpuPlatformConfigNumaNodesPerSocketEnum(in.NumaNodesPerSocket) + return nil +} + +// Convert_v1beta2_AmdRomeBmGpuPlatformConfig_To_v1beta1_AmdRomeBmGpuPlatformConfig is an autogenerated conversion function. +func Convert_v1beta2_AmdRomeBmGpuPlatformConfig_To_v1beta1_AmdRomeBmGpuPlatformConfig(in *v1beta2.AmdRomeBmGpuPlatformConfig, out *AmdRomeBmGpuPlatformConfig, s conversion.Scope) error { + return autoConvert_v1beta2_AmdRomeBmGpuPlatformConfig_To_v1beta1_AmdRomeBmGpuPlatformConfig(in, out, s) +} + +func autoConvert_v1beta1_AmdRomeBmPlatformConfig_To_v1beta2_AmdRomeBmPlatformConfig(in *AmdRomeBmPlatformConfig, out *v1beta2.AmdRomeBmPlatformConfig, s conversion.Scope) error { + out.IsSecureBootEnabled = (*bool)(unsafe.Pointer(in.IsSecureBootEnabled)) + out.IsTrustedPlatformModuleEnabled = (*bool)(unsafe.Pointer(in.IsTrustedPlatformModuleEnabled)) + out.IsMeasuredBootEnabled = (*bool)(unsafe.Pointer(in.IsMeasuredBootEnabled)) + out.IsMemoryEncryptionEnabled = (*bool)(unsafe.Pointer(in.IsMemoryEncryptionEnabled)) + out.IsSymmetricMultiThreadingEnabled = (*bool)(unsafe.Pointer(in.IsSymmetricMultiThreadingEnabled)) + out.IsAccessControlServiceEnabled = (*bool)(unsafe.Pointer(in.IsAccessControlServiceEnabled)) + out.AreVirtualInstructionsEnabled = (*bool)(unsafe.Pointer(in.AreVirtualInstructionsEnabled)) + out.IsInputOutputMemoryManagementUnitEnabled = (*bool)(unsafe.Pointer(in.IsInputOutputMemoryManagementUnitEnabled)) + out.PercentageOfCoresEnabled = (*int)(unsafe.Pointer(in.PercentageOfCoresEnabled)) + out.NumaNodesPerSocket = v1beta2.AmdRomeBmPlatformConfigNumaNodesPerSocketEnum(in.NumaNodesPerSocket) + return nil +} + +// Convert_v1beta1_AmdRomeBmPlatformConfig_To_v1beta2_AmdRomeBmPlatformConfig is an autogenerated conversion function. +func Convert_v1beta1_AmdRomeBmPlatformConfig_To_v1beta2_AmdRomeBmPlatformConfig(in *AmdRomeBmPlatformConfig, out *v1beta2.AmdRomeBmPlatformConfig, s conversion.Scope) error { + return autoConvert_v1beta1_AmdRomeBmPlatformConfig_To_v1beta2_AmdRomeBmPlatformConfig(in, out, s) +} + +func autoConvert_v1beta2_AmdRomeBmPlatformConfig_To_v1beta1_AmdRomeBmPlatformConfig(in *v1beta2.AmdRomeBmPlatformConfig, out *AmdRomeBmPlatformConfig, s conversion.Scope) error { + out.IsSecureBootEnabled = (*bool)(unsafe.Pointer(in.IsSecureBootEnabled)) + out.IsTrustedPlatformModuleEnabled = (*bool)(unsafe.Pointer(in.IsTrustedPlatformModuleEnabled)) + out.IsMeasuredBootEnabled = (*bool)(unsafe.Pointer(in.IsMeasuredBootEnabled)) + out.IsMemoryEncryptionEnabled = (*bool)(unsafe.Pointer(in.IsMemoryEncryptionEnabled)) + out.IsSymmetricMultiThreadingEnabled = (*bool)(unsafe.Pointer(in.IsSymmetricMultiThreadingEnabled)) + out.IsAccessControlServiceEnabled = (*bool)(unsafe.Pointer(in.IsAccessControlServiceEnabled)) + out.AreVirtualInstructionsEnabled = (*bool)(unsafe.Pointer(in.AreVirtualInstructionsEnabled)) + out.IsInputOutputMemoryManagementUnitEnabled = (*bool)(unsafe.Pointer(in.IsInputOutputMemoryManagementUnitEnabled)) + out.PercentageOfCoresEnabled = (*int)(unsafe.Pointer(in.PercentageOfCoresEnabled)) + out.NumaNodesPerSocket = AmdRomeBmPlatformConfigNumaNodesPerSocketEnum(in.NumaNodesPerSocket) + return nil +} + +// Convert_v1beta2_AmdRomeBmPlatformConfig_To_v1beta1_AmdRomeBmPlatformConfig is an autogenerated conversion function. +func Convert_v1beta2_AmdRomeBmPlatformConfig_To_v1beta1_AmdRomeBmPlatformConfig(in *v1beta2.AmdRomeBmPlatformConfig, out *AmdRomeBmPlatformConfig, s conversion.Scope) error { + return autoConvert_v1beta2_AmdRomeBmPlatformConfig_To_v1beta1_AmdRomeBmPlatformConfig(in, out, s) +} + +func autoConvert_v1beta1_AmdVmPlatformConfig_To_v1beta2_AmdVmPlatformConfig(in *AmdVmPlatformConfig, out *v1beta2.AmdVmPlatformConfig, s conversion.Scope) error { + out.IsSecureBootEnabled = (*bool)(unsafe.Pointer(in.IsSecureBootEnabled)) + out.IsTrustedPlatformModuleEnabled = (*bool)(unsafe.Pointer(in.IsTrustedPlatformModuleEnabled)) + out.IsMeasuredBootEnabled = (*bool)(unsafe.Pointer(in.IsMeasuredBootEnabled)) + out.IsMemoryEncryptionEnabled = (*bool)(unsafe.Pointer(in.IsMemoryEncryptionEnabled)) + return nil +} + +// Convert_v1beta1_AmdVmPlatformConfig_To_v1beta2_AmdVmPlatformConfig is an autogenerated conversion function. +func Convert_v1beta1_AmdVmPlatformConfig_To_v1beta2_AmdVmPlatformConfig(in *AmdVmPlatformConfig, out *v1beta2.AmdVmPlatformConfig, s conversion.Scope) error { + return autoConvert_v1beta1_AmdVmPlatformConfig_To_v1beta2_AmdVmPlatformConfig(in, out, s) +} + +func autoConvert_v1beta2_AmdVmPlatformConfig_To_v1beta1_AmdVmPlatformConfig(in *v1beta2.AmdVmPlatformConfig, out *AmdVmPlatformConfig, s conversion.Scope) error { + out.IsSecureBootEnabled = (*bool)(unsafe.Pointer(in.IsSecureBootEnabled)) + out.IsTrustedPlatformModuleEnabled = (*bool)(unsafe.Pointer(in.IsTrustedPlatformModuleEnabled)) + out.IsMeasuredBootEnabled = (*bool)(unsafe.Pointer(in.IsMeasuredBootEnabled)) + out.IsMemoryEncryptionEnabled = (*bool)(unsafe.Pointer(in.IsMemoryEncryptionEnabled)) + return nil +} + +// Convert_v1beta2_AmdVmPlatformConfig_To_v1beta1_AmdVmPlatformConfig is an autogenerated conversion function. +func Convert_v1beta2_AmdVmPlatformConfig_To_v1beta1_AmdVmPlatformConfig(in *v1beta2.AmdVmPlatformConfig, out *AmdVmPlatformConfig, s conversion.Scope) error { + return autoConvert_v1beta2_AmdVmPlatformConfig_To_v1beta1_AmdVmPlatformConfig(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 + out.ID = (*string)(unsafe.Pointer(in.ID)) + out.VcnAttachmentId = (*string)(unsafe.Pointer(in.VcnAttachmentId)) + return nil +} + +// Convert_v1beta1_DRG_To_v1beta2_DRG is an autogenerated conversion function. +func Convert_v1beta1_DRG_To_v1beta2_DRG(in *DRG, out *v1beta2.DRG, s conversion.Scope) error { + return autoConvert_v1beta1_DRG_To_v1beta2_DRG(in, out, s) +} + +func autoConvert_v1beta2_DRG_To_v1beta1_DRG(in *v1beta2.DRG, out *DRG, s conversion.Scope) error { + out.Manage = in.Manage + out.Name = in.Name + out.ID = (*string)(unsafe.Pointer(in.ID)) + out.VcnAttachmentId = (*string)(unsafe.Pointer(in.VcnAttachmentId)) + return nil +} + +// Convert_v1beta2_DRG_To_v1beta1_DRG is an autogenerated conversion function. +func Convert_v1beta2_DRG_To_v1beta1_DRG(in *v1beta2.DRG, out *DRG, s conversion.Scope) error { + return autoConvert_v1beta2_DRG_To_v1beta1_DRG(in, out, s) +} + +func autoConvert_v1beta1_EgressSecurityRule_To_v1beta2_EgressSecurityRule(in *EgressSecurityRule, out *v1beta2.EgressSecurityRule, s conversion.Scope) error { + out.Destination = (*string)(unsafe.Pointer(in.Destination)) + out.Protocol = (*string)(unsafe.Pointer(in.Protocol)) + out.DestinationType = v1beta2.EgressSecurityRuleDestinationTypeEnum(in.DestinationType) + out.IcmpOptions = (*v1beta2.IcmpOptions)(unsafe.Pointer(in.IcmpOptions)) + out.IsStateless = (*bool)(unsafe.Pointer(in.IsStateless)) + out.TcpOptions = (*v1beta2.TcpOptions)(unsafe.Pointer(in.TcpOptions)) + out.UdpOptions = (*v1beta2.UdpOptions)(unsafe.Pointer(in.UdpOptions)) + out.Description = (*string)(unsafe.Pointer(in.Description)) + return nil +} + +// Convert_v1beta1_EgressSecurityRule_To_v1beta2_EgressSecurityRule is an autogenerated conversion function. +func Convert_v1beta1_EgressSecurityRule_To_v1beta2_EgressSecurityRule(in *EgressSecurityRule, out *v1beta2.EgressSecurityRule, s conversion.Scope) error { + return autoConvert_v1beta1_EgressSecurityRule_To_v1beta2_EgressSecurityRule(in, out, s) +} + +func autoConvert_v1beta2_EgressSecurityRule_To_v1beta1_EgressSecurityRule(in *v1beta2.EgressSecurityRule, out *EgressSecurityRule, s conversion.Scope) error { + out.Destination = (*string)(unsafe.Pointer(in.Destination)) + out.Protocol = (*string)(unsafe.Pointer(in.Protocol)) + out.DestinationType = EgressSecurityRuleDestinationTypeEnum(in.DestinationType) + out.IcmpOptions = (*IcmpOptions)(unsafe.Pointer(in.IcmpOptions)) + out.IsStateless = (*bool)(unsafe.Pointer(in.IsStateless)) + out.TcpOptions = (*TcpOptions)(unsafe.Pointer(in.TcpOptions)) + out.UdpOptions = (*UdpOptions)(unsafe.Pointer(in.UdpOptions)) + out.Description = (*string)(unsafe.Pointer(in.Description)) + return nil +} + +// Convert_v1beta2_EgressSecurityRule_To_v1beta1_EgressSecurityRule is an autogenerated conversion function. +func Convert_v1beta2_EgressSecurityRule_To_v1beta1_EgressSecurityRule(in *v1beta2.EgressSecurityRule, out *EgressSecurityRule, s conversion.Scope) error { + return autoConvert_v1beta2_EgressSecurityRule_To_v1beta1_EgressSecurityRule(in, out, s) +} + +func autoConvert_v1beta1_EgressSecurityRuleForNSG_To_v1beta2_EgressSecurityRuleForNSG(in *EgressSecurityRuleForNSG, out *v1beta2.EgressSecurityRuleForNSG, s conversion.Scope) error { + // WARNING: in.ID requires manual conversion: does not exist in peer-type + if err := Convert_v1beta1_EgressSecurityRule_To_v1beta2_EgressSecurityRule(&in.EgressSecurityRule, &out.EgressSecurityRule, s); err != nil { + return err + } + return nil +} + +func autoConvert_v1beta2_EgressSecurityRuleForNSG_To_v1beta1_EgressSecurityRuleForNSG(in *v1beta2.EgressSecurityRuleForNSG, out *EgressSecurityRuleForNSG, s conversion.Scope) error { + if err := Convert_v1beta2_EgressSecurityRule_To_v1beta1_EgressSecurityRule(&in.EgressSecurityRule, &out.EgressSecurityRule, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_EgressSecurityRuleForNSG_To_v1beta1_EgressSecurityRuleForNSG is an autogenerated conversion function. +func Convert_v1beta2_EgressSecurityRuleForNSG_To_v1beta1_EgressSecurityRuleForNSG(in *v1beta2.EgressSecurityRuleForNSG, out *EgressSecurityRuleForNSG, s conversion.Scope) error { + return autoConvert_v1beta2_EgressSecurityRuleForNSG_To_v1beta1_EgressSecurityRuleForNSG(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)) + return nil +} + +// Convert_v1beta1_IcmpOptions_To_v1beta2_IcmpOptions is an autogenerated conversion function. +func Convert_v1beta1_IcmpOptions_To_v1beta2_IcmpOptions(in *IcmpOptions, out *v1beta2.IcmpOptions, s conversion.Scope) error { + return autoConvert_v1beta1_IcmpOptions_To_v1beta2_IcmpOptions(in, out, s) +} + +func autoConvert_v1beta2_IcmpOptions_To_v1beta1_IcmpOptions(in *v1beta2.IcmpOptions, out *IcmpOptions, s conversion.Scope) error { + out.Type = (*int)(unsafe.Pointer(in.Type)) + out.Code = (*int)(unsafe.Pointer(in.Code)) + return nil +} + +// Convert_v1beta2_IcmpOptions_To_v1beta1_IcmpOptions is an autogenerated conversion function. +func Convert_v1beta2_IcmpOptions_To_v1beta1_IcmpOptions(in *v1beta2.IcmpOptions, out *IcmpOptions, s conversion.Scope) error { + return autoConvert_v1beta2_IcmpOptions_To_v1beta1_IcmpOptions(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)) + out.IcmpOptions = (*v1beta2.IcmpOptions)(unsafe.Pointer(in.IcmpOptions)) + out.IsStateless = (*bool)(unsafe.Pointer(in.IsStateless)) + out.SourceType = v1beta2.IngressSecurityRuleSourceTypeEnum(in.SourceType) + out.TcpOptions = (*v1beta2.TcpOptions)(unsafe.Pointer(in.TcpOptions)) + out.UdpOptions = (*v1beta2.UdpOptions)(unsafe.Pointer(in.UdpOptions)) + out.Description = (*string)(unsafe.Pointer(in.Description)) + return nil +} + +// Convert_v1beta1_IngressSecurityRule_To_v1beta2_IngressSecurityRule is an autogenerated conversion function. +func Convert_v1beta1_IngressSecurityRule_To_v1beta2_IngressSecurityRule(in *IngressSecurityRule, out *v1beta2.IngressSecurityRule, s conversion.Scope) error { + return autoConvert_v1beta1_IngressSecurityRule_To_v1beta2_IngressSecurityRule(in, out, s) +} + +func autoConvert_v1beta2_IngressSecurityRule_To_v1beta1_IngressSecurityRule(in *v1beta2.IngressSecurityRule, out *IngressSecurityRule, s conversion.Scope) error { + out.Protocol = (*string)(unsafe.Pointer(in.Protocol)) + out.Source = (*string)(unsafe.Pointer(in.Source)) + out.IcmpOptions = (*IcmpOptions)(unsafe.Pointer(in.IcmpOptions)) + out.IsStateless = (*bool)(unsafe.Pointer(in.IsStateless)) + out.SourceType = IngressSecurityRuleSourceTypeEnum(in.SourceType) + out.TcpOptions = (*TcpOptions)(unsafe.Pointer(in.TcpOptions)) + out.UdpOptions = (*UdpOptions)(unsafe.Pointer(in.UdpOptions)) + out.Description = (*string)(unsafe.Pointer(in.Description)) + return nil +} + +// Convert_v1beta2_IngressSecurityRule_To_v1beta1_IngressSecurityRule is an autogenerated conversion function. +func Convert_v1beta2_IngressSecurityRule_To_v1beta1_IngressSecurityRule(in *v1beta2.IngressSecurityRule, out *IngressSecurityRule, s conversion.Scope) error { + return autoConvert_v1beta2_IngressSecurityRule_To_v1beta1_IngressSecurityRule(in, out, s) +} + +func autoConvert_v1beta1_IngressSecurityRuleForNSG_To_v1beta2_IngressSecurityRuleForNSG(in *IngressSecurityRuleForNSG, out *v1beta2.IngressSecurityRuleForNSG, s conversion.Scope) error { + // WARNING: in.ID requires manual conversion: does not exist in peer-type + if err := Convert_v1beta1_IngressSecurityRule_To_v1beta2_IngressSecurityRule(&in.IngressSecurityRule, &out.IngressSecurityRule, s); err != nil { + return err + } + return nil +} + +func autoConvert_v1beta2_IngressSecurityRuleForNSG_To_v1beta1_IngressSecurityRuleForNSG(in *v1beta2.IngressSecurityRuleForNSG, out *IngressSecurityRuleForNSG, s conversion.Scope) error { + if err := Convert_v1beta2_IngressSecurityRule_To_v1beta1_IngressSecurityRule(&in.IngressSecurityRule, &out.IngressSecurityRule, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_IngressSecurityRuleForNSG_To_v1beta1_IngressSecurityRuleForNSG is an autogenerated conversion function. +func Convert_v1beta2_IngressSecurityRuleForNSG_To_v1beta1_IngressSecurityRuleForNSG(in *v1beta2.IngressSecurityRuleForNSG, out *IngressSecurityRuleForNSG, s conversion.Scope) error { + return autoConvert_v1beta2_IngressSecurityRuleForNSG_To_v1beta1_IngressSecurityRuleForNSG(in, out, s) +} + +func autoConvert_v1beta1_InstanceAgentPluginConfig_To_v1beta2_InstanceAgentPluginConfig(in *InstanceAgentPluginConfig, out *v1beta2.InstanceAgentPluginConfig, s conversion.Scope) error { + out.Name = (*string)(unsafe.Pointer(in.Name)) + out.DesiredState = v1beta2.InstanceAgentPluginConfigDetailsDesiredStateEnum(in.DesiredState) + return nil +} + +// Convert_v1beta1_InstanceAgentPluginConfig_To_v1beta2_InstanceAgentPluginConfig is an autogenerated conversion function. +func Convert_v1beta1_InstanceAgentPluginConfig_To_v1beta2_InstanceAgentPluginConfig(in *InstanceAgentPluginConfig, out *v1beta2.InstanceAgentPluginConfig, s conversion.Scope) error { + return autoConvert_v1beta1_InstanceAgentPluginConfig_To_v1beta2_InstanceAgentPluginConfig(in, out, s) +} + +func autoConvert_v1beta2_InstanceAgentPluginConfig_To_v1beta1_InstanceAgentPluginConfig(in *v1beta2.InstanceAgentPluginConfig, out *InstanceAgentPluginConfig, s conversion.Scope) error { + out.Name = (*string)(unsafe.Pointer(in.Name)) + out.DesiredState = InstanceAgentPluginConfigDetailsDesiredStateEnum(in.DesiredState) + return nil +} + +// Convert_v1beta2_InstanceAgentPluginConfig_To_v1beta1_InstanceAgentPluginConfig is an autogenerated conversion function. +func Convert_v1beta2_InstanceAgentPluginConfig_To_v1beta1_InstanceAgentPluginConfig(in *v1beta2.InstanceAgentPluginConfig, out *InstanceAgentPluginConfig, s conversion.Scope) error { + return autoConvert_v1beta2_InstanceAgentPluginConfig_To_v1beta1_InstanceAgentPluginConfig(in, out, s) +} + +func autoConvert_v1beta1_InstanceOptions_To_v1beta2_InstanceOptions(in *InstanceOptions, out *v1beta2.InstanceOptions, s conversion.Scope) error { + out.AreLegacyImdsEndpointsDisabled = (*bool)(unsafe.Pointer(in.AreLegacyImdsEndpointsDisabled)) + return nil +} + +// Convert_v1beta1_InstanceOptions_To_v1beta2_InstanceOptions is an autogenerated conversion function. +func Convert_v1beta1_InstanceOptions_To_v1beta2_InstanceOptions(in *InstanceOptions, out *v1beta2.InstanceOptions, s conversion.Scope) error { + return autoConvert_v1beta1_InstanceOptions_To_v1beta2_InstanceOptions(in, out, s) +} + +func autoConvert_v1beta2_InstanceOptions_To_v1beta1_InstanceOptions(in *v1beta2.InstanceOptions, out *InstanceOptions, s conversion.Scope) error { + out.AreLegacyImdsEndpointsDisabled = (*bool)(unsafe.Pointer(in.AreLegacyImdsEndpointsDisabled)) + return nil +} + +// Convert_v1beta2_InstanceOptions_To_v1beta1_InstanceOptions is an autogenerated conversion function. +func Convert_v1beta2_InstanceOptions_To_v1beta1_InstanceOptions(in *v1beta2.InstanceOptions, out *InstanceOptions, s conversion.Scope) error { + return autoConvert_v1beta2_InstanceOptions_To_v1beta1_InstanceOptions(in, out, s) +} + +func autoConvert_v1beta1_InstanceSourceViaImageConfig_To_v1beta2_InstanceSourceViaImageConfig(in *InstanceSourceViaImageConfig, out *v1beta2.InstanceSourceViaImageConfig, s conversion.Scope) error { + out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) + out.BootVolumeVpusPerGB = (*int64)(unsafe.Pointer(in.BootVolumeVpusPerGB)) + return nil +} + +// Convert_v1beta1_InstanceSourceViaImageConfig_To_v1beta2_InstanceSourceViaImageConfig is an autogenerated conversion function. +func Convert_v1beta1_InstanceSourceViaImageConfig_To_v1beta2_InstanceSourceViaImageConfig(in *InstanceSourceViaImageConfig, out *v1beta2.InstanceSourceViaImageConfig, s conversion.Scope) error { + return autoConvert_v1beta1_InstanceSourceViaImageConfig_To_v1beta2_InstanceSourceViaImageConfig(in, out, s) +} + +func autoConvert_v1beta2_InstanceSourceViaImageConfig_To_v1beta1_InstanceSourceViaImageConfig(in *v1beta2.InstanceSourceViaImageConfig, out *InstanceSourceViaImageConfig, s conversion.Scope) error { + out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) + out.BootVolumeVpusPerGB = (*int64)(unsafe.Pointer(in.BootVolumeVpusPerGB)) + return nil +} + +// Convert_v1beta2_InstanceSourceViaImageConfig_To_v1beta1_InstanceSourceViaImageConfig is an autogenerated conversion function. +func Convert_v1beta2_InstanceSourceViaImageConfig_To_v1beta1_InstanceSourceViaImageConfig(in *v1beta2.InstanceSourceViaImageConfig, out *InstanceSourceViaImageConfig, s conversion.Scope) error { + return autoConvert_v1beta2_InstanceSourceViaImageConfig_To_v1beta1_InstanceSourceViaImageConfig(in, out, s) +} + +func autoConvert_v1beta1_IntelIcelakeBmPlatformConfig_To_v1beta2_IntelIcelakeBmPlatformConfig(in *IntelIcelakeBmPlatformConfig, out *v1beta2.IntelIcelakeBmPlatformConfig, s conversion.Scope) error { + out.IsSecureBootEnabled = (*bool)(unsafe.Pointer(in.IsSecureBootEnabled)) + out.IsTrustedPlatformModuleEnabled = (*bool)(unsafe.Pointer(in.IsTrustedPlatformModuleEnabled)) + out.IsMeasuredBootEnabled = (*bool)(unsafe.Pointer(in.IsMeasuredBootEnabled)) + out.IsMemoryEncryptionEnabled = (*bool)(unsafe.Pointer(in.IsMemoryEncryptionEnabled)) + out.IsSymmetricMultiThreadingEnabled = (*bool)(unsafe.Pointer(in.IsSymmetricMultiThreadingEnabled)) + out.IsInputOutputMemoryManagementUnitEnabled = (*bool)(unsafe.Pointer(in.IsInputOutputMemoryManagementUnitEnabled)) + out.PercentageOfCoresEnabled = (*int)(unsafe.Pointer(in.PercentageOfCoresEnabled)) + out.NumaNodesPerSocket = v1beta2.IntelIcelakeBmPlatformConfigNumaNodesPerSocketEnum(in.NumaNodesPerSocket) + return nil +} + +// Convert_v1beta1_IntelIcelakeBmPlatformConfig_To_v1beta2_IntelIcelakeBmPlatformConfig is an autogenerated conversion function. +func Convert_v1beta1_IntelIcelakeBmPlatformConfig_To_v1beta2_IntelIcelakeBmPlatformConfig(in *IntelIcelakeBmPlatformConfig, out *v1beta2.IntelIcelakeBmPlatformConfig, s conversion.Scope) error { + return autoConvert_v1beta1_IntelIcelakeBmPlatformConfig_To_v1beta2_IntelIcelakeBmPlatformConfig(in, out, s) +} + +func autoConvert_v1beta2_IntelIcelakeBmPlatformConfig_To_v1beta1_IntelIcelakeBmPlatformConfig(in *v1beta2.IntelIcelakeBmPlatformConfig, out *IntelIcelakeBmPlatformConfig, s conversion.Scope) error { + out.IsSecureBootEnabled = (*bool)(unsafe.Pointer(in.IsSecureBootEnabled)) + out.IsTrustedPlatformModuleEnabled = (*bool)(unsafe.Pointer(in.IsTrustedPlatformModuleEnabled)) + out.IsMeasuredBootEnabled = (*bool)(unsafe.Pointer(in.IsMeasuredBootEnabled)) + out.IsMemoryEncryptionEnabled = (*bool)(unsafe.Pointer(in.IsMemoryEncryptionEnabled)) + out.IsSymmetricMultiThreadingEnabled = (*bool)(unsafe.Pointer(in.IsSymmetricMultiThreadingEnabled)) + out.IsInputOutputMemoryManagementUnitEnabled = (*bool)(unsafe.Pointer(in.IsInputOutputMemoryManagementUnitEnabled)) + out.PercentageOfCoresEnabled = (*int)(unsafe.Pointer(in.PercentageOfCoresEnabled)) + out.NumaNodesPerSocket = IntelIcelakeBmPlatformConfigNumaNodesPerSocketEnum(in.NumaNodesPerSocket) + return nil +} + +// Convert_v1beta2_IntelIcelakeBmPlatformConfig_To_v1beta1_IntelIcelakeBmPlatformConfig is an autogenerated conversion function. +func Convert_v1beta2_IntelIcelakeBmPlatformConfig_To_v1beta1_IntelIcelakeBmPlatformConfig(in *v1beta2.IntelIcelakeBmPlatformConfig, out *IntelIcelakeBmPlatformConfig, s conversion.Scope) error { + return autoConvert_v1beta2_IntelIcelakeBmPlatformConfig_To_v1beta1_IntelIcelakeBmPlatformConfig(in, out, s) +} + +func autoConvert_v1beta1_IntelSkylakeBmPlatformConfig_To_v1beta2_IntelSkylakeBmPlatformConfig(in *IntelSkylakeBmPlatformConfig, out *v1beta2.IntelSkylakeBmPlatformConfig, s conversion.Scope) error { + out.IsSecureBootEnabled = (*bool)(unsafe.Pointer(in.IsSecureBootEnabled)) + out.IsTrustedPlatformModuleEnabled = (*bool)(unsafe.Pointer(in.IsTrustedPlatformModuleEnabled)) + out.IsMeasuredBootEnabled = (*bool)(unsafe.Pointer(in.IsMeasuredBootEnabled)) + out.IsMemoryEncryptionEnabled = (*bool)(unsafe.Pointer(in.IsMemoryEncryptionEnabled)) + return nil +} + +// Convert_v1beta1_IntelSkylakeBmPlatformConfig_To_v1beta2_IntelSkylakeBmPlatformConfig is an autogenerated conversion function. +func Convert_v1beta1_IntelSkylakeBmPlatformConfig_To_v1beta2_IntelSkylakeBmPlatformConfig(in *IntelSkylakeBmPlatformConfig, out *v1beta2.IntelSkylakeBmPlatformConfig, s conversion.Scope) error { + return autoConvert_v1beta1_IntelSkylakeBmPlatformConfig_To_v1beta2_IntelSkylakeBmPlatformConfig(in, out, s) +} + +func autoConvert_v1beta2_IntelSkylakeBmPlatformConfig_To_v1beta1_IntelSkylakeBmPlatformConfig(in *v1beta2.IntelSkylakeBmPlatformConfig, out *IntelSkylakeBmPlatformConfig, s conversion.Scope) error { + out.IsSecureBootEnabled = (*bool)(unsafe.Pointer(in.IsSecureBootEnabled)) + out.IsTrustedPlatformModuleEnabled = (*bool)(unsafe.Pointer(in.IsTrustedPlatformModuleEnabled)) + out.IsMeasuredBootEnabled = (*bool)(unsafe.Pointer(in.IsMeasuredBootEnabled)) + out.IsMemoryEncryptionEnabled = (*bool)(unsafe.Pointer(in.IsMemoryEncryptionEnabled)) + return nil +} + +// Convert_v1beta2_IntelSkylakeBmPlatformConfig_To_v1beta1_IntelSkylakeBmPlatformConfig is an autogenerated conversion function. +func Convert_v1beta2_IntelSkylakeBmPlatformConfig_To_v1beta1_IntelSkylakeBmPlatformConfig(in *v1beta2.IntelSkylakeBmPlatformConfig, out *IntelSkylakeBmPlatformConfig, s conversion.Scope) error { + return autoConvert_v1beta2_IntelSkylakeBmPlatformConfig_To_v1beta1_IntelSkylakeBmPlatformConfig(in, out, s) +} + +func autoConvert_v1beta1_IntelVmPlatformConfig_To_v1beta2_IntelVmPlatformConfig(in *IntelVmPlatformConfig, out *v1beta2.IntelVmPlatformConfig, s conversion.Scope) error { + out.IsSecureBootEnabled = (*bool)(unsafe.Pointer(in.IsSecureBootEnabled)) + out.IsTrustedPlatformModuleEnabled = (*bool)(unsafe.Pointer(in.IsTrustedPlatformModuleEnabled)) + out.IsMeasuredBootEnabled = (*bool)(unsafe.Pointer(in.IsMeasuredBootEnabled)) + out.IsMemoryEncryptionEnabled = (*bool)(unsafe.Pointer(in.IsMemoryEncryptionEnabled)) + return nil +} + +// Convert_v1beta1_IntelVmPlatformConfig_To_v1beta2_IntelVmPlatformConfig is an autogenerated conversion function. +func Convert_v1beta1_IntelVmPlatformConfig_To_v1beta2_IntelVmPlatformConfig(in *IntelVmPlatformConfig, out *v1beta2.IntelVmPlatformConfig, s conversion.Scope) error { + return autoConvert_v1beta1_IntelVmPlatformConfig_To_v1beta2_IntelVmPlatformConfig(in, out, s) +} + +func autoConvert_v1beta2_IntelVmPlatformConfig_To_v1beta1_IntelVmPlatformConfig(in *v1beta2.IntelVmPlatformConfig, out *IntelVmPlatformConfig, s conversion.Scope) error { + out.IsSecureBootEnabled = (*bool)(unsafe.Pointer(in.IsSecureBootEnabled)) + out.IsTrustedPlatformModuleEnabled = (*bool)(unsafe.Pointer(in.IsTrustedPlatformModuleEnabled)) + out.IsMeasuredBootEnabled = (*bool)(unsafe.Pointer(in.IsMeasuredBootEnabled)) + out.IsMemoryEncryptionEnabled = (*bool)(unsafe.Pointer(in.IsMemoryEncryptionEnabled)) + return nil +} + +// Convert_v1beta2_IntelVmPlatformConfig_To_v1beta1_IntelVmPlatformConfig is an autogenerated conversion function. +func Convert_v1beta2_IntelVmPlatformConfig_To_v1beta1_IntelVmPlatformConfig(in *v1beta2.IntelVmPlatformConfig, out *IntelVmPlatformConfig, s conversion.Scope) error { + return autoConvert_v1beta2_IntelVmPlatformConfig_To_v1beta1_IntelVmPlatformConfig(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)) + out.AreAllPluginsDisabled = (*bool)(unsafe.Pointer(in.AreAllPluginsDisabled)) + out.PluginsConfig = *(*[]v1beta2.InstanceAgentPluginConfig)(unsafe.Pointer(&in.PluginsConfig)) + return nil +} + +// Convert_v1beta1_LaunchInstanceAgentConfig_To_v1beta2_LaunchInstanceAgentConfig is an autogenerated conversion function. +func Convert_v1beta1_LaunchInstanceAgentConfig_To_v1beta2_LaunchInstanceAgentConfig(in *LaunchInstanceAgentConfig, out *v1beta2.LaunchInstanceAgentConfig, s conversion.Scope) error { + return autoConvert_v1beta1_LaunchInstanceAgentConfig_To_v1beta2_LaunchInstanceAgentConfig(in, out, s) +} + +func autoConvert_v1beta2_LaunchInstanceAgentConfig_To_v1beta1_LaunchInstanceAgentConfig(in *v1beta2.LaunchInstanceAgentConfig, out *LaunchInstanceAgentConfig, s conversion.Scope) error { + out.IsMonitoringDisabled = (*bool)(unsafe.Pointer(in.IsMonitoringDisabled)) + out.IsManagementDisabled = (*bool)(unsafe.Pointer(in.IsManagementDisabled)) + out.AreAllPluginsDisabled = (*bool)(unsafe.Pointer(in.AreAllPluginsDisabled)) + out.PluginsConfig = *(*[]InstanceAgentPluginConfig)(unsafe.Pointer(&in.PluginsConfig)) + return nil +} + +// Convert_v1beta2_LaunchInstanceAgentConfig_To_v1beta1_LaunchInstanceAgentConfig is an autogenerated conversion function. +func Convert_v1beta2_LaunchInstanceAgentConfig_To_v1beta1_LaunchInstanceAgentConfig(in *v1beta2.LaunchInstanceAgentConfig, out *LaunchInstanceAgentConfig, s conversion.Scope) error { + return autoConvert_v1beta2_LaunchInstanceAgentConfig_To_v1beta1_LaunchInstanceAgentConfig(in, out, s) +} + +func autoConvert_v1beta1_LaunchInstanceAvailabilityConfig_To_v1beta2_LaunchInstanceAvailabilityConfig(in *LaunchInstanceAvailabilityConfig, out *v1beta2.LaunchInstanceAvailabilityConfig, s conversion.Scope) error { + out.IsLiveMigrationPreferred = (*bool)(unsafe.Pointer(in.IsLiveMigrationPreferred)) + out.RecoveryAction = v1beta2.LaunchInstanceAvailabilityConfigDetailsRecoveryActionEnum(in.RecoveryAction) + return nil +} + +// Convert_v1beta1_LaunchInstanceAvailabilityConfig_To_v1beta2_LaunchInstanceAvailabilityConfig is an autogenerated conversion function. +func Convert_v1beta1_LaunchInstanceAvailabilityConfig_To_v1beta2_LaunchInstanceAvailabilityConfig(in *LaunchInstanceAvailabilityConfig, out *v1beta2.LaunchInstanceAvailabilityConfig, s conversion.Scope) error { + return autoConvert_v1beta1_LaunchInstanceAvailabilityConfig_To_v1beta2_LaunchInstanceAvailabilityConfig(in, out, s) +} + +func autoConvert_v1beta2_LaunchInstanceAvailabilityConfig_To_v1beta1_LaunchInstanceAvailabilityConfig(in *v1beta2.LaunchInstanceAvailabilityConfig, out *LaunchInstanceAvailabilityConfig, s conversion.Scope) error { + out.IsLiveMigrationPreferred = (*bool)(unsafe.Pointer(in.IsLiveMigrationPreferred)) + out.RecoveryAction = LaunchInstanceAvailabilityConfigDetailsRecoveryActionEnum(in.RecoveryAction) + return nil +} + +// Convert_v1beta2_LaunchInstanceAvailabilityConfig_To_v1beta1_LaunchInstanceAvailabilityConfig is an autogenerated conversion function. +func Convert_v1beta2_LaunchInstanceAvailabilityConfig_To_v1beta1_LaunchInstanceAvailabilityConfig(in *v1beta2.LaunchInstanceAvailabilityConfig, out *LaunchInstanceAvailabilityConfig, s conversion.Scope) error { + return autoConvert_v1beta2_LaunchInstanceAvailabilityConfig_To_v1beta1_LaunchInstanceAvailabilityConfig(in, out, s) +} + +func autoConvert_v1beta1_LaunchOptions_To_v1beta2_LaunchOptions(in *LaunchOptions, out *v1beta2.LaunchOptions, s conversion.Scope) error { + out.BootVolumeType = v1beta2.LaunchOptionsBootVolumeTypeEnum(in.BootVolumeType) + out.Firmware = v1beta2.LaunchOptionsFirmwareEnum(in.Firmware) + out.NetworkType = v1beta2.LaunchOptionsNetworkTypeEnum(in.NetworkType) + out.RemoteDataVolumeType = v1beta2.LaunchOptionsRemoteDataVolumeTypeEnum(in.RemoteDataVolumeType) + out.IsConsistentVolumeNamingEnabled = (*bool)(unsafe.Pointer(in.IsConsistentVolumeNamingEnabled)) + return nil +} + +// Convert_v1beta1_LaunchOptions_To_v1beta2_LaunchOptions is an autogenerated conversion function. +func Convert_v1beta1_LaunchOptions_To_v1beta2_LaunchOptions(in *LaunchOptions, out *v1beta2.LaunchOptions, s conversion.Scope) error { + return autoConvert_v1beta1_LaunchOptions_To_v1beta2_LaunchOptions(in, out, s) +} + +func autoConvert_v1beta2_LaunchOptions_To_v1beta1_LaunchOptions(in *v1beta2.LaunchOptions, out *LaunchOptions, s conversion.Scope) error { + out.BootVolumeType = LaunchOptionsBootVolumeTypeEnum(in.BootVolumeType) + out.Firmware = LaunchOptionsFirmwareEnum(in.Firmware) + out.NetworkType = LaunchOptionsNetworkTypeEnum(in.NetworkType) + out.RemoteDataVolumeType = LaunchOptionsRemoteDataVolumeTypeEnum(in.RemoteDataVolumeType) + out.IsConsistentVolumeNamingEnabled = (*bool)(unsafe.Pointer(in.IsConsistentVolumeNamingEnabled)) + return nil +} + +// Convert_v1beta2_LaunchOptions_To_v1beta1_LaunchOptions is an autogenerated conversion function. +func Convert_v1beta2_LaunchOptions_To_v1beta1_LaunchOptions(in *v1beta2.LaunchOptions, out *LaunchOptions, s conversion.Scope) error { + return autoConvert_v1beta2_LaunchOptions_To_v1beta1_LaunchOptions(in, out, s) +} + +func autoConvert_v1beta1_LoadBalancer_To_v1beta2_LoadBalancer(in *LoadBalancer, out *v1beta2.LoadBalancer, s conversion.Scope) error { + out.Name = in.Name + out.LoadBalancerId = (*string)(unsafe.Pointer(in.LoadBalancerId)) + return nil +} + +// Convert_v1beta1_LoadBalancer_To_v1beta2_LoadBalancer is an autogenerated conversion function. +func Convert_v1beta1_LoadBalancer_To_v1beta2_LoadBalancer(in *LoadBalancer, out *v1beta2.LoadBalancer, s conversion.Scope) error { + return autoConvert_v1beta1_LoadBalancer_To_v1beta2_LoadBalancer(in, out, s) +} + +func autoConvert_v1beta2_LoadBalancer_To_v1beta1_LoadBalancer(in *v1beta2.LoadBalancer, out *LoadBalancer, s conversion.Scope) error { + out.Name = in.Name + out.LoadBalancerId = (*string)(unsafe.Pointer(in.LoadBalancerId)) + return nil +} + +// Convert_v1beta2_LoadBalancer_To_v1beta1_LoadBalancer is an autogenerated conversion function. +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 autoConvert_v1beta1_NSG_To_v1beta2_NSG(in *NSG, out *v1beta2.NSG, s conversion.Scope) error { + out.ID = (*string)(unsafe.Pointer(in.ID)) + out.Name = in.Name + out.Role = v1beta2.Role(in.Role) + if in.EgressRules != nil { + in, out := &in.EgressRules, &out.EgressRules + *out = make([]v1beta2.EgressSecurityRuleForNSG, len(*in)) + for i := range *in { + if err := Convert_v1beta1_EgressSecurityRuleForNSG_To_v1beta2_EgressSecurityRuleForNSG(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.EgressRules = nil + } + if in.IngressRules != nil { + in, out := &in.IngressRules, &out.IngressRules + *out = make([]v1beta2.IngressSecurityRuleForNSG, len(*in)) + for i := range *in { + if err := Convert_v1beta1_IngressSecurityRuleForNSG_To_v1beta2_IngressSecurityRuleForNSG(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.IngressRules = nil + } + return nil +} + +// Convert_v1beta1_NSG_To_v1beta2_NSG is an autogenerated conversion function. +func Convert_v1beta1_NSG_To_v1beta2_NSG(in *NSG, out *v1beta2.NSG, s conversion.Scope) error { + return autoConvert_v1beta1_NSG_To_v1beta2_NSG(in, out, s) +} + +func autoConvert_v1beta2_NSG_To_v1beta1_NSG(in *v1beta2.NSG, out *NSG, s conversion.Scope) error { + out.ID = (*string)(unsafe.Pointer(in.ID)) + out.Name = in.Name + out.Role = Role(in.Role) + if in.EgressRules != nil { + in, out := &in.EgressRules, &out.EgressRules + *out = make([]EgressSecurityRuleForNSG, len(*in)) + for i := range *in { + if err := Convert_v1beta2_EgressSecurityRuleForNSG_To_v1beta1_EgressSecurityRuleForNSG(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.EgressRules = nil + } + if in.IngressRules != nil { + in, out := &in.IngressRules, &out.IngressRules + *out = make([]IngressSecurityRuleForNSG, len(*in)) + for i := range *in { + if err := Convert_v1beta2_IngressSecurityRuleForNSG_To_v1beta1_IngressSecurityRuleForNSG(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.IngressRules = nil + } + return nil +} + +// Convert_v1beta2_NSG_To_v1beta1_NSG is an autogenerated conversion function. +func Convert_v1beta2_NSG_To_v1beta1_NSG(in *v1beta2.NSG, out *NSG, s conversion.Scope) error { + return autoConvert_v1beta2_NSG_To_v1beta1_NSG(in, out, s) +} + +func autoConvert_v1beta1_NetworkDetails_To_v1beta2_NetworkDetails(in *NetworkDetails, out *v1beta2.NetworkDetails, s conversion.Scope) error { + // WARNING: in.SubnetId requires manual conversion: does not exist in peer-type + out.AssignPublicIp = in.AssignPublicIp + out.SubnetName = in.SubnetName + // WARNING: in.NSGId requires manual conversion: does not exist in peer-type + out.SkipSourceDestCheck = (*bool)(unsafe.Pointer(in.SkipSourceDestCheck)) + out.NsgNames = *(*[]string)(unsafe.Pointer(&in.NsgNames)) + out.HostnameLabel = (*string)(unsafe.Pointer(in.HostnameLabel)) + out.DisplayName = (*string)(unsafe.Pointer(in.DisplayName)) + out.AssignPrivateDnsRecord = (*bool)(unsafe.Pointer(in.AssignPrivateDnsRecord)) + return nil +} + +func autoConvert_v1beta2_NetworkDetails_To_v1beta1_NetworkDetails(in *v1beta2.NetworkDetails, out *NetworkDetails, s conversion.Scope) error { + out.AssignPublicIp = in.AssignPublicIp + out.SubnetName = in.SubnetName + out.SkipSourceDestCheck = (*bool)(unsafe.Pointer(in.SkipSourceDestCheck)) + out.NsgNames = *(*[]string)(unsafe.Pointer(&in.NsgNames)) + out.HostnameLabel = (*string)(unsafe.Pointer(in.HostnameLabel)) + out.DisplayName = (*string)(unsafe.Pointer(in.DisplayName)) + out.AssignPrivateDnsRecord = (*bool)(unsafe.Pointer(in.AssignPrivateDnsRecord)) + return nil +} + +// Convert_v1beta2_NetworkDetails_To_v1beta1_NetworkDetails is an autogenerated conversion function. +func Convert_v1beta2_NetworkDetails_To_v1beta1_NetworkDetails(in *v1beta2.NetworkDetails, out *NetworkDetails, s conversion.Scope) error { + return autoConvert_v1beta2_NetworkDetails_To_v1beta1_NetworkDetails(in, out, s) +} + +func autoConvert_v1beta1_NetworkSpec_To_v1beta2_NetworkSpec(in *NetworkSpec, out *v1beta2.NetworkSpec, s conversion.Scope) error { + out.SkipNetworkManagement = in.SkipNetworkManagement + if err := Convert_v1beta1_VCN_To_v1beta2_VCN(&in.Vcn, &out.Vcn, s); err != nil { + return err + } + if err := Convert_v1beta1_LoadBalancer_To_v1beta2_LoadBalancer(&in.APIServerLB, &out.APIServerLB, s); err != nil { + return err + } + out.VCNPeering = (*v1beta2.VCNPeering)(unsafe.Pointer(in.VCNPeering)) + return nil +} + +// Convert_v1beta1_NetworkSpec_To_v1beta2_NetworkSpec is an autogenerated conversion function. +func Convert_v1beta1_NetworkSpec_To_v1beta2_NetworkSpec(in *NetworkSpec, out *v1beta2.NetworkSpec, s conversion.Scope) error { + return autoConvert_v1beta1_NetworkSpec_To_v1beta2_NetworkSpec(in, out, s) +} + +func autoConvert_v1beta2_NetworkSpec_To_v1beta1_NetworkSpec(in *v1beta2.NetworkSpec, out *NetworkSpec, s conversion.Scope) error { + out.SkipNetworkManagement = in.SkipNetworkManagement + if err := Convert_v1beta2_VCN_To_v1beta1_VCN(&in.Vcn, &out.Vcn, s); err != nil { + return err + } + if err := Convert_v1beta2_LoadBalancer_To_v1beta1_LoadBalancer(&in.APIServerLB, &out.APIServerLB, s); err != nil { + return err + } + out.VCNPeering = (*VCNPeering)(unsafe.Pointer(in.VCNPeering)) + return nil +} + +// Convert_v1beta2_NetworkSpec_To_v1beta1_NetworkSpec is an autogenerated conversion function. +func Convert_v1beta2_NetworkSpec_To_v1beta1_NetworkSpec(in *v1beta2.NetworkSpec, out *NetworkSpec, s conversion.Scope) error { + return autoConvert_v1beta2_NetworkSpec_To_v1beta1_NetworkSpec(in, out, s) +} + +func autoConvert_v1beta1_OCIAvailabilityDomain_To_v1beta2_OCIAvailabilityDomain(in *OCIAvailabilityDomain, out *v1beta2.OCIAvailabilityDomain, s conversion.Scope) error { + out.Name = in.Name + out.FaultDomains = *(*[]string)(unsafe.Pointer(&in.FaultDomains)) + return nil +} + +// Convert_v1beta1_OCIAvailabilityDomain_To_v1beta2_OCIAvailabilityDomain is an autogenerated conversion function. +func Convert_v1beta1_OCIAvailabilityDomain_To_v1beta2_OCIAvailabilityDomain(in *OCIAvailabilityDomain, out *v1beta2.OCIAvailabilityDomain, s conversion.Scope) error { + return autoConvert_v1beta1_OCIAvailabilityDomain_To_v1beta2_OCIAvailabilityDomain(in, out, s) +} + +func autoConvert_v1beta2_OCIAvailabilityDomain_To_v1beta1_OCIAvailabilityDomain(in *v1beta2.OCIAvailabilityDomain, out *OCIAvailabilityDomain, s conversion.Scope) error { + out.Name = in.Name + out.FaultDomains = *(*[]string)(unsafe.Pointer(&in.FaultDomains)) + return nil +} + +// Convert_v1beta2_OCIAvailabilityDomain_To_v1beta1_OCIAvailabilityDomain is an autogenerated conversion function. +func Convert_v1beta2_OCIAvailabilityDomain_To_v1beta1_OCIAvailabilityDomain(in *v1beta2.OCIAvailabilityDomain, out *OCIAvailabilityDomain, s conversion.Scope) error { + return autoConvert_v1beta2_OCIAvailabilityDomain_To_v1beta1_OCIAvailabilityDomain(in, out, s) +} + +func autoConvert_v1beta1_OCICluster_To_v1beta2_OCICluster(in *OCICluster, out *v1beta2.OCICluster, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta1_OCIClusterSpec_To_v1beta2_OCIClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1beta1_OCIClusterStatus_To_v1beta2_OCIClusterStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCICluster_To_v1beta2_OCICluster is an autogenerated conversion function. +func Convert_v1beta1_OCICluster_To_v1beta2_OCICluster(in *OCICluster, out *v1beta2.OCICluster, s conversion.Scope) error { + return autoConvert_v1beta1_OCICluster_To_v1beta2_OCICluster(in, out, s) +} + +func autoConvert_v1beta2_OCICluster_To_v1beta1_OCICluster(in *v1beta2.OCICluster, out *OCICluster, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta2_OCIClusterSpec_To_v1beta1_OCIClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1beta2_OCIClusterStatus_To_v1beta1_OCIClusterStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCICluster_To_v1beta1_OCICluster is an autogenerated conversion function. +func Convert_v1beta2_OCICluster_To_v1beta1_OCICluster(in *v1beta2.OCICluster, out *OCICluster, s conversion.Scope) error { + return autoConvert_v1beta2_OCICluster_To_v1beta1_OCICluster(in, out, s) +} + +func autoConvert_v1beta1_OCIClusterIdentity_To_v1beta2_OCIClusterIdentity(in *OCIClusterIdentity, out *v1beta2.OCIClusterIdentity, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta1_OCIClusterIdentitySpec_To_v1beta2_OCIClusterIdentitySpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1beta1_OCIClusterIdentityStatus_To_v1beta2_OCIClusterIdentityStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIClusterIdentity_To_v1beta2_OCIClusterIdentity is an autogenerated conversion function. +func Convert_v1beta1_OCIClusterIdentity_To_v1beta2_OCIClusterIdentity(in *OCIClusterIdentity, out *v1beta2.OCIClusterIdentity, s conversion.Scope) error { + return autoConvert_v1beta1_OCIClusterIdentity_To_v1beta2_OCIClusterIdentity(in, out, s) +} + +func autoConvert_v1beta2_OCIClusterIdentity_To_v1beta1_OCIClusterIdentity(in *v1beta2.OCIClusterIdentity, out *OCIClusterIdentity, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta2_OCIClusterIdentitySpec_To_v1beta1_OCIClusterIdentitySpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1beta2_OCIClusterIdentityStatus_To_v1beta1_OCIClusterIdentityStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIClusterIdentity_To_v1beta1_OCIClusterIdentity is an autogenerated conversion function. +func Convert_v1beta2_OCIClusterIdentity_To_v1beta1_OCIClusterIdentity(in *v1beta2.OCIClusterIdentity, out *OCIClusterIdentity, s conversion.Scope) error { + return autoConvert_v1beta2_OCIClusterIdentity_To_v1beta1_OCIClusterIdentity(in, out, s) +} + +func autoConvert_v1beta1_OCIClusterIdentityList_To_v1beta2_OCIClusterIdentityList(in *OCIClusterIdentityList, out *v1beta2.OCIClusterIdentityList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1beta2.OCIClusterIdentity)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1beta1_OCIClusterIdentityList_To_v1beta2_OCIClusterIdentityList is an autogenerated conversion function. +func Convert_v1beta1_OCIClusterIdentityList_To_v1beta2_OCIClusterIdentityList(in *OCIClusterIdentityList, out *v1beta2.OCIClusterIdentityList, s conversion.Scope) error { + return autoConvert_v1beta1_OCIClusterIdentityList_To_v1beta2_OCIClusterIdentityList(in, out, s) +} + +func autoConvert_v1beta2_OCIClusterIdentityList_To_v1beta1_OCIClusterIdentityList(in *v1beta2.OCIClusterIdentityList, out *OCIClusterIdentityList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]OCIClusterIdentity)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1beta2_OCIClusterIdentityList_To_v1beta1_OCIClusterIdentityList is an autogenerated conversion function. +func Convert_v1beta2_OCIClusterIdentityList_To_v1beta1_OCIClusterIdentityList(in *v1beta2.OCIClusterIdentityList, out *OCIClusterIdentityList, s conversion.Scope) error { + return autoConvert_v1beta2_OCIClusterIdentityList_To_v1beta1_OCIClusterIdentityList(in, out, s) +} + +func autoConvert_v1beta1_OCIClusterIdentitySpec_To_v1beta2_OCIClusterIdentitySpec(in *OCIClusterIdentitySpec, out *v1beta2.OCIClusterIdentitySpec, s conversion.Scope) error { + out.Type = v1beta2.PrincipalType(in.Type) + out.PrincipalSecret = in.PrincipalSecret + out.AllowedNamespaces = (*v1beta2.AllowedNamespaces)(unsafe.Pointer(in.AllowedNamespaces)) + return nil +} + +// Convert_v1beta1_OCIClusterIdentitySpec_To_v1beta2_OCIClusterIdentitySpec is an autogenerated conversion function. +func Convert_v1beta1_OCIClusterIdentitySpec_To_v1beta2_OCIClusterIdentitySpec(in *OCIClusterIdentitySpec, out *v1beta2.OCIClusterIdentitySpec, s conversion.Scope) error { + return autoConvert_v1beta1_OCIClusterIdentitySpec_To_v1beta2_OCIClusterIdentitySpec(in, out, s) +} + +func autoConvert_v1beta2_OCIClusterIdentitySpec_To_v1beta1_OCIClusterIdentitySpec(in *v1beta2.OCIClusterIdentitySpec, out *OCIClusterIdentitySpec, s conversion.Scope) error { + out.Type = PrincipalType(in.Type) + out.PrincipalSecret = in.PrincipalSecret + out.AllowedNamespaces = (*AllowedNamespaces)(unsafe.Pointer(in.AllowedNamespaces)) + return nil +} + +// Convert_v1beta2_OCIClusterIdentitySpec_To_v1beta1_OCIClusterIdentitySpec is an autogenerated conversion function. +func Convert_v1beta2_OCIClusterIdentitySpec_To_v1beta1_OCIClusterIdentitySpec(in *v1beta2.OCIClusterIdentitySpec, out *OCIClusterIdentitySpec, s conversion.Scope) error { + return autoConvert_v1beta2_OCIClusterIdentitySpec_To_v1beta1_OCIClusterIdentitySpec(in, out, s) +} + +func autoConvert_v1beta1_OCIClusterIdentityStatus_To_v1beta2_OCIClusterIdentityStatus(in *OCIClusterIdentityStatus, out *v1beta2.OCIClusterIdentityStatus, s conversion.Scope) error { + out.Conditions = *(*apiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1beta1_OCIClusterIdentityStatus_To_v1beta2_OCIClusterIdentityStatus is an autogenerated conversion function. +func Convert_v1beta1_OCIClusterIdentityStatus_To_v1beta2_OCIClusterIdentityStatus(in *OCIClusterIdentityStatus, out *v1beta2.OCIClusterIdentityStatus, s conversion.Scope) error { + return autoConvert_v1beta1_OCIClusterIdentityStatus_To_v1beta2_OCIClusterIdentityStatus(in, out, s) +} + +func autoConvert_v1beta2_OCIClusterIdentityStatus_To_v1beta1_OCIClusterIdentityStatus(in *v1beta2.OCIClusterIdentityStatus, out *OCIClusterIdentityStatus, s conversion.Scope) error { + out.Conditions = *(*apiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1beta2_OCIClusterIdentityStatus_To_v1beta1_OCIClusterIdentityStatus is an autogenerated conversion function. +func Convert_v1beta2_OCIClusterIdentityStatus_To_v1beta1_OCIClusterIdentityStatus(in *v1beta2.OCIClusterIdentityStatus, out *OCIClusterIdentityStatus, s conversion.Scope) error { + return autoConvert_v1beta2_OCIClusterIdentityStatus_To_v1beta1_OCIClusterIdentityStatus(in, out, s) +} + +func autoConvert_v1beta1_OCIClusterList_To_v1beta2_OCIClusterList(in *OCIClusterList, out *v1beta2.OCIClusterList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1beta2.OCICluster, len(*in)) + for i := range *in { + if err := Convert_v1beta1_OCICluster_To_v1beta2_OCICluster(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta1_OCIClusterList_To_v1beta2_OCIClusterList is an autogenerated conversion function. +func Convert_v1beta1_OCIClusterList_To_v1beta2_OCIClusterList(in *OCIClusterList, out *v1beta2.OCIClusterList, s conversion.Scope) error { + return autoConvert_v1beta1_OCIClusterList_To_v1beta2_OCIClusterList(in, out, s) +} + +func autoConvert_v1beta2_OCIClusterList_To_v1beta1_OCIClusterList(in *v1beta2.OCIClusterList, out *OCIClusterList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCICluster, len(*in)) + for i := range *in { + if err := Convert_v1beta2_OCICluster_To_v1beta1_OCICluster(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta2_OCIClusterList_To_v1beta1_OCIClusterList is an autogenerated conversion function. +func Convert_v1beta2_OCIClusterList_To_v1beta1_OCIClusterList(in *v1beta2.OCIClusterList, out *OCIClusterList, s conversion.Scope) error { + return autoConvert_v1beta2_OCIClusterList_To_v1beta1_OCIClusterList(in, out, s) +} + +func autoConvert_v1beta1_OCIClusterSpec_To_v1beta2_OCIClusterSpec(in *OCIClusterSpec, out *v1beta2.OCIClusterSpec, 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_OCIClusterSpec_To_v1beta2_OCIClusterSpec is an autogenerated conversion function. +func Convert_v1beta1_OCIClusterSpec_To_v1beta2_OCIClusterSpec(in *OCIClusterSpec, out *v1beta2.OCIClusterSpec, s conversion.Scope) error { + return autoConvert_v1beta1_OCIClusterSpec_To_v1beta2_OCIClusterSpec(in, out, s) +} + +func autoConvert_v1beta2_OCIClusterSpec_To_v1beta1_OCIClusterSpec(in *v1beta2.OCIClusterSpec, out *OCIClusterSpec, 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 + return nil +} + +func autoConvert_v1beta1_OCIClusterStatus_To_v1beta2_OCIClusterStatus(in *OCIClusterStatus, out *v1beta2.OCIClusterStatus, 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_OCIClusterStatus_To_v1beta1_OCIClusterStatus(in *v1beta2.OCIClusterStatus, out *OCIClusterStatus, 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_OCIClusterStatus_To_v1beta1_OCIClusterStatus is an autogenerated conversion function. +func Convert_v1beta2_OCIClusterStatus_To_v1beta1_OCIClusterStatus(in *v1beta2.OCIClusterStatus, out *OCIClusterStatus, s conversion.Scope) error { + return autoConvert_v1beta2_OCIClusterStatus_To_v1beta1_OCIClusterStatus(in, out, s) +} + +func autoConvert_v1beta1_OCIClusterTemplate_To_v1beta2_OCIClusterTemplate(in *OCIClusterTemplate, out *v1beta2.OCIClusterTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta1_OCIClusterTemplateSpec_To_v1beta2_OCIClusterTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIClusterTemplate_To_v1beta2_OCIClusterTemplate is an autogenerated conversion function. +func Convert_v1beta1_OCIClusterTemplate_To_v1beta2_OCIClusterTemplate(in *OCIClusterTemplate, out *v1beta2.OCIClusterTemplate, s conversion.Scope) error { + return autoConvert_v1beta1_OCIClusterTemplate_To_v1beta2_OCIClusterTemplate(in, out, s) +} + +func autoConvert_v1beta2_OCIClusterTemplate_To_v1beta1_OCIClusterTemplate(in *v1beta2.OCIClusterTemplate, out *OCIClusterTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta2_OCIClusterTemplateSpec_To_v1beta1_OCIClusterTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIClusterTemplate_To_v1beta1_OCIClusterTemplate is an autogenerated conversion function. +func Convert_v1beta2_OCIClusterTemplate_To_v1beta1_OCIClusterTemplate(in *v1beta2.OCIClusterTemplate, out *OCIClusterTemplate, s conversion.Scope) error { + return autoConvert_v1beta2_OCIClusterTemplate_To_v1beta1_OCIClusterTemplate(in, out, s) +} + +func autoConvert_v1beta1_OCIClusterTemplateList_To_v1beta2_OCIClusterTemplateList(in *OCIClusterTemplateList, out *v1beta2.OCIClusterTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1beta2.OCIClusterTemplate, len(*in)) + for i := range *in { + if err := Convert_v1beta1_OCIClusterTemplate_To_v1beta2_OCIClusterTemplate(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta1_OCIClusterTemplateList_To_v1beta2_OCIClusterTemplateList is an autogenerated conversion function. +func Convert_v1beta1_OCIClusterTemplateList_To_v1beta2_OCIClusterTemplateList(in *OCIClusterTemplateList, out *v1beta2.OCIClusterTemplateList, s conversion.Scope) error { + return autoConvert_v1beta1_OCIClusterTemplateList_To_v1beta2_OCIClusterTemplateList(in, out, s) +} + +func autoConvert_v1beta2_OCIClusterTemplateList_To_v1beta1_OCIClusterTemplateList(in *v1beta2.OCIClusterTemplateList, out *OCIClusterTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIClusterTemplate, len(*in)) + for i := range *in { + if err := Convert_v1beta2_OCIClusterTemplate_To_v1beta1_OCIClusterTemplate(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta2_OCIClusterTemplateList_To_v1beta1_OCIClusterTemplateList is an autogenerated conversion function. +func Convert_v1beta2_OCIClusterTemplateList_To_v1beta1_OCIClusterTemplateList(in *v1beta2.OCIClusterTemplateList, out *OCIClusterTemplateList, s conversion.Scope) error { + return autoConvert_v1beta2_OCIClusterTemplateList_To_v1beta1_OCIClusterTemplateList(in, out, s) +} + +func autoConvert_v1beta1_OCIClusterTemplateResource_To_v1beta2_OCIClusterTemplateResource(in *OCIClusterTemplateResource, out *v1beta2.OCIClusterTemplateResource, s conversion.Scope) error { + if err := Convert_v1beta1_OCIClusterSpec_To_v1beta2_OCIClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIClusterTemplateResource_To_v1beta2_OCIClusterTemplateResource is an autogenerated conversion function. +func Convert_v1beta1_OCIClusterTemplateResource_To_v1beta2_OCIClusterTemplateResource(in *OCIClusterTemplateResource, out *v1beta2.OCIClusterTemplateResource, s conversion.Scope) error { + return autoConvert_v1beta1_OCIClusterTemplateResource_To_v1beta2_OCIClusterTemplateResource(in, out, s) +} + +func autoConvert_v1beta2_OCIClusterTemplateResource_To_v1beta1_OCIClusterTemplateResource(in *v1beta2.OCIClusterTemplateResource, out *OCIClusterTemplateResource, s conversion.Scope) error { + if err := Convert_v1beta2_OCIClusterSpec_To_v1beta1_OCIClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIClusterTemplateResource_To_v1beta1_OCIClusterTemplateResource is an autogenerated conversion function. +func Convert_v1beta2_OCIClusterTemplateResource_To_v1beta1_OCIClusterTemplateResource(in *v1beta2.OCIClusterTemplateResource, out *OCIClusterTemplateResource, s conversion.Scope) error { + return autoConvert_v1beta2_OCIClusterTemplateResource_To_v1beta1_OCIClusterTemplateResource(in, out, s) +} + +func autoConvert_v1beta1_OCIClusterTemplateSpec_To_v1beta2_OCIClusterTemplateSpec(in *OCIClusterTemplateSpec, out *v1beta2.OCIClusterTemplateSpec, s conversion.Scope) error { + if err := Convert_v1beta1_OCIClusterTemplateResource_To_v1beta2_OCIClusterTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIClusterTemplateSpec_To_v1beta2_OCIClusterTemplateSpec is an autogenerated conversion function. +func Convert_v1beta1_OCIClusterTemplateSpec_To_v1beta2_OCIClusterTemplateSpec(in *OCIClusterTemplateSpec, out *v1beta2.OCIClusterTemplateSpec, s conversion.Scope) error { + return autoConvert_v1beta1_OCIClusterTemplateSpec_To_v1beta2_OCIClusterTemplateSpec(in, out, s) +} + +func autoConvert_v1beta2_OCIClusterTemplateSpec_To_v1beta1_OCIClusterTemplateSpec(in *v1beta2.OCIClusterTemplateSpec, out *OCIClusterTemplateSpec, s conversion.Scope) error { + if err := Convert_v1beta2_OCIClusterTemplateResource_To_v1beta1_OCIClusterTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIClusterTemplateSpec_To_v1beta1_OCIClusterTemplateSpec is an autogenerated conversion function. +func Convert_v1beta2_OCIClusterTemplateSpec_To_v1beta1_OCIClusterTemplateSpec(in *v1beta2.OCIClusterTemplateSpec, out *OCIClusterTemplateSpec, s conversion.Scope) error { + return autoConvert_v1beta2_OCIClusterTemplateSpec_To_v1beta1_OCIClusterTemplateSpec(in, out, s) +} + +func autoConvert_v1beta1_OCIMachine_To_v1beta2_OCIMachine(in *OCIMachine, out *v1beta2.OCIMachine, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta1_OCIMachineSpec_To_v1beta2_OCIMachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1beta1_OCIMachineStatus_To_v1beta2_OCIMachineStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIMachine_To_v1beta2_OCIMachine is an autogenerated conversion function. +func Convert_v1beta1_OCIMachine_To_v1beta2_OCIMachine(in *OCIMachine, out *v1beta2.OCIMachine, s conversion.Scope) error { + return autoConvert_v1beta1_OCIMachine_To_v1beta2_OCIMachine(in, out, s) +} + +func autoConvert_v1beta2_OCIMachine_To_v1beta1_OCIMachine(in *v1beta2.OCIMachine, out *OCIMachine, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta2_OCIMachineSpec_To_v1beta1_OCIMachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1beta2_OCIMachineStatus_To_v1beta1_OCIMachineStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIMachine_To_v1beta1_OCIMachine is an autogenerated conversion function. +func Convert_v1beta2_OCIMachine_To_v1beta1_OCIMachine(in *v1beta2.OCIMachine, out *OCIMachine, s conversion.Scope) error { + return autoConvert_v1beta2_OCIMachine_To_v1beta1_OCIMachine(in, out, s) +} + +func autoConvert_v1beta1_OCIMachineList_To_v1beta2_OCIMachineList(in *OCIMachineList, out *v1beta2.OCIMachineList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1beta2.OCIMachine, len(*in)) + for i := range *in { + if err := Convert_v1beta1_OCIMachine_To_v1beta2_OCIMachine(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta1_OCIMachineList_To_v1beta2_OCIMachineList is an autogenerated conversion function. +func Convert_v1beta1_OCIMachineList_To_v1beta2_OCIMachineList(in *OCIMachineList, out *v1beta2.OCIMachineList, s conversion.Scope) error { + return autoConvert_v1beta1_OCIMachineList_To_v1beta2_OCIMachineList(in, out, s) +} + +func autoConvert_v1beta2_OCIMachineList_To_v1beta1_OCIMachineList(in *v1beta2.OCIMachineList, out *OCIMachineList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIMachine, len(*in)) + for i := range *in { + if err := Convert_v1beta2_OCIMachine_To_v1beta1_OCIMachine(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta2_OCIMachineList_To_v1beta1_OCIMachineList is an autogenerated conversion function. +func Convert_v1beta2_OCIMachineList_To_v1beta1_OCIMachineList(in *v1beta2.OCIMachineList, out *OCIMachineList, s conversion.Scope) error { + return autoConvert_v1beta2_OCIMachineList_To_v1beta1_OCIMachineList(in, out, s) +} + +func autoConvert_v1beta1_OCIMachineSpec_To_v1beta2_OCIMachineSpec(in *OCIMachineSpec, out *v1beta2.OCIMachineSpec, s conversion.Scope) error { + out.InstanceId = (*string)(unsafe.Pointer(in.InstanceId)) + out.ImageId = in.ImageId + out.CompartmentId = in.CompartmentId + out.Shape = in.Shape + out.IpxeScript = (*string)(unsafe.Pointer(in.IpxeScript)) + out.CapacityReservationId = (*string)(unsafe.Pointer(in.CapacityReservationId)) + if err := Convert_v1beta1_ShapeConfig_To_v1beta2_ShapeConfig(&in.ShapeConfig, &out.ShapeConfig, s); err != nil { + return err + } + if err := Convert_v1beta1_NetworkDetails_To_v1beta2_NetworkDetails(&in.NetworkDetails, &out.NetworkDetails, s); err != nil { + return err + } + out.VnicAttachments = *(*[]v1beta2.VnicAttachment)(unsafe.Pointer(&in.VnicAttachments)) + out.LaunchOptions = (*v1beta2.LaunchOptions)(unsafe.Pointer(in.LaunchOptions)) + out.InstanceOptions = (*v1beta2.InstanceOptions)(unsafe.Pointer(in.InstanceOptions)) + out.AvailabilityConfig = (*v1beta2.LaunchInstanceAvailabilityConfig)(unsafe.Pointer(in.AvailabilityConfig)) + out.PreemptibleInstanceConfig = (*v1beta2.PreemptibleInstanceConfig)(unsafe.Pointer(in.PreemptibleInstanceConfig)) + out.AgentConfig = (*v1beta2.LaunchInstanceAgentConfig)(unsafe.Pointer(in.AgentConfig)) + out.InstanceSourceViaImageDetails = (*v1beta2.InstanceSourceViaImageConfig)(unsafe.Pointer(in.InstanceSourceViaImageDetails)) + out.PlatformConfig = (*v1beta2.PlatformConfig)(unsafe.Pointer(in.PlatformConfig)) + out.DedicatedVmHostId = (*string)(unsafe.Pointer(in.DedicatedVmHostId)) + out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) + out.IsPvEncryptionInTransitEnabled = in.IsPvEncryptionInTransitEnabled + out.BootVolumeSizeInGBs = in.BootVolumeSizeInGBs + out.Metadata = *(*map[string]string)(unsafe.Pointer(&in.Metadata)) + out.FreeformTags = *(*map[string]string)(unsafe.Pointer(&in.FreeformTags)) + out.DefinedTags = *(*map[string]map[string]string)(unsafe.Pointer(&in.DefinedTags)) + out.SubnetName = in.SubnetName + // WARNING: in.NSGName requires manual conversion: does not exist in peer-type + return nil +} + +func autoConvert_v1beta2_OCIMachineSpec_To_v1beta1_OCIMachineSpec(in *v1beta2.OCIMachineSpec, out *OCIMachineSpec, s conversion.Scope) error { + out.InstanceId = (*string)(unsafe.Pointer(in.InstanceId)) + out.ImageId = in.ImageId + out.CompartmentId = in.CompartmentId + out.Shape = in.Shape + out.IpxeScript = (*string)(unsafe.Pointer(in.IpxeScript)) + out.CapacityReservationId = (*string)(unsafe.Pointer(in.CapacityReservationId)) + if err := Convert_v1beta2_ShapeConfig_To_v1beta1_ShapeConfig(&in.ShapeConfig, &out.ShapeConfig, s); err != nil { + return err + } + if err := Convert_v1beta2_NetworkDetails_To_v1beta1_NetworkDetails(&in.NetworkDetails, &out.NetworkDetails, s); err != nil { + return err + } + out.VnicAttachments = *(*[]VnicAttachment)(unsafe.Pointer(&in.VnicAttachments)) + out.LaunchOptions = (*LaunchOptions)(unsafe.Pointer(in.LaunchOptions)) + out.InstanceOptions = (*InstanceOptions)(unsafe.Pointer(in.InstanceOptions)) + out.AvailabilityConfig = (*LaunchInstanceAvailabilityConfig)(unsafe.Pointer(in.AvailabilityConfig)) + out.PreemptibleInstanceConfig = (*PreemptibleInstanceConfig)(unsafe.Pointer(in.PreemptibleInstanceConfig)) + out.AgentConfig = (*LaunchInstanceAgentConfig)(unsafe.Pointer(in.AgentConfig)) + out.InstanceSourceViaImageDetails = (*InstanceSourceViaImageConfig)(unsafe.Pointer(in.InstanceSourceViaImageDetails)) + out.PlatformConfig = (*PlatformConfig)(unsafe.Pointer(in.PlatformConfig)) + out.DedicatedVmHostId = (*string)(unsafe.Pointer(in.DedicatedVmHostId)) + out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) + out.IsPvEncryptionInTransitEnabled = in.IsPvEncryptionInTransitEnabled + out.BootVolumeSizeInGBs = in.BootVolumeSizeInGBs + out.Metadata = *(*map[string]string)(unsafe.Pointer(&in.Metadata)) + out.FreeformTags = *(*map[string]string)(unsafe.Pointer(&in.FreeformTags)) + out.DefinedTags = *(*map[string]map[string]string)(unsafe.Pointer(&in.DefinedTags)) + out.SubnetName = in.SubnetName + return nil +} + +// Convert_v1beta2_OCIMachineSpec_To_v1beta1_OCIMachineSpec is an autogenerated conversion function. +func Convert_v1beta2_OCIMachineSpec_To_v1beta1_OCIMachineSpec(in *v1beta2.OCIMachineSpec, out *OCIMachineSpec, s conversion.Scope) error { + return autoConvert_v1beta2_OCIMachineSpec_To_v1beta1_OCIMachineSpec(in, out, s) +} + +func autoConvert_v1beta1_OCIMachineStatus_To_v1beta2_OCIMachineStatus(in *OCIMachineStatus, out *v1beta2.OCIMachineStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.Addresses = *(*[]apiv1beta1.MachineAddress)(unsafe.Pointer(&in.Addresses)) + out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + out.LaunchInstanceWorkRequestId = in.LaunchInstanceWorkRequestId + out.CreateBackendWorkRequestId = in.CreateBackendWorkRequestId + out.DeleteBackendWorkRequestId = in.DeleteBackendWorkRequestId + out.Conditions = *(*apiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1beta1_OCIMachineStatus_To_v1beta2_OCIMachineStatus is an autogenerated conversion function. +func Convert_v1beta1_OCIMachineStatus_To_v1beta2_OCIMachineStatus(in *OCIMachineStatus, out *v1beta2.OCIMachineStatus, s conversion.Scope) error { + return autoConvert_v1beta1_OCIMachineStatus_To_v1beta2_OCIMachineStatus(in, out, s) +} + +func autoConvert_v1beta2_OCIMachineStatus_To_v1beta1_OCIMachineStatus(in *v1beta2.OCIMachineStatus, out *OCIMachineStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.Addresses = *(*[]apiv1beta1.MachineAddress)(unsafe.Pointer(&in.Addresses)) + out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + out.LaunchInstanceWorkRequestId = in.LaunchInstanceWorkRequestId + out.CreateBackendWorkRequestId = in.CreateBackendWorkRequestId + out.DeleteBackendWorkRequestId = in.DeleteBackendWorkRequestId + out.Conditions = *(*apiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1beta2_OCIMachineStatus_To_v1beta1_OCIMachineStatus is an autogenerated conversion function. +func Convert_v1beta2_OCIMachineStatus_To_v1beta1_OCIMachineStatus(in *v1beta2.OCIMachineStatus, out *OCIMachineStatus, s conversion.Scope) error { + return autoConvert_v1beta2_OCIMachineStatus_To_v1beta1_OCIMachineStatus(in, out, s) +} + +func autoConvert_v1beta1_OCIMachineTemplate_To_v1beta2_OCIMachineTemplate(in *OCIMachineTemplate, out *v1beta2.OCIMachineTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta1_OCIMachineTemplateSpec_To_v1beta2_OCIMachineTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIMachineTemplate_To_v1beta2_OCIMachineTemplate is an autogenerated conversion function. +func Convert_v1beta1_OCIMachineTemplate_To_v1beta2_OCIMachineTemplate(in *OCIMachineTemplate, out *v1beta2.OCIMachineTemplate, s conversion.Scope) error { + return autoConvert_v1beta1_OCIMachineTemplate_To_v1beta2_OCIMachineTemplate(in, out, s) +} + +func autoConvert_v1beta2_OCIMachineTemplate_To_v1beta1_OCIMachineTemplate(in *v1beta2.OCIMachineTemplate, out *OCIMachineTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta2_OCIMachineTemplateSpec_To_v1beta1_OCIMachineTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIMachineTemplate_To_v1beta1_OCIMachineTemplate is an autogenerated conversion function. +func Convert_v1beta2_OCIMachineTemplate_To_v1beta1_OCIMachineTemplate(in *v1beta2.OCIMachineTemplate, out *OCIMachineTemplate, s conversion.Scope) error { + return autoConvert_v1beta2_OCIMachineTemplate_To_v1beta1_OCIMachineTemplate(in, out, s) +} + +func autoConvert_v1beta1_OCIMachineTemplateList_To_v1beta2_OCIMachineTemplateList(in *OCIMachineTemplateList, out *v1beta2.OCIMachineTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1beta2.OCIMachineTemplate, len(*in)) + for i := range *in { + if err := Convert_v1beta1_OCIMachineTemplate_To_v1beta2_OCIMachineTemplate(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta1_OCIMachineTemplateList_To_v1beta2_OCIMachineTemplateList is an autogenerated conversion function. +func Convert_v1beta1_OCIMachineTemplateList_To_v1beta2_OCIMachineTemplateList(in *OCIMachineTemplateList, out *v1beta2.OCIMachineTemplateList, s conversion.Scope) error { + return autoConvert_v1beta1_OCIMachineTemplateList_To_v1beta2_OCIMachineTemplateList(in, out, s) +} + +func autoConvert_v1beta2_OCIMachineTemplateList_To_v1beta1_OCIMachineTemplateList(in *v1beta2.OCIMachineTemplateList, out *OCIMachineTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIMachineTemplate, len(*in)) + for i := range *in { + if err := Convert_v1beta2_OCIMachineTemplate_To_v1beta1_OCIMachineTemplate(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta2_OCIMachineTemplateList_To_v1beta1_OCIMachineTemplateList is an autogenerated conversion function. +func Convert_v1beta2_OCIMachineTemplateList_To_v1beta1_OCIMachineTemplateList(in *v1beta2.OCIMachineTemplateList, out *OCIMachineTemplateList, s conversion.Scope) error { + return autoConvert_v1beta2_OCIMachineTemplateList_To_v1beta1_OCIMachineTemplateList(in, out, s) +} + +func autoConvert_v1beta1_OCIMachineTemplateResource_To_v1beta2_OCIMachineTemplateResource(in *OCIMachineTemplateResource, out *v1beta2.OCIMachineTemplateResource, s conversion.Scope) error { + if err := Convert_v1beta1_OCIMachineSpec_To_v1beta2_OCIMachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIMachineTemplateResource_To_v1beta2_OCIMachineTemplateResource is an autogenerated conversion function. +func Convert_v1beta1_OCIMachineTemplateResource_To_v1beta2_OCIMachineTemplateResource(in *OCIMachineTemplateResource, out *v1beta2.OCIMachineTemplateResource, s conversion.Scope) error { + return autoConvert_v1beta1_OCIMachineTemplateResource_To_v1beta2_OCIMachineTemplateResource(in, out, s) +} + +func autoConvert_v1beta2_OCIMachineTemplateResource_To_v1beta1_OCIMachineTemplateResource(in *v1beta2.OCIMachineTemplateResource, out *OCIMachineTemplateResource, s conversion.Scope) error { + if err := Convert_v1beta2_OCIMachineSpec_To_v1beta1_OCIMachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIMachineTemplateResource_To_v1beta1_OCIMachineTemplateResource is an autogenerated conversion function. +func Convert_v1beta2_OCIMachineTemplateResource_To_v1beta1_OCIMachineTemplateResource(in *v1beta2.OCIMachineTemplateResource, out *OCIMachineTemplateResource, s conversion.Scope) error { + return autoConvert_v1beta2_OCIMachineTemplateResource_To_v1beta1_OCIMachineTemplateResource(in, out, s) +} + +func autoConvert_v1beta1_OCIMachineTemplateSpec_To_v1beta2_OCIMachineTemplateSpec(in *OCIMachineTemplateSpec, out *v1beta2.OCIMachineTemplateSpec, s conversion.Scope) error { + if err := Convert_v1beta1_OCIMachineTemplateResource_To_v1beta2_OCIMachineTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIMachineTemplateSpec_To_v1beta2_OCIMachineTemplateSpec is an autogenerated conversion function. +func Convert_v1beta1_OCIMachineTemplateSpec_To_v1beta2_OCIMachineTemplateSpec(in *OCIMachineTemplateSpec, out *v1beta2.OCIMachineTemplateSpec, s conversion.Scope) error { + return autoConvert_v1beta1_OCIMachineTemplateSpec_To_v1beta2_OCIMachineTemplateSpec(in, out, s) +} + +func autoConvert_v1beta2_OCIMachineTemplateSpec_To_v1beta1_OCIMachineTemplateSpec(in *v1beta2.OCIMachineTemplateSpec, out *OCIMachineTemplateSpec, s conversion.Scope) error { + if err := Convert_v1beta2_OCIMachineTemplateResource_To_v1beta1_OCIMachineTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIMachineTemplateSpec_To_v1beta1_OCIMachineTemplateSpec is an autogenerated conversion function. +func Convert_v1beta2_OCIMachineTemplateSpec_To_v1beta1_OCIMachineTemplateSpec(in *v1beta2.OCIMachineTemplateSpec, out *OCIMachineTemplateSpec, s conversion.Scope) error { + return autoConvert_v1beta2_OCIMachineTemplateSpec_To_v1beta1_OCIMachineTemplateSpec(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 +} + +// Convert_v1beta1_PeerRouteRule_To_v1beta2_PeerRouteRule is an autogenerated conversion function. +func Convert_v1beta1_PeerRouteRule_To_v1beta2_PeerRouteRule(in *PeerRouteRule, out *v1beta2.PeerRouteRule, s conversion.Scope) error { + return autoConvert_v1beta1_PeerRouteRule_To_v1beta2_PeerRouteRule(in, out, s) +} + +func autoConvert_v1beta2_PeerRouteRule_To_v1beta1_PeerRouteRule(in *v1beta2.PeerRouteRule, out *PeerRouteRule, s conversion.Scope) error { + out.VCNCIDRRange = in.VCNCIDRRange + return nil +} + +// Convert_v1beta2_PeerRouteRule_To_v1beta1_PeerRouteRule is an autogenerated conversion function. +func Convert_v1beta2_PeerRouteRule_To_v1beta1_PeerRouteRule(in *v1beta2.PeerRouteRule, out *PeerRouteRule, s conversion.Scope) error { + return autoConvert_v1beta2_PeerRouteRule_To_v1beta1_PeerRouteRule(in, out, s) +} + +func autoConvert_v1beta1_PlatformConfig_To_v1beta2_PlatformConfig(in *PlatformConfig, out *v1beta2.PlatformConfig, s conversion.Scope) error { + out.PlatformConfigType = v1beta2.PlatformConfigTypeEnum(in.PlatformConfigType) + if err := Convert_v1beta1_AmdMilanBmPlatformConfig_To_v1beta2_AmdMilanBmPlatformConfig(&in.AmdMilanBmPlatformConfig, &out.AmdMilanBmPlatformConfig, s); err != nil { + return err + } + if err := Convert_v1beta1_AmdRomeBmPlatformConfig_To_v1beta2_AmdRomeBmPlatformConfig(&in.AmdRomeBmPlatformConfig, &out.AmdRomeBmPlatformConfig, s); err != nil { + return err + } + if err := Convert_v1beta1_IntelSkylakeBmPlatformConfig_To_v1beta2_IntelSkylakeBmPlatformConfig(&in.IntelSkylakeBmPlatformConfig, &out.IntelSkylakeBmPlatformConfig, s); err != nil { + return err + } + if err := Convert_v1beta1_IntelIcelakeBmPlatformConfig_To_v1beta2_IntelIcelakeBmPlatformConfig(&in.IntelIcelakeBmPlatformConfig, &out.IntelIcelakeBmPlatformConfig, s); err != nil { + return err + } + if err := Convert_v1beta1_AmdRomeBmGpuPlatformConfig_To_v1beta2_AmdRomeBmGpuPlatformConfig(&in.AmdRomeBmGpuPlatformConfig, &out.AmdRomeBmGpuPlatformConfig, s); err != nil { + return err + } + if err := Convert_v1beta1_IntelVmPlatformConfig_To_v1beta2_IntelVmPlatformConfig(&in.IntelVmPlatformConfig, &out.IntelVmPlatformConfig, s); err != nil { + return err + } + if err := Convert_v1beta1_AmdVmPlatformConfig_To_v1beta2_AmdVmPlatformConfig(&in.AmdVmPlatformConfig, &out.AmdVmPlatformConfig, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_PlatformConfig_To_v1beta2_PlatformConfig is an autogenerated conversion function. +func Convert_v1beta1_PlatformConfig_To_v1beta2_PlatformConfig(in *PlatformConfig, out *v1beta2.PlatformConfig, s conversion.Scope) error { + return autoConvert_v1beta1_PlatformConfig_To_v1beta2_PlatformConfig(in, out, s) +} + +func autoConvert_v1beta2_PlatformConfig_To_v1beta1_PlatformConfig(in *v1beta2.PlatformConfig, out *PlatformConfig, s conversion.Scope) error { + out.PlatformConfigType = PlatformConfigTypeEnum(in.PlatformConfigType) + if err := Convert_v1beta2_AmdMilanBmPlatformConfig_To_v1beta1_AmdMilanBmPlatformConfig(&in.AmdMilanBmPlatformConfig, &out.AmdMilanBmPlatformConfig, s); err != nil { + return err + } + if err := Convert_v1beta2_AmdRomeBmPlatformConfig_To_v1beta1_AmdRomeBmPlatformConfig(&in.AmdRomeBmPlatformConfig, &out.AmdRomeBmPlatformConfig, s); err != nil { + return err + } + if err := Convert_v1beta2_IntelSkylakeBmPlatformConfig_To_v1beta1_IntelSkylakeBmPlatformConfig(&in.IntelSkylakeBmPlatformConfig, &out.IntelSkylakeBmPlatformConfig, s); err != nil { + return err + } + if err := Convert_v1beta2_IntelIcelakeBmPlatformConfig_To_v1beta1_IntelIcelakeBmPlatformConfig(&in.IntelIcelakeBmPlatformConfig, &out.IntelIcelakeBmPlatformConfig, s); err != nil { + return err + } + if err := Convert_v1beta2_AmdRomeBmGpuPlatformConfig_To_v1beta1_AmdRomeBmGpuPlatformConfig(&in.AmdRomeBmGpuPlatformConfig, &out.AmdRomeBmGpuPlatformConfig, s); err != nil { + return err + } + if err := Convert_v1beta2_IntelVmPlatformConfig_To_v1beta1_IntelVmPlatformConfig(&in.IntelVmPlatformConfig, &out.IntelVmPlatformConfig, s); err != nil { + return err + } + if err := Convert_v1beta2_AmdVmPlatformConfig_To_v1beta1_AmdVmPlatformConfig(&in.AmdVmPlatformConfig, &out.AmdVmPlatformConfig, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_PlatformConfig_To_v1beta1_PlatformConfig is an autogenerated conversion function. +func Convert_v1beta2_PlatformConfig_To_v1beta1_PlatformConfig(in *v1beta2.PlatformConfig, out *PlatformConfig, s conversion.Scope) error { + return autoConvert_v1beta2_PlatformConfig_To_v1beta1_PlatformConfig(in, out, s) +} + +func autoConvert_v1beta1_PortRange_To_v1beta2_PortRange(in *PortRange, out *v1beta2.PortRange, s conversion.Scope) error { + out.Max = (*int)(unsafe.Pointer(in.Max)) + out.Min = (*int)(unsafe.Pointer(in.Min)) + return nil +} + +// Convert_v1beta1_PortRange_To_v1beta2_PortRange is an autogenerated conversion function. +func Convert_v1beta1_PortRange_To_v1beta2_PortRange(in *PortRange, out *v1beta2.PortRange, s conversion.Scope) error { + return autoConvert_v1beta1_PortRange_To_v1beta2_PortRange(in, out, s) +} + +func autoConvert_v1beta2_PortRange_To_v1beta1_PortRange(in *v1beta2.PortRange, out *PortRange, s conversion.Scope) error { + out.Max = (*int)(unsafe.Pointer(in.Max)) + out.Min = (*int)(unsafe.Pointer(in.Min)) + return nil +} + +// Convert_v1beta2_PortRange_To_v1beta1_PortRange is an autogenerated conversion function. +func Convert_v1beta2_PortRange_To_v1beta1_PortRange(in *v1beta2.PortRange, out *PortRange, s conversion.Scope) error { + return autoConvert_v1beta2_PortRange_To_v1beta1_PortRange(in, out, s) +} + +func autoConvert_v1beta1_PreemptibleInstanceConfig_To_v1beta2_PreemptibleInstanceConfig(in *PreemptibleInstanceConfig, out *v1beta2.PreemptibleInstanceConfig, s conversion.Scope) error { + out.TerminatePreemptionAction = (*v1beta2.TerminatePreemptionAction)(unsafe.Pointer(in.TerminatePreemptionAction)) + return nil +} + +// Convert_v1beta1_PreemptibleInstanceConfig_To_v1beta2_PreemptibleInstanceConfig is an autogenerated conversion function. +func Convert_v1beta1_PreemptibleInstanceConfig_To_v1beta2_PreemptibleInstanceConfig(in *PreemptibleInstanceConfig, out *v1beta2.PreemptibleInstanceConfig, s conversion.Scope) error { + return autoConvert_v1beta1_PreemptibleInstanceConfig_To_v1beta2_PreemptibleInstanceConfig(in, out, s) +} + +func autoConvert_v1beta2_PreemptibleInstanceConfig_To_v1beta1_PreemptibleInstanceConfig(in *v1beta2.PreemptibleInstanceConfig, out *PreemptibleInstanceConfig, s conversion.Scope) error { + out.TerminatePreemptionAction = (*TerminatePreemptionAction)(unsafe.Pointer(in.TerminatePreemptionAction)) + return nil +} + +// Convert_v1beta2_PreemptibleInstanceConfig_To_v1beta1_PreemptibleInstanceConfig is an autogenerated conversion function. +func Convert_v1beta2_PreemptibleInstanceConfig_To_v1beta1_PreemptibleInstanceConfig(in *v1beta2.PreemptibleInstanceConfig, out *PreemptibleInstanceConfig, s conversion.Scope) error { + return autoConvert_v1beta2_PreemptibleInstanceConfig_To_v1beta1_PreemptibleInstanceConfig(in, out, s) +} + +func autoConvert_v1beta1_RemotePeeringConnection_To_v1beta2_RemotePeeringConnection(in *RemotePeeringConnection, out *v1beta2.RemotePeeringConnection, s conversion.Scope) error { + out.ManagePeerRPC = in.ManagePeerRPC + out.PeerRegionName = in.PeerRegionName + out.PeerDRGId = (*string)(unsafe.Pointer(in.PeerDRGId)) + out.PeerRPCConnectionId = (*string)(unsafe.Pointer(in.PeerRPCConnectionId)) + out.RPCConnectionId = (*string)(unsafe.Pointer(in.RPCConnectionId)) + return nil +} + +// Convert_v1beta1_RemotePeeringConnection_To_v1beta2_RemotePeeringConnection is an autogenerated conversion function. +func Convert_v1beta1_RemotePeeringConnection_To_v1beta2_RemotePeeringConnection(in *RemotePeeringConnection, out *v1beta2.RemotePeeringConnection, s conversion.Scope) error { + return autoConvert_v1beta1_RemotePeeringConnection_To_v1beta2_RemotePeeringConnection(in, out, s) +} + +func autoConvert_v1beta2_RemotePeeringConnection_To_v1beta1_RemotePeeringConnection(in *v1beta2.RemotePeeringConnection, out *RemotePeeringConnection, s conversion.Scope) error { + out.ManagePeerRPC = in.ManagePeerRPC + out.PeerRegionName = in.PeerRegionName + out.PeerDRGId = (*string)(unsafe.Pointer(in.PeerDRGId)) + out.PeerRPCConnectionId = (*string)(unsafe.Pointer(in.PeerRPCConnectionId)) + out.RPCConnectionId = (*string)(unsafe.Pointer(in.RPCConnectionId)) + return nil +} + +// Convert_v1beta2_RemotePeeringConnection_To_v1beta1_RemotePeeringConnection is an autogenerated conversion function. +func Convert_v1beta2_RemotePeeringConnection_To_v1beta1_RemotePeeringConnection(in *v1beta2.RemotePeeringConnection, out *RemotePeeringConnection, s conversion.Scope) error { + return autoConvert_v1beta2_RemotePeeringConnection_To_v1beta1_RemotePeeringConnection(in, out, s) +} + +func autoConvert_v1beta1_SecurityList_To_v1beta2_SecurityList(in *SecurityList, out *v1beta2.SecurityList, s conversion.Scope) error { + out.ID = (*string)(unsafe.Pointer(in.ID)) + out.Name = in.Name + out.EgressRules = *(*[]v1beta2.EgressSecurityRule)(unsafe.Pointer(&in.EgressRules)) + out.IngressRules = *(*[]v1beta2.IngressSecurityRule)(unsafe.Pointer(&in.IngressRules)) + return nil +} + +// Convert_v1beta1_SecurityList_To_v1beta2_SecurityList is an autogenerated conversion function. +func Convert_v1beta1_SecurityList_To_v1beta2_SecurityList(in *SecurityList, out *v1beta2.SecurityList, s conversion.Scope) error { + return autoConvert_v1beta1_SecurityList_To_v1beta2_SecurityList(in, out, s) +} + +func autoConvert_v1beta2_SecurityList_To_v1beta1_SecurityList(in *v1beta2.SecurityList, out *SecurityList, s conversion.Scope) error { + out.ID = (*string)(unsafe.Pointer(in.ID)) + out.Name = in.Name + out.EgressRules = *(*[]EgressSecurityRule)(unsafe.Pointer(&in.EgressRules)) + out.IngressRules = *(*[]IngressSecurityRule)(unsafe.Pointer(&in.IngressRules)) + return nil +} + +// Convert_v1beta2_SecurityList_To_v1beta1_SecurityList is an autogenerated conversion function. +func Convert_v1beta2_SecurityList_To_v1beta1_SecurityList(in *v1beta2.SecurityList, out *SecurityList, s conversion.Scope) error { + return autoConvert_v1beta2_SecurityList_To_v1beta1_SecurityList(in, out, s) +} + +func autoConvert_v1beta1_ShapeConfig_To_v1beta2_ShapeConfig(in *ShapeConfig, out *v1beta2.ShapeConfig, s conversion.Scope) error { + out.Ocpus = in.Ocpus + out.MemoryInGBs = in.MemoryInGBs + out.BaselineOcpuUtilization = in.BaselineOcpuUtilization + out.Nvmes = (*int)(unsafe.Pointer(in.Nvmes)) + return nil +} + +// Convert_v1beta1_ShapeConfig_To_v1beta2_ShapeConfig is an autogenerated conversion function. +func Convert_v1beta1_ShapeConfig_To_v1beta2_ShapeConfig(in *ShapeConfig, out *v1beta2.ShapeConfig, s conversion.Scope) error { + return autoConvert_v1beta1_ShapeConfig_To_v1beta2_ShapeConfig(in, out, s) +} + +func autoConvert_v1beta2_ShapeConfig_To_v1beta1_ShapeConfig(in *v1beta2.ShapeConfig, out *ShapeConfig, s conversion.Scope) error { + out.Ocpus = in.Ocpus + out.MemoryInGBs = in.MemoryInGBs + out.BaselineOcpuUtilization = in.BaselineOcpuUtilization + out.Nvmes = (*int)(unsafe.Pointer(in.Nvmes)) + return nil +} + +// Convert_v1beta2_ShapeConfig_To_v1beta1_ShapeConfig is an autogenerated conversion function. +func Convert_v1beta2_ShapeConfig_To_v1beta1_ShapeConfig(in *v1beta2.ShapeConfig, out *ShapeConfig, s conversion.Scope) error { + return autoConvert_v1beta2_ShapeConfig_To_v1beta1_ShapeConfig(in, out, s) +} + +func autoConvert_v1beta1_Subnet_To_v1beta2_Subnet(in *Subnet, out *v1beta2.Subnet, s conversion.Scope) error { + out.Role = v1beta2.Role(in.Role) + out.ID = (*string)(unsafe.Pointer(in.ID)) + out.Name = in.Name + out.CIDR = in.CIDR + out.Type = v1beta2.SubnetType(in.Type) + out.SecurityList = (*v1beta2.SecurityList)(unsafe.Pointer(in.SecurityList)) + return nil +} + +// Convert_v1beta1_Subnet_To_v1beta2_Subnet is an autogenerated conversion function. +func Convert_v1beta1_Subnet_To_v1beta2_Subnet(in *Subnet, out *v1beta2.Subnet, s conversion.Scope) error { + return autoConvert_v1beta1_Subnet_To_v1beta2_Subnet(in, out, s) +} + +func autoConvert_v1beta2_Subnet_To_v1beta1_Subnet(in *v1beta2.Subnet, out *Subnet, s conversion.Scope) error { + out.Role = Role(in.Role) + out.ID = (*string)(unsafe.Pointer(in.ID)) + out.Name = in.Name + out.CIDR = in.CIDR + out.Type = SubnetType(in.Type) + out.SecurityList = (*SecurityList)(unsafe.Pointer(in.SecurityList)) + return nil +} + +// Convert_v1beta2_Subnet_To_v1beta1_Subnet is an autogenerated conversion function. +func Convert_v1beta2_Subnet_To_v1beta1_Subnet(in *v1beta2.Subnet, out *Subnet, s conversion.Scope) error { + return autoConvert_v1beta2_Subnet_To_v1beta1_Subnet(in, out, s) +} + +func autoConvert_v1beta1_TcpOptions_To_v1beta2_TcpOptions(in *TcpOptions, out *v1beta2.TcpOptions, s conversion.Scope) error { + out.DestinationPortRange = (*v1beta2.PortRange)(unsafe.Pointer(in.DestinationPortRange)) + out.SourcePortRange = (*v1beta2.PortRange)(unsafe.Pointer(in.SourcePortRange)) + return nil +} + +// Convert_v1beta1_TcpOptions_To_v1beta2_TcpOptions is an autogenerated conversion function. +func Convert_v1beta1_TcpOptions_To_v1beta2_TcpOptions(in *TcpOptions, out *v1beta2.TcpOptions, s conversion.Scope) error { + return autoConvert_v1beta1_TcpOptions_To_v1beta2_TcpOptions(in, out, s) +} + +func autoConvert_v1beta2_TcpOptions_To_v1beta1_TcpOptions(in *v1beta2.TcpOptions, out *TcpOptions, s conversion.Scope) error { + out.DestinationPortRange = (*PortRange)(unsafe.Pointer(in.DestinationPortRange)) + out.SourcePortRange = (*PortRange)(unsafe.Pointer(in.SourcePortRange)) + return nil +} + +// Convert_v1beta2_TcpOptions_To_v1beta1_TcpOptions is an autogenerated conversion function. +func Convert_v1beta2_TcpOptions_To_v1beta1_TcpOptions(in *v1beta2.TcpOptions, out *TcpOptions, s conversion.Scope) error { + return autoConvert_v1beta2_TcpOptions_To_v1beta1_TcpOptions(in, out, s) +} + +func autoConvert_v1beta1_TerminatePreemptionAction_To_v1beta2_TerminatePreemptionAction(in *TerminatePreemptionAction, out *v1beta2.TerminatePreemptionAction, s conversion.Scope) error { + out.PreserveBootVolume = (*bool)(unsafe.Pointer(in.PreserveBootVolume)) + return nil +} + +// Convert_v1beta1_TerminatePreemptionAction_To_v1beta2_TerminatePreemptionAction is an autogenerated conversion function. +func Convert_v1beta1_TerminatePreemptionAction_To_v1beta2_TerminatePreemptionAction(in *TerminatePreemptionAction, out *v1beta2.TerminatePreemptionAction, s conversion.Scope) error { + return autoConvert_v1beta1_TerminatePreemptionAction_To_v1beta2_TerminatePreemptionAction(in, out, s) +} + +func autoConvert_v1beta2_TerminatePreemptionAction_To_v1beta1_TerminatePreemptionAction(in *v1beta2.TerminatePreemptionAction, out *TerminatePreemptionAction, s conversion.Scope) error { + out.PreserveBootVolume = (*bool)(unsafe.Pointer(in.PreserveBootVolume)) + return nil +} + +// Convert_v1beta2_TerminatePreemptionAction_To_v1beta1_TerminatePreemptionAction is an autogenerated conversion function. +func Convert_v1beta2_TerminatePreemptionAction_To_v1beta1_TerminatePreemptionAction(in *v1beta2.TerminatePreemptionAction, out *TerminatePreemptionAction, s conversion.Scope) error { + return autoConvert_v1beta2_TerminatePreemptionAction_To_v1beta1_TerminatePreemptionAction(in, out, s) +} + +func autoConvert_v1beta1_UdpOptions_To_v1beta2_UdpOptions(in *UdpOptions, out *v1beta2.UdpOptions, s conversion.Scope) error { + out.DestinationPortRange = (*v1beta2.PortRange)(unsafe.Pointer(in.DestinationPortRange)) + out.SourcePortRange = (*v1beta2.PortRange)(unsafe.Pointer(in.SourcePortRange)) + return nil +} + +// Convert_v1beta1_UdpOptions_To_v1beta2_UdpOptions is an autogenerated conversion function. +func Convert_v1beta1_UdpOptions_To_v1beta2_UdpOptions(in *UdpOptions, out *v1beta2.UdpOptions, s conversion.Scope) error { + return autoConvert_v1beta1_UdpOptions_To_v1beta2_UdpOptions(in, out, s) +} + +func autoConvert_v1beta2_UdpOptions_To_v1beta1_UdpOptions(in *v1beta2.UdpOptions, out *UdpOptions, s conversion.Scope) error { + out.DestinationPortRange = (*PortRange)(unsafe.Pointer(in.DestinationPortRange)) + out.SourcePortRange = (*PortRange)(unsafe.Pointer(in.SourcePortRange)) + return nil +} + +// Convert_v1beta2_UdpOptions_To_v1beta1_UdpOptions is an autogenerated conversion function. +func Convert_v1beta2_UdpOptions_To_v1beta1_UdpOptions(in *v1beta2.UdpOptions, out *UdpOptions, s conversion.Scope) error { + return autoConvert_v1beta2_UdpOptions_To_v1beta1_UdpOptions(in, out, s) +} + +func autoConvert_v1beta1_VCN_To_v1beta2_VCN(in *VCN, out *v1beta2.VCN, s conversion.Scope) error { + out.ID = (*string)(unsafe.Pointer(in.ID)) + out.Name = in.Name + out.CIDR = in.CIDR + // WARNING: in.NatGatewayId requires manual conversion: does not exist in peer-type + // WARNING: in.InternetGatewayId requires manual conversion: does not exist in peer-type + // WARNING: in.ServiceGatewayId requires manual conversion: does not exist in peer-type + // WARNING: in.PrivateRouteTableId requires manual conversion: does not exist in peer-type + // WARNING: in.PublicRouteTableId requires manual conversion: does not exist in peer-type + out.Subnets = *(*[]*v1beta2.Subnet)(unsafe.Pointer(&in.Subnets)) + // WARNING: in.NetworkSecurityGroups requires manual conversion: does not exist in peer-type + return nil +} + +func autoConvert_v1beta2_VCN_To_v1beta1_VCN(in *v1beta2.VCN, out *VCN, s conversion.Scope) error { + out.ID = (*string)(unsafe.Pointer(in.ID)) + out.Name = in.Name + out.CIDR = in.CIDR + out.Subnets = *(*[]*Subnet)(unsafe.Pointer(&in.Subnets)) + // WARNING: in.InternetGateway requires manual conversion: does not exist in peer-type + // WARNING: in.NATGateway requires manual conversion: does not exist in peer-type + // WARNING: in.ServiceGateway requires manual conversion: does not exist in peer-type + // WARNING: in.RouteTable requires manual conversion: does not exist in peer-type + // WARNING: in.NetworkSecurityGroup requires manual conversion: does not exist in peer-type + return nil +} + +func autoConvert_v1beta1_VCNPeering_To_v1beta2_VCNPeering(in *VCNPeering, out *v1beta2.VCNPeering, s conversion.Scope) error { + out.DRG = (*v1beta2.DRG)(unsafe.Pointer(in.DRG)) + out.PeerRouteRules = *(*[]v1beta2.PeerRouteRule)(unsafe.Pointer(&in.PeerRouteRules)) + out.RemotePeeringConnections = *(*[]v1beta2.RemotePeeringConnection)(unsafe.Pointer(&in.RemotePeeringConnections)) + return nil +} + +// Convert_v1beta1_VCNPeering_To_v1beta2_VCNPeering is an autogenerated conversion function. +func Convert_v1beta1_VCNPeering_To_v1beta2_VCNPeering(in *VCNPeering, out *v1beta2.VCNPeering, s conversion.Scope) error { + return autoConvert_v1beta1_VCNPeering_To_v1beta2_VCNPeering(in, out, s) +} + +func autoConvert_v1beta2_VCNPeering_To_v1beta1_VCNPeering(in *v1beta2.VCNPeering, out *VCNPeering, s conversion.Scope) error { + out.DRG = (*DRG)(unsafe.Pointer(in.DRG)) + out.PeerRouteRules = *(*[]PeerRouteRule)(unsafe.Pointer(&in.PeerRouteRules)) + out.RemotePeeringConnections = *(*[]RemotePeeringConnection)(unsafe.Pointer(&in.RemotePeeringConnections)) + return nil +} + +// Convert_v1beta2_VCNPeering_To_v1beta1_VCNPeering is an autogenerated conversion function. +func Convert_v1beta2_VCNPeering_To_v1beta1_VCNPeering(in *v1beta2.VCNPeering, out *VCNPeering, s conversion.Scope) error { + return autoConvert_v1beta2_VCNPeering_To_v1beta1_VCNPeering(in, out, s) +} + +func autoConvert_v1beta1_VnicAttachment_To_v1beta2_VnicAttachment(in *VnicAttachment, out *v1beta2.VnicAttachment, s conversion.Scope) error { + out.VnicAttachmentId = (*string)(unsafe.Pointer(in.VnicAttachmentId)) + out.AssignPublicIp = in.AssignPublicIp + out.SubnetName = in.SubnetName + out.DisplayName = (*string)(unsafe.Pointer(in.DisplayName)) + out.NicIndex = (*int)(unsafe.Pointer(in.NicIndex)) + return nil +} + +// Convert_v1beta1_VnicAttachment_To_v1beta2_VnicAttachment is an autogenerated conversion function. +func Convert_v1beta1_VnicAttachment_To_v1beta2_VnicAttachment(in *VnicAttachment, out *v1beta2.VnicAttachment, s conversion.Scope) error { + return autoConvert_v1beta1_VnicAttachment_To_v1beta2_VnicAttachment(in, out, s) +} + +func autoConvert_v1beta2_VnicAttachment_To_v1beta1_VnicAttachment(in *v1beta2.VnicAttachment, out *VnicAttachment, s conversion.Scope) error { + out.VnicAttachmentId = (*string)(unsafe.Pointer(in.VnicAttachmentId)) + out.AssignPublicIp = in.AssignPublicIp + out.SubnetName = in.SubnetName + out.DisplayName = (*string)(unsafe.Pointer(in.DisplayName)) + out.NicIndex = (*int)(unsafe.Pointer(in.NicIndex)) + return nil +} + +// Convert_v1beta2_VnicAttachment_To_v1beta1_VnicAttachment is an autogenerated conversion function. +func Convert_v1beta2_VnicAttachment_To_v1beta1_VnicAttachment(in *v1beta2.VnicAttachment, out *VnicAttachment, s conversion.Scope) error { + return autoConvert_v1beta2_VnicAttachment_To_v1beta1_VnicAttachment(in, out, s) +} diff --git a/api/v1beta2/conditions_consts.go b/api/v1beta2/conditions_consts.go new file mode 100644 index 00000000..f3b79858 --- /dev/null +++ b/api/v1beta2/conditions_consts.go @@ -0,0 +1,104 @@ +/* + 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 v1beta2 + +import clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + +const ( + // InstanceReadyCondition Ready indicates the instance is in a Running state. + InstanceReadyCondition clusterv1.ConditionType = "InstanceReady" + // InstanceNotFoundReason used when the instance couldn't be retrieved. + InstanceNotFoundReason = "InstanceNotFound" + // InstanceTerminatedReason instance is in a terminated state. + InstanceTerminatedReason = "InstanceTerminated" + // InstanceTerminatingReason instance is in terminating state. + InstanceTerminatingReason = "InstanceTerminating" + // InstanceNotReadyReason used when the instance is in a pending state. + InstanceNotReadyReason = "InstanceNotReady" + // InstanceProvisionStartedReason set when the provisioning of an instance started. + InstanceProvisionStartedReason = "InstanceProvisionStarted" + // InstanceProvisionFailedReason used for failures during instance provisioning. + InstanceProvisionFailedReason = "InstanceProvisionFailed" + // WaitingForClusterInfrastructureReason used when machine is waiting for cluster infrastructure to be ready before proceeding. + WaitingForClusterInfrastructureReason = "WaitingForClusterInfrastructure" + // WaitingForBootstrapDataReason used when machine is waiting for bootstrap data to be ready before proceeding. + WaitingForBootstrapDataReason = "WaitingForBootstrapData" + // InstanceLBackendAdditionFailedReason used when addition to LB backend fails + InstanceLBackendAdditionFailedReason = "BackendAdditionFailed" + // ClusterReadyCondition Ready indicates the cluster is Ready. + ClusterReadyCondition clusterv1.ConditionType = "ClusterReady" + // VcnReconciliationFailedReason used when the vcn reconciliation is failed. + VcnReconciliationFailedReason = "VcnReconciliationFailed" + // DrgReconciliationFailedReason used when the DRG reconciliation fails. + DrgReconciliationFailedReason = "DRGReconciliationFailed" + // DRGVCNAttachmentReconciliationFailedReason used when the DRG VCN Attachment reconciliation fails. + DRGVCNAttachmentReconciliationFailedReason = "DRGVCNAttachmentReconciliationFailed" + // DRGRPCAttachmentReconciliationFailedReason used when the DRG RPC Attachment reconciliation fails. + DRGRPCAttachmentReconciliationFailedReason = "DRGRPCAttachmentReconciliationFailed" + // InternetGatewayReconciliationFailedReason used when the InternetGateway reconciliation is failed. + InternetGatewayReconciliationFailedReason = "InternetGatewayReconciliationFailed" + // NatGatewayReconciliationFailedReason used when the NatGateway reconciliation is failed. + NatGatewayReconciliationFailedReason = "NatGatewayReconciliationFailed" + // ServiceGatewayReconciliationFailedReason used when the ServiceGateway reconciliation is failed. + ServiceGatewayReconciliationFailedReason = "ServiceGatewayReconciliationFailed" + // NSGReconciliationFailedReason used when the NSG reconciliation is failed. + NSGReconciliationFailedReason = "NSGReconciliationFailed" + // RouteTableReconciliationFailedReason used when the RouteTable reconciliation is failed. + RouteTableReconciliationFailedReason = "RouteTableReconciliationFailed" + // SubnetReconciliationFailedReason used when the Subnet reconciliation is failed. + SubnetReconciliationFailedReason = "SubnetReconciliationFailed" + // SecurityListReconciliationFailedReason used when the SecurityList reconciliation is failed. + SecurityListReconciliationFailedReason = "SecurityListReconciliationFailed" + // APIServerLoadBalancerFailedReason used when the Subnet reconciliation is failed. + APIServerLoadBalancerFailedReason = "APIServerLoadBalancerReconciliationFailed" + // FailureDomainFailedReason used when the Subnet reconciliation is failed. + FailureDomainFailedReason = "FailureDomainFailedReconciliationFailed" + // InstanceLBBackendAdditionFailedReason used when addition to LB backend fails + InstanceLBBackendAdditionFailedReason = "BackendAdditionFailed" + // InstanceVnicAttachmentFailedReason used when attaching vnics to machine + InstanceVnicAttachmentFailedReason = "VnicAttachmentFailed" + // InstanceIPAddressNotFound used when IP address of the instance count not be found + InstanceIPAddressNotFound = "InstanceIPAddressNotFound" + // VcnEventReady used after reconciliation has completed successfully + VcnEventReady = "VCNReady" + // DrgEventReady used after reconciliation has completed successfully + DrgEventReady = "DRGReady" + // DRGVCNAttachmentEventReady used after reconciliation has completed successfully + DRGVCNAttachmentEventReady = "DRGVCNAttachmentEventReady" + // DRGRPCAttachmentEventReady used after reconciliation has completed successfully + DRGRPCAttachmentEventReady = "DRGRPCAttachmentEventReady" + // InternetGatewayEventReady used after reconciliation has completed successfully + InternetGatewayEventReady = "InternetGatewayReady" + // NatEventReady used after reconciliation has completed successfully + NatEventReady = "NATReady" + // ServiceGatewayEventReady used after reconciliation has completed successfully + ServiceGatewayEventReady = "ServiceGatewayReady" + // NetworkSecurityEventReady used after reconciliation has completed successfully + NetworkSecurityEventReady = "NetworkSecurityReady" + // RouteTableEventReady used after reconciliation has completed successfully + RouteTableEventReady = "RouteTableReady" + // SubnetEventReady used after reconciliation has completed successfully + SubnetEventReady = "SubnetReady" + // InstanceVnicAttachmentReady used after reconciliation has been completed successfully + InstanceVnicAttachmentReady = "VnicAttachmentReady" + // ApiServerLoadBalancerEventReady used after reconciliation has completed successfully + ApiServerLoadBalancerEventReady = "APIServerLoadBalancerReady" + // FailureDomainEventReady used after reconciliation has completed successfully + FailureDomainEventReady = "FailureDomainsReady" + // NamespaceNotAllowedByIdentity used to indicate cluster in a namespace not allowed by identity. + NamespaceNotAllowedByIdentity = "NamespaceNotAllowedByIdentity" +) diff --git a/api/v1beta2/constants.go b/api/v1beta2/constants.go new file mode 100644 index 00000000..958634f7 --- /dev/null +++ b/api/v1beta2/constants.go @@ -0,0 +1,31 @@ +/* + 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 v1beta2 + +const ( + VcnDefaultCidr = "10.0.0.0/16" + ControlPlaneEndpointSubnetDefaultCIDR = "10.0.0.8/29" + ControlPlaneMachineSubnetDefaultCIDR = "10.0.0.0/29" + WorkerSubnetDefaultCIDR = "10.0.64.0/20" + ServiceLoadBalancerDefaultCIDR = "10.0.0.32/27" + APIServerLBBackendSetName = "apiserver-lb-backendset" + APIServerLBListener = "apiserver-lb-listener" + ControlPlaneEndpointDefaultName = "control-plane-endpoint" + ControlPlaneDefaultName = "control-plane" + WorkerDefaultName = "worker" + ServiceLBDefaultName = "service-lb" +) diff --git a/api/v1beta2/conversion.go b/api/v1beta2/conversion.go new file mode 100644 index 00000000..9b562e76 --- /dev/null +++ b/api/v1beta2/conversion.go @@ -0,0 +1,47 @@ +/* + 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 v1beta2 + +// Hub marks OCICluster as a conversion hub. +func (*OCICluster) Hub() {} + +// Hub marks OCIClusterList as a conversion hub. +func (*OCIClusterList) Hub() {} + +// Hub marks OCIClusterTemplate as a conversion hub. +func (*OCIClusterTemplate) Hub() {} + +// Hub marks OCIClusterTemplateList as a conversion hub. +func (*OCIClusterTemplateList) Hub() {} + +// Hub marks OCICluster as a conversion hub. +func (*OCIMachine) Hub() {} + +// Hub marks OCIMachineList as a conversion hub. +func (*OCIMachineList) Hub() {} + +// Hub marks OCIMachineTemplate as a conversion hub. +func (*OCIMachineTemplate) Hub() {} + +// Hub marks OCIMachineTemplateList as a conversion hub. +func (*OCIMachineTemplateList) Hub() {} + +// Hub marks OCIClusterIdentity as a conversion hub. +func (*OCIClusterIdentity) Hub() {} + +// Hub marks OCIClusterIdentityList as a conversion hub. +func (*OCIClusterIdentityList) Hub() {} diff --git a/api/v1beta2/groupversion_info.go b/api/v1beta2/groupversion_info.go new file mode 100644 index 00000000..b9f1a59a --- /dev/null +++ b/api/v1beta2/groupversion_info.go @@ -0,0 +1,36 @@ +/* +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 + + http://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 v1beta2 contains API Schema definitions for the infrastructure v1beta2 API group +// +kubebuilder:object:generate=true +// +groupName=infrastructure.cluster.x-k8s.io +package v1beta2 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "infrastructure.cluster.x-k8s.io", Version: "v1beta2"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/api/v1beta2/ocicluster_types.go b/api/v1beta2/ocicluster_types.go new file mode 100644 index 00000000..bf255195 --- /dev/null +++ b/api/v1beta2/ocicluster_types.go @@ -0,0 +1,140 @@ +/* +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 + + http://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 v1beta2 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" +) + +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. +// Important: Run "make" to regenerate code after modifying this file + +const ( + // ClusterFinalizer allows OCIClusterReconciler to clean up OCI resources associated with OCICluster before + // removing it from the apiserver. + ClusterFinalizer = "ocicluster.infrastructure.cluster.x-k8s.io" +) + +// OCIClusterSpec defines the desired state of OciCluster +type OCIClusterSpec struct { + + // The unique ID which will be used to tag all the resources created by this Cluster. + // The tag will be used to identify resources belonging to this cluster. + // this will be auto-generated and should not be set by the user. + // +optional + OCIResourceIdentifier string `json:"ociResourceIdentifier,omitempty"` + + // IdentityRef is a reference to an identity(principal) to be used when reconciling this cluster + // +optional + IdentityRef *corev1.ObjectReference `json:"identityRef,omitempty"` + + // NetworkSpec encapsulates all things related to OCI network. + // +optional + NetworkSpec NetworkSpec `json:"networkSpec,omitempty"` + + // Free-form tags for this resource. + // +optional + FreeformTags map[string]string `json:"freeformTags,omitempty"` + + // Defined tags for this resource. Each key is predefined and scoped to a + // namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Operations": {"CostCenter": "42"}}` + // +optional + DefinedTags map[string]map[string]string `json:"definedTags,omitempty"` + + // Compartment to create the cluster network. + // +optional + CompartmentId string `json:"compartmentId"` + + // Region the cluster operates in. It must be one of available regions in Region Identifier format. + // See https://docs.oracle.com/en-us/iaas/Content/General/Concepts/regions.htm + Region string `json:"region,omitempty"` + + // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. + // +optional + ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"` + + // 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]OCIAvailabilityDomain `json:"availabilityDomains,omitempty"` +} + +// OCIClusterStatus defines the observed state of OCICluster +type OCIClusterStatus struct { + // +optional + FailureDomains clusterv1.FailureDomains `json:"failureDomains,omitempty"` + + // +optional + Ready bool `json:"ready"` + // NetworkSpec encapsulates all things related to OCI network. + // +optional + Conditions clusterv1.Conditions `json:"conditions,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status + +// OCICluster is the Schema for the ociclusters API. +type OCICluster struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec OCIClusterSpec `json:"spec,omitempty"` + Status OCIClusterStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true +// +kubebuilder:storageversion + +// OCIClusterList contains a list of OCICluster. +type OCIClusterList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []OCICluster `json:"items"` +} + +// OCIAvailabilityDomain contains information about an Availability Domain (AD). +type OCIAvailabilityDomain struct { + + // Name is the AD's full name. Example: Uocm:PHX-AD-1 + Name string `json:"name,omitempty"` + + // FaultDomains a list of fault domain (FD) names. Example: ["FAULT-DOMAIN-1"] + FaultDomains []string `json:"faultDomains,omitempty"` +} + +// GetConditions returns the list of conditions for an OCICluster API object. +func (c *OCICluster) GetConditions() clusterv1.Conditions { + return c.Status.Conditions +} + +// SetConditions will set the given conditions on an OCICluster object. +func (c *OCICluster) SetConditions(conditions clusterv1.Conditions) { + c.Status.Conditions = conditions +} + +// GetOCIResourceIdentifier will return the OCI resource identifier. +func (c *OCICluster) GetOCIResourceIdentifier() string { + return c.Spec.OCIResourceIdentifier +} + +func init() { + SchemeBuilder.Register(&OCICluster{}, &OCIClusterList{}) +} diff --git a/api/v1beta1/ocicluster_webhook.go b/api/v1beta2/ocicluster_webhook.go similarity index 97% rename from api/v1beta1/ocicluster_webhook.go rename to api/v1beta2/ocicluster_webhook.go index 816f76b6..400d3cb6 100644 --- a/api/v1beta1/ocicluster_webhook.go +++ b/api/v1beta2/ocicluster_webhook.go @@ -17,7 +17,7 @@ * */ -package v1beta1 +package v1beta2 import ( "fmt" @@ -38,8 +38,8 @@ var ( _ webhook.Validator = &OCICluster{} ) -// +kubebuilder:webhook:verbs=create;update,path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-ocicluster,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ociclusters,versions=v1beta1,name=validation.ocicluster.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 -// +kubebuilder:webhook:verbs=create;update,path=/mutate-infrastructure-cluster-x-k8s-io-v1beta1-ocicluster,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ociclusters,versions=v1beta1,name=default.ocicluster.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-infrastructure-cluster-x-k8s-io-v1beta2-ocicluster,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ociclusters,versions=v1beta2,name=validation.ocicluster.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/mutate-infrastructure-cluster-x-k8s-io-v1beta2-ocicluster,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ociclusters,versions=v1beta2,name=default.ocicluster.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 func (c *OCICluster) Default() { if c.Spec.OCIResourceIdentifier == "" { @@ -47,7 +47,7 @@ func (c *OCICluster) Default() { } if !c.Spec.NetworkSpec.SkipNetworkManagement { c.Spec.NetworkSpec.Vcn.Subnets = c.SubnetSpec() - c.Spec.NetworkSpec.Vcn.NetworkSecurityGroups = c.NSGSpec() + c.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List = c.NSGSpec() } } @@ -216,8 +216,10 @@ func (c *OCICluster) SubnetSpec() []*Subnet { } func (c *OCICluster) NSGSpec() []*NSG { - nsgs := c.Spec.NetworkSpec.Vcn.NetworkSecurityGroups - + nsgs := c.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List + if c.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.Skip { + return nsgs + } if !c.IsNSGExitsByRole(ControlPlaneEndpointRole) && !c.IsSecurityListExitsByRole(ControlPlaneEndpointRole) { nsgs = append(nsgs, &NSG{ Role: ControlPlaneEndpointRole, @@ -707,7 +709,7 @@ func (c *OCICluster) GetNodeSubnet() []*Subnet { } func (c *OCICluster) IsNSGExitsByRole(role Role) bool { - for _, nsg := range c.Spec.NetworkSpec.Vcn.NetworkSecurityGroups { + for _, nsg := range c.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List { if role == nsg.Role { return true } diff --git a/api/v1beta1/ocicluster_webhook_test.go b/api/v1beta2/ocicluster_webhook_test.go similarity index 89% rename from api/v1beta1/ocicluster_webhook_test.go rename to api/v1beta2/ocicluster_webhook_test.go index e2213d87..a8e89cbb 100644 --- a/api/v1beta1/ocicluster_webhook_test.go +++ b/api/v1beta2/ocicluster_webhook_test.go @@ -17,7 +17,7 @@ * */ -package v1beta1 +package v1beta2 import ( "strings" @@ -312,14 +312,16 @@ func TestOCICluster_ValidateCreate(t *testing.T) { Spec: OCIClusterSpec{ NetworkSpec: NetworkSpec{ Vcn: VCN{ - NetworkSecurityGroups: []*NSG{{ - EgressRules: []EgressSecurityRuleForNSG{{ - EgressSecurityRule: EgressSecurityRule{ - Destination: common.String("bad/15"), - DestinationType: EgressSecurityRuleDestinationTypeCidrBlock, - }, + NetworkSecurityGroup: NetworkSecurityGroup{ + List: []*NSG{{ + EgressRules: []EgressSecurityRuleForNSG{{ + EgressSecurityRule: EgressSecurityRule{ + Destination: common.String("bad/15"), + DestinationType: EgressSecurityRuleDestinationTypeCidrBlock, + }, + }}, }}, - }}, + }, }, }, }, @@ -336,14 +338,16 @@ func TestOCICluster_ValidateCreate(t *testing.T) { Spec: OCIClusterSpec{ NetworkSpec: NetworkSpec{ Vcn: VCN{ - NetworkSecurityGroups: []*NSG{{ - IngressRules: []IngressSecurityRuleForNSG{{ - IngressSecurityRule: IngressSecurityRule{ - Source: common.String("bad/15"), - SourceType: IngressSecurityRuleSourceTypeCidrBlock, - }, + NetworkSecurityGroup: NetworkSecurityGroup{ + List: []*NSG{{ + IngressRules: []IngressSecurityRuleForNSG{{ + IngressSecurityRule: IngressSecurityRule{ + Source: common.String("bad/15"), + SourceType: IngressSecurityRuleSourceTypeCidrBlock, + }, + }}, }}, - }}, + }, }, }, }, @@ -360,9 +364,11 @@ func TestOCICluster_ValidateCreate(t *testing.T) { Spec: OCIClusterSpec{ NetworkSpec: NetworkSpec{ Vcn: VCN{ - NetworkSecurityGroups: []*NSG{{ - Role: "bad-role", - }}, + NetworkSecurityGroup: NetworkSecurityGroup{ + List: []*NSG{{ + Role: "bad-role", + }}, + }, }, }, }, @@ -377,9 +383,9 @@ func TestOCICluster_ValidateCreate(t *testing.T) { Spec: OCIClusterSpec{ NetworkSpec: NetworkSpec{ Vcn: VCN{ - NetworkSecurityGroups: []*NSG{{ + NetworkSecurityGroup: NetworkSecurityGroup{List: []*NSG{{ Role: PodRole, - }}, + }}}, }, }, }, @@ -606,7 +612,26 @@ func TestOCICluster_CreateDefault(t *testing.T) { }, }, expect: func(g *gomega.WithT, c *OCICluster) { - g.Expect(c.Spec.NetworkSpec.Vcn.NetworkSecurityGroups).To(Equal(c.NSGSpec())) + g.Expect(c.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List).To(Equal(c.NSGSpec())) + }, + }, + { + name: "should set default nsg", + c: &OCICluster{ + ObjectMeta: metav1.ObjectMeta{}, + Spec: OCIClusterSpec{ + CompartmentId: "ocid", + NetworkSpec: NetworkSpec{ + Vcn: VCN{ + NetworkSecurityGroup: NetworkSecurityGroup{ + Skip: true, + }, + }, + }, + }, + }, + expect: func(g *gomega.WithT, c *OCICluster) { + g.Expect(len(c.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List)).To(Equal(0)) }, }, { @@ -667,14 +692,16 @@ func TestOCICluster_CreateDefault(t *testing.T) { CompartmentId: "ocid", NetworkSpec: NetworkSpec{ Vcn: VCN{ - NetworkSecurityGroups: []*NSG{ - { - Role: ServiceLoadBalancerRole, - Name: ServiceLBDefaultName, - }, - { - Role: ControlPlaneEndpointRole, - Name: ControlPlaneEndpointDefaultName, + NetworkSecurityGroup: NetworkSecurityGroup{ + List: []*NSG{ + { + Role: ServiceLoadBalancerRole, + Name: ServiceLBDefaultName, + }, + { + Role: ControlPlaneEndpointRole, + Name: ControlPlaneEndpointDefaultName, + }, }, }, }, @@ -704,7 +731,7 @@ func TestOCICluster_CreateDefault(t *testing.T) { EgressRules: c.GetNodeDefaultEgressRules(), }, } - g.Expect(c.Spec.NetworkSpec.Vcn.NetworkSecurityGroups).To(Equal(nsgs)) + g.Expect(c.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List).To(Equal(nsgs)) }, }, } diff --git a/api/v1beta2/ociclusteridentity_types.go b/api/v1beta2/ociclusteridentity_types.go new file mode 100644 index 00000000..8dc52865 --- /dev/null +++ b/api/v1beta2/ociclusteridentity_types.go @@ -0,0 +1,102 @@ +/* + Copyright (c) 2022, 2023 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 v1beta2 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" +) + +type PrincipalType string + +const ( + // UserPrincipal represents a user principal. + UserPrincipal PrincipalType = "UserPrincipal" +) + +// OCIClusterIdentitySpec defines the parameters that are used to create an OCIClusterIdentity. +type OCIClusterIdentitySpec struct { + // Type is the type of OCI Principal used. + // UserPrincipal is the only supported value + Type PrincipalType `json:"type"` + + // PrincipalSecret is a secret reference which contains the authentication credentials for the principal. + // +optional + PrincipalSecret corev1.SecretReference `json:"principalSecret,omitempty"` + + // AllowedNamespaces is used to identify the namespaces the clusters are allowed to use the identity from. + // Namespaces can be selected either using an array of namespaces or with label selector. + // An empty allowedNamespaces object indicates that OCIClusters can use this identity from any namespace. + // If this object is nil, no namespaces will be allowed (default behaviour, if this field is not provided) + // A namespace should be either in the NamespaceList or match with Selector to use the identity. + // + // +optional + // +nullable + AllowedNamespaces *AllowedNamespaces `json:"allowedNamespaces"` +} + +// AllowedNamespaces defines the namespaces the clusters are allowed to use the identity from +type AllowedNamespaces struct { + // A nil or empty list indicates that OCICluster cannot use the identity from any namespace. + // NamespaceList takes precedence over the Selector. + // +optional + // +nullable + NamespaceList []string `json:"list"` + + // Selector is a selector of namespaces that OCICluster can + // use this Identity from. This is a standard Kubernetes LabelSelector, + // a label query over a set of resources. The result of matchLabels and + // matchExpressions are ANDed. + // + // A nil or empty selector indicates that OCICluster cannot use this + // OCIClusterIdentity from any namespace. + // +optional + Selector *metav1.LabelSelector `json:"selector"` +} + +// OCIClusterIdentityStatus defines the observed state of OCIClusterIdentity. +type OCIClusterIdentityStatus struct { + // Conditions defines current service state of the OCIClusterIdentity. + // +optional + Conditions clusterv1.Conditions `json:"conditions,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +// +kubebuilder:storageversion + +// OCIClusterIdentity is the Schema for the OCI Cluster Identity API +type OCIClusterIdentity struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec OCIClusterIdentitySpec `json:"spec,omitempty"` + Status OCIClusterIdentityStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// OCIClusterIdentityList contains a list of OCIClusterIdentity. +type OCIClusterIdentityList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []OCIClusterIdentity `json:"items"` +} + +func init() { + SchemeBuilder.Register(&OCIClusterIdentity{}, &OCIClusterIdentityList{}) +} diff --git a/api/v1beta2/ociclustertemplate_types.go b/api/v1beta2/ociclustertemplate_types.go new file mode 100644 index 00000000..dd1dfd23 --- /dev/null +++ b/api/v1beta2/ociclustertemplate_types.go @@ -0,0 +1,57 @@ +/* +Copyright (c) 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 + + http://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 v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// OCIClusterTemplateSpec defines the desired state of OCIClusterTemplate. +type OCIClusterTemplateSpec struct { + Template OCIClusterTemplateResource `json:"template"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=ociclustertemplates,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion + +// OCIClusterTemplate is the Schema for the ociclustertemplates API. +type OCIClusterTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec OCIClusterTemplateSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true + +// OCIClusterTemplateList contains a list of OCIClusterTemplate. +type OCIClusterTemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []OCIClusterTemplate `json:"items"` +} + +func init() { + SchemeBuilder.Register(&OCIClusterTemplate{}, &OCIClusterTemplateList{}) +} + +// OCIClusterTemplateResource describes the data needed to create an OCICluster from a template. +type OCIClusterTemplateResource struct { + Spec OCIClusterSpec `json:"spec"` +} diff --git a/api/v1beta2/ocimachine_types.go b/api/v1beta2/ocimachine_types.go new file mode 100644 index 00000000..c33edc74 --- /dev/null +++ b/api/v1beta2/ocimachine_types.go @@ -0,0 +1,199 @@ +/* +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 + + http://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 v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + "sigs.k8s.io/cluster-api/errors" +) + +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. +// Important: Run "make" to regenerate code after modifying this file + +const ( + // MachineFinalizer allows ReconcileMachine to clean up OCI resources associated with OCIMachine before + // removing it from the apiserver. + MachineFinalizer = "ocimachine.infrastructure.cluster.x-k8s.io" +) + +// OCIMachineSpec defines the desired state of OCIMachine +// Please read the API https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/Instance/LaunchInstance +// for more information about the parameters below +type OCIMachineSpec struct { + // OCID of launched compute instance. + // +optional + InstanceId *string `json:"instanceId,omitempty"` + + // OCID of the image to be used to launch the instance. + ImageId string `json:"imageId,omitempty"` + + // Compartment to launch the instance in. + CompartmentId string `json:"compartmentId,omitempty"` + + // Shape of the instance. + Shape string `json:"shape,omitempty"` + + IpxeScript *string `json:"ipxeScript,omitempty"` + + // CapacityReservationId defines the OCID of the compute capacity reservation this instance is launched under. + // You can opt out of all default reservations by specifying an empty string as input for this field. + // For more information, see Capacity Reservations (https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/reserve-capacity.htm#default). + CapacityReservationId *string `json:"capacityReservationId,omitempty"` + + // The shape configuration of rhe instance, applicable for flex instances. + ShapeConfig ShapeConfig `json:"shapeConfig,omitempty"` + + // NetworkDetails defines the configuration options for the network + NetworkDetails NetworkDetails `json:"networkDetails,omitempty"` + + // VnicAttachments defines the configuration options for the vnic(s) attached to the machine + // The network bandwidth and number of VNICs scale proportionately with the number of OCPUs. + VnicAttachments []VnicAttachment `json:"vnicAttachments,omitempty"` + + // LaunchOptions defines the options for tuning the compatibility and performance of VM shapes + LaunchOptions *LaunchOptions `json:"launchOptions,omitempty"` + + // InstanceOptions defines the instance options + InstanceOptions *InstanceOptions `json:"instanceOptions,omitempty"` + + // LaunchInstanceAvailabilityConfig defines the options for VM migration during infrastructure maintenance events and for defining + // the availability of a VM instance after a maintenance event that impacts the underlying hardware. + AvailabilityConfig *LaunchInstanceAvailabilityConfig `json:"availabilityConfig,omitempty"` + + // PreemptibleInstanceConfig Configuration options for preemptible instances. + PreemptibleInstanceConfig *PreemptibleInstanceConfig `json:"preemptibleInstanceConfig,omitempty"` + + // AgentConfig defines the options for the Oracle Cloud Agent software running on the instance. + AgentConfig *LaunchInstanceAgentConfig `json:"agentConfig,omitempty"` + + // InstanceSourceViaImageConfig defines the options for booting up instances via images + InstanceSourceViaImageDetails *InstanceSourceViaImageConfig `json:"instanceSourceViaImageConfig,omitempty"` + + // PlatformConfig defines the platform config parameters + PlatformConfig *PlatformConfig `json:"platformConfig,omitempty"` + + // DedicatedVmHostId defines the OCID of the dedicated VM host. + DedicatedVmHostId *string `json:"dedicatedVmHostId,omitempty"` + + // Provider ID of the instance, this will be set by Cluster API provider itself, + // users should not set this parameter. + // +optional + ProviderID *string `json:"providerID,omitempty"` + + // Is in transit encryption of volumes required. + // +kubebuilder:default=true + // +optional + IsPvEncryptionInTransitEnabled bool `json:"isPvEncryptionInTransitEnabled,omitempty"` + + // The size of boot volume. Please see https://docs.oracle.com/en-us/iaas/Content/Block/Tasks/extendingbootpartition.htm + // to extend the boot volume size. + BootVolumeSizeInGBs string `json:"bootVolumeSizeInGBs,omitempty"` + + // Custom metadata key/value pairs that you provide, such as the SSH public key + // required to connect to the instance. + Metadata map[string]string `json:"metadata,omitempty"` + + // Free-form tags for this resource. + // +optional + FreeformTags map[string]string `json:"freeformTags,omitempty"` + + // Defined tags for this resource. Each key is predefined and scoped to a + // namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Operations": {"CostCenter": "42"}}` + // +optional + DefinedTags map[string]map[string]string `json:"definedTags,omitempty"` + + // The name of the subnet to use. The name here refers to the subnets + // defined in the OCICluster Spec. Optional, only if multiple subnets of a type + // is defined, else the first element is used. + // +optional + SubnetName string `json:"subnetName,omitempty"` +} + +// OCIMachineStatus defines the observed state of OCIMachine. +type OCIMachineStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of machine + + // Flag set to true when machine is ready. + // +optional + Ready bool `json:"ready,omitempty"` + + // Addresses contains the addresses of the associated OCI instance. + Addresses []clusterv1.MachineAddress `json:"addresses,omitempty"` + + // Error status on the machine. + // +optional + FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"` + + // The error message corresponding to the error on the machine. + // +optional + FailureMessage *string `json:"failureMessage,omitempty"` + + // Launch instance work request ID. + // +optional + LaunchInstanceWorkRequestId string `json:"launchInstanceWorkRequestId,omitempty"` + + // Create Backend OPC work request ID for the machine backend. + // +optional + CreateBackendWorkRequestId string `json:"createBackendWorkRequestId,omitempty"` + + // Delete Backend OPC work request ID for the machine backend. + // +optional + DeleteBackendWorkRequestId string `json:"deleteBackendWorkRequestId,omitempty"` + + // Conditions defines current service state of the OCIMachine. + // +optional + Conditions clusterv1.Conditions `json:"conditions,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +// +kubebuilder:storageversion + +// OCIMachine is the Schema for the ocimachines API. +type OCIMachine struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec OCIMachineSpec `json:"spec,omitempty"` + Status OCIMachineStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true +// +kubebuilder:storageversion + +// OCIMachineList contains a list of OCIMachine. +type OCIMachineList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []OCIMachine `json:"items"` +} + +// GetConditions returns the list of conditions for an OCIMachine API object. +func (m *OCIMachine) GetConditions() clusterv1.Conditions { + return m.Status.Conditions +} + +// SetConditions will set the given conditions on an OCIMachine object. +func (m *OCIMachine) SetConditions(conditions clusterv1.Conditions) { + m.Status.Conditions = conditions +} + +func init() { + SchemeBuilder.Register(&OCIMachine{}, &OCIMachineList{}) +} diff --git a/api/v1beta2/ocimachinetemplate_types.go b/api/v1beta2/ocimachinetemplate_types.go new file mode 100644 index 00000000..d5f55193 --- /dev/null +++ b/api/v1beta2/ocimachinetemplate_types.go @@ -0,0 +1,58 @@ +/* + 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 v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// OCIMachineTemplateSpec defines the desired state of OCIMachineTemplate. +type OCIMachineTemplateSpec struct { + Template OCIMachineTemplateResource `json:"template"` +} + +// OCIMachineTemplateResource describes the data needed to create an OCIMachine from a template. +type OCIMachineTemplateResource struct { + // Spec is the specification of the desired behavior of the machine. + Spec OCIMachineSpec `json:"spec"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=ocimachinetemplates,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion + +// OCIMachineTemplate is the schema for the OCI compute instance machine template. +type OCIMachineTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec OCIMachineTemplateSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:storageversion + +// OCIMachineTemplateList contains a list of OCIMachineTemplate. +type OCIMachineTemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []OCIMachineTemplate `json:"items"` +} + +func init() { + SchemeBuilder.Register(&OCIMachineTemplate{}, &OCIMachineTemplateList{}) +} diff --git a/api/v1beta1/ocimachinetemplate_webhook.go b/api/v1beta2/ocimachinetemplate_webhook.go similarity index 95% rename from api/v1beta1/ocimachinetemplate_webhook.go rename to api/v1beta2/ocimachinetemplate_webhook.go index 4b966a48..c33b5936 100644 --- a/api/v1beta1/ocimachinetemplate_webhook.go +++ b/api/v1beta2/ocimachinetemplate_webhook.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1beta1 +package v1beta2 import ( "fmt" @@ -30,7 +30,7 @@ var ( _ webhook.Validator = &OCIMachineTemplate{} ) -// +kubebuilder:webhook:verbs=create;update,path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-ocimachinetemplate,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ocimachinetemplates,versions=v1beta1,name=validation.ocimachinetemplate.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-infrastructure-cluster-x-k8s-io-v1beta2-ocimachinetemplate,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ocimachinetemplates,versions=v1beta2,name=validation.ocimachinetemplate.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 func (m *OCIMachineTemplate) SetupWebhookWithManager(mgr ctrl.Manager) error { return ctrl.NewWebhookManagedBy(mgr). diff --git a/api/v1beta1/ocimachinetemplate_webhook_test.go b/api/v1beta2/ocimachinetemplate_webhook_test.go similarity index 99% rename from api/v1beta1/ocimachinetemplate_webhook_test.go rename to api/v1beta2/ocimachinetemplate_webhook_test.go index 35a8aa1b..0667f6c6 100644 --- a/api/v1beta1/ocimachinetemplate_webhook_test.go +++ b/api/v1beta2/ocimachinetemplate_webhook_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1beta1 +package v1beta2 import ( "strings" diff --git a/api/v1beta2/types.go b/api/v1beta2/types.go new file mode 100644 index 00000000..3fb36bcc --- /dev/null +++ b/api/v1beta2/types.go @@ -0,0 +1,1068 @@ +/* + 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 v1beta2 + +const ( + ControlPlaneRole = "control-plane" + ControlPlaneEndpointRole = "control-plane-endpoint" + WorkerRole = "worker" + ServiceLoadBalancerRole = "service-lb" + PodRole = "pod" + Private = "private" + Public = "public" +) + +// OCIClusterSubnetRoles a slice of all the subnet roles for self managed cluster +var OCIClusterSubnetRoles = []Role{ControlPlaneRole, ControlPlaneEndpointRole, WorkerRole, ServiceLoadBalancerRole} + +// OCIManagedClusterSubnetRoles a slice of all the subnet roles for managed cluster +var OCIManagedClusterSubnetRoles = []Role{PodRole, ControlPlaneEndpointRole, WorkerRole, ServiceLoadBalancerRole} + +// NetworkDetails defines the configuration options for the network +type NetworkDetails struct { + // AssignPublicIp defines whether the instance should have a public IP address + AssignPublicIp bool `json:"assignPublicIp,omitempty"` + + // SubnetName defines the subnet name to use for the VNIC + SubnetName string `json:"subnetName,omitempty"` + + // SkipSourceDestCheck defines whether the source/destination check is disabled on the VNIC. + SkipSourceDestCheck *bool `json:"skipSourceDestCheck,omitempty"` + + // NsgNames defines a list of the nsg names of the network security groups (NSGs) to add the VNIC to. + NsgNames []string `json:"nsgNames,omitempty"` + + // HostnameLabel defines the hostname for the VNIC's primary private IP. Used for DNS. + HostnameLabel *string `json:"hostnameLabel,omitempty"` + + // DisplayName defines a user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `json:"displayName,omitempty"` + + // AssignPrivateDnsRecord defines whether the VNIC should be assigned a DNS record. + AssignPrivateDnsRecord *bool `json:"assignPrivateDnsRecord,omitempty"` +} + +type VnicAttachment struct { + // VnicAttachmentId defines the ID of the VnicAttachment + VnicAttachmentId *string `json:"vnicAttachmentId,omitempty"` + + // AssignPublicIp defines whether the vnic should have a public IP address + // +optional + AssignPublicIp bool `json:"assignPublicIp,omitempty"` + + // SubnetName defines the subnet name to use for the VNIC + // Defaults to the "worker" subnet if not provided + // +optional + SubnetName string `json:"subnetName,omitempty"` + + // DisplayName defines a user-friendly name. Does not have to be unique. + // Avoid entering confidential information. + DisplayName *string `json:"displayName"` + + // NicIndex defines which physical Network Interface Card (NIC) to use + // You can determine which NICs are active for a shape by reviewing the + // https://docs.oracle.com/en-us/iaas/Content/Compute/References/computeshapes.htm + // +optional + NicIndex *int `json:"nicIndex,omitempty"` +} + +// LaunchOptionsBootVolumeTypeEnum Enum with underlying type: string +type LaunchOptionsBootVolumeTypeEnum string + +// Set of constants representing the allowable values for LaunchOptionsBootVolumeTypeEnum +const ( + LaunchOptionsBootVolumeTypeIscsi LaunchOptionsBootVolumeTypeEnum = "ISCSI" + LaunchOptionsBootVolumeTypeScsi LaunchOptionsBootVolumeTypeEnum = "SCSI" + LaunchOptionsBootVolumeTypeIde LaunchOptionsBootVolumeTypeEnum = "IDE" + LaunchOptionsBootVolumeTypeVfio LaunchOptionsBootVolumeTypeEnum = "VFIO" + LaunchOptionsBootVolumeTypeParavirtualized LaunchOptionsBootVolumeTypeEnum = "PARAVIRTUALIZED" +) + +// LaunchOptionsFirmwareEnum Enum with underlying type: string +type LaunchOptionsFirmwareEnum string + +// Set of constants representing the allowable values for LaunchOptionsFirmwareEnum +const ( + LaunchOptionsFirmwareBios LaunchOptionsFirmwareEnum = "BIOS" + LaunchOptionsFirmwareUefi64 LaunchOptionsFirmwareEnum = "UEFI_64" +) + +// LaunchOptionsNetworkTypeEnum Enum with underlying type: string +type LaunchOptionsNetworkTypeEnum string + +// Set of constants representing the allowable values for LaunchOptionsNetworkTypeEnum +const ( + LaunchOptionsNetworkTypeE1000 LaunchOptionsNetworkTypeEnum = "E1000" + LaunchOptionsNetworkTypeVfio LaunchOptionsNetworkTypeEnum = "VFIO" + LaunchOptionsNetworkTypeParavirtualized LaunchOptionsNetworkTypeEnum = "PARAVIRTUALIZED" +) + +// LaunchOptionsRemoteDataVolumeTypeEnum Enum with underlying type: string +type LaunchOptionsRemoteDataVolumeTypeEnum string + +// Set of constants representing the allowable values for LaunchOptionsRemoteDataVolumeTypeEnum +const ( + LaunchOptionsRemoteDataVolumeTypeIscsi LaunchOptionsRemoteDataVolumeTypeEnum = "ISCSI" + LaunchOptionsRemoteDataVolumeTypeScsi LaunchOptionsRemoteDataVolumeTypeEnum = "SCSI" + LaunchOptionsRemoteDataVolumeTypeIde LaunchOptionsRemoteDataVolumeTypeEnum = "IDE" + LaunchOptionsRemoteDataVolumeTypeVfio LaunchOptionsRemoteDataVolumeTypeEnum = "VFIO" + LaunchOptionsRemoteDataVolumeTypeParavirtualized LaunchOptionsRemoteDataVolumeTypeEnum = "PARAVIRTUALIZED" +) + +// LaunchOptions Options for tuning the compatibility and performance of VM shapes. The values that you specify override any +// default values. +type LaunchOptions struct { + + // BootVolumeType defines Emulation type for the boot volume. + // * `ISCSI` - ISCSI attached block storage device. + // * `SCSI` - Emulated SCSI disk. + // * `IDE` - Emulated IDE disk. + // * `VFIO` - Direct attached Virtual Function storage. This is the default option for local data + // volumes on platform images. + // * `PARAVIRTUALIZED` - Paravirtualized disk. This is the default for boot volumes and remote block + // storage volumes on platform images. + BootVolumeType LaunchOptionsBootVolumeTypeEnum `json:"bootVolumeType,omitempty"` + + // Firmware defines the firmware used to boot VM. Select the option that matches your operating system. + // * `BIOS` - Boot VM using BIOS style firmware. This is compatible with both 32 bit and 64 bit operating + // systems that boot using MBR style bootloaders. + // * `UEFI_64` - Boot VM using UEFI style firmware compatible with 64 bit operating systems. This is the + // default for platform images. + Firmware LaunchOptionsFirmwareEnum `json:"firmware,omitempty"` + + // NetworkType defines the emulation type for the physical network interface card (NIC). + // * `E1000` - Emulated Gigabit ethernet controller. Compatible with Linux e1000 network driver. + // * `VFIO` - Direct attached Virtual Function network controller. This is the networking type + // when you launch an instance using hardware-assisted (SR-IOV) networking. + // * `PARAVIRTUALIZED` - VM instances launch with paravirtualized devices using VirtIO drivers. + NetworkType LaunchOptionsNetworkTypeEnum `json:"networkType,omitempty"` + + // RemoteDataVolumeType defines the emulation type for volume. + // * `ISCSI` - ISCSI attached block storage device. + // * `SCSI` - Emulated SCSI disk. + // * `IDE` - Emulated IDE disk. + // * `VFIO` - Direct attached Virtual Function storage. This is the default option for local data + // volumes on platform images. + // * `PARAVIRTUALIZED` - Paravirtualized disk. This is the default for boot volumes and remote block + // storage volumes on platform images. + RemoteDataVolumeType LaunchOptionsRemoteDataVolumeTypeEnum `json:"remoteDataVolumeType,omitempty"` + + // IsConsistentVolumeNamingEnabled defines whether to enable consistent volume naming feature. Defaults to false. + IsConsistentVolumeNamingEnabled *bool `json:"isConsistentVolumeNamingEnabled,omitempty"` +} + +// InstanceSourceViaImageConfig The configuration options for booting up instances via images +type InstanceSourceViaImageConfig struct { + // KmsKeyId defines the OCID of the Key Management key to assign as the master encryption key for the boot volume. + KmsKeyId *string `json:"kmsKeyId,omitempty"` + + // BootVolumeVpusPerGB defines the number of volume performance units (VPUs) that will be applied to this volume per GB, + // representing the Block Volume service's elastic performance options. + // See Block Volume Performance Levels (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/blockvolumeperformance.htm#perf_levels) for more information. + // Allowed values: + // * `10`: Represents Balanced option. + // * `20`: Represents Higher Performance option. + // * `30`-`120`: Represents the Ultra High Performance option. + // For volumes with the auto-tuned performance feature enabled, this is set to the default (minimum) VPUs/GB. + BootVolumeVpusPerGB *int64 `json:"bootVolumeVpusPerGB,omitempty"` +} + +// LaunchInstanceAvailabilityConfigDetailsRecoveryActionEnum Enum with underlying type: string +type PlatformConfigTypeEnum string + +// Set of constants representing the allowable values for LaunchInstanceAvailabilityConfigDetailsRecoveryActionEnum +const ( + PlatformConfigTypeAmdRomeBmGpu PlatformConfigTypeEnum = "AMD_ROME_BM_GPU" + PlatformConfigTypeAmdRomeBm PlatformConfigTypeEnum = "AMD_ROME_BM" + PlatformConfigTypeIntelIcelakeBm PlatformConfigTypeEnum = "INTEL_ICELAKE_BM" + PlatformConfigTypeAmdvm PlatformConfigTypeEnum = "AMD_VM" + PlatformConfigTypeIntelVm PlatformConfigTypeEnum = "INTEL_VM" + PlatformConfigTypeIntelSkylakeBm PlatformConfigTypeEnum = "INTEL_SKYLAKE_BM" + PlatformConfigTypeAmdMilanBm PlatformConfigTypeEnum = "AMD_MILAN_BM" +) + +// PlatformConfig defines the platform config parameters +type PlatformConfig struct { + // The type of platform configuration. Valid values are + // * `AMD_ROME_BM_GPU` + // * `AMD_ROME_BM` + // * `INTEL_ICELAKE_BM` + // * `AMD_VM` + // * `INTEL_VM` + // * `INTEL_SKYLAKE_BM` + // * `AMD_MILAN_BM` + // Based on the enum, exactly one of the specific configuration types must be set + PlatformConfigType PlatformConfigTypeEnum `json:"platformConfigType,omitempty"` + + // AmdMilanBmPlatformConfig describe AMD Milan BM platform configuration + AmdMilanBmPlatformConfig AmdMilanBmPlatformConfig `json:"amdMilanBmPlatformConfig,omitempty"` + + // AmdMilanBmPlatformConfig describe AMD Rome BM platform configuration + AmdRomeBmPlatformConfig AmdRomeBmPlatformConfig `json:"amdRomeBmPlatformConfig,omitempty"` + + // AmdMilanBmPlatformConfig describe Intel Skylke BM platform configuration + IntelSkylakeBmPlatformConfig IntelSkylakeBmPlatformConfig `json:"intelSkylakeBmPlatformConfig,omitempty"` + + // AmdMilanBmPlatformConfig describe Intel Skylke BM platform configuration + IntelIcelakeBmPlatformConfig IntelIcelakeBmPlatformConfig `json:"intelIcelakeBmPlatformConfig,omitempty"` + + // AmdMilanBmPlatformConfig describe AMD Rome BM platform configuration + AmdRomeBmGpuPlatformConfig AmdRomeBmGpuPlatformConfig `json:"amdRomeBmGpuPlatformConfig,omitempty"` + + // AmdMilanBmPlatformConfig describe Intel VM platform configuration + IntelVmPlatformConfig IntelVmPlatformConfig `json:"intelVmPlatformConfig,omitempty"` + + // AmdMilanBmPlatformConfig describe AMD VM platform configuration + AmdVmPlatformConfig AmdVmPlatformConfig `json:"amdVmPlatformConfig,omitempty"` +} + +// AmdMilanBmPlatformConfigNumaNodesPerSocketEnum Enum with underlying type: string +type AmdMilanBmPlatformConfigNumaNodesPerSocketEnum string + +// Set of constants representing the allowable values for AmdMilanBmPlatformConfigNumaNodesPerSocketEnum +const ( + AmdMilanBmPlatformConfigNumaNodesPerSocketNps0 AmdMilanBmPlatformConfigNumaNodesPerSocketEnum = "NPS0" + AmdMilanBmPlatformConfigNumaNodesPerSocketNps1 AmdMilanBmPlatformConfigNumaNodesPerSocketEnum = "NPS1" + AmdMilanBmPlatformConfigNumaNodesPerSocketNps2 AmdMilanBmPlatformConfigNumaNodesPerSocketEnum = "NPS2" + AmdMilanBmPlatformConfigNumaNodesPerSocketNps4 AmdMilanBmPlatformConfigNumaNodesPerSocketEnum = "NPS4" +) + +// AmdMilanBmPlatformConfig The platform configuration used when launching a bare metal instance with one of the following shapes: BM.Standard.E4.128 +// or BM.DenseIO.E4.128 (the AMD Milan platform). +type AmdMilanBmPlatformConfig struct { + // Whether Secure Boot is enabled on the instance. + IsSecureBootEnabled *bool `json:"isSecureBootEnabled,omitempty"` + + // Whether the Trusted Platform Module (TPM) is enabled on the instance. + IsTrustedPlatformModuleEnabled *bool `json:"isTrustedPlatformModuleEnabled,omitempty"` + + // Whether the Measured Boot feature is enabled on the instance. + IsMeasuredBootEnabled *bool `json:"isMeasuredBootEnabled,omitempty"` + + // Whether the instance is a confidential instance. If this value is `true`, the instance is a confidential instance. The default value is `false`. + IsMemoryEncryptionEnabled *bool `json:"isMemoryEncryptionEnabled,omitempty"` + + // Whether symmetric multithreading is enabled on the instance. Symmetric multithreading is also + // called simultaneous multithreading (SMT) or Intel Hyper-Threading. + // Intel and AMD processors have two hardware execution threads per core (OCPU). SMT permits multiple + // independent threads of execution, to better use the resources and increase the efficiency + // of the CPU. When multithreading is disabled, only one thread is permitted to run on each core, which + // can provide higher or more predictable performance for some workloads. + IsSymmetricMultiThreadingEnabled *bool `json:"isSymmetricMultiThreadingEnabled,omitempty"` + + // Whether the Access Control Service is enabled on the instance. When enabled, + // the platform can enforce PCIe device isolation, required for VFIO device pass-through. + IsAccessControlServiceEnabled *bool `json:"isAccessControlServiceEnabled,omitempty"` + + // Whether virtualization instructions are available. For example, Secure Virtual Machine for AMD shapes + // or VT-x for Intel shapes. + AreVirtualInstructionsEnabled *bool `json:"areVirtualInstructionsEnabled,omitempty"` + + // Whether the input-output memory management unit is enabled. + IsInputOutputMemoryManagementUnitEnabled *bool `json:"isInputOutputMemoryManagementUnitEnabled,omitempty"` + + // The percentage of cores enabled. Value must be a multiple of 25%. If the requested percentage + // results in a fractional number of cores, the system rounds up the number of cores across processors + // and provisions an instance with a whole number of cores. + // If the applications that you run on the instance use a core-based licensing model and need fewer cores + // than the full size of the shape, you can disable cores to reduce your licensing costs. The instance + // itself is billed for the full shape, regardless of whether all cores are enabled. + PercentageOfCoresEnabled *int `json:"percentageOfCoresEnabled,omitempty"` + + // The number of NUMA nodes per socket (NPS). + // The following values are supported: + // * `NPS0` + // * `NPS1` + // * `NPS2` + // * `NPS4` + NumaNodesPerSocket AmdMilanBmPlatformConfigNumaNodesPerSocketEnum `json:"numaNodesPerSocket,omitempty"` +} + +// AmdRomeBmPlatformConfigNumaNodesPerSocketEnum Enum with underlying type: string +type AmdRomeBmPlatformConfigNumaNodesPerSocketEnum string + +// Set of constants representing the allowable values for AmdRomeBmPlatformConfigNumaNodesPerSocketEnum +const ( + AmdRomeBmPlatformConfigNumaNodesPerSocketNps0 AmdRomeBmPlatformConfigNumaNodesPerSocketEnum = "NPS0" + AmdRomeBmPlatformConfigNumaNodesPerSocketNps1 AmdRomeBmPlatformConfigNumaNodesPerSocketEnum = "NPS1" + AmdRomeBmPlatformConfigNumaNodesPerSocketNps2 AmdRomeBmPlatformConfigNumaNodesPerSocketEnum = "NPS2" + AmdRomeBmPlatformConfigNumaNodesPerSocketNps4 AmdRomeBmPlatformConfigNumaNodesPerSocketEnum = "NPS4" +) + +// AmdRomeBmPlatformConfig The platform configuration of a bare metal instance that uses the BM.Standard.E3.128 shape (the AMD Rome platform). +type AmdRomeBmPlatformConfig struct { + // Whether Secure Boot is enabled on the instance. + IsSecureBootEnabled *bool `json:"isSecureBootEnabled,omitempty"` + + // Whether the Trusted Platform Module (TPM) is enabled on the instance. + IsTrustedPlatformModuleEnabled *bool `json:"isTrustedPlatformModuleEnabled,omitempty"` + + // Whether the Measured Boot feature is enabled on the instance. + IsMeasuredBootEnabled *bool `json:"isMeasuredBootEnabled,omitempty"` + + // Whether the instance is a confidential instance. If this value is `true`, the instance is a confidential instance. The default value is `false`. + IsMemoryEncryptionEnabled *bool `json:"isMemoryEncryptionEnabled,omitempty"` + + // Whether symmetric multithreading is enabled on the instance. Symmetric multithreading is also + // called simultaneous multithreading (SMT) or Intel Hyper-Threading. + // Intel and AMD processors have two hardware execution threads per core (OCPU). SMT permits multiple + // independent threads of execution, to better use the resources and increase the efficiency + // of the CPU. When multithreading is disabled, only one thread is permitted to run on each core, which + // can provide higher or more predictable performance for some workloads. + IsSymmetricMultiThreadingEnabled *bool `json:"isSymmetricMultiThreadingEnabled,omitempty"` + + // Whether the Access Control Service is enabled on the instance. When enabled, + // the platform can enforce PCIe device isolation, required for VFIO device pass-through. + IsAccessControlServiceEnabled *bool `json:"isAccessControlServiceEnabled,omitempty"` + + // Whether virtualization instructions are available. For example, Secure Virtual Machine for AMD shapes + // or VT-x for Intel shapes. + AreVirtualInstructionsEnabled *bool `json:"areVirtualInstructionsEnabled,omitempty"` + + // Whether the input-output memory management unit is enabled. + IsInputOutputMemoryManagementUnitEnabled *bool `json:"isInputOutputMemoryManagementUnitEnabled,omitempty"` + + // The percentage of cores enabled. Value must be a multiple of 25%. If the requested percentage + // results in a fractional number of cores, the system rounds up the number of cores across processors + // and provisions an instance with a whole number of cores. + // If the applications that you run on the instance use a core-based licensing model and need fewer cores + // than the full size of the shape, you can disable cores to reduce your licensing costs. The instance + // itself is billed for the full shape, regardless of whether all cores are enabled. + PercentageOfCoresEnabled *int `json:"percentageOfCoresEnabled,omitempty"` + + // The number of NUMA nodes per socket (NPS). + // The following values are supported: + // * `NPS0` + // * `NPS1` + // * `NPS2` + // * `NPS4` + NumaNodesPerSocket AmdRomeBmPlatformConfigNumaNodesPerSocketEnum `json:"numaNodesPerSocket,omitempty"` +} + +// IntelSkylakeBmPlatformConfig The platform configuration of a bare metal instance that uses one of the following shapes: +// BM.Standard2.52, BM.GPU2.2, BM.GPU3.8, or BM.DenseIO2.52 (the Intel Skylake platform). +type IntelSkylakeBmPlatformConfig struct { + // Whether Secure Boot is enabled on the instance. + IsSecureBootEnabled *bool `json:"isSecureBootEnabled,omitempty"` + + // Whether the Trusted Platform Module (TPM) is enabled on the instance. + IsTrustedPlatformModuleEnabled *bool `json:"isTrustedPlatformModuleEnabled,omitempty"` + + // Whether the Measured Boot feature is enabled on the instance. + IsMeasuredBootEnabled *bool `json:"isMeasuredBootEnabled,omitempty"` + + // Whether the instance is a confidential instance. If this value is `true`, the instance is a confidential instance. The default value is `false`. + IsMemoryEncryptionEnabled *bool `json:"isMemoryEncryptionEnabled,omitempty"` +} + +// AmdRomeBmGpuPlatformConfigNumaNodesPerSocketEnum Enum with underlying type: string +type AmdRomeBmGpuPlatformConfigNumaNodesPerSocketEnum string + +// Set of constants representing the allowable values for AmdRomeBmGpuPlatformConfigNumaNodesPerSocketEnum +const ( + AmdRomeBmGpuPlatformConfigNumaNodesPerSocketNps0 AmdRomeBmGpuPlatformConfigNumaNodesPerSocketEnum = "NPS0" + AmdRomeBmGpuPlatformConfigNumaNodesPerSocketNps1 AmdRomeBmGpuPlatformConfigNumaNodesPerSocketEnum = "NPS1" + AmdRomeBmGpuPlatformConfigNumaNodesPerSocketNps2 AmdRomeBmGpuPlatformConfigNumaNodesPerSocketEnum = "NPS2" + AmdRomeBmGpuPlatformConfigNumaNodesPerSocketNps4 AmdRomeBmGpuPlatformConfigNumaNodesPerSocketEnum = "NPS4" +) + +// AmdRomeBmGpuPlatformConfig The platform configuration of a bare metal GPU instance that uses the BM.GPU4.8 shape +// (the AMD Rome platform). +type AmdRomeBmGpuPlatformConfig struct { + // Whether Secure Boot is enabled on the instance. + IsSecureBootEnabled *bool `json:"isSecureBootEnabled,omitempty"` + + // Whether the Trusted Platform Module (TPM) is enabled on the instance. + IsTrustedPlatformModuleEnabled *bool `json:"isTrustedPlatformModuleEnabled,omitempty"` + + // Whether the Measured Boot feature is enabled on the instance. + IsMeasuredBootEnabled *bool `json:"isMeasuredBootEnabled,omitempty"` + + // Whether the instance is a confidential instance. If this value is `true`, the instance is a confidential instance. The default value is `false`. + IsMemoryEncryptionEnabled *bool `json:"isMemoryEncryptionEnabled,omitempty"` + + // Whether symmetric multithreading is enabled on the instance. Symmetric multithreading is also + // called simultaneous multithreading (SMT) or Intel Hyper-Threading. + // Intel and AMD processors have two hardware execution threads per core (OCPU). SMT permits multiple + // independent threads of execution, to better use the resources and increase the efficiency + // of the CPU. When multithreading is disabled, only one thread is permitted to run on each core, which + // can provide higher or more predictable performance for some workloads. + IsSymmetricMultiThreadingEnabled *bool `json:"isSymmetricMultiThreadingEnabled,omitempty"` + + // Whether the Access Control Service is enabled on the instance. When enabled, + // the platform can enforce PCIe device isolation, required for VFIO device pass-through. + IsAccessControlServiceEnabled *bool `json:"isAccessControlServiceEnabled,omitempty"` + + // Whether virtualization instructions are available. For example, Secure Virtual Machine for AMD shapes + // or VT-x for Intel shapes. + AreVirtualInstructionsEnabled *bool `json:"areVirtualInstructionsEnabled,omitempty"` + + // Whether the input-output memory management unit is enabled. + IsInputOutputMemoryManagementUnitEnabled *bool `json:"isInputOutputMemoryManagementUnitEnabled,omitempty"` + + // The number of NUMA nodes per socket (NPS). + // The following values are supported: + // * `NPS0` + // * `NPS1` + // * `NPS2` + // * `NPS4` + NumaNodesPerSocket AmdRomeBmGpuPlatformConfigNumaNodesPerSocketEnum `json:"numaNodesPerSocket,omitempty"` +} + +// IntelIcelakeBmPlatformConfigNumaNodesPerSocketEnum Enum with underlying type: string +type IntelIcelakeBmPlatformConfigNumaNodesPerSocketEnum string + +// Set of constants representing the allowable values for IntelIcelakeBmPlatformConfigNumaNodesPerSocketEnum +const ( + IntelIcelakeBmPlatformConfigNumaNodesPerSocketNps1 IntelIcelakeBmPlatformConfigNumaNodesPerSocketEnum = "NPS1" + IntelIcelakeBmPlatformConfigNumaNodesPerSocketNps2 IntelIcelakeBmPlatformConfigNumaNodesPerSocketEnum = "NPS2" +) + +// IntelIcelakeBmPlatformConfig The platform configuration of a bare metal instance that uses the BM.Standard3.64 shape or the +// BM.Optimized3.36 shape (the Intel Ice Lake platform). +type IntelIcelakeBmPlatformConfig struct { + // Whether Secure Boot is enabled on the instance. + IsSecureBootEnabled *bool `json:"isSecureBootEnabled,omitempty"` + + // Whether the Trusted Platform Module (TPM) is enabled on the instance. + IsTrustedPlatformModuleEnabled *bool `json:"isTrustedPlatformModuleEnabled,omitempty"` + + // Whether the Measured Boot feature is enabled on the instance. + IsMeasuredBootEnabled *bool `json:"isMeasuredBootEnabled,omitempty"` + + // Whether the instance is a confidential instance. If this value is `true`, the instance is a confidential instance. The default value is `false`. + IsMemoryEncryptionEnabled *bool `json:"isMemoryEncryptionEnabled,omitempty"` + + // Whether symmetric multithreading is enabled on the instance. Symmetric multithreading is also + // called simultaneous multithreading (SMT) or Intel Hyper-Threading. + // Intel and AMD processors have two hardware execution threads per core (OCPU). SMT permits multiple + // independent threads of execution, to better use the resources and increase the efficiency + // of the CPU. When multithreading is disabled, only one thread is permitted to run on each core, which + // can provide higher or more predictable performance for some workloads. + IsSymmetricMultiThreadingEnabled *bool `json:"isSymmetricMultiThreadingEnabled,omitempty"` + + // Whether the input-output memory management unit is enabled. + IsInputOutputMemoryManagementUnitEnabled *bool `json:"isInputOutputMemoryManagementUnitEnabled,omitempty"` + + // The percentage of cores enabled. Value must be a multiple of 25%. If the requested percentage + // results in a fractional number of cores, the system rounds up the number of cores across processors + // and provisions an instance with a whole number of cores. + // If the applications that you run on the instance use a core-based licensing model and need fewer cores + // than the full size of the shape, you can disable cores to reduce your licensing costs. The instance + // itself is billed for the full shape, regardless of whether all cores are enabled. + PercentageOfCoresEnabled *int `json:"percentageOfCoresEnabled,omitempty"` + + // The number of NUMA nodes per socket (NPS). + // The following values are supported: + // * `NPS1` + // * `NPS2` + NumaNodesPerSocket IntelIcelakeBmPlatformConfigNumaNodesPerSocketEnum `json:"numaNodesPerSocket,omitempty"` +} + +// IntelVmPlatformConfig The platform configuration of a virtual machine instance that uses the Intel platform. +type IntelVmPlatformConfig struct { + // Whether Secure Boot is enabled on the instance. + IsSecureBootEnabled *bool `json:"isSecureBootEnabled,omitempty"` + + // Whether the Trusted Platform Module (TPM) is enabled on the instance. + IsTrustedPlatformModuleEnabled *bool `json:"isTrustedPlatformModuleEnabled,omitempty"` + + // Whether the Measured Boot feature is enabled on the instance. + IsMeasuredBootEnabled *bool `json:"isMeasuredBootEnabled,omitempty"` + + // Whether the instance is a confidential instance. If this value is `true`, the instance is a confidential instance. The default value is `false`. + IsMemoryEncryptionEnabled *bool `json:"isMemoryEncryptionEnabled,omitempty"` +} + +// AmdVmPlatformConfig The platform configuration of a virtual machine instance that uses the AMD platform. +type AmdVmPlatformConfig struct { + // Whether Secure Boot is enabled on the instance. + IsSecureBootEnabled *bool `json:"isSecureBootEnabled,omitempty"` + + // Whether the Trusted Platform Module (TPM) is enabled on the instance. + IsTrustedPlatformModuleEnabled *bool `json:"isTrustedPlatformModuleEnabled,omitempty"` + + // Whether the Measured Boot feature is enabled on the instance. + IsMeasuredBootEnabled *bool `json:"isMeasuredBootEnabled,omitempty"` + + // Whether the instance is a confidential instance. If this value is `true`, the instance is a confidential instance. The default value is `false`. + IsMemoryEncryptionEnabled *bool `json:"isMemoryEncryptionEnabled,omitempty"` +} + +// InstanceOptions Optional mutable instance options +type InstanceOptions struct { + + // Whether to disable the legacy (/v1) instance metadata service endpoints. + // Customers who have migrated to /v2 should set this to true for added security. + // Default is false. + AreLegacyImdsEndpointsDisabled *bool `json:"areLegacyImdsEndpointsDisabled,omitempty"` +} + +// LaunchInstanceAvailabilityConfigDetailsRecoveryActionEnum Enum with underlying type: string +type LaunchInstanceAvailabilityConfigDetailsRecoveryActionEnum string + +// Set of constants representing the allowable values for LaunchInstanceAvailabilityConfigDetailsRecoveryActionEnum +const ( + LaunchInstanceAvailabilityConfigDetailsRecoveryActionRestoreInstance LaunchInstanceAvailabilityConfigDetailsRecoveryActionEnum = "RESTORE_INSTANCE" + LaunchInstanceAvailabilityConfigDetailsRecoveryActionStopInstance LaunchInstanceAvailabilityConfigDetailsRecoveryActionEnum = "STOP_INSTANCE" +) + +// LaunchInstanceAvailabilityConfig Options for VM migration during infrastructure maintenance events and for defining +// the availability of a VM instance after a maintenance event that impacts the underlying hardware. +type LaunchInstanceAvailabilityConfig struct { + + // IsLiveMigrationPreferred defines whether to live migrate supported VM instances to a healthy physical VM host without + // disrupting running instances during infrastructure maintenance events. If null, Oracle + // chooses the best option for migrating the VM during infrastructure maintenance events. + IsLiveMigrationPreferred *bool `json:"isLiveMigrationPreferred,omitempty"` + + //RecoveryAction defines the lifecycle state for an instance when it is recovered after infrastructure maintenance. + // * `RESTORE_INSTANCE` - The instance is restored to the lifecycle state it was in before the maintenance event. + // If the instance was running, it is automatically rebooted. This is the default action when a value is not set. + // * `STOP_INSTANCE` - The instance is recovered in the stopped state. + RecoveryAction LaunchInstanceAvailabilityConfigDetailsRecoveryActionEnum `json:"recoveryAction,omitempty"` +} + +// PreemptibleInstanceConfig Configuration options for preemptible instances. +type PreemptibleInstanceConfig struct { + // TerminatePreemptionAction terminates the preemptible instance when it is interrupted for eviction. + TerminatePreemptionAction *TerminatePreemptionAction `json:"terminatePreemptionAction,omitempty"` +} + +// TerminatePreemptionAction Terminates the preemptible instance when it is interrupted for eviction. +type TerminatePreemptionAction struct { + + // PreserveBootVolume defines whether to preserve the boot volume that was used to launch the preemptible instance when the instance is terminated. Defaults to false if not specified. + PreserveBootVolume *bool `json:"preserveBootVolume,omitempty"` +} + +// LaunchInstanceAgentConfig Configuration options for the Oracle Cloud Agent software running on the instance. +type LaunchInstanceAgentConfig struct { + + // IsMonitoringDisabled defines whether Oracle Cloud Agent can gather performance metrics and monitor the instance using the + // monitoring plugins. Default value is false (monitoring plugins are enabled). + // These are the monitoring plugins: Compute Instance Monitoring + // and Custom Logs Monitoring. + // The monitoring plugins are controlled by this parameter and by the per-plugin + // configuration in the `pluginsConfig` object. + // - If `isMonitoringDisabled` is true, all of the monitoring plugins are disabled, regardless of + // the per-plugin configuration. + // - If `isMonitoringDisabled` is false, all of the monitoring plugins are enabled. You + // can optionally disable individual monitoring plugins by providing a value in the `pluginsConfig` + // object. + IsMonitoringDisabled *bool `json:"isMonitoringDisabled,omitempty"` + + // IsManagementDisabled defines whether Oracle Cloud Agent can run all the available management plugins. + // Default value is false (management plugins are enabled). + // These are the management plugins: OS Management Service Agent and Compute Instance + // Run Command. + // The management plugins are controlled by this parameter and by the per-plugin + // configuration in the `pluginsConfig` object. + // - If `isManagementDisabled` is true, all of the management plugins are disabled, regardless of + // the per-plugin configuration. + // - If `isManagementDisabled` is false, all of the management plugins are enabled. You + // can optionally disable individual management plugins by providing a value in the `pluginsConfig` + // object. + IsManagementDisabled *bool `json:"isManagementDisabled,omitempty"` + + // AreAllPluginsDisabled defines whether Oracle Cloud Agent can run all the available plugins. + // This includes the management and monitoring plugins. + // To get a list of available plugins, use the + // ListInstanceagentAvailablePlugins + // operation in the Oracle Cloud Agent API. For more information about the available plugins, see + // Managing Plugins with Oracle Cloud Agent (https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/manage-plugins.htm). + AreAllPluginsDisabled *bool `json:"areAllPluginsDisabled,omitempty"` + + // PluginsConfig defines the configuration of plugins associated with this instance. + PluginsConfig []InstanceAgentPluginConfig `json:"pluginsConfigs,omitempty"` +} + +// InstanceAgentPluginConfigDetailsDesiredStateEnum Enum with underlying type: string +type InstanceAgentPluginConfigDetailsDesiredStateEnum string + +// Set of constants representing the allowable values for InstanceAgentPluginConfigDetailsDesiredStateEnum +const ( + InstanceAgentPluginConfigDetailsDesiredStateEnabled InstanceAgentPluginConfigDetailsDesiredStateEnum = "ENABLED" + InstanceAgentPluginConfigDetailsDesiredStateDisabled InstanceAgentPluginConfigDetailsDesiredStateEnum = "DISABLED" +) + +// InstanceAgentPluginConfig defines the configuration of plugins associated with this instance. +type InstanceAgentPluginConfig struct { + + // Name defines the name of the plugin. To get a list of available plugins, use the + // ListInstanceagentAvailablePlugins + // operation in the Oracle Cloud Agent API. For more information about the available plugins, see + // Managing Plugins with Oracle Cloud Agent (https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/manage-plugins.htm). + Name *string `json:"name,omitempty"` + + // DesiredState defines whether the plugin should be enabled or disabled. + // To enable the monitoring and management plugins, the `isMonitoringDisabled` and + // `isManagementDisabled` attributes must also be set to false. + // The following values are supported: + // * `ENABLED` + // * `DISABLED` + DesiredState InstanceAgentPluginConfigDetailsDesiredStateEnum `json:"desiredState,omitempty"` +} + +// ShapeConfig defines the configuration options for the compute instance shape +// https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/LaunchInstanceShapeConfigDetails +type ShapeConfig struct { + // The total number of OCPUs available to the instance. + Ocpus string `json:"ocpus,omitempty"` + + // The total amount of memory available to the instance, in gigabytes. + MemoryInGBs string `json:"memoryInGBs,omitempty"` + + // The baseline OCPU utilization for a subcore burstable VM instance. Leave this attribute blank for a + // non-burstable instance, or explicitly specify non-burstable with `BASELINE_1_1`. + // The following values are supported: + // - `BASELINE_1_8` - baseline usage is 1/8 of an OCPU. + // - `BASELINE_1_2` - baseline usage is 1/2 of an OCPU. + // - `BASELINE_1_1` - baseline usage is an entire OCPU. This represents a non-burstable instance. + BaselineOcpuUtilization string `json:"baselineOcpuUtilization,omitempty"` + + // Nvmes defines the number of NVMe drives to be used for storage. A single drive has 6.8 TB available. + Nvmes *int `json:"nvmes,omitempty"` +} + +// EgressSecurityRule A rule for allowing outbound IP packets. +type EgressSecurityRule struct { + + // Conceptually, this is the range of IP addresses that a packet originating from the instance + // can go to. + // Allowed values: + // * IP address range in CIDR notation. For example: `192.168.1.0/24` or `2001:0db8:0123:45::/56` + // Note that IPv6 addressing is currently supported only in certain regions. See + // IPv6 Addresses (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + // * The `cidrBlock` value for a Service, if you're + // setting up a security list rule for traffic destined for a particular `Service` through + // a service gateway. For example: `oci-phx-objectstorage`. + Destination *string `json:"destination,omitempty"` + + // The transport protocol. Specify either `all` or an IPv4 protocol number as + // defined in + // Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + // Options are supported only for ICMP ("1"), TCP ("6"), UDP ("17"), and ICMPv6 ("58"). + Protocol *string `json:"protocol,omitempty"` + + // Type of destination for the rule. The default is `CIDR_BLOCK`. + // Allowed values: + // * `CIDR_BLOCK`: If the rule's `destination` is an IP address range in CIDR notation. + // * `SERVICE_CIDR_BLOCK`: If the rule's `destination` is the `cidrBlock` value for a + // Service (the rule is for traffic destined for a + // particular `Service` through a service gateway). + DestinationType EgressSecurityRuleDestinationTypeEnum `json:"destinationType,omitempty"` + + IcmpOptions *IcmpOptions `json:"icmpOptions,omitempty"` + + // A stateless rule allows traffic in one direction. Remember to add a corresponding + // stateless rule in the other direction if you need to support bidirectional traffic. For + // example, if egress traffic allows TCP destination port 80, there should be an ingress + // rule to allow TCP source port 80. Defaults to false, which means the rule is stateful + // and a corresponding rule is not necessary for bidirectional traffic. + IsStateless *bool `json:"isStateless,omitempty"` + + TcpOptions *TcpOptions `json:"tcpOptions,omitempty"` + + UdpOptions *UdpOptions `json:"udpOptions,omitempty"` + + // An optional description of your choice for the rule. + Description *string `json:"description,omitempty"` +} + +// IngressSecurityRule A rule for allowing inbound IP packets. +type IngressSecurityRule struct { + + // The transport protocol. Specify either `all` or an IPv4 protocol number as + // defined in + // Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + // Options are supported only for ICMP ("1"), TCP ("6"), UDP ("17"), and ICMPv6 ("58"). + Protocol *string `json:"protocol,omitempty"` + + // Conceptually, this is the range of IP addresses that a packet coming into the instance + // can come from. + // Allowed values: + // * IP address range in CIDR notation. For example: `192.168.1.0/24` or `2001:0db8:0123:45::/56`. + // IPv6 addressing is supported for all commercial and government regions. See + // IPv6 Addresses (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + // * The `cidrBlock` value for a Service, if you're + // setting up a security list rule for traffic coming from a particular `Service` through + // a service gateway. For example: `oci-phx-objectstorage`. + Source *string `json:"source,omitempty"` + + IcmpOptions *IcmpOptions `json:"icmpOptions,omitempty"` + + // A stateless rule allows traffic in one direction. Remember to add a corresponding + // stateless rule in the other direction if you need to support bidirectional traffic. For + // example, if ingress traffic allows TCP destination port 80, there should be an egress + // rule to allow TCP source port 80. Defaults to false, which means the rule is stateful + // and a corresponding rule is not necessary for bidirectional traffic. + IsStateless *bool `json:"isStateless,omitempty"` + + // Type of source for the rule. The default is `CIDR_BLOCK`. + // * `CIDR_BLOCK`: If the rule's `source` is an IP address range in CIDR notation. + // * `SERVICE_CIDR_BLOCK`: If the rule's `source` is the `cidrBlock` value for a + // Service (the rule is for traffic coming from a + // particular `Service` through a service gateway). + SourceType IngressSecurityRuleSourceTypeEnum `json:"sourceType,omitempty"` + + TcpOptions *TcpOptions `json:"tcpOptions,omitempty"` + + UdpOptions *UdpOptions `json:"udpOptions,omitempty"` + + // An optional description of your choice for the rule. + Description *string `json:"description,omitempty"` +} + +// IngressSecurityRuleForNSG is IngressSecurityRule for NSG +type IngressSecurityRuleForNSG struct { + IngressSecurityRule `json:"ingressRule,omitempty"` +} + +// EgressSecurityRuleForNSG is EgressSecurityRule for NSG. +type EgressSecurityRuleForNSG struct { + EgressSecurityRule `json:"egressRule,omitempty"` +} + +// IngressSecurityRuleSourceTypeEnum Enum with underlying type: string. +type IngressSecurityRuleSourceTypeEnum string + +// Set of constants representing the allowable values for IngressSecurityRuleSourceTypeEnum +const ( + IngressSecurityRuleSourceTypeCidrBlock IngressSecurityRuleSourceTypeEnum = "CIDR_BLOCK" + IngressSecurityRuleSourceTypeServiceCidrBlock IngressSecurityRuleSourceTypeEnum = "SERVICE_CIDR_BLOCK" +) + +// UdpOptions Optional and valid only for UDP. Use to specify particular destination ports for UDP rules. +// If you specify UDP as the protocol but omit this object, then all destination ports are allowed. +type UdpOptions struct { + DestinationPortRange *PortRange `json:"destinationPortRange,omitempty"` + + SourcePortRange *PortRange `json:"sourcePortRange,omitempty"` +} + +// IcmpOptions Optional and valid only for ICMP and ICMPv6. Use to specify a particular ICMP type and code +// as defined in: +// - ICMP Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) +// - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) +// If you specify ICMP or ICMPv6 as the protocol but omit this object, then all ICMP types and +// codes are allowed. If you do provide this object, the type is required and the code is optional. +// To enable MTU negotiation for ingress internet traffic via IPv4, make sure to allow type 3 ("Destination +// Unreachable") code 4 ("Fragmentation Needed and Don't Fragment was Set"). If you need to specify +// multiple codes for a single type, create a separate security list rule for each. +type IcmpOptions struct { + + // The ICMP type. + Type *int `json:"type,omitempty"` + + // The ICMP code (optional). + Code *int `json:"code,omitempty"` +} + +// TcpOptions Optional and valid only for TCP. Use to specify particular destination ports for TCP rules. +// If you specify TCP as the protocol but omit this object, then all destination ports are allowed. +type TcpOptions struct { + DestinationPortRange *PortRange `json:"destinationPortRange,omitempty"` + + SourcePortRange *PortRange `json:"sourcePortRange,omitempty"` +} + +// PortRange The representation of PortRange. +type PortRange struct { + + // The maximum port number, which must not be less than the minimum port number. To specify + // a single port number, set both the min and max to the same value. + Max *int `json:"max,omitempty"` + + // The minimum port number, which must not be greater than the maximum port number. + Min *int `json:"min,omitempty"` +} + +const ( + // EgressSecurityRuleDestinationTypeCidrBlock is the contant for CIDR block security rule destination type + EgressSecurityRuleDestinationTypeCidrBlock EgressSecurityRuleDestinationTypeEnum = "CIDR_BLOCK" + EgressSecurityRuleSourceTypeServiceCidrBlock EgressSecurityRuleDestinationTypeEnum = "SERVICE_CIDR_BLOCK" +) + +type EgressSecurityRuleDestinationTypeEnum string + +// SecurityList defines the configureation for the security list for network virtual firewall +// https://docs.oracle.com/en-us/iaas/Content/Network/Concepts/securitylists.htm +type SecurityList struct { + // ID of the SecurityList. + // +optional + ID *string `json:"id,omitempty"` + // SecurityList Name. + // +optional + Name string `json:"name"` + // EgressRules on the SecurityList. + // +optional + EgressRules []EgressSecurityRule `json:"egressRules,omitempty"` + //IngressRules on the SecurityList. + // +optional + IngressRules []IngressSecurityRule `json:"ingressRules,omitempty"` +} + +// Role defines the unique role of a subnet. +type Role string + +type SubnetType string + +// Subnet defines the configuration for a network's subnet +// https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/managingVCNs_topic-Overview_of_VCNs_and_Subnets.htm#Overview +type Subnet struct { + // Role defines the subnet role (eg. control-plane, control-plane-endpoint, service-lb, worker). + Role Role `json:"role"` + // Subnet OCID. + // +optional + ID *string `json:"id,omitempty"` + // Subnet Name. + Name string `json:"name"` + // Subnet CIDR. + // +optional + CIDR string `json:"cidr,omitempty"` + // Type defines the subnet type (e.g. public, private). + // +optional + Type SubnetType `json:"type,omitempty"` + // The security list associated with Subnet. + // +optional + SecurityList *SecurityList `json:"securityList,omitempty"` +} + +// NSG defines configuration for a Network Security Group. +// https://docs.oracle.com/en-us/iaas/Content/Network/Concepts/networksecuritygroups.htm +type NSG struct { + // NSG OCID. + // +optional + ID *string `json:"id,omitempty"` + // NSG Name. + Name string `json:"name"` + // Role defines the NSG role (eg. control-plane, control-plane-endpoint, service-lb, worker). + Role Role `json:"role,omitempty"` + // EgressRules on the NSG. + // +optional + EgressRules []EgressSecurityRuleForNSG `json:"egressRules,omitempty"` + // IngressRules on the NSG. + // +optional + IngressRules []IngressSecurityRuleForNSG `json:"ingressRules,omitempty"` +} + +// VCN dfines the configuration for a Virtual Cloud Network. +// https://docs.oracle.com/en-us/iaas/Content/Network/Concepts/overview.htm +type VCN struct { + // VCN OCID. + // +optional + ID *string `json:"id,omitempty"` + // VCN Name. + // +optional + Name string `json:"name"` + // VCN CIDR. + // +optional + CIDR string `json:"cidr,omitempty"` + + // Subnets is the configuration for subnets required in the VCN. + // +optional + // +listType=map + // +listMapKey=name + Subnets []*Subnet `json:"subnets,omitempty"` + + // Configuration for Internet Gateway. + // +optional + InternetGateway InternetGateway `json:"internetGateway,omitempty"` + + // Configuration for NAT Gateway. + // +optional + NATGateway NATGateway `json:"natGateway,omitempty"` + + // Configuration for Service Gateway. + // +optional + ServiceGateway ServiceGateway `json:"serviceGateway,omitempty"` + + // Configuration for Route table. + // +optional + RouteTable RouteTable `json:"routeTable,omitempty"` + + // Configuration for NSG management. + // +optional + NetworkSecurityGroup NetworkSecurityGroup `json:"networkSecurityGroup,omitempty"` +} + +// LoadBalancer Configuration +type LoadBalancer struct { + //LoadBalancer Name. + // +optional + Name string `json:"name"` + + // ID of Load Balancer. + // +optional + LoadBalancerId *string `json:"loadBalancerId,omitempty"` +} + +// NetworkSpec specifies what the OCI networking resources should look like. +type NetworkSpec struct { + // SkipNetworkManagement defines if the networking spec(VCN related) specified by the user needs to be reconciled(actioned-upon) + // or used as it is. APIServerLB will still be reconciled. + // +optional + SkipNetworkManagement bool `json:"skipNetworkManagement,omitempty"` + + // VCN configuration. + // +optional + Vcn VCN `json:"vcn,omitempty"` + + //API Server LB configuration. + // +optional + APIServerLB LoadBalancer `json:"apiServerLoadBalancer,omitempty"` + + // VCNPeering configuration. + // +optional + VCNPeering *VCNPeering `json:"vcnPeering,omitempty"` +} + +// VCNPeering defines the VCN peering details of the workload cluster VCN. +type VCNPeering struct { + + // DRG configuration refers to the DRG which has to be created if required. If management cluster + // and workload cluster shares the same DRG, this fields is not required to be specified. + // +optional + DRG *DRG `json:"drg,omitempty"` + + // PeerRouteRules defines the routing rules which will be added to the private route tables + // of the workload cluster VCN. The routes defined here will be directed to DRG. + PeerRouteRules []PeerRouteRule `json:"peerRouteRules,omitempty"` + + // RemotePeeringConnections defines the RPC connections which be established with the + // workload cluster DRG. + RemotePeeringConnections []RemotePeeringConnection `json:"remotePeeringConnections,omitempty"` +} + +// DRG defines the configuration for a Dynamic Resource Group. +type DRG struct { + + // Manage defines whether the DRG has to be managed(including create). If set to false(the default) the ID + // has to be specified by the user to a valid DRG ID to which the VCN has to be attached. + // +optional + Manage bool `json:"manage,omitempty"` + + // Name is the name of the created DRG. + // +optional + Name string `json:"name,omitempty"` + + // ID is the OCID for the created DRG. + // +optional + ID *string `json:"id,omitempty"` + + // VcnAttachmentId is the ID of the VCN attachment of the DRG. + // The workload cluster VCN can be attached to either the management cluster VCN if they are sharing the same DRG + // or to the workload cluster DRG. + // +optional + VcnAttachmentId *string `json:"vcnAttachmentId,omitempty"` +} + +// PeerRouteRule defines a Route Rule to be routed via a DRG. +type PeerRouteRule struct { + // VCNCIDRRange is the CIDR Range of peer VCN to which the + // workload cluster VCN will be peered. The CIDR range is required to add the route rule + // in the workload cluster VCN, the route rule will forward any traffic to the CIDR to the DRG. + // +optional + VCNCIDRRange string `json:"vcnCIDRRange,omitempty"` +} + +// RemotePeeringConnection is used to peer VCNs residing in different regions(typically). +// Remote VCN Peering is explained here - https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/remoteVCNpeering.htm +type RemotePeeringConnection struct { + + // ManagePeerRPC will define if the Peer VCN needs to be managed. If set to true + // a Remote Peering Connection will be created in the Peer DRG and the connection + // will be created between local and peer RPC. + ManagePeerRPC bool `json:"managePeerRPC,omitempty"` + + // PeerRegionName defined the region name of Peer VCN. + PeerRegionName string `json:"peerRegionName,omitempty"` + + // PeerDRGId defines the DRG ID of the peer. + PeerDRGId *string `json:"peerDRGId,omitempty"` + + // PeerRPCConnectionId defines the RPC ID of peer. If ManagePeerRPC is set to true + // this will be created by Cluster API Provider for OCI, otherwise this has be defined by the + // user. + PeerRPCConnectionId *string `json:"peerRPCConnectionId,omitempty"` + + // RPCConnectionId is the connection ID of the connection between peer and local RPC. + RPCConnectionId *string `json:"rpcConnectionId,omitempty"` +} + +// InternetGateway is used to specify the options for creating internet gateway. +type InternetGateway struct { + // Skip specifies whether to skip creating internet gateway even if any one Subnet is public. + // +optional + Skip bool `json:"skip,omitempty"` + + // ID of Internet Gateway. + // +optional + Id *string `json:"id,omitempty"` +} + +// NATGateway is used to specify the options for creating NAT gateway. +type NATGateway struct { + // Skip specifies whether to skip creating NAT gateway even if any one Subnet is private. + // +optional + Skip bool `json:"skip,omitempty"` + + // ID of Nat Gateway. + // +optional + Id *string `json:"id,omitempty"` +} + +// ServiceGateway is used to specify the options for creating Service gateway. +type ServiceGateway struct { + // Skip specifies whether to skip creating Service gateway. + // +optional + Skip bool `json:"skip,omitempty"` + + // ID of Service Gateway. + // +optional + Id *string `json:"id,omitempty"` +} + +// RouteTable is used to specify the options for creating Route table. +type RouteTable struct { + // Skip specifies whether to skip creating Route table. + // +optional + Skip bool `json:"skip,omitempty"` + + // ID of Private Route Table. + // +optional + PrivateRouteTableId *string `json:"privateRouteTableId,omitempty"` + + // ID of Public Route Table. + // +optional + PublicRouteTableId *string `json:"publicRouteTableId,omitempty"` +} + +// NetworkSecurityGroup is used to specify the options for managing network security groups. +type NetworkSecurityGroup struct { + // Skip specifies whether to skip creating network security groups. + // +optional + Skip bool `json:"skip,omitempty"` + + // NetworkSecurityGroup is the configuration for the Network Security Groups required in the VCN. + // +optional + // +listType=map + // +listMapKey=name + List []*NSG `json:"list,omitempty"` +} diff --git a/api/v1beta2/validator.go b/api/v1beta2/validator.go new file mode 100644 index 00000000..86c990da --- /dev/null +++ b/api/v1beta2/validator.go @@ -0,0 +1,244 @@ +/* + * + * Copyright (c) 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 + * + * http://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 v1beta2 + +import ( + "fmt" + "net" + "regexp" + + "github.com/oracle/cluster-api-provider-oci/cloud/ociutil" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +const ( + // can't use: \/"'[]:|<>+=;,.?*@&, Can't start with underscore. Can't end with period or hyphen. + // not using . in the name to avoid issues when the name is part of DNS name. + clusterNameRegex = `^[a-z0-9][a-z0-9-]{0,42}[a-z0-9]$` +) + +// invalidNameRegex is a broad regex used to validate allows names in OCI +var invalidNameRegex = regexp.MustCompile("\\s") + +// ValidOcid is a simple pre-flight +// we will let the serverside handle the more complex and compete validation +func ValidOcid(ocid string) bool { + if len(ocid) >= 4 && ocid[:4] == "ocid" { + return true + } + + return false +} + +// validShape is a simple pre-flight +// we will let the serverside handle the more complex and compete validation. +func validShape(shape string) bool { + return len(shape) > 0 +} + +// ValidRegion test if the string can be a region. +func ValidRegion(stringRegion string) bool { + + // region can be blank since the regional information + // can be derived from other sources + if stringRegion == "" { + return true + } + + if invalidNameRegex.MatchString(stringRegion) { + return false + } + return true +} + +// ValidateNetworkSpec validates the NetworkSpec +func ValidateNetworkSpec(validRoles []Role, networkSpec NetworkSpec, old NetworkSpec, fldPath *field.Path) field.ErrorList { + var allErrs field.ErrorList + + if len(networkSpec.Vcn.CIDR) > 0 { + allErrs = append(allErrs, validateVCNCIDR(networkSpec.Vcn.CIDR, fldPath.Child("cidr"))...) + } + + if networkSpec.Vcn.Subnets != nil { + allErrs = append(allErrs, validateSubnets(validRoles, networkSpec.Vcn.Subnets, networkSpec.Vcn, fldPath.Child("subnets"))...) + } + + if networkSpec.Vcn.NetworkSecurityGroup.List != nil { + allErrs = append(allErrs, validateNSGs(validRoles, networkSpec.Vcn.NetworkSecurityGroup.List, fldPath.Child("networkSecurityGroups"))...) + } + + if len(allErrs) == 0 { + return nil + } + return allErrs +} + +// validateVCNCIDR validates the CIDR of a VNC. +func validateVCNCIDR(vncCIDR string, fldPath *field.Path) field.ErrorList { + var allErrs field.ErrorList + if _, _, err := net.ParseCIDR(vncCIDR); err != nil { + allErrs = append(allErrs, field.Invalid(fldPath, vncCIDR, "invalid CIDR format")) + } + return allErrs +} + +// ValidateClusterName validates the name of the cluster. +func ValidateClusterName(name string) field.ErrorList { + var allErrs field.ErrorList + + if success, _ := regexp.MatchString(clusterNameRegex, name); !success { + allErrs = append(allErrs, field.Invalid(field.NewPath("metadata").Child("Name"), name, + fmt.Sprintf("Cluster Name doesn't match regex %s, can contain only lowercase alphanumeric characters and '-', must start/end with an alphanumeric character", + clusterNameRegex))) + } + if len(allErrs) == 0 { + return nil + } + return allErrs +} + +// validateSubnetCIDR validates the CIDR blocks of a Subnet. +func validateSubnetCIDR(subnetCidr string, vcnCidr string, fldPath *field.Path) field.ErrorList { + var allErrs field.ErrorList + + if len(subnetCidr) > 0 { + subnetCidrIP, _, err := net.ParseCIDR(subnetCidr) + if err != nil { + allErrs = append(allErrs, field.Invalid(fldPath, subnetCidr, "invalid CIDR format")) + } + + // Check subnet is in vcnCidr if vcnCidr is set + if len(vcnCidr) > 0 { + var vcnNetwork *net.IPNet + if _, parseNetwork, err := net.ParseCIDR(vcnCidr); err == nil { + vcnNetwork = parseNetwork + } + + var found bool + if vcnNetwork != nil && vcnNetwork.Contains(subnetCidrIP) { + found = true + } + + if !found { + allErrs = append(allErrs, field.Invalid(fldPath, subnetCidr, fmt.Sprintf("subnet CIDR not in VCN address space: %s", vcnCidr))) + } + } + + } + return allErrs +} + +// validateNSGs validates a list of Subnets. +func validateNSGs(validRoles []Role, networkSecurityGroups []*NSG, fldPath *field.Path) field.ErrorList { + var allErrs field.ErrorList + + for i, nsg := range networkSecurityGroups { + if err := validateRole(validRoles, nsg.Role, fldPath.Index(i).Child("role"), "networkSecurityGroup role invalid"); err != nil { + allErrs = append(allErrs, err) + } + allErrs = append(allErrs, validateEgressSecurityRuleForNSG(nsg.EgressRules, fldPath.Index(i).Child("egressRules"))...) + allErrs = append(allErrs, validateIngressSecurityRuleForNSG(nsg.IngressRules, fldPath.Index(i).Child("ingressRules"))...) + } + + return allErrs +} + +// validateEgressSecurityRuleForNSG validates the Egress Security Rule of a Subnet. +func validateEgressSecurityRuleForNSG(egressRules []EgressSecurityRuleForNSG, fldPath *field.Path) field.ErrorList { + var allErrs field.ErrorList + + for _, r := range egressRules { + rule := r.EgressSecurityRule + + if rule.DestinationType == EgressSecurityRuleDestinationTypeCidrBlock && rule.Destination != nil { + if _, _, err := net.ParseCIDR(ociutil.DerefString(rule.Destination)); err != nil { + allErrs = append(allErrs, field.Invalid(fldPath, rule.Destination, "invalid egressRules CIDR format")) + } + } + } + + return allErrs +} + +// validateEgressSecurityRuleForNSG validates the Egress Security Rule of a Subnet. +func validateIngressSecurityRuleForNSG(egressRules []IngressSecurityRuleForNSG, fldPath *field.Path) field.ErrorList { + var allErrs field.ErrorList + + for _, r := range egressRules { + rule := r.IngressSecurityRule + + if rule.SourceType == IngressSecurityRuleSourceTypeCidrBlock && rule.Source != nil { + if _, _, err := net.ParseCIDR(ociutil.DerefString(rule.Source)); err != nil { + allErrs = append(allErrs, field.Invalid(fldPath, rule.Source, "invalid ingressRule CIDR format")) + } + } + } + + return allErrs +} + +// validateSubnets validates a list of Subnets. +func validateSubnets(validRoles []Role, subnets []*Subnet, vcn VCN, fldPath *field.Path) field.ErrorList { + var allErrs field.ErrorList + subnetNames := make(map[string]bool, len(subnets)) + + for i, subnet := range subnets { + if err := validateSubnetName(subnet.Name, fldPath.Index(i).Child("name")); err != nil { + allErrs = append(allErrs, err) + } + if len(subnet.Name) > 0 { + if _, ok := subnetNames[subnet.Name]; ok { + allErrs = append(allErrs, field.Duplicate(fldPath, subnet.Name)) + } + subnetNames[subnet.Name] = true + } + + if err := validateRole(validRoles, subnet.Role, fldPath.Index(i).Child("role"), "subnet role invalid"); err != nil { + allErrs = append(allErrs, err) + } + + allErrs = append(allErrs, validateSubnetCIDR(subnet.CIDR, vcn.CIDR, fldPath.Index(i).Child("cidr"))...) + } + + return allErrs +} + +// validateSubnetName validates the Name of a Subnet. +func validateSubnetName(name string, fldPath *field.Path) *field.Error { + // subnet name can be empty + if len(name) > 0 { + if invalidNameRegex.Match([]byte(name)) || name == "" { + return field.Invalid(fldPath, name, + fmt.Sprintf("subnet name invalid")) + } + } + return nil +} + +// validateRole validates that the subnet role is one of the allowed types +func validateRole(validRoles []Role, subnetRole Role, fldPath *field.Path, errorMsg string) *field.Error { + for _, role := range validRoles { + if subnetRole == role { + return nil + } + } + return field.Invalid(fldPath, subnetRole, + fmt.Sprintf(errorMsg)) +} diff --git a/api/v1beta2/zz_generated.deepcopy.go b/api/v1beta2/zz_generated.deepcopy.go new file mode 100644 index 00000000..a60e3e66 --- /dev/null +++ b/api/v1beta2/zz_generated.deepcopy.go @@ -0,0 +1,1949 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 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 + + http://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. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/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 *AllowedNamespaces) DeepCopyInto(out *AllowedNamespaces) { + *out = *in + if in.NamespaceList != nil { + in, out := &in.NamespaceList, &out.NamespaceList + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AllowedNamespaces. +func (in *AllowedNamespaces) DeepCopy() *AllowedNamespaces { + if in == nil { + return nil + } + out := new(AllowedNamespaces) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AmdMilanBmPlatformConfig) DeepCopyInto(out *AmdMilanBmPlatformConfig) { + *out = *in + if in.IsSecureBootEnabled != nil { + in, out := &in.IsSecureBootEnabled, &out.IsSecureBootEnabled + *out = new(bool) + **out = **in + } + if in.IsTrustedPlatformModuleEnabled != nil { + in, out := &in.IsTrustedPlatformModuleEnabled, &out.IsTrustedPlatformModuleEnabled + *out = new(bool) + **out = **in + } + if in.IsMeasuredBootEnabled != nil { + in, out := &in.IsMeasuredBootEnabled, &out.IsMeasuredBootEnabled + *out = new(bool) + **out = **in + } + if in.IsMemoryEncryptionEnabled != nil { + in, out := &in.IsMemoryEncryptionEnabled, &out.IsMemoryEncryptionEnabled + *out = new(bool) + **out = **in + } + if in.IsSymmetricMultiThreadingEnabled != nil { + in, out := &in.IsSymmetricMultiThreadingEnabled, &out.IsSymmetricMultiThreadingEnabled + *out = new(bool) + **out = **in + } + if in.IsAccessControlServiceEnabled != nil { + in, out := &in.IsAccessControlServiceEnabled, &out.IsAccessControlServiceEnabled + *out = new(bool) + **out = **in + } + if in.AreVirtualInstructionsEnabled != nil { + in, out := &in.AreVirtualInstructionsEnabled, &out.AreVirtualInstructionsEnabled + *out = new(bool) + **out = **in + } + if in.IsInputOutputMemoryManagementUnitEnabled != nil { + in, out := &in.IsInputOutputMemoryManagementUnitEnabled, &out.IsInputOutputMemoryManagementUnitEnabled + *out = new(bool) + **out = **in + } + if in.PercentageOfCoresEnabled != nil { + in, out := &in.PercentageOfCoresEnabled, &out.PercentageOfCoresEnabled + *out = new(int) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AmdMilanBmPlatformConfig. +func (in *AmdMilanBmPlatformConfig) DeepCopy() *AmdMilanBmPlatformConfig { + if in == nil { + return nil + } + out := new(AmdMilanBmPlatformConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AmdRomeBmGpuPlatformConfig) DeepCopyInto(out *AmdRomeBmGpuPlatformConfig) { + *out = *in + if in.IsSecureBootEnabled != nil { + in, out := &in.IsSecureBootEnabled, &out.IsSecureBootEnabled + *out = new(bool) + **out = **in + } + if in.IsTrustedPlatformModuleEnabled != nil { + in, out := &in.IsTrustedPlatformModuleEnabled, &out.IsTrustedPlatformModuleEnabled + *out = new(bool) + **out = **in + } + if in.IsMeasuredBootEnabled != nil { + in, out := &in.IsMeasuredBootEnabled, &out.IsMeasuredBootEnabled + *out = new(bool) + **out = **in + } + if in.IsMemoryEncryptionEnabled != nil { + in, out := &in.IsMemoryEncryptionEnabled, &out.IsMemoryEncryptionEnabled + *out = new(bool) + **out = **in + } + if in.IsSymmetricMultiThreadingEnabled != nil { + in, out := &in.IsSymmetricMultiThreadingEnabled, &out.IsSymmetricMultiThreadingEnabled + *out = new(bool) + **out = **in + } + if in.IsAccessControlServiceEnabled != nil { + in, out := &in.IsAccessControlServiceEnabled, &out.IsAccessControlServiceEnabled + *out = new(bool) + **out = **in + } + if in.AreVirtualInstructionsEnabled != nil { + in, out := &in.AreVirtualInstructionsEnabled, &out.AreVirtualInstructionsEnabled + *out = new(bool) + **out = **in + } + if in.IsInputOutputMemoryManagementUnitEnabled != nil { + in, out := &in.IsInputOutputMemoryManagementUnitEnabled, &out.IsInputOutputMemoryManagementUnitEnabled + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AmdRomeBmGpuPlatformConfig. +func (in *AmdRomeBmGpuPlatformConfig) DeepCopy() *AmdRomeBmGpuPlatformConfig { + if in == nil { + return nil + } + out := new(AmdRomeBmGpuPlatformConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AmdRomeBmPlatformConfig) DeepCopyInto(out *AmdRomeBmPlatformConfig) { + *out = *in + if in.IsSecureBootEnabled != nil { + in, out := &in.IsSecureBootEnabled, &out.IsSecureBootEnabled + *out = new(bool) + **out = **in + } + if in.IsTrustedPlatformModuleEnabled != nil { + in, out := &in.IsTrustedPlatformModuleEnabled, &out.IsTrustedPlatformModuleEnabled + *out = new(bool) + **out = **in + } + if in.IsMeasuredBootEnabled != nil { + in, out := &in.IsMeasuredBootEnabled, &out.IsMeasuredBootEnabled + *out = new(bool) + **out = **in + } + if in.IsMemoryEncryptionEnabled != nil { + in, out := &in.IsMemoryEncryptionEnabled, &out.IsMemoryEncryptionEnabled + *out = new(bool) + **out = **in + } + if in.IsSymmetricMultiThreadingEnabled != nil { + in, out := &in.IsSymmetricMultiThreadingEnabled, &out.IsSymmetricMultiThreadingEnabled + *out = new(bool) + **out = **in + } + if in.IsAccessControlServiceEnabled != nil { + in, out := &in.IsAccessControlServiceEnabled, &out.IsAccessControlServiceEnabled + *out = new(bool) + **out = **in + } + if in.AreVirtualInstructionsEnabled != nil { + in, out := &in.AreVirtualInstructionsEnabled, &out.AreVirtualInstructionsEnabled + *out = new(bool) + **out = **in + } + if in.IsInputOutputMemoryManagementUnitEnabled != nil { + in, out := &in.IsInputOutputMemoryManagementUnitEnabled, &out.IsInputOutputMemoryManagementUnitEnabled + *out = new(bool) + **out = **in + } + if in.PercentageOfCoresEnabled != nil { + in, out := &in.PercentageOfCoresEnabled, &out.PercentageOfCoresEnabled + *out = new(int) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AmdRomeBmPlatformConfig. +func (in *AmdRomeBmPlatformConfig) DeepCopy() *AmdRomeBmPlatformConfig { + if in == nil { + return nil + } + out := new(AmdRomeBmPlatformConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AmdVmPlatformConfig) DeepCopyInto(out *AmdVmPlatformConfig) { + *out = *in + if in.IsSecureBootEnabled != nil { + in, out := &in.IsSecureBootEnabled, &out.IsSecureBootEnabled + *out = new(bool) + **out = **in + } + if in.IsTrustedPlatformModuleEnabled != nil { + in, out := &in.IsTrustedPlatformModuleEnabled, &out.IsTrustedPlatformModuleEnabled + *out = new(bool) + **out = **in + } + if in.IsMeasuredBootEnabled != nil { + in, out := &in.IsMeasuredBootEnabled, &out.IsMeasuredBootEnabled + *out = new(bool) + **out = **in + } + if in.IsMemoryEncryptionEnabled != nil { + in, out := &in.IsMemoryEncryptionEnabled, &out.IsMemoryEncryptionEnabled + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AmdVmPlatformConfig. +func (in *AmdVmPlatformConfig) DeepCopy() *AmdVmPlatformConfig { + if in == nil { + return nil + } + out := new(AmdVmPlatformConfig) + 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 + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.VcnAttachmentId != nil { + in, out := &in.VcnAttachmentId, &out.VcnAttachmentId + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DRG. +func (in *DRG) DeepCopy() *DRG { + if in == nil { + return nil + } + out := new(DRG) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EgressSecurityRule) DeepCopyInto(out *EgressSecurityRule) { + *out = *in + if in.Destination != nil { + in, out := &in.Destination, &out.Destination + *out = new(string) + **out = **in + } + if in.Protocol != nil { + in, out := &in.Protocol, &out.Protocol + *out = new(string) + **out = **in + } + if in.IcmpOptions != nil { + in, out := &in.IcmpOptions, &out.IcmpOptions + *out = new(IcmpOptions) + (*in).DeepCopyInto(*out) + } + if in.IsStateless != nil { + in, out := &in.IsStateless, &out.IsStateless + *out = new(bool) + **out = **in + } + if in.TcpOptions != nil { + in, out := &in.TcpOptions, &out.TcpOptions + *out = new(TcpOptions) + (*in).DeepCopyInto(*out) + } + if in.UdpOptions != nil { + in, out := &in.UdpOptions, &out.UdpOptions + *out = new(UdpOptions) + (*in).DeepCopyInto(*out) + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EgressSecurityRule. +func (in *EgressSecurityRule) DeepCopy() *EgressSecurityRule { + if in == nil { + return nil + } + out := new(EgressSecurityRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EgressSecurityRuleForNSG) DeepCopyInto(out *EgressSecurityRuleForNSG) { + *out = *in + in.EgressSecurityRule.DeepCopyInto(&out.EgressSecurityRule) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EgressSecurityRuleForNSG. +func (in *EgressSecurityRuleForNSG) DeepCopy() *EgressSecurityRuleForNSG { + if in == nil { + return nil + } + out := new(EgressSecurityRuleForNSG) + 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 + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(int) + **out = **in + } + if in.Code != nil { + in, out := &in.Code, &out.Code + *out = new(int) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IcmpOptions. +func (in *IcmpOptions) DeepCopy() *IcmpOptions { + if in == nil { + return nil + } + out := new(IcmpOptions) + 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 + if in.Protocol != nil { + in, out := &in.Protocol, &out.Protocol + *out = new(string) + **out = **in + } + if in.Source != nil { + in, out := &in.Source, &out.Source + *out = new(string) + **out = **in + } + if in.IcmpOptions != nil { + in, out := &in.IcmpOptions, &out.IcmpOptions + *out = new(IcmpOptions) + (*in).DeepCopyInto(*out) + } + if in.IsStateless != nil { + in, out := &in.IsStateless, &out.IsStateless + *out = new(bool) + **out = **in + } + if in.TcpOptions != nil { + in, out := &in.TcpOptions, &out.TcpOptions + *out = new(TcpOptions) + (*in).DeepCopyInto(*out) + } + if in.UdpOptions != nil { + in, out := &in.UdpOptions, &out.UdpOptions + *out = new(UdpOptions) + (*in).DeepCopyInto(*out) + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressSecurityRule. +func (in *IngressSecurityRule) DeepCopy() *IngressSecurityRule { + if in == nil { + return nil + } + out := new(IngressSecurityRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IngressSecurityRuleForNSG) DeepCopyInto(out *IngressSecurityRuleForNSG) { + *out = *in + in.IngressSecurityRule.DeepCopyInto(&out.IngressSecurityRule) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressSecurityRuleForNSG. +func (in *IngressSecurityRuleForNSG) DeepCopy() *IngressSecurityRuleForNSG { + if in == nil { + return nil + } + out := new(IngressSecurityRuleForNSG) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceAgentPluginConfig) DeepCopyInto(out *InstanceAgentPluginConfig) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceAgentPluginConfig. +func (in *InstanceAgentPluginConfig) DeepCopy() *InstanceAgentPluginConfig { + if in == nil { + return nil + } + out := new(InstanceAgentPluginConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceOptions) DeepCopyInto(out *InstanceOptions) { + *out = *in + if in.AreLegacyImdsEndpointsDisabled != nil { + in, out := &in.AreLegacyImdsEndpointsDisabled, &out.AreLegacyImdsEndpointsDisabled + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceOptions. +func (in *InstanceOptions) DeepCopy() *InstanceOptions { + if in == nil { + return nil + } + out := new(InstanceOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceSourceViaImageConfig) DeepCopyInto(out *InstanceSourceViaImageConfig) { + *out = *in + if in.KmsKeyId != nil { + in, out := &in.KmsKeyId, &out.KmsKeyId + *out = new(string) + **out = **in + } + if in.BootVolumeVpusPerGB != nil { + in, out := &in.BootVolumeVpusPerGB, &out.BootVolumeVpusPerGB + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSourceViaImageConfig. +func (in *InstanceSourceViaImageConfig) DeepCopy() *InstanceSourceViaImageConfig { + if in == nil { + return nil + } + out := new(InstanceSourceViaImageConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IntelIcelakeBmPlatformConfig) DeepCopyInto(out *IntelIcelakeBmPlatformConfig) { + *out = *in + if in.IsSecureBootEnabled != nil { + in, out := &in.IsSecureBootEnabled, &out.IsSecureBootEnabled + *out = new(bool) + **out = **in + } + if in.IsTrustedPlatformModuleEnabled != nil { + in, out := &in.IsTrustedPlatformModuleEnabled, &out.IsTrustedPlatformModuleEnabled + *out = new(bool) + **out = **in + } + if in.IsMeasuredBootEnabled != nil { + in, out := &in.IsMeasuredBootEnabled, &out.IsMeasuredBootEnabled + *out = new(bool) + **out = **in + } + if in.IsMemoryEncryptionEnabled != nil { + in, out := &in.IsMemoryEncryptionEnabled, &out.IsMemoryEncryptionEnabled + *out = new(bool) + **out = **in + } + if in.IsSymmetricMultiThreadingEnabled != nil { + in, out := &in.IsSymmetricMultiThreadingEnabled, &out.IsSymmetricMultiThreadingEnabled + *out = new(bool) + **out = **in + } + if in.IsInputOutputMemoryManagementUnitEnabled != nil { + in, out := &in.IsInputOutputMemoryManagementUnitEnabled, &out.IsInputOutputMemoryManagementUnitEnabled + *out = new(bool) + **out = **in + } + if in.PercentageOfCoresEnabled != nil { + in, out := &in.PercentageOfCoresEnabled, &out.PercentageOfCoresEnabled + *out = new(int) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IntelIcelakeBmPlatformConfig. +func (in *IntelIcelakeBmPlatformConfig) DeepCopy() *IntelIcelakeBmPlatformConfig { + if in == nil { + return nil + } + out := new(IntelIcelakeBmPlatformConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IntelSkylakeBmPlatformConfig) DeepCopyInto(out *IntelSkylakeBmPlatformConfig) { + *out = *in + if in.IsSecureBootEnabled != nil { + in, out := &in.IsSecureBootEnabled, &out.IsSecureBootEnabled + *out = new(bool) + **out = **in + } + if in.IsTrustedPlatformModuleEnabled != nil { + in, out := &in.IsTrustedPlatformModuleEnabled, &out.IsTrustedPlatformModuleEnabled + *out = new(bool) + **out = **in + } + if in.IsMeasuredBootEnabled != nil { + in, out := &in.IsMeasuredBootEnabled, &out.IsMeasuredBootEnabled + *out = new(bool) + **out = **in + } + if in.IsMemoryEncryptionEnabled != nil { + in, out := &in.IsMemoryEncryptionEnabled, &out.IsMemoryEncryptionEnabled + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IntelSkylakeBmPlatformConfig. +func (in *IntelSkylakeBmPlatformConfig) DeepCopy() *IntelSkylakeBmPlatformConfig { + if in == nil { + return nil + } + out := new(IntelSkylakeBmPlatformConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IntelVmPlatformConfig) DeepCopyInto(out *IntelVmPlatformConfig) { + *out = *in + if in.IsSecureBootEnabled != nil { + in, out := &in.IsSecureBootEnabled, &out.IsSecureBootEnabled + *out = new(bool) + **out = **in + } + if in.IsTrustedPlatformModuleEnabled != nil { + in, out := &in.IsTrustedPlatformModuleEnabled, &out.IsTrustedPlatformModuleEnabled + *out = new(bool) + **out = **in + } + if in.IsMeasuredBootEnabled != nil { + in, out := &in.IsMeasuredBootEnabled, &out.IsMeasuredBootEnabled + *out = new(bool) + **out = **in + } + if in.IsMemoryEncryptionEnabled != nil { + in, out := &in.IsMemoryEncryptionEnabled, &out.IsMemoryEncryptionEnabled + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IntelVmPlatformConfig. +func (in *IntelVmPlatformConfig) DeepCopy() *IntelVmPlatformConfig { + if in == nil { + return nil + } + out := new(IntelVmPlatformConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InternetGateway) DeepCopyInto(out *InternetGateway) { + *out = *in + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InternetGateway. +func (in *InternetGateway) DeepCopy() *InternetGateway { + if in == nil { + return nil + } + out := new(InternetGateway) + 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 + if in.IsMonitoringDisabled != nil { + in, out := &in.IsMonitoringDisabled, &out.IsMonitoringDisabled + *out = new(bool) + **out = **in + } + if in.IsManagementDisabled != nil { + in, out := &in.IsManagementDisabled, &out.IsManagementDisabled + *out = new(bool) + **out = **in + } + if in.AreAllPluginsDisabled != nil { + in, out := &in.AreAllPluginsDisabled, &out.AreAllPluginsDisabled + *out = new(bool) + **out = **in + } + if in.PluginsConfig != nil { + in, out := &in.PluginsConfig, &out.PluginsConfig + *out = make([]InstanceAgentPluginConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchInstanceAgentConfig. +func (in *LaunchInstanceAgentConfig) DeepCopy() *LaunchInstanceAgentConfig { + if in == nil { + return nil + } + out := new(LaunchInstanceAgentConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchInstanceAvailabilityConfig) DeepCopyInto(out *LaunchInstanceAvailabilityConfig) { + *out = *in + if in.IsLiveMigrationPreferred != nil { + in, out := &in.IsLiveMigrationPreferred, &out.IsLiveMigrationPreferred + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchInstanceAvailabilityConfig. +func (in *LaunchInstanceAvailabilityConfig) DeepCopy() *LaunchInstanceAvailabilityConfig { + if in == nil { + return nil + } + out := new(LaunchInstanceAvailabilityConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchOptions) DeepCopyInto(out *LaunchOptions) { + *out = *in + if in.IsConsistentVolumeNamingEnabled != nil { + in, out := &in.IsConsistentVolumeNamingEnabled, &out.IsConsistentVolumeNamingEnabled + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchOptions. +func (in *LaunchOptions) DeepCopy() *LaunchOptions { + if in == nil { + return nil + } + out := new(LaunchOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoadBalancer) DeepCopyInto(out *LoadBalancer) { + *out = *in + if in.LoadBalancerId != nil { + in, out := &in.LoadBalancerId, &out.LoadBalancerId + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadBalancer. +func (in *LoadBalancer) DeepCopy() *LoadBalancer { + if in == nil { + return nil + } + out := new(LoadBalancer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NATGateway) DeepCopyInto(out *NATGateway) { + *out = *in + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NATGateway. +func (in *NATGateway) DeepCopy() *NATGateway { + if in == nil { + return nil + } + out := new(NATGateway) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NSG) DeepCopyInto(out *NSG) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.EgressRules != nil { + in, out := &in.EgressRules, &out.EgressRules + *out = make([]EgressSecurityRuleForNSG, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.IngressRules != nil { + in, out := &in.IngressRules, &out.IngressRules + *out = make([]IngressSecurityRuleForNSG, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NSG. +func (in *NSG) DeepCopy() *NSG { + if in == nil { + return nil + } + out := new(NSG) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkDetails) DeepCopyInto(out *NetworkDetails) { + *out = *in + if in.SkipSourceDestCheck != nil { + in, out := &in.SkipSourceDestCheck, &out.SkipSourceDestCheck + *out = new(bool) + **out = **in + } + if in.NsgNames != nil { + in, out := &in.NsgNames, &out.NsgNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.HostnameLabel != nil { + in, out := &in.HostnameLabel, &out.HostnameLabel + *out = new(string) + **out = **in + } + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } + if in.AssignPrivateDnsRecord != nil { + in, out := &in.AssignPrivateDnsRecord, &out.AssignPrivateDnsRecord + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkDetails. +func (in *NetworkDetails) DeepCopy() *NetworkDetails { + if in == nil { + return nil + } + out := new(NetworkDetails) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkSecurityGroup) DeepCopyInto(out *NetworkSecurityGroup) { + *out = *in + if in.List != nil { + in, out := &in.List, &out.List + *out = make([]*NSG, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(NSG) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkSecurityGroup. +func (in *NetworkSecurityGroup) DeepCopy() *NetworkSecurityGroup { + if in == nil { + return nil + } + out := new(NetworkSecurityGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkSpec) DeepCopyInto(out *NetworkSpec) { + *out = *in + in.Vcn.DeepCopyInto(&out.Vcn) + in.APIServerLB.DeepCopyInto(&out.APIServerLB) + if in.VCNPeering != nil { + in, out := &in.VCNPeering, &out.VCNPeering + *out = new(VCNPeering) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkSpec. +func (in *NetworkSpec) DeepCopy() *NetworkSpec { + if in == nil { + return nil + } + out := new(NetworkSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIAvailabilityDomain) DeepCopyInto(out *OCIAvailabilityDomain) { + *out = *in + if in.FaultDomains != nil { + in, out := &in.FaultDomains, &out.FaultDomains + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIAvailabilityDomain. +func (in *OCIAvailabilityDomain) DeepCopy() *OCIAvailabilityDomain { + if in == nil { + return nil + } + out := new(OCIAvailabilityDomain) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCICluster) DeepCopyInto(out *OCICluster) { + *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 OCICluster. +func (in *OCICluster) DeepCopy() *OCICluster { + if in == nil { + return nil + } + out := new(OCICluster) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCICluster) 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 *OCIClusterIdentity) DeepCopyInto(out *OCIClusterIdentity) { + *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 OCIClusterIdentity. +func (in *OCIClusterIdentity) DeepCopy() *OCIClusterIdentity { + if in == nil { + return nil + } + out := new(OCIClusterIdentity) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIClusterIdentity) 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 *OCIClusterIdentityList) DeepCopyInto(out *OCIClusterIdentityList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIClusterIdentity, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIClusterIdentityList. +func (in *OCIClusterIdentityList) DeepCopy() *OCIClusterIdentityList { + if in == nil { + return nil + } + out := new(OCIClusterIdentityList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIClusterIdentityList) 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 *OCIClusterIdentitySpec) DeepCopyInto(out *OCIClusterIdentitySpec) { + *out = *in + out.PrincipalSecret = in.PrincipalSecret + if in.AllowedNamespaces != nil { + in, out := &in.AllowedNamespaces, &out.AllowedNamespaces + *out = new(AllowedNamespaces) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIClusterIdentitySpec. +func (in *OCIClusterIdentitySpec) DeepCopy() *OCIClusterIdentitySpec { + if in == nil { + return nil + } + out := new(OCIClusterIdentitySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIClusterIdentityStatus) DeepCopyInto(out *OCIClusterIdentityStatus) { + *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]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIClusterIdentityStatus. +func (in *OCIClusterIdentityStatus) DeepCopy() *OCIClusterIdentityStatus { + if in == nil { + return nil + } + out := new(OCIClusterIdentityStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIClusterList) DeepCopyInto(out *OCIClusterList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCICluster, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIClusterList. +func (in *OCIClusterList) DeepCopy() *OCIClusterList { + if in == nil { + return nil + } + out := new(OCIClusterList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIClusterList) 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 *OCIClusterSpec) DeepCopyInto(out *OCIClusterSpec) { + *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() + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIClusterSpec. +func (in *OCIClusterSpec) DeepCopy() *OCIClusterSpec { + if in == nil { + return nil + } + out := new(OCIClusterSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIClusterStatus) DeepCopyInto(out *OCIClusterStatus) { + *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 OCIClusterStatus. +func (in *OCIClusterStatus) DeepCopy() *OCIClusterStatus { + if in == nil { + return nil + } + out := new(OCIClusterStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIClusterTemplate) DeepCopyInto(out *OCIClusterTemplate) { + *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 OCIClusterTemplate. +func (in *OCIClusterTemplate) DeepCopy() *OCIClusterTemplate { + if in == nil { + return nil + } + out := new(OCIClusterTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIClusterTemplate) 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 *OCIClusterTemplateList) DeepCopyInto(out *OCIClusterTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIClusterTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIClusterTemplateList. +func (in *OCIClusterTemplateList) DeepCopy() *OCIClusterTemplateList { + if in == nil { + return nil + } + out := new(OCIClusterTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIClusterTemplateList) 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 *OCIClusterTemplateResource) DeepCopyInto(out *OCIClusterTemplateResource) { + *out = *in + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIClusterTemplateResource. +func (in *OCIClusterTemplateResource) DeepCopy() *OCIClusterTemplateResource { + if in == nil { + return nil + } + out := new(OCIClusterTemplateResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIClusterTemplateSpec) DeepCopyInto(out *OCIClusterTemplateSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIClusterTemplateSpec. +func (in *OCIClusterTemplateSpec) DeepCopy() *OCIClusterTemplateSpec { + if in == nil { + return nil + } + out := new(OCIClusterTemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIMachine) DeepCopyInto(out *OCIMachine) { + *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 OCIMachine. +func (in *OCIMachine) DeepCopy() *OCIMachine { + if in == nil { + return nil + } + out := new(OCIMachine) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIMachine) 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 *OCIMachineList) DeepCopyInto(out *OCIMachineList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIMachine, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIMachineList. +func (in *OCIMachineList) DeepCopy() *OCIMachineList { + if in == nil { + return nil + } + out := new(OCIMachineList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIMachineList) 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 *OCIMachineSpec) DeepCopyInto(out *OCIMachineSpec) { + *out = *in + if in.InstanceId != nil { + in, out := &in.InstanceId, &out.InstanceId + *out = new(string) + **out = **in + } + if in.IpxeScript != nil { + in, out := &in.IpxeScript, &out.IpxeScript + *out = new(string) + **out = **in + } + if in.CapacityReservationId != nil { + in, out := &in.CapacityReservationId, &out.CapacityReservationId + *out = new(string) + **out = **in + } + in.ShapeConfig.DeepCopyInto(&out.ShapeConfig) + in.NetworkDetails.DeepCopyInto(&out.NetworkDetails) + if in.VnicAttachments != nil { + in, out := &in.VnicAttachments, &out.VnicAttachments + *out = make([]VnicAttachment, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.LaunchOptions != nil { + in, out := &in.LaunchOptions, &out.LaunchOptions + *out = new(LaunchOptions) + (*in).DeepCopyInto(*out) + } + if in.InstanceOptions != nil { + in, out := &in.InstanceOptions, &out.InstanceOptions + *out = new(InstanceOptions) + (*in).DeepCopyInto(*out) + } + if in.AvailabilityConfig != nil { + in, out := &in.AvailabilityConfig, &out.AvailabilityConfig + *out = new(LaunchInstanceAvailabilityConfig) + (*in).DeepCopyInto(*out) + } + if in.PreemptibleInstanceConfig != nil { + in, out := &in.PreemptibleInstanceConfig, &out.PreemptibleInstanceConfig + *out = new(PreemptibleInstanceConfig) + (*in).DeepCopyInto(*out) + } + if in.AgentConfig != nil { + in, out := &in.AgentConfig, &out.AgentConfig + *out = new(LaunchInstanceAgentConfig) + (*in).DeepCopyInto(*out) + } + if in.InstanceSourceViaImageDetails != nil { + in, out := &in.InstanceSourceViaImageDetails, &out.InstanceSourceViaImageDetails + *out = new(InstanceSourceViaImageConfig) + (*in).DeepCopyInto(*out) + } + if in.PlatformConfig != nil { + in, out := &in.PlatformConfig, &out.PlatformConfig + *out = new(PlatformConfig) + (*in).DeepCopyInto(*out) + } + if in.DedicatedVmHostId != nil { + in, out := &in.DedicatedVmHostId, &out.DedicatedVmHostId + *out = new(string) + **out = **in + } + if in.ProviderID != nil { + in, out := &in.ProviderID, &out.ProviderID + *out = new(string) + **out = **in + } + if in.Metadata != nil { + in, out := &in.Metadata, &out.Metadata + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + 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 + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIMachineSpec. +func (in *OCIMachineSpec) DeepCopy() *OCIMachineSpec { + if in == nil { + return nil + } + out := new(OCIMachineSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIMachineStatus) DeepCopyInto(out *OCIMachineStatus) { + *out = *in + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]v1beta1.MachineAddress, len(*in)) + copy(*out, *in) + } + if in.FailureReason != nil { + in, out := &in.FailureReason, &out.FailureReason + *out = new(errors.MachineStatusError) + **out = **in + } + if in.FailureMessage != nil { + in, out := &in.FailureMessage, &out.FailureMessage + *out = new(string) + **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]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIMachineStatus. +func (in *OCIMachineStatus) DeepCopy() *OCIMachineStatus { + if in == nil { + return nil + } + out := new(OCIMachineStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIMachineTemplate) DeepCopyInto(out *OCIMachineTemplate) { + *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 OCIMachineTemplate. +func (in *OCIMachineTemplate) DeepCopy() *OCIMachineTemplate { + if in == nil { + return nil + } + out := new(OCIMachineTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIMachineTemplate) 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 *OCIMachineTemplateList) DeepCopyInto(out *OCIMachineTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIMachineTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIMachineTemplateList. +func (in *OCIMachineTemplateList) DeepCopy() *OCIMachineTemplateList { + if in == nil { + return nil + } + out := new(OCIMachineTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIMachineTemplateList) 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 *OCIMachineTemplateResource) DeepCopyInto(out *OCIMachineTemplateResource) { + *out = *in + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIMachineTemplateResource. +func (in *OCIMachineTemplateResource) DeepCopy() *OCIMachineTemplateResource { + if in == nil { + return nil + } + out := new(OCIMachineTemplateResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIMachineTemplateSpec) DeepCopyInto(out *OCIMachineTemplateSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIMachineTemplateSpec. +func (in *OCIMachineTemplateSpec) DeepCopy() *OCIMachineTemplateSpec { + if in == nil { + return nil + } + out := new(OCIMachineTemplateSpec) + 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 +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PeerRouteRule. +func (in *PeerRouteRule) DeepCopy() *PeerRouteRule { + if in == nil { + return nil + } + out := new(PeerRouteRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlatformConfig) DeepCopyInto(out *PlatformConfig) { + *out = *in + in.AmdMilanBmPlatformConfig.DeepCopyInto(&out.AmdMilanBmPlatformConfig) + in.AmdRomeBmPlatformConfig.DeepCopyInto(&out.AmdRomeBmPlatformConfig) + in.IntelSkylakeBmPlatformConfig.DeepCopyInto(&out.IntelSkylakeBmPlatformConfig) + in.IntelIcelakeBmPlatformConfig.DeepCopyInto(&out.IntelIcelakeBmPlatformConfig) + in.AmdRomeBmGpuPlatformConfig.DeepCopyInto(&out.AmdRomeBmGpuPlatformConfig) + in.IntelVmPlatformConfig.DeepCopyInto(&out.IntelVmPlatformConfig) + in.AmdVmPlatformConfig.DeepCopyInto(&out.AmdVmPlatformConfig) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlatformConfig. +func (in *PlatformConfig) DeepCopy() *PlatformConfig { + if in == nil { + return nil + } + out := new(PlatformConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PortRange) DeepCopyInto(out *PortRange) { + *out = *in + if in.Max != nil { + in, out := &in.Max, &out.Max + *out = new(int) + **out = **in + } + if in.Min != nil { + in, out := &in.Min, &out.Min + *out = new(int) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortRange. +func (in *PortRange) DeepCopy() *PortRange { + if in == nil { + return nil + } + out := new(PortRange) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PreemptibleInstanceConfig) DeepCopyInto(out *PreemptibleInstanceConfig) { + *out = *in + if in.TerminatePreemptionAction != nil { + in, out := &in.TerminatePreemptionAction, &out.TerminatePreemptionAction + *out = new(TerminatePreemptionAction) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PreemptibleInstanceConfig. +func (in *PreemptibleInstanceConfig) DeepCopy() *PreemptibleInstanceConfig { + if in == nil { + return nil + } + out := new(PreemptibleInstanceConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemotePeeringConnection) DeepCopyInto(out *RemotePeeringConnection) { + *out = *in + if in.PeerDRGId != nil { + in, out := &in.PeerDRGId, &out.PeerDRGId + *out = new(string) + **out = **in + } + if in.PeerRPCConnectionId != nil { + in, out := &in.PeerRPCConnectionId, &out.PeerRPCConnectionId + *out = new(string) + **out = **in + } + if in.RPCConnectionId != nil { + in, out := &in.RPCConnectionId, &out.RPCConnectionId + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemotePeeringConnection. +func (in *RemotePeeringConnection) DeepCopy() *RemotePeeringConnection { + if in == nil { + return nil + } + out := new(RemotePeeringConnection) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTable) DeepCopyInto(out *RouteTable) { + *out = *in + if in.PrivateRouteTableId != nil { + in, out := &in.PrivateRouteTableId, &out.PrivateRouteTableId + *out = new(string) + **out = **in + } + if in.PublicRouteTableId != nil { + in, out := &in.PublicRouteTableId, &out.PublicRouteTableId + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTable. +func (in *RouteTable) DeepCopy() *RouteTable { + if in == nil { + return nil + } + out := new(RouteTable) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecurityList) DeepCopyInto(out *SecurityList) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.EgressRules != nil { + in, out := &in.EgressRules, &out.EgressRules + *out = make([]EgressSecurityRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.IngressRules != nil { + in, out := &in.IngressRules, &out.IngressRules + *out = make([]IngressSecurityRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityList. +func (in *SecurityList) DeepCopy() *SecurityList { + if in == nil { + return nil + } + out := new(SecurityList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceGateway) DeepCopyInto(out *ServiceGateway) { + *out = *in + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceGateway. +func (in *ServiceGateway) DeepCopy() *ServiceGateway { + if in == nil { + return nil + } + out := new(ServiceGateway) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ShapeConfig) DeepCopyInto(out *ShapeConfig) { + *out = *in + if in.Nvmes != nil { + in, out := &in.Nvmes, &out.Nvmes + *out = new(int) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShapeConfig. +func (in *ShapeConfig) DeepCopy() *ShapeConfig { + if in == nil { + return nil + } + out := new(ShapeConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Subnet) DeepCopyInto(out *Subnet) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.SecurityList != nil { + in, out := &in.SecurityList, &out.SecurityList + *out = new(SecurityList) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subnet. +func (in *Subnet) DeepCopy() *Subnet { + if in == nil { + return nil + } + out := new(Subnet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TcpOptions) DeepCopyInto(out *TcpOptions) { + *out = *in + if in.DestinationPortRange != nil { + in, out := &in.DestinationPortRange, &out.DestinationPortRange + *out = new(PortRange) + (*in).DeepCopyInto(*out) + } + if in.SourcePortRange != nil { + in, out := &in.SourcePortRange, &out.SourcePortRange + *out = new(PortRange) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TcpOptions. +func (in *TcpOptions) DeepCopy() *TcpOptions { + if in == nil { + return nil + } + out := new(TcpOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TerminatePreemptionAction) DeepCopyInto(out *TerminatePreemptionAction) { + *out = *in + if in.PreserveBootVolume != nil { + in, out := &in.PreserveBootVolume, &out.PreserveBootVolume + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TerminatePreemptionAction. +func (in *TerminatePreemptionAction) DeepCopy() *TerminatePreemptionAction { + if in == nil { + return nil + } + out := new(TerminatePreemptionAction) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UdpOptions) DeepCopyInto(out *UdpOptions) { + *out = *in + if in.DestinationPortRange != nil { + in, out := &in.DestinationPortRange, &out.DestinationPortRange + *out = new(PortRange) + (*in).DeepCopyInto(*out) + } + if in.SourcePortRange != nil { + in, out := &in.SourcePortRange, &out.SourcePortRange + *out = new(PortRange) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UdpOptions. +func (in *UdpOptions) DeepCopy() *UdpOptions { + if in == nil { + return nil + } + out := new(UdpOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VCN) DeepCopyInto(out *VCN) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.Subnets != nil { + in, out := &in.Subnets, &out.Subnets + *out = make([]*Subnet, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Subnet) + (*in).DeepCopyInto(*out) + } + } + } + in.InternetGateway.DeepCopyInto(&out.InternetGateway) + in.NATGateway.DeepCopyInto(&out.NATGateway) + in.ServiceGateway.DeepCopyInto(&out.ServiceGateway) + in.RouteTable.DeepCopyInto(&out.RouteTable) + in.NetworkSecurityGroup.DeepCopyInto(&out.NetworkSecurityGroup) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VCN. +func (in *VCN) DeepCopy() *VCN { + if in == nil { + return nil + } + out := new(VCN) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VCNPeering) DeepCopyInto(out *VCNPeering) { + *out = *in + if in.DRG != nil { + in, out := &in.DRG, &out.DRG + *out = new(DRG) + (*in).DeepCopyInto(*out) + } + if in.PeerRouteRules != nil { + in, out := &in.PeerRouteRules, &out.PeerRouteRules + *out = make([]PeerRouteRule, len(*in)) + copy(*out, *in) + } + if in.RemotePeeringConnections != nil { + in, out := &in.RemotePeeringConnections, &out.RemotePeeringConnections + *out = make([]RemotePeeringConnection, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VCNPeering. +func (in *VCNPeering) DeepCopy() *VCNPeering { + if in == nil { + return nil + } + out := new(VCNPeering) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VnicAttachment) DeepCopyInto(out *VnicAttachment) { + *out = *in + if in.VnicAttachmentId != nil { + in, out := &in.VnicAttachmentId, &out.VnicAttachmentId + *out = new(string) + **out = **in + } + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } + if in.NicIndex != nil { + in, out := &in.NicIndex, &out.NicIndex + *out = new(int) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VnicAttachment. +func (in *VnicAttachment) DeepCopy() *VnicAttachment { + if in == nil { + return nil + } + out := new(VnicAttachment) + in.DeepCopyInto(out) + return out +} diff --git a/cloud/scope/cluster.go b/cloud/scope/cluster.go index d7effbdb..282c690d 100644 --- a/cloud/scope/cluster.go +++ b/cloud/scope/cluster.go @@ -20,9 +20,10 @@ import ( "context" "fmt" "strconv" + "strings" "github.com/go-logr/logr" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/cluster-api-provider-oci/cloud/ociutil" identityClient "github.com/oracle/cluster-api-provider-oci/cloud/services/identity" nlb "github.com/oracle/cluster-api-provider-oci/cloud/services/networkloadbalancer" @@ -127,21 +128,24 @@ func (s *ClusterScope) ReconcileFailureDomains(ctx context.Context) error { // in case of single AD regions, the failure domain will be fault domain, in case of multi Ad regions, it will // be AD func (s *ClusterScope) setFailureDomains(ctx context.Context) error { - reqAd := identity.ListAvailabilityDomainsRequest{CompartmentId: common.String(s.GetCompartmentId())} + adMap := s.OCIClusterAccessor.GetAvailabilityDomains() + if adMap == nil { + reqAd := identity.ListAvailabilityDomainsRequest{CompartmentId: common.String(s.GetCompartmentId())} - respAd, err := s.IdentityClient.ListAvailabilityDomains(ctx, reqAd) - if err != nil { - s.Logger.Error(err, "failed to list identity domains") - return err - } + respAd, err := s.IdentityClient.ListAvailabilityDomains(ctx, reqAd) + if err != nil { + s.Logger.Error(err, "failed to list identity domains") + return err + } - // build the AD list for cluster - ads, err := s.setAvailabiltyDomainStatus(ctx, respAd.Items) - if err != nil { - return err + // build the AD list for cluster + adMap, err = s.setAvailabiltyDomainSpec(ctx, respAd.Items) + if err != nil { + return err + } } - numOfAds := len(respAd.Items) + numOfAds := len(adMap) if numOfAds != 1 && numOfAds != 3 { err := errors.New(fmt.Sprintf("invalid number of Availability Domains, should be either 1 or 3, but got %d", numOfAds)) s.Logger.Error(err, "invalid number of Availability Domains") @@ -149,23 +153,36 @@ func (s *ClusterScope) setFailureDomains(ctx context.Context) error { } if numOfAds == 3 { - for i, ad := range respAd.Items { - s.SetFailureDomain(strconv.Itoa(i+1), clusterv1.FailureDomainSpec{ + for k := range adMap { + adIndex := strings.LastIndexAny(k, "-") + if adIndex < 0 { + return errors.New(fmt.Sprintf("could not infer ad number from availability domain %s", k)) + } + adNumber := k[adIndex+1:] + _, err := strconv.Atoi(adNumber) + if err != nil { + return errors.New(fmt.Sprintf("availability domain is not a valid integer: availability domain %s", k)) + } + s.SetFailureDomain(adNumber, clusterv1.FailureDomainSpec{ ControlPlane: true, - Attributes: map[string]string{AvailabilityDomain: *ad.Name}, + Attributes: map[string]string{AvailabilityDomain: k}, }) } } else { - adName := *respAd.Items[0].Name - for i, fd := range ads[adName].FaultDomains { - s.SetFailureDomain(strconv.Itoa(i+1), clusterv1.FailureDomainSpec{ - ControlPlane: true, - Attributes: map[string]string{ - AvailabilityDomain: adName, - FaultDomain: fd, - }, - }) + // only first element is used, hence break at the end + for k := range adMap { + for i, fd := range adMap[k].FaultDomains { + s.SetFailureDomain(strconv.Itoa(i+1), clusterv1.FailureDomainSpec{ + ControlPlane: true, + Attributes: map[string]string{ + AvailabilityDomain: k, + FaultDomain: fd, + }, + }) + } + break } + } return nil @@ -176,10 +193,10 @@ func (s *ClusterScope) SetFailureDomain(id string, spec clusterv1.FailureDomainS s.OCIClusterAccessor.SetFailureDomain(id, spec) } -// setAvailabiltyDomainStatus builds the OCIAvailabilityDomain list and sets the OCICluster's status with this list +// setAvailabiltyDomainSpec builds the OCIAvailabilityDomain list and sets the OCICluster's spec with this list // so that other parts of the provider have access to ADs and FDs without having to make multiple calls to identity. -func (s *ClusterScope) setAvailabiltyDomainStatus(ctx context.Context, ads []identity.AvailabilityDomain) (map[string]infrastructurev1beta1.OCIAvailabilityDomain, error) { - clusterAds := make(map[string]infrastructurev1beta1.OCIAvailabilityDomain) +func (s *ClusterScope) setAvailabiltyDomainSpec(ctx context.Context, ads []identity.AvailabilityDomain) (map[string]infrastructurev1beta2.OCIAvailabilityDomain, error) { + clusterAds := make(map[string]infrastructurev1beta2.OCIAvailabilityDomain) for _, ad := range ads { reqFd := identity.ListFaultDomainsRequest{ CompartmentId: common.String(s.GetCompartmentId()), @@ -197,7 +214,7 @@ func (s *ClusterScope) setAvailabiltyDomainStatus(ctx context.Context, ads []ide } adName := *ad.Name - clusterAds[adName] = infrastructurev1beta1.OCIAvailabilityDomain{ + clusterAds[adName] = infrastructurev1beta2.OCIAvailabilityDomain{ Name: adName, FaultDomains: faultDomains, } @@ -255,7 +272,7 @@ func (s *ClusterScope) GetOCIClusterAccessor() OCIClusterAccessor { return s.OCIClusterAccessor } -func (s *ClusterScope) getDRG() *infrastructurev1beta1.DRG { +func (s *ClusterScope) getDRG() *infrastructurev1beta2.DRG { return s.OCIClusterAccessor.GetNetworkSpec().VCNPeering.DRG } diff --git a/cloud/scope/cluster_accessor.go b/cloud/scope/cluster_accessor.go index d1f0f44c..46a7651e 100644 --- a/cloud/scope/cluster_accessor.go +++ b/cloud/scope/cluster_accessor.go @@ -17,7 +17,7 @@ limitations under the License. package scope import ( - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" corev1 "k8s.io/api/core/v1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" ) @@ -43,15 +43,17 @@ type OCIClusterAccessor interface { // GetRegion returns the region of the cluster, if specified in the spec. GetRegion() string // GetNetworkSpec returns the NetworkSpec of the cluster. - GetNetworkSpec() *infrastructurev1beta1.NetworkSpec + GetNetworkSpec() *infrastructurev1beta2.NetworkSpec // SetControlPlaneEndpoint sets the control plane endpoint of the cluster. SetControlPlaneEndpoint(endpoint clusterv1.APIEndpoint) // GetFailureDomains returns the failure domains of the cluster. GetFailureDomains() clusterv1.FailureDomains // SetFailureDomain sets the failure domain. SetFailureDomain(id string, spec clusterv1.FailureDomainSpec) + // GetAvailabilityDomains get the availability domain. + GetAvailabilityDomains() map[string]infrastructurev1beta2.OCIAvailabilityDomain // SetAvailabilityDomains sets the availability domain. - SetAvailabilityDomains(ads map[string]infrastructurev1beta1.OCIAvailabilityDomain) + SetAvailabilityDomains(ads map[string]infrastructurev1beta2.OCIAvailabilityDomain) // MarkConditionFalse marks the provided condition as false in the cluster object MarkConditionFalse(t clusterv1.ConditionType, reason string, severity clusterv1.ConditionSeverity, messageFormat string, messageArgs ...interface{}) // GetIdentityRef returns the Identity reference of the cluster diff --git a/cloud/scope/cluster_test.go b/cloud/scope/cluster_test.go index d12e80be..98e979ae 100644 --- a/cloud/scope/cluster_test.go +++ b/cloud/scope/cluster_test.go @@ -18,10 +18,11 @@ package scope import ( "context" + "strings" "testing" "github.com/golang/mock/gomock" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/cluster-api-provider-oci/cloud/services/identity/mock_identity" "github.com/oracle/oci-go-sdk/v65/common" "github.com/oracle/oci-go-sdk/v65/identity" @@ -38,13 +39,13 @@ func TestClusterScope_ReconcileFailureDomains(t *testing.T) { CompartmentId: common.String("3ad"), })).Return(identity.ListAvailabilityDomainsResponse{Items: []identity.AvailabilityDomain{ { - Name: common.String("ad1"), + Name: common.String("ad-1"), }, { - Name: common.String("ad2"), + Name: common.String("ad-2"), }, { - Name: common.String("ad3"), + Name: common.String("ad-3"), }, }}, nil) @@ -56,7 +57,7 @@ func TestClusterScope_ReconcileFailureDomains(t *testing.T) { CompartmentId: common.String("1ad"), })).Return(identity.ListAvailabilityDomainsResponse{Items: []identity.AvailabilityDomain{ { - Name: common.String("ad1"), + Name: common.String("ad-1"), }, }}, nil) @@ -64,7 +65,7 @@ func TestClusterScope_ReconcileFailureDomains(t *testing.T) { CompartmentId: common.String("list-fd-error"), })).Return(identity.ListAvailabilityDomainsResponse{Items: []identity.AvailabilityDomain{ { - Name: common.String("ad1"), + Name: common.String("ad-1"), }, }}, nil) @@ -72,164 +73,222 @@ func TestClusterScope_ReconcileFailureDomains(t *testing.T) { CompartmentId: common.String("2ad"), })).Return(identity.ListAvailabilityDomainsResponse{Items: []identity.AvailabilityDomain{ { - Name: common.String("ad1"), + Name: common.String("ad-1"), }, { - Name: common.String("ad2"), + Name: common.String("ad-2"), }, }}, nil) identityClient.EXPECT().ListFaultDomains(gomock.Any(), gomock.Eq(identity.ListFaultDomainsRequest{ CompartmentId: common.String("1ad"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), })).Return(identity.ListFaultDomainsResponse{Items: []identity.FaultDomain{ { Name: common.String("fd1"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, { Name: common.String("fd2"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, { Name: common.String("fd3"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, }}, nil) identityClient.EXPECT().ListFaultDomains(gomock.Any(), gomock.Eq(identity.ListFaultDomainsRequest{ CompartmentId: common.String("3ad"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), })).Return(identity.ListFaultDomainsResponse{Items: []identity.FaultDomain{ { Name: common.String("fault-domain-1"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, { Name: common.String("fault-domain-2"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, { Name: common.String("fault-domain-3"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, }}, nil) identityClient.EXPECT().ListFaultDomains(gomock.Any(), gomock.Eq(identity.ListFaultDomainsRequest{ CompartmentId: common.String("3ad"), - AvailabilityDomain: common.String("ad2"), + AvailabilityDomain: common.String("ad-2"), })).Return(identity.ListFaultDomainsResponse{Items: []identity.FaultDomain{ { Name: common.String("fault-domain-1"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, { Name: common.String("fault-domain-2"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, { Name: common.String("fault-domain-3"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, }}, nil) identityClient.EXPECT().ListFaultDomains(gomock.Any(), gomock.Eq(identity.ListFaultDomainsRequest{ CompartmentId: common.String("3ad"), - AvailabilityDomain: common.String("ad3"), + AvailabilityDomain: common.String("ad-3"), })).Return(identity.ListFaultDomainsResponse{Items: []identity.FaultDomain{ { Name: common.String("fault-domain-1"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, { Name: common.String("fault-domain-2"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, { Name: common.String("fault-domain-3"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, }}, nil) identityClient.EXPECT().ListFaultDomains(gomock.Any(), gomock.Eq(identity.ListFaultDomainsRequest{ CompartmentId: common.String("2ad"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), })).Return(identity.ListFaultDomainsResponse{Items: []identity.FaultDomain{ { Name: common.String("fd1"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, { Name: common.String("fd2"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, { Name: common.String("fd3"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, }}, nil) identityClient.EXPECT().ListFaultDomains(gomock.Any(), gomock.Eq(identity.ListFaultDomainsRequest{ CompartmentId: common.String("2ad"), - AvailabilityDomain: common.String("ad2"), + AvailabilityDomain: common.String("ad-2"), })).Return(identity.ListFaultDomainsResponse{Items: []identity.FaultDomain{ { Name: common.String("fd1"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, { Name: common.String("fd2"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, { Name: common.String("fd3"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), }, }}, nil) identityClient.EXPECT().ListFaultDomains(gomock.Any(), gomock.Eq(identity.ListFaultDomainsRequest{ CompartmentId: common.String("list-fd-error"), - AvailabilityDomain: common.String("ad1"), + AvailabilityDomain: common.String("ad-1"), })).Return(identity.ListFaultDomainsResponse{}, errors.New("some error")) tests := []struct { - name string - spec infrastructurev1beta1.OCIClusterSpec - wantErr bool - expectedError string + name string + spec infrastructurev1beta2.OCIClusterSpec + wantErr bool + expectedError string + expectedErrorPrefix string }{ { name: "3ad region", - spec: infrastructurev1beta1.OCIClusterSpec{CompartmentId: "3ad"}, + spec: infrastructurev1beta2.OCIClusterSpec{CompartmentId: "3ad"}, }, { name: "1ad region", - spec: infrastructurev1beta1.OCIClusterSpec{CompartmentId: "1ad"}, + spec: infrastructurev1beta2.OCIClusterSpec{CompartmentId: "1ad"}, }, { name: "2ad region", - spec: infrastructurev1beta1.OCIClusterSpec{CompartmentId: "2ad"}, + spec: infrastructurev1beta2.OCIClusterSpec{CompartmentId: "2ad"}, wantErr: true, expectedError: "invalid number of Availability Domains, should be either 1 or 3, but got 2", }, { name: "list ad error", - spec: infrastructurev1beta1.OCIClusterSpec{CompartmentId: "list-ad-error"}, + spec: infrastructurev1beta2.OCIClusterSpec{CompartmentId: "list-ad-error"}, wantErr: true, expectedError: "some error", }, { name: "list fd error", - spec: infrastructurev1beta1.OCIClusterSpec{CompartmentId: "list-fd-error"}, + spec: infrastructurev1beta2.OCIClusterSpec{CompartmentId: "list-fd-error"}, wantErr: true, expectedError: "some error", }, + { + name: "should not call oci api", + spec: infrastructurev1beta2.OCIClusterSpec{ + CompartmentId: "2ad", + AvailabilityDomains: map[string]infrastructurev1beta2.OCIAvailabilityDomain{ + "ad-1": { + Name: "ad-1", + FaultDomains: []string{"fault-domain-1", "fault-domain-2", "fault-domain-3"}, + }, + }, + }, + wantErr: false, + }, + { + name: "ad does not have number suffix", + spec: infrastructurev1beta2.OCIClusterSpec{ + CompartmentId: "2ad", + AvailabilityDomains: map[string]infrastructurev1beta2.OCIAvailabilityDomain{ + "ad1": { + Name: "ad1", + FaultDomains: []string{"fault-domain-1", "fault-domain-2", "fault-domain-3"}, + }, + "ad2": { + Name: "ad2", + FaultDomains: []string{"fault-domain-1", "fault-domain-2", "fault-domain-3"}, + }, + "ad3": { + Name: "ad3", + FaultDomains: []string{"fault-domain-1", "fault-domain-2", "fault-domain-3"}, + }, + }, + }, + wantErr: true, + expectedErrorPrefix: "could not infer ad number from availability domain ad", + }, + { + name: "ad suffix is not a valid integer", + spec: infrastructurev1beta2.OCIClusterSpec{ + CompartmentId: "2ad", + AvailabilityDomains: map[string]infrastructurev1beta2.OCIAvailabilityDomain{ + "adone": { + Name: "ad1", + FaultDomains: []string{"fault-domain-1", "fault-domain-2", "fault-domain-3"}, + }, + "adtwo": { + Name: "ad2", + FaultDomains: []string{"fault-domain-1", "fault-domain-2", "fault-domain-3"}, + }, + "adthree": { + Name: "ad3", + FaultDomains: []string{"fault-domain-1", "fault-domain-2", "fault-domain-3"}, + }, + }, + }, + wantErr: true, + expectedErrorPrefix: "could not infer ad number from availability domain ad", + }, } l := log.FromContext(context.Background()) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - OCICluster: &infrastructurev1beta1.OCICluster{ + OCICluster: &infrastructurev1beta2.OCICluster{ Spec: tt.spec, ObjectMeta: metav1.ObjectMeta{ UID: "a", @@ -246,7 +305,11 @@ func TestClusterScope_ReconcileFailureDomains(t *testing.T) { t.Errorf("ReconcileFailureDomains() error = %v, wantErr %v", err, tt.wantErr) } if err != nil { - if err.Error() != tt.expectedError { + if tt.expectedErrorPrefix != "" { + if !strings.HasPrefix(err.Error(), tt.expectedErrorPrefix) { + t.Errorf("ReconcileFailureDomains() expected prefix = %s, actual error %s", tt.expectedErrorPrefix, err.Error()) + } + } else if err.Error() != tt.expectedError { t.Errorf("ReconcileFailureDomains() expected error = %s, actual error %s", tt.expectedError, err.Error()) } diff --git a/cloud/scope/drg_reconciler_test.go b/cloud/scope/drg_reconciler_test.go index f10d0155..b4a3a092 100644 --- a/cloud/scope/drg_reconciler_test.go +++ b/cloud/scope/drg_reconciler_test.go @@ -23,7 +23,7 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/vcn/mock_vcn" "github.com/oracle/oci-go-sdk/v65/common" @@ -41,7 +41,7 @@ func TestDRGReconciliation(t *testing.T) { vcnClient *mock_vcn.MockClient ociClusterAccessor OCISelfManagedCluster tags map[string]string - vcnPeering infrastructurev1beta1.VCNPeering + vcnPeering infrastructurev1beta2.VCNPeering ) setup := func(t *testing.T, g *WithT) { @@ -50,12 +50,12 @@ func TestDRGReconciliation(t *testing.T) { vcnClient = mock_vcn.NewMockClient(mockCtrl) client := fake.NewClientBuilder().Build() ociClusterAccessor = OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", Name: "cluster", }, - Spec: infrastructurev1beta1.OCIClusterSpec{ + Spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "compartment-id", OCIResourceIdentifier: "resource_uid", }, @@ -71,7 +71,7 @@ func TestDRGReconciliation(t *testing.T) { tags = make(map[string]string) tags[ociutil.CreatedBy] = ociutil.OCIClusterAPIProvider tags[ociutil.ClusterResourceIdentifier] = "resource_uid" - vcnPeering = infrastructurev1beta1.VCNPeering{} + vcnPeering = infrastructurev1beta2.VCNPeering{} g.Expect(err).To(BeNil()) } teardown := func(t *testing.T, g *WithT) { @@ -105,7 +105,7 @@ func TestDRGReconciliation(t *testing.T) { name: "drg is unmanaged", errorExpected: false, testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.Manage = false clusterScope.OCIClusterAccessor.GetNetworkSpec().VCNPeering = &vcnPeering }, @@ -116,7 +116,7 @@ func TestDRGReconciliation(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("request failed"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.Manage = true vcnPeering.DRG.ID = common.String("drg-id") clusterScope.OCIClusterAccessor.GetNetworkSpec().VCNPeering = &vcnPeering @@ -132,7 +132,7 @@ func TestDRGReconciliation(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("request failed"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.Manage = true vcnPeering.DRG.ID = common.String("drg-id") clusterScope.OCIClusterAccessor.GetNetworkSpec().VCNPeering = &vcnPeering @@ -146,7 +146,7 @@ func TestDRGReconciliation(t *testing.T) { name: "get drg call success", errorExpected: false, testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.Manage = true vcnPeering.DRG.ID = common.String("drg-id") clusterScope.OCIClusterAccessor.GetNetworkSpec().VCNPeering = &vcnPeering @@ -166,7 +166,7 @@ func TestDRGReconciliation(t *testing.T) { name: "drg create", errorExpected: false, testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.Manage = true clusterScope.OCIClusterAccessor.GetNetworkSpec().VCNPeering = &vcnPeering vcnClient.EXPECT().ListDrgs(gomock.Any(), gomock.Eq(core.ListDrgsRequest{ @@ -219,7 +219,7 @@ func TestDRGDeletion(t *testing.T) { vcnClient *mock_vcn.MockClient ociClusterAccessor OCISelfManagedCluster tags map[string]string - vcnPeering infrastructurev1beta1.VCNPeering + vcnPeering infrastructurev1beta2.VCNPeering ) setup := func(t *testing.T, g *WithT) { @@ -228,12 +228,12 @@ func TestDRGDeletion(t *testing.T) { vcnClient = mock_vcn.NewMockClient(mockCtrl) client := fake.NewClientBuilder().Build() ociClusterAccessor = OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", Name: "cluster", }, - Spec: infrastructurev1beta1.OCIClusterSpec{ + Spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "compartment-id", OCIResourceIdentifier: "resource_uid", }, @@ -250,7 +250,7 @@ func TestDRGDeletion(t *testing.T) { tags = make(map[string]string) tags[ociutil.CreatedBy] = ociutil.OCIClusterAPIProvider tags[ociutil.ClusterResourceIdentifier] = "resource_uid" - vcnPeering = infrastructurev1beta1.VCNPeering{} + vcnPeering = infrastructurev1beta2.VCNPeering{} g.Expect(err).To(BeNil()) } teardown := func(t *testing.T, g *WithT) { @@ -284,7 +284,7 @@ func TestDRGDeletion(t *testing.T) { name: "drg is unmanaged", errorExpected: false, testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.Manage = false clusterScope.OCIClusterAccessor.GetNetworkSpec().VCNPeering = &vcnPeering }, @@ -295,7 +295,7 @@ func TestDRGDeletion(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("request failed"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.Manage = true vcnPeering.DRG.ID = common.String("drg-id") clusterScope.OCIClusterAccessor.GetNetworkSpec().VCNPeering = &vcnPeering @@ -309,7 +309,7 @@ func TestDRGDeletion(t *testing.T) { name: "drg not found", errorExpected: false, testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.Manage = true vcnPeering.DRG.ID = common.String("drg-id") clusterScope.OCIClusterAccessor.GetNetworkSpec().VCNPeering = &vcnPeering @@ -323,7 +323,7 @@ func TestDRGDeletion(t *testing.T) { name: "delete success", errorExpected: false, testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.Manage = true vcnPeering.DRG.ID = common.String("drg-id") clusterScope.OCIClusterAccessor.GetNetworkSpec().VCNPeering = &vcnPeering diff --git a/cloud/scope/drg_rpc_attachment_reconciler_test.go b/cloud/scope/drg_rpc_attachment_reconciler_test.go index e8d359bb..b2dd9efe 100644 --- a/cloud/scope/drg_rpc_attachment_reconciler_test.go +++ b/cloud/scope/drg_rpc_attachment_reconciler_test.go @@ -23,7 +23,7 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/vcn/mock_vcn" "github.com/oracle/oci-go-sdk/v65/common" @@ -42,7 +42,7 @@ func TestDRGRPCAttachmentReconciliation(t *testing.T) { peerVcnClient *mock_vcn.MockClient ociClusterAccessor OCISelfManagedCluster tags map[string]string - vcnPeering infrastructurev1beta1.VCNPeering + vcnPeering infrastructurev1beta2.VCNPeering ) setup := func(t *testing.T, g *WithT) { @@ -52,12 +52,12 @@ func TestDRGRPCAttachmentReconciliation(t *testing.T) { peerVcnClient = mock_vcn.NewMockClient(mockCtrl) client := fake.NewClientBuilder().Build() ociClusterAccessor = OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", Name: "cluster", }, - Spec: infrastructurev1beta1.OCIClusterSpec{ + Spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "compartment-id", OCIResourceIdentifier: "resource_uid", }, @@ -80,7 +80,7 @@ func TestDRGRPCAttachmentReconciliation(t *testing.T) { tags = make(map[string]string) tags[ociutil.CreatedBy] = ociutil.OCIClusterAPIProvider tags[ociutil.ClusterResourceIdentifier] = "resource_uid" - vcnPeering = infrastructurev1beta1.VCNPeering{} + vcnPeering = infrastructurev1beta2.VCNPeering{} g.Expect(err).To(BeNil()) } teardown := func(t *testing.T, g *WithT) { @@ -107,9 +107,9 @@ func TestDRGRPCAttachmentReconciliation(t *testing.T) { name: "create local rpc", errorExpected: false, testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.ID = common.String("drg-id") - vcnPeering.RemotePeeringConnections = []infrastructurev1beta1.RemotePeeringConnection{ + vcnPeering.RemotePeeringConnections = []infrastructurev1beta2.RemotePeeringConnection{ { ManagePeerRPC: false, PeerDRGId: common.String("peer-drg-id"), @@ -171,9 +171,9 @@ func TestDRGRPCAttachmentReconciliation(t *testing.T) { name: "create remote rpc", errorExpected: false, testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.ID = common.String("drg-id") - vcnPeering.RemotePeeringConnections = []infrastructurev1beta1.RemotePeeringConnection{ + vcnPeering.RemotePeeringConnections = []infrastructurev1beta2.RemotePeeringConnection{ { ManagePeerRPC: true, PeerDRGId: common.String("peer-drg-id"), @@ -276,7 +276,7 @@ func TestDRGRPCAttachmentReconciliation(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("DRG ID has not been set"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} ociClusterAccessor.OCICluster.Spec.NetworkSpec.VCNPeering = &vcnPeering }, }, @@ -286,9 +286,9 @@ func TestDRGRPCAttachmentReconciliation(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("peer DRG ID has not been specified"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.ID = common.String("drg-id") - vcnPeering.RemotePeeringConnections = []infrastructurev1beta1.RemotePeeringConnection{ + vcnPeering.RemotePeeringConnections = []infrastructurev1beta2.RemotePeeringConnection{ { ManagePeerRPC: true, PeerRegionName: "us-sanjose-1", @@ -333,9 +333,9 @@ func TestDRGRPCAttachmentReconciliation(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("peer RPC Connection ID is empty"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.ID = common.String("drg-id") - vcnPeering.RemotePeeringConnections = []infrastructurev1beta1.RemotePeeringConnection{ + vcnPeering.RemotePeeringConnections = []infrastructurev1beta2.RemotePeeringConnection{ { ManagePeerRPC: false, PeerDRGId: common.String("peer-drg-id"), @@ -381,9 +381,9 @@ func TestDRGRPCAttachmentReconciliation(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("request failed"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.ID = common.String("drg-id") - vcnPeering.RemotePeeringConnections = []infrastructurev1beta1.RemotePeeringConnection{ + vcnPeering.RemotePeeringConnections = []infrastructurev1beta2.RemotePeeringConnection{ { ManagePeerRPC: true, PeerDRGId: common.String("peer-drg-id"), @@ -404,9 +404,9 @@ func TestDRGRPCAttachmentReconciliation(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("request failed"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.ID = common.String("drg-id") - vcnPeering.RemotePeeringConnections = []infrastructurev1beta1.RemotePeeringConnection{ + vcnPeering.RemotePeeringConnections = []infrastructurev1beta2.RemotePeeringConnection{ { ManagePeerRPC: true, PeerDRGId: common.String("peer-drg-id"), @@ -443,9 +443,9 @@ func TestDRGRPCAttachmentReconciliation(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("request failed"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.ID = common.String("drg-id") - vcnPeering.RemotePeeringConnections = []infrastructurev1beta1.RemotePeeringConnection{ + vcnPeering.RemotePeeringConnections = []infrastructurev1beta2.RemotePeeringConnection{ { ManagePeerRPC: true, PeerDRGId: common.String("peer-drg-id"), @@ -492,9 +492,9 @@ func TestDRGRPCAttachmentReconciliation(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("request failed"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.ID = common.String("drg-id") - vcnPeering.RemotePeeringConnections = []infrastructurev1beta1.RemotePeeringConnection{ + vcnPeering.RemotePeeringConnections = []infrastructurev1beta2.RemotePeeringConnection{ { ManagePeerRPC: true, PeerDRGId: common.String("peer-drg-id"), @@ -556,9 +556,9 @@ func TestDRGRPCAttachmentReconciliation(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("request failed"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.ID = common.String("drg-id") - vcnPeering.RemotePeeringConnections = []infrastructurev1beta1.RemotePeeringConnection{ + vcnPeering.RemotePeeringConnections = []infrastructurev1beta2.RemotePeeringConnection{ { ManagePeerRPC: true, PeerDRGId: common.String("peer-drg-id"), @@ -629,9 +629,9 @@ func TestDRGRPCAttachmentReconciliation(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("request failed"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.ID = common.String("drg-id") - vcnPeering.RemotePeeringConnections = []infrastructurev1beta1.RemotePeeringConnection{ + vcnPeering.RemotePeeringConnections = []infrastructurev1beta2.RemotePeeringConnection{ { ManagePeerRPC: true, PeerDRGId: common.String("peer-drg-id"), @@ -716,9 +716,9 @@ func TestDRGRPCAttachmentReconciliation(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("invalid peering status INVALID of RPC local-connection-id"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.ID = common.String("drg-id") - vcnPeering.RemotePeeringConnections = []infrastructurev1beta1.RemotePeeringConnection{ + vcnPeering.RemotePeeringConnections = []infrastructurev1beta2.RemotePeeringConnection{ { ManagePeerRPC: true, PeerDRGId: common.String("peer-drg-id"), @@ -837,7 +837,7 @@ func TestDRGRPCAttachmentDeletion(t *testing.T) { peerVcnClient *mock_vcn.MockClient ociClusterAccessor OCISelfManagedCluster tags map[string]string - vcnPeering infrastructurev1beta1.VCNPeering + vcnPeering infrastructurev1beta2.VCNPeering ) setup := func(t *testing.T, g *WithT) { @@ -846,12 +846,12 @@ func TestDRGRPCAttachmentDeletion(t *testing.T) { vcnClient = mock_vcn.NewMockClient(mockCtrl) client := fake.NewClientBuilder().Build() ociClusterAccessor = OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", Name: "cluster", }, - Spec: infrastructurev1beta1.OCIClusterSpec{ + Spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "compartment-id", OCIResourceIdentifier: "resource_uid", }, @@ -876,7 +876,7 @@ func TestDRGRPCAttachmentDeletion(t *testing.T) { tags = make(map[string]string) tags[ociutil.CreatedBy] = ociutil.OCIClusterAPIProvider tags[ociutil.ClusterResourceIdentifier] = "resource_uid" - vcnPeering = infrastructurev1beta1.VCNPeering{} + vcnPeering = infrastructurev1beta2.VCNPeering{} g.Expect(err).To(BeNil()) } teardown := func(t *testing.T, g *WithT) { @@ -903,9 +903,9 @@ func TestDRGRPCAttachmentDeletion(t *testing.T) { name: "delete local rpc", errorExpected: false, testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.ID = common.String("drg-id") - vcnPeering.RemotePeeringConnections = []infrastructurev1beta1.RemotePeeringConnection{ + vcnPeering.RemotePeeringConnections = []infrastructurev1beta2.RemotePeeringConnection{ { ManagePeerRPC: false, PeerDRGId: common.String("peer-drg-id"), @@ -946,9 +946,9 @@ func TestDRGRPCAttachmentDeletion(t *testing.T) { name: "delete remote rpc", errorExpected: false, testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.ID = common.String("drg-id") - vcnPeering.RemotePeeringConnections = []infrastructurev1beta1.RemotePeeringConnection{ + vcnPeering.RemotePeeringConnections = []infrastructurev1beta2.RemotePeeringConnection{ { ManagePeerRPC: true, PeerDRGId: common.String("peer-drg-id"), @@ -1017,9 +1017,9 @@ func TestDRGRPCAttachmentDeletion(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("request failed"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.ID = common.String("drg-id") - vcnPeering.RemotePeeringConnections = []infrastructurev1beta1.RemotePeeringConnection{ + vcnPeering.RemotePeeringConnections = []infrastructurev1beta2.RemotePeeringConnection{ { ManagePeerRPC: true, PeerDRGId: common.String("peer-drg-id"), @@ -1051,9 +1051,9 @@ func TestDRGRPCAttachmentDeletion(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("request failed"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.ID = common.String("drg-id") - vcnPeering.RemotePeeringConnections = []infrastructurev1beta1.RemotePeeringConnection{ + vcnPeering.RemotePeeringConnections = []infrastructurev1beta2.RemotePeeringConnection{ { ManagePeerRPC: true, PeerDRGId: common.String("peer-drg-id"), diff --git a/cloud/scope/drg_vcn_attachment_reconciler_test.go b/cloud/scope/drg_vcn_attachment_reconciler_test.go index ec813023..f8ea1fe5 100644 --- a/cloud/scope/drg_vcn_attachment_reconciler_test.go +++ b/cloud/scope/drg_vcn_attachment_reconciler_test.go @@ -23,7 +23,7 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/vcn/mock_vcn" "github.com/oracle/oci-go-sdk/v65/common" @@ -41,7 +41,7 @@ func TestDRGVCNAttachmentReconciliation(t *testing.T) { vcnClient *mock_vcn.MockClient ociClusterAccessor OCISelfManagedCluster tags map[string]string - vcnPeering infrastructurev1beta1.VCNPeering + vcnPeering infrastructurev1beta2.VCNPeering ) setup := func(t *testing.T, g *WithT) { @@ -50,12 +50,12 @@ func TestDRGVCNAttachmentReconciliation(t *testing.T) { vcnClient = mock_vcn.NewMockClient(mockCtrl) client := fake.NewClientBuilder().Build() ociClusterAccessor = OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", Name: "cluster", }, - Spec: infrastructurev1beta1.OCIClusterSpec{ + Spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "compartment-id", OCIResourceIdentifier: "resource_uid", }, @@ -71,7 +71,7 @@ func TestDRGVCNAttachmentReconciliation(t *testing.T) { tags = make(map[string]string) tags[ociutil.CreatedBy] = ociutil.OCIClusterAPIProvider tags[ociutil.ClusterResourceIdentifier] = "resource_uid" - vcnPeering = infrastructurev1beta1.VCNPeering{} + vcnPeering = infrastructurev1beta2.VCNPeering{} g.Expect(err).To(BeNil()) } teardown := func(t *testing.T, g *WithT) { @@ -100,7 +100,7 @@ func TestDRGVCNAttachmentReconciliation(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("request failed"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.Manage = true vcnPeering.DRG.ID = common.String("drg-id") vcnPeering.DRG.VcnAttachmentId = common.String("attachment-id") @@ -115,7 +115,7 @@ func TestDRGVCNAttachmentReconciliation(t *testing.T) { name: "get drg attachment call success", errorExpected: false, testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.Manage = true vcnPeering.DRG.ID = common.String("drg-id") vcnPeering.DRG.VcnAttachmentId = common.String("attachment-id") @@ -136,7 +136,7 @@ func TestDRGVCNAttachmentReconciliation(t *testing.T) { name: "drg attachment create", errorExpected: false, testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.Manage = true vcnPeering.DRG.ID = common.String("drg-id") clusterScope.OCIClusterAccessor.GetNetworkSpec().VCNPeering = &vcnPeering @@ -195,7 +195,7 @@ func TestDRGVcnAttachmentDeletion(t *testing.T) { vcnClient *mock_vcn.MockClient ociClusterAccessor OCISelfManagedCluster tags map[string]string - vcnPeering infrastructurev1beta1.VCNPeering + vcnPeering infrastructurev1beta2.VCNPeering ) setup := func(t *testing.T, g *WithT) { @@ -204,12 +204,12 @@ func TestDRGVcnAttachmentDeletion(t *testing.T) { vcnClient = mock_vcn.NewMockClient(mockCtrl) client := fake.NewClientBuilder().Build() ociClusterAccessor = OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", Name: "cluster", }, - Spec: infrastructurev1beta1.OCIClusterSpec{ + Spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "compartment-id", OCIResourceIdentifier: "resource_uid", }, @@ -225,7 +225,7 @@ func TestDRGVcnAttachmentDeletion(t *testing.T) { tags = make(map[string]string) tags[ociutil.CreatedBy] = ociutil.OCIClusterAPIProvider tags[ociutil.ClusterResourceIdentifier] = "resource_uid" - vcnPeering = infrastructurev1beta1.VCNPeering{} + vcnPeering = infrastructurev1beta2.VCNPeering{} g.Expect(err).To(BeNil()) } teardown := func(t *testing.T, g *WithT) { @@ -254,7 +254,7 @@ func TestDRGVcnAttachmentDeletion(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("request failed"), testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.Manage = true vcnPeering.DRG.ID = common.String("drg-id") vcnPeering.DRG.VcnAttachmentId = common.String("attachment-id") @@ -269,7 +269,7 @@ func TestDRGVcnAttachmentDeletion(t *testing.T) { name: "drg attachment not found", errorExpected: false, testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.Manage = true vcnPeering.DRG.ID = common.String("drg-id") vcnPeering.DRG.VcnAttachmentId = common.String("attachment-id") @@ -284,7 +284,7 @@ func TestDRGVcnAttachmentDeletion(t *testing.T) { name: "delete success", errorExpected: false, testSpecificSetup: func(clusterScope *ClusterScope, vcnClient *mock_vcn.MockClient) { - vcnPeering.DRG = &infrastructurev1beta1.DRG{} + vcnPeering.DRG = &infrastructurev1beta2.DRG{} vcnPeering.DRG.Manage = true vcnPeering.DRG.ID = common.String("drg-id") vcnPeering.DRG.VcnAttachmentId = common.String("attachment-id") diff --git a/cloud/scope/internet_gateway_reconciler.go b/cloud/scope/internet_gateway_reconciler.go index 516e8496..d896aa50 100644 --- a/cloud/scope/internet_gateway_reconciler.go +++ b/cloud/scope/internet_gateway_reconciler.go @@ -27,6 +27,10 @@ import ( // ReconcileInternetGateway tries to move the Internet Gateway to the desired OCICluster Spec func (s *ClusterScope) ReconcileInternetGateway(ctx context.Context) error { + if s.OCIClusterAccessor.GetNetworkSpec().Vcn.InternetGateway.Skip { + s.Logger.Info("Skipping Internet Gateway reconciliation as per spec") + return nil + } if s.IsAllSubnetsPrivate() { s.Logger.Info("All subnets are private, we don't need internet gateway") return nil @@ -37,7 +41,7 @@ func (s *ClusterScope) ReconcileInternetGateway(ctx context.Context) error { return err } if igw != nil { - s.OCIClusterAccessor.GetNetworkSpec().Vcn.InternetGatewayId = igw.Id + s.OCIClusterAccessor.GetNetworkSpec().Vcn.InternetGateway.Id = igw.Id s.Logger.Info("No Reconciliation Required for Internet Gateway", "internet_gateway", igw.Id) return nil } @@ -45,7 +49,7 @@ func (s *ClusterScope) ReconcileInternetGateway(ctx context.Context) error { if err != nil { return err } - s.OCIClusterAccessor.GetNetworkSpec().Vcn.InternetGatewayId = internetGateway + s.OCIClusterAccessor.GetNetworkSpec().Vcn.InternetGateway.Id = internetGateway return err } @@ -55,7 +59,7 @@ func (s *ClusterScope) ReconcileInternetGateway(ctx context.Context) error { // // 2. Listing the Internet Gateways for the Compartment (by ID) and filtering by tag func (s *ClusterScope) GetInternetGateway(ctx context.Context) (*core.InternetGateway, error) { - gwId := s.OCIClusterAccessor.GetNetworkSpec().Vcn.InternetGatewayId + gwId := s.OCIClusterAccessor.GetNetworkSpec().Vcn.InternetGateway.Id if gwId != nil { resp, err := s.VCNClient.GetInternetGateway(ctx, core.GetInternetGatewayRequest{ IgId: gwId, @@ -110,6 +114,10 @@ func (s *ClusterScope) CreateInternetGateway(ctx context.Context) (*string, erro // DeleteInternetGateway retrieves and attempts to delete the Internet Gateway if found. func (s *ClusterScope) DeleteInternetGateway(ctx context.Context) error { + if s.OCIClusterAccessor.GetNetworkSpec().Vcn.RouteTable.Skip { + s.Logger.Info("Skipping Internet Gateway reconciliation as per spec") + return nil + } igw, err := s.GetInternetGateway(ctx) if err != nil && !ociutil.IsNotFound(err) { return err diff --git a/cloud/scope/internet_gateway_reconciler_test.go b/cloud/scope/internet_gateway_reconciler_test.go index be9922ad..866aaf49 100644 --- a/cloud/scope/internet_gateway_reconciler_test.go +++ b/cloud/scope/internet_gateway_reconciler_test.go @@ -21,7 +21,7 @@ import ( "testing" "github.com/golang/mock/gomock" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/vcn/mock_vcn" "github.com/oracle/oci-go-sdk/v65/common" @@ -132,23 +132,23 @@ func TestClusterScope_ReconcileInternetGateway(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec wantErr bool expectedError string }{ { name: "all subnets are private", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Type: infrastructurev1beta1.Private, - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Type: infrastructurev1beta2.Private, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, }, { - Type: infrastructurev1beta1.Private, - Role: infrastructurev1beta1.ServiceLoadBalancerRole, + Type: infrastructurev1beta2.Private, + Role: infrastructurev1beta2.ServiceLoadBalancerRole, }, }, }, @@ -158,11 +158,13 @@ func TestClusterScope_ReconcileInternetGateway(t *testing.T) { }, { name: "no update needed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - InternetGatewayId: common.String("foo"), + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + InternetGateway: infrastructurev1beta2.InternetGateway{ + Id: common.String("foo"), + }, }, }, }, @@ -170,14 +172,14 @@ func TestClusterScope_ReconcileInternetGateway(t *testing.T) { }, { name: "id not present in spec but found by name and no update needed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", FreeformTags: map[string]string{ "foo": "bar", }, DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn"), }, }, @@ -186,14 +188,14 @@ func TestClusterScope_ReconcileInternetGateway(t *testing.T) { }, { name: "creation needed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", FreeformTags: map[string]string{ "foo": "bar", }, DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn1"), }, }, @@ -202,11 +204,11 @@ func TestClusterScope_ReconcileInternetGateway(t *testing.T) { }, { name: "creation failed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn1"), }, }, @@ -214,12 +216,28 @@ func TestClusterScope_ReconcileInternetGateway(t *testing.T) { wantErr: true, expectedError: "failed create internet gateway: some error", }, + { + name: "creation skip", + spec: infrastructurev1beta2.OCIClusterSpec{ + CompartmentId: "foo", + DefinedTags: definedTags, + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + ID: common.String("vcn1"), + InternetGateway: infrastructurev1beta2.InternetGateway{ + Skip: true, + }, + }, + }, + }, + wantErr: false, + }, } l := log.FromContext(context.Background()) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, @@ -293,16 +311,18 @@ func TestClusterScope_DeleteInternetGateway(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec wantErr bool expectedError string }{ { name: "delete internet gateway is successful", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - InternetGatewayId: common.String("normal_id"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + InternetGateway: infrastructurev1beta2.InternetGateway{ + Id: common.String("normal_id"), + }, }, }, }, @@ -310,10 +330,12 @@ func TestClusterScope_DeleteInternetGateway(t *testing.T) { }, { name: "internet gateway already deleted", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - InternetGatewayId: common.String("igw_deleted"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + InternetGateway: infrastructurev1beta2.InternetGateway{ + Id: common.String("igw_deleted"), + }, }, }, }, @@ -321,10 +343,12 @@ func TestClusterScope_DeleteInternetGateway(t *testing.T) { }, { name: "delete internet gateway error when calling get internet gateway", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - InternetGatewayId: common.String("error"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + InternetGateway: infrastructurev1beta2.InternetGateway{ + Id: common.String("error"), + }, }, }, }, @@ -333,10 +357,12 @@ func TestClusterScope_DeleteInternetGateway(t *testing.T) { }, { name: "delete internet gateway error when calling delete internet gateway", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - InternetGatewayId: common.String("error_delete_igw"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + InternetGateway: infrastructurev1beta2.InternetGateway{ + Id: common.String("error_delete_igw"), + }, }, }, }, @@ -348,7 +374,7 @@ func TestClusterScope_DeleteInternetGateway(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ Spec: tt.spec, ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", diff --git a/cloud/scope/load_balancer_reconciler.go b/cloud/scope/load_balancer_reconciler.go index 09905c33..1f889059 100644 --- a/cloud/scope/load_balancer_reconciler.go +++ b/cloud/scope/load_balancer_reconciler.go @@ -20,7 +20,7 @@ import ( "context" "fmt" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/cluster-api-provider-oci/cloud/ociutil" "github.com/oracle/oci-go-sdk/v65/common" "github.com/oracle/oci-go-sdk/v65/networkloadbalancer" @@ -94,8 +94,8 @@ func (s *ClusterScope) DeleteApiServerLB(ctx context.Context) error { } // LBSpec builds the LoadBalancer from the ClusterScope and returns it -func (s *ClusterScope) LBSpec() infrastructurev1beta1.LoadBalancer { - lbSpec := infrastructurev1beta1.LoadBalancer{ +func (s *ClusterScope) LBSpec() infrastructurev1beta2.LoadBalancer { + lbSpec := infrastructurev1beta2.LoadBalancer{ Name: s.GetControlPlaneLoadBalancerName(), } return lbSpec @@ -111,7 +111,7 @@ func (s *ClusterScope) GetControlPlaneLoadBalancerName() string { } // UpdateLB updates existing Load Balancer's DisplayName, FreeformTags and DefinedTags -func (s *ClusterScope) UpdateLB(ctx context.Context, lb infrastructurev1beta1.LoadBalancer) error { +func (s *ClusterScope) UpdateLB(ctx context.Context, lb infrastructurev1beta2.LoadBalancer) error { lbId := s.OCIClusterAccessor.GetNetworkSpec().APIServerLB.LoadBalancerId updateLBDetails := networkloadbalancer.UpdateNetworkLoadBalancerDetails{ DisplayName: common.String(lb.Name), @@ -138,7 +138,7 @@ func (s *ClusterScope) UpdateLB(ctx context.Context, lb infrastructurev1beta1.Lo // // See https://docs.oracle.com/en-us/iaas/Content/NetworkLoadBalancer/overview.htm for more details on the Network // Load Balancer -func (s *ClusterScope) CreateLB(ctx context.Context, lb infrastructurev1beta1.LoadBalancer) (*string, *string, error) { +func (s *ClusterScope) CreateLB(ctx context.Context, lb infrastructurev1beta2.LoadBalancer) (*string, *string, error) { listenerDetails := make(map[string]networkloadbalancer.ListenerDetails) listenerDetails[APIServerLBListener] = networkloadbalancer.ListenerDetails{ Protocol: networkloadbalancer.ListenerProtocolsTcp, @@ -162,7 +162,7 @@ func (s *ClusterScope) CreateLB(ctx context.Context, lb infrastructurev1beta1.Lo var controlPlaneEndpointSubnets []string for _, subnet := range s.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets { - if subnet.Role == infrastructurev1beta1.ControlPlaneEndpointRole { + if subnet.Role == infrastructurev1beta2.ControlPlaneEndpointRole { controlPlaneEndpointSubnets = append(controlPlaneEndpointSubnets, *subnet.ID) } } @@ -184,8 +184,8 @@ func (s *ClusterScope) CreateLB(ctx context.Context, lb infrastructurev1beta1.Lo DefinedTags: s.GetDefinedTags(), } - for _, nsg := range s.OCIClusterAccessor.GetNetworkSpec().Vcn.NetworkSecurityGroups { - if nsg.Role == infrastructurev1beta1.ControlPlaneEndpointRole { + for _, nsg := range s.OCIClusterAccessor.GetNetworkSpec().Vcn.NetworkSecurityGroup.List { + if nsg.Role == infrastructurev1beta2.ControlPlaneEndpointRole { if nsg.ID != nil { lbDetails.NetworkSecurityGroupIds = []string{*nsg.ID} } @@ -245,7 +245,7 @@ func (s *ClusterScope) getLoadbalancerIp(nlb networkloadbalancer.NetworkLoadBala // IsLBEqual determines if the actual networkloadbalancer.NetworkLoadBalancer is equal to the desired. // Equality is determined by DisplayName -func (s *ClusterScope) IsLBEqual(actual *networkloadbalancer.NetworkLoadBalancer, desired infrastructurev1beta1.LoadBalancer) bool { +func (s *ClusterScope) IsLBEqual(actual *networkloadbalancer.NetworkLoadBalancer, desired infrastructurev1beta2.LoadBalancer) bool { if desired.Name != *actual.DisplayName { return false } diff --git a/cloud/scope/load_balancer_reconciler_test.go b/cloud/scope/load_balancer_reconciler_test.go index d8526efb..3e33ee1b 100644 --- a/cloud/scope/load_balancer_reconciler_test.go +++ b/cloud/scope/load_balancer_reconciler_test.go @@ -24,7 +24,7 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/networkloadbalancer/mock_nlb" "github.com/oracle/oci-go-sdk/v65/common" @@ -50,12 +50,12 @@ func TestLBReconciliation(t *testing.T) { nlbClient = mock_nlb.NewMockNetworkLoadBalancerClient(mockCtrl) client := fake.NewClientBuilder().Build() ociClusterAccessor = OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "a", Name: "cluster", }, - Spec: infrastructurev1beta1.OCIClusterSpec{ + Spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "compartment-id", OCIResourceIdentifier: "resource_uid", }, @@ -223,13 +223,13 @@ func TestLBReconciliation(t *testing.T) { errorExpected: true, matchError: errors.New("cannot have more than 1 control plane endpoint subnet"), testSpecificSetup: func(clusterScope *ClusterScope, nlbClient *mock_nlb.MockNetworkLoadBalancerClient) { - clusterScope.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets = []*infrastructurev1beta1.Subnet{ + clusterScope.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets = []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, ID: common.String("s1"), }, { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, ID: common.String("s2"), }, } @@ -244,9 +244,9 @@ func TestLBReconciliation(t *testing.T) { name: "create load balancer", errorExpected: false, testSpecificSetup: func(clusterScope *ClusterScope, nlbClient *mock_nlb.MockNetworkLoadBalancerClient) { - clusterScope.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets = []*infrastructurev1beta1.Subnet{ + clusterScope.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets = []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, ID: common.String("s1"), }, } @@ -329,9 +329,9 @@ func TestLBReconciliation(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("request failed"), testSpecificSetup: func(clusterScope *ClusterScope, nlbClient *mock_nlb.MockNetworkLoadBalancerClient) { - clusterScope.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets = []*infrastructurev1beta1.Subnet{ + clusterScope.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets = []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, ID: common.String("s1"), }, } @@ -381,9 +381,9 @@ func TestLBReconciliation(t *testing.T) { errorSubStringMatch: true, matchError: errors.New("WorkRequest opc-wr-id failed"), testSpecificSetup: func(clusterScope *ClusterScope, nlbClient *mock_nlb.MockNetworkLoadBalancerClient) { - clusterScope.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets = []*infrastructurev1beta1.Subnet{ + clusterScope.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets = []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, ID: common.String("s1"), }, } @@ -553,12 +553,12 @@ func TestLBDeletion(t *testing.T) { nlbClient = mock_nlb.NewMockNetworkLoadBalancerClient(mockCtrl) client := fake.NewClientBuilder().Build() ociClusterAccessor = OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "a", Name: "cluster", }, - Spec: infrastructurev1beta1.OCIClusterSpec{ + Spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "compartment-id", OCIResourceIdentifier: "resource_uid", }, diff --git a/cloud/scope/machine.go b/cloud/scope/machine.go index 607c79c8..67379ca2 100644 --- a/cloud/scope/machine.go +++ b/cloud/scope/machine.go @@ -25,7 +25,7 @@ import ( "time" "github.com/go-logr/logr" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/compute" nlb "github.com/oracle/cluster-api-provider-oci/cloud/services/networkloadbalancer" @@ -55,8 +55,8 @@ type MachineScopeParams struct { Machine *clusterv1.Machine Client client.Client ComputeClient compute.ComputeClient - OCICluster *infrastructurev1beta1.OCICluster - OCIMachine *infrastructurev1beta1.OCIMachine + OCICluster *infrastructurev1beta2.OCICluster + OCIMachine *infrastructurev1beta2.OCIMachine VCNClient vcn.Client NetworkLoadBalancerClient nlb.NetworkLoadBalancerClient } @@ -68,8 +68,8 @@ type MachineScope struct { Cluster *clusterv1.Cluster Machine *clusterv1.Machine ComputeClient compute.ComputeClient - OCICluster *infrastructurev1beta1.OCICluster - OCIMachine *infrastructurev1beta1.OCIMachine + OCICluster *infrastructurev1beta2.OCICluster + OCIMachine *infrastructurev1beta2.OCIMachine VCNClient vcn.Client NetworkLoadBalancerClient nlb.NetworkLoadBalancerClient } @@ -124,7 +124,7 @@ func (m *MachineScope) GetOrCreateMachine(ctx context.Context) (*core.Instance, } shapeConfig := core.LaunchInstanceShapeConfigDetails{} - if (m.OCIMachine.Spec.ShapeConfig != infrastructurev1beta1.ShapeConfig{}) { + if (m.OCIMachine.Spec.ShapeConfig != infrastructurev1beta2.ShapeConfig{}) { ocpuString := m.OCIMachine.Spec.ShapeConfig.Ocpus if ocpuString != "" { ocpus, err := strconv.ParseFloat(ocpuString, 32) @@ -172,25 +172,18 @@ func (m *MachineScope) GetOrCreateMachine(ctx context.Context) (*core.Instance, sourceDetails.BootVolumeVpusPerGB = m.OCIMachine.Spec.InstanceSourceViaImageDetails.BootVolumeVpusPerGB } - subnetId := m.OCIMachine.Spec.NetworkDetails.SubnetId - if subnetId == nil { - if m.IsControlPlane() { - subnetId = m.getGetControlPlaneMachineSubnet() - } else { - subnetId = m.getWorkerMachineSubnet() - } + var subnetId *string + if m.IsControlPlane() { + subnetId = m.getGetControlPlaneMachineSubnet() + } else { + subnetId = m.getWorkerMachineSubnet() } var nsgIds []string - if m.OCIMachine.Spec.NetworkDetails.NSGId != nil { - nsgIds = []string{*m.OCIMachine.Spec.NetworkDetails.NSGId} - } - if len(nsgIds) == 0 { - if m.IsControlPlane() { - nsgIds = m.getGetControlPlaneMachineNSGs() - } else { - nsgIds = m.getWorkerMachineNSGs() - } + if m.IsControlPlane() { + nsgIds = m.getGetControlPlaneMachineNSGs() + } else { + nsgIds = m.getWorkerMachineNSGs() } failureDomain := m.Machine.Spec.FailureDomain @@ -274,7 +267,7 @@ func (m *MachineScope) GetOrCreateMachine(ctx context.Context) (*core.Instance, } } -func (m *MachineScope) getFreeFormTags(ociCluster infrastructurev1beta1.OCICluster) map[string]string { +func (m *MachineScope) getFreeFormTags(ociCluster infrastructurev1beta2.OCICluster) map[string]string { tags := ociutil.BuildClusterTags(ociCluster.GetOCIResourceIdentifier()) // first use cluster level tags, then override with machine level tags if ociCluster.Spec.FreeformTags != nil { @@ -596,7 +589,7 @@ func (m *MachineScope) getCompartmentId() string { func (m *MachineScope) getGetControlPlaneMachineSubnet() *string { for _, subnet := range m.OCICluster.Spec.NetworkSpec.Vcn.Subnets { - if subnet.Role == infrastructurev1beta1.ControlPlaneRole { + if subnet.Role == infrastructurev1beta2.ControlPlaneRole { return subnet.ID } } @@ -605,8 +598,8 @@ func (m *MachineScope) getGetControlPlaneMachineSubnet() *string { func (m *MachineScope) getGetControlPlaneMachineNSGs() []string { nsgs := make([]string, 0) - for _, nsg := range m.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroups { - if nsg.Role == infrastructurev1beta1.ControlPlaneRole { + for _, nsg := range m.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List { + if nsg.Role == infrastructurev1beta2.ControlPlaneRole { nsgs = append(nsgs, *nsg.ID) } } @@ -626,7 +619,7 @@ func (m *MachineScope) getMachineSubnet(name string) (*string, error) { func (m *MachineScope) getWorkerMachineSubnet() *string { for _, subnet := range m.OCICluster.Spec.NetworkSpec.Vcn.Subnets { - if subnet.Role == infrastructurev1beta1.WorkerRole { + if subnet.Role == infrastructurev1beta2.WorkerRole { // if a subnet name is defined, use the correct subnet if m.OCIMachine.Spec.SubnetName != "" { if m.OCIMachine.Spec.SubnetName == subnet.Name { @@ -644,7 +637,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.NetworkSecurityGroups { + for _, nsg := range m.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List { if nsg.Name == nsgName { nsgs = append(nsgs, *nsg.ID) } @@ -653,16 +646,9 @@ func (m *MachineScope) getWorkerMachineNSGs() []string { return nsgs } else { nsgs := make([]string, 0) - for _, nsg := range m.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroups { - if nsg.Role == infrastructurev1beta1.WorkerRole { - // if an NSG name is defined, use the correct NSG - if m.OCIMachine.Spec.NSGName != "" { - if m.OCIMachine.Spec.NSGName == nsg.Name { - nsgs = append(nsgs, *nsg.ID) - } - } else { - nsgs = append(nsgs, *nsg.ID) - } + for _, nsg := range m.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List { + if nsg.Role == infrastructurev1beta2.WorkerRole { + nsgs = append(nsgs, *nsg.ID) } } return nsgs @@ -761,7 +747,7 @@ func (m *MachineScope) getPlatformConfig() core.PlatformConfig { platformConfig := m.OCIMachine.Spec.PlatformConfig if platformConfig != nil { switch platformConfig.PlatformConfigType { - case infrastructurev1beta1.PlatformConfigTypeAmdRomeBmGpu: + case infrastructurev1beta2.PlatformConfigTypeAmdRomeBmGpu: numaNodesPerSocket, _ := core.GetMappingAmdRomeBmGpuPlatformConfigNumaNodesPerSocketEnum(string(platformConfig.AmdRomeBmGpuPlatformConfig.NumaNodesPerSocket)) return core.AmdRomeBmGpuPlatformConfig{ IsSecureBootEnabled: platformConfig.AmdRomeBmGpuPlatformConfig.IsSecureBootEnabled, @@ -774,7 +760,7 @@ func (m *MachineScope) getPlatformConfig() core.PlatformConfig { IsInputOutputMemoryManagementUnitEnabled: platformConfig.AmdRomeBmGpuPlatformConfig.IsInputOutputMemoryManagementUnitEnabled, NumaNodesPerSocket: numaNodesPerSocket, } - case infrastructurev1beta1.PlatformConfigTypeAmdRomeBm: + case infrastructurev1beta2.PlatformConfigTypeAmdRomeBm: numaNodesPerSocket, _ := core.GetMappingAmdRomeBmPlatformConfigNumaNodesPerSocketEnum(string(platformConfig.AmdRomeBmPlatformConfig.NumaNodesPerSocket)) return core.AmdRomeBmPlatformConfig{ IsSecureBootEnabled: platformConfig.AmdRomeBmPlatformConfig.IsSecureBootEnabled, @@ -788,7 +774,7 @@ func (m *MachineScope) getPlatformConfig() core.PlatformConfig { PercentageOfCoresEnabled: platformConfig.AmdRomeBmPlatformConfig.PercentageOfCoresEnabled, NumaNodesPerSocket: numaNodesPerSocket, } - case infrastructurev1beta1.PlatformConfigTypeIntelIcelakeBm: + case infrastructurev1beta2.PlatformConfigTypeIntelIcelakeBm: numaNodesPerSocket, _ := core.GetMappingIntelIcelakeBmPlatformConfigNumaNodesPerSocketEnum(string(platformConfig.IntelIcelakeBmPlatformConfig.NumaNodesPerSocket)) return core.IntelIcelakeBmPlatformConfig{ IsSecureBootEnabled: platformConfig.IntelIcelakeBmPlatformConfig.IsSecureBootEnabled, @@ -800,28 +786,28 @@ func (m *MachineScope) getPlatformConfig() core.PlatformConfig { IsInputOutputMemoryManagementUnitEnabled: platformConfig.IntelIcelakeBmPlatformConfig.IsInputOutputMemoryManagementUnitEnabled, NumaNodesPerSocket: numaNodesPerSocket, } - case infrastructurev1beta1.PlatformConfigTypeAmdvm: + case infrastructurev1beta2.PlatformConfigTypeAmdvm: return core.AmdVmPlatformConfig{ IsSecureBootEnabled: platformConfig.AmdVmPlatformConfig.IsSecureBootEnabled, IsTrustedPlatformModuleEnabled: platformConfig.AmdVmPlatformConfig.IsTrustedPlatformModuleEnabled, IsMeasuredBootEnabled: platformConfig.AmdVmPlatformConfig.IsMeasuredBootEnabled, IsMemoryEncryptionEnabled: platformConfig.AmdVmPlatformConfig.IsMemoryEncryptionEnabled, } - case infrastructurev1beta1.PlatformConfigTypeIntelVm: + case infrastructurev1beta2.PlatformConfigTypeIntelVm: return core.IntelVmPlatformConfig{ IsSecureBootEnabled: platformConfig.IntelVmPlatformConfig.IsSecureBootEnabled, IsTrustedPlatformModuleEnabled: platformConfig.IntelVmPlatformConfig.IsTrustedPlatformModuleEnabled, IsMeasuredBootEnabled: platformConfig.IntelVmPlatformConfig.IsMeasuredBootEnabled, IsMemoryEncryptionEnabled: platformConfig.IntelVmPlatformConfig.IsMemoryEncryptionEnabled, } - case infrastructurev1beta1.PlatformConfigTypeIntelSkylakeBm: + case infrastructurev1beta2.PlatformConfigTypeIntelSkylakeBm: return core.IntelSkylakeBmPlatformConfig{ IsSecureBootEnabled: platformConfig.IntelSkylakeBmPlatformConfig.IsSecureBootEnabled, IsTrustedPlatformModuleEnabled: platformConfig.IntelSkylakeBmPlatformConfig.IsTrustedPlatformModuleEnabled, IsMeasuredBootEnabled: platformConfig.IntelSkylakeBmPlatformConfig.IsMeasuredBootEnabled, IsMemoryEncryptionEnabled: platformConfig.IntelSkylakeBmPlatformConfig.IsMemoryEncryptionEnabled, } - case infrastructurev1beta1.PlatformConfigTypeAmdMilanBm: + case infrastructurev1beta2.PlatformConfigTypeAmdMilanBm: numaNodesPerSocket, _ := core.GetMappingAmdMilanBmPlatformConfigNumaNodesPerSocketEnum(string(platformConfig.AmdMilanBmPlatformConfig.NumaNodesPerSocket)) return core.AmdMilanBmPlatformConfig{ IsSecureBootEnabled: platformConfig.AmdMilanBmPlatformConfig.IsSecureBootEnabled, diff --git a/cloud/scope/machine_pool.go b/cloud/scope/machine_pool.go index 2aeeba46..3c3cb92d 100644 --- a/cloud/scope/machine_pool.go +++ b/cloud/scope/machine_pool.go @@ -25,11 +25,11 @@ import ( "strings" "github.com/go-logr/logr" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/computemanagement" - expinfra1 "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1" - infrav1exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1" + expinfra1 "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" + 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" "github.com/pkg/errors" @@ -54,7 +54,7 @@ type MachinePoolScopeParams struct { MachinePool *expclusterv1.MachinePool Client client.Client ComputeManagementClient computemanagement.Client - OCICluster *infrastructurev1beta1.OCICluster + OCICluster *infrastructurev1beta2.OCICluster OCIMachinePool *expinfra1.OCIMachinePool } @@ -65,7 +65,7 @@ type MachinePoolScope struct { Cluster *clusterv1.Cluster MachinePool *expclusterv1.MachinePool ComputeManagementClient computemanagement.Client - OCICluster *infrastructurev1beta1.OCICluster + OCICluster *infrastructurev1beta2.OCICluster OCIMachinePool *expinfra1.OCIMachinePool } @@ -146,7 +146,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 { - if subnet.Role == infrastructurev1beta1.WorkerRole { + if subnet.Role == infrastructurev1beta2.WorkerRole { return subnet.ID } } @@ -226,8 +226,8 @@ 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.NetworkSecurityGroups { - if nsg.Role == infrastructurev1beta1.WorkerRole { + for _, nsg := range m.OCICluster.Spec.NetworkSpec.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.Status.AvailabilityDomains + ads := s.OCICluster.Spec.AvailabilityDomains specPlacementDetails := s.OCIMachinePool.Spec.PlacementDetails @@ -425,7 +425,7 @@ func (m *MachinePoolScope) createInstanceConfiguration(ctx context.Context, laun resp, err := m.ComputeManagementClient.CreateInstanceConfiguration(ctx, req) if err != nil { - conditions.MarkFalse(m.MachinePool, infrav1exp.LaunchTemplateReadyCondition, infrav1exp.LaunchTemplateCreateFailedReason, clusterv1.ConditionSeverityError, err.Error()) + conditions.MarkFalse(m.MachinePool, infrav2exp.LaunchTemplateReadyCondition, infrav2exp.LaunchTemplateCreateFailedReason, clusterv1.ConditionSeverityError, err.Error()) m.Info("failed to create instance configuration") return err } @@ -434,7 +434,7 @@ func (m *MachinePoolScope) createInstanceConfiguration(ctx context.Context, laun return nil } -func (m *MachinePoolScope) getLaunchInstanceDetails(instanceConfigurationSpec infrav1exp.InstanceConfiguration, freeFormTags map[string]string, definedTags map[string]map[string]interface{}) (*core.InstanceConfigurationLaunchInstanceDetails, error) { +func (m *MachinePoolScope) getLaunchInstanceDetails(instanceConfigurationSpec infrav2exp.InstanceConfiguration, freeFormTags map[string]string, definedTags map[string]map[string]interface{}) (*core.InstanceConfigurationLaunchInstanceDetails, error) { metadata := instanceConfigurationSpec.Metadata if metadata == nil { metadata = make(map[string]string) @@ -469,7 +469,7 @@ func (m *MachinePoolScope) getLaunchInstanceDetails(instanceConfigurationSpec in shapeConfig, err := m.buildInstanceConfigurationShapeConfig() if err != nil { - conditions.MarkFalse(m.MachinePool, infrav1exp.LaunchTemplateReadyCondition, infrav1exp.LaunchTemplateCreateFailedReason, clusterv1.ConditionSeverityError, err.Error()) + conditions.MarkFalse(m.MachinePool, infrav2exp.LaunchTemplateReadyCondition, infrav2exp.LaunchTemplateCreateFailedReason, clusterv1.ConditionSeverityError, err.Error()) m.Info("failed to create instance configuration due to shape config") return nil, err } @@ -756,7 +756,7 @@ func (m *MachinePoolScope) getPlatformConfig() core.PlatformConfig { platformConfig := m.OCIMachinePool.Spec.InstanceConfiguration.PlatformConfig if platformConfig != nil { switch platformConfig.PlatformConfigType { - case infrastructurev1beta1.PlatformConfigTypeAmdRomeBmGpu: + case infrastructurev1beta2.PlatformConfigTypeAmdRomeBmGpu: numaNodesPerSocket, _ := core.GetMappingAmdRomeBmGpuPlatformConfigNumaNodesPerSocketEnum(string(platformConfig.AmdRomeBmGpuPlatformConfig.NumaNodesPerSocket)) return core.AmdRomeBmGpuPlatformConfig{ IsSecureBootEnabled: platformConfig.AmdRomeBmGpuPlatformConfig.IsSecureBootEnabled, @@ -769,7 +769,7 @@ func (m *MachinePoolScope) getPlatformConfig() core.PlatformConfig { IsInputOutputMemoryManagementUnitEnabled: platformConfig.AmdRomeBmGpuPlatformConfig.IsInputOutputMemoryManagementUnitEnabled, NumaNodesPerSocket: numaNodesPerSocket, } - case infrastructurev1beta1.PlatformConfigTypeAmdRomeBm: + case infrastructurev1beta2.PlatformConfigTypeAmdRomeBm: numaNodesPerSocket, _ := core.GetMappingAmdRomeBmPlatformConfigNumaNodesPerSocketEnum(string(platformConfig.AmdRomeBmPlatformConfig.NumaNodesPerSocket)) return core.AmdRomeBmPlatformConfig{ IsSecureBootEnabled: platformConfig.AmdRomeBmPlatformConfig.IsSecureBootEnabled, @@ -783,7 +783,7 @@ func (m *MachinePoolScope) getPlatformConfig() core.PlatformConfig { PercentageOfCoresEnabled: platformConfig.AmdRomeBmPlatformConfig.PercentageOfCoresEnabled, NumaNodesPerSocket: numaNodesPerSocket, } - case infrastructurev1beta1.PlatformConfigTypeIntelIcelakeBm: + case infrastructurev1beta2.PlatformConfigTypeIntelIcelakeBm: numaNodesPerSocket, _ := core.GetMappingIntelIcelakeBmPlatformConfigNumaNodesPerSocketEnum(string(platformConfig.IntelIcelakeBmPlatformConfig.NumaNodesPerSocket)) return core.IntelIcelakeBmPlatformConfig{ IsSecureBootEnabled: platformConfig.IntelIcelakeBmPlatformConfig.IsSecureBootEnabled, @@ -795,28 +795,28 @@ func (m *MachinePoolScope) getPlatformConfig() core.PlatformConfig { IsInputOutputMemoryManagementUnitEnabled: platformConfig.IntelIcelakeBmPlatformConfig.IsInputOutputMemoryManagementUnitEnabled, NumaNodesPerSocket: numaNodesPerSocket, } - case infrastructurev1beta1.PlatformConfigTypeAmdvm: + case infrastructurev1beta2.PlatformConfigTypeAmdvm: return core.AmdVmPlatformConfig{ IsSecureBootEnabled: platformConfig.AmdVmPlatformConfig.IsSecureBootEnabled, IsTrustedPlatformModuleEnabled: platformConfig.AmdVmPlatformConfig.IsTrustedPlatformModuleEnabled, IsMeasuredBootEnabled: platformConfig.AmdVmPlatformConfig.IsMeasuredBootEnabled, IsMemoryEncryptionEnabled: platformConfig.AmdVmPlatformConfig.IsMemoryEncryptionEnabled, } - case infrastructurev1beta1.PlatformConfigTypeIntelVm: + case infrastructurev1beta2.PlatformConfigTypeIntelVm: return core.IntelVmPlatformConfig{ IsSecureBootEnabled: platformConfig.IntelVmPlatformConfig.IsSecureBootEnabled, IsTrustedPlatformModuleEnabled: platformConfig.IntelVmPlatformConfig.IsTrustedPlatformModuleEnabled, IsMeasuredBootEnabled: platformConfig.IntelVmPlatformConfig.IsMeasuredBootEnabled, IsMemoryEncryptionEnabled: platformConfig.IntelVmPlatformConfig.IsMemoryEncryptionEnabled, } - case infrastructurev1beta1.PlatformConfigTypeIntelSkylakeBm: + case infrastructurev1beta2.PlatformConfigTypeIntelSkylakeBm: return core.IntelSkylakeBmPlatformConfig{ IsSecureBootEnabled: platformConfig.IntelSkylakeBmPlatformConfig.IsSecureBootEnabled, IsTrustedPlatformModuleEnabled: platformConfig.IntelSkylakeBmPlatformConfig.IsTrustedPlatformModuleEnabled, IsMeasuredBootEnabled: platformConfig.IntelSkylakeBmPlatformConfig.IsMeasuredBootEnabled, IsMemoryEncryptionEnabled: platformConfig.IntelSkylakeBmPlatformConfig.IsMemoryEncryptionEnabled, } - case infrastructurev1beta1.PlatformConfigTypeAmdMilanBm: + case infrastructurev1beta2.PlatformConfigTypeAmdMilanBm: numaNodesPerSocket, _ := core.GetMappingAmdMilanBmPlatformConfigNumaNodesPerSocketEnum(string(platformConfig.AmdMilanBmPlatformConfig.NumaNodesPerSocket)) return core.AmdMilanBmPlatformConfig{ IsSecureBootEnabled: platformConfig.AmdMilanBmPlatformConfig.IsSecureBootEnabled, @@ -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.NetworkSecurityGroups { + for _, nsg := range m.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List { if nsg.Name == nsgName { nsgs = append(nsgs, *nsg.ID) } @@ -850,8 +850,8 @@ func (m *MachinePoolScope) getWorkerMachineNSGs() []string { return nsgs } else { nsgs := make([]string, 0) - for _, nsg := range m.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroups { - if nsg.Role == infrastructurev1beta1.WorkerRole { + for _, nsg := range m.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List { + if nsg.Role == infrastructurev1beta2.WorkerRole { nsgs = append(nsgs, *nsg.ID) } } @@ -941,7 +941,7 @@ func (m *MachinePoolScope) getInstanceConfigurationsFromDisplayNameSortedTimeCre return ids, nil } -func (m *MachinePoolScope) getVnicDetails(instanceConfigurationSpec infrav1exp.InstanceConfiguration, freeFormTags map[string]string, definedTags map[string]map[string]interface{}) *core.InstanceConfigurationCreateVnicDetails { +func (m *MachinePoolScope) getVnicDetails(instanceConfigurationSpec infrav2exp.InstanceConfiguration, freeFormTags map[string]string, definedTags map[string]map[string]interface{}) *core.InstanceConfigurationCreateVnicDetails { subnetId := m.GetWorkerMachineSubnet() createVnicDetails := core.InstanceConfigurationCreateVnicDetails{ SubnetId: subnetId, diff --git a/cloud/scope/machine_pool_test.go b/cloud/scope/machine_pool_test.go index 0a69f0c0..f51c7a05 100644 --- a/cloud/scope/machine_pool_test.go +++ b/cloud/scope/machine_pool_test.go @@ -22,10 +22,10 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/computemanagement/mock_computemanagement" - 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" "github.com/oracle/oci-go-sdk/v65/core" corev1 "k8s.io/api/core/v1" @@ -80,37 +80,37 @@ func TestInstanceConfigCreate(t *testing.T) { }, } computeManagementClient = mock_computemanagement.NewMockClient(mockCtrl) - ociCluster := &infrastructurev1beta1.OCICluster{ + ociCluster := &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, - Spec: infrastructurev1beta1.OCIClusterSpec{ + Spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "test-compartment", DefinedTags: definedTags, OCIResourceIdentifier: "resource_uid", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn-id"), - Subnets: []*infrastructurev1beta1.Subnet{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.WorkerRole, + Role: infrastructurev1beta2.WorkerRole, ID: common.String("subnet-id"), - Type: infrastructurev1beta1.Private, + Type: infrastructurev1beta2.Private, Name: "worker-subnet", }, }, - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - Role: infrastructurev1beta1.WorkerRole, - ID: common.String("nsg-id"), - Name: "worker-nsg", + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + Role: infrastructurev1beta2.WorkerRole, + ID: common.String("nsg-id"), + Name: "worker-nsg", + }, }, }, }, }, - }, - Status: infrastructurev1beta1.OCIClusterStatus{ - AvailabilityDomains: map[string]infrastructurev1beta1.OCIAvailabilityDomain{ + AvailabilityDomains: map[string]infrastructurev1beta2.OCIAvailabilityDomain{ "ad-1": { Name: "ad-1", FaultDomains: []string{"fd-5", "fd-6"}, @@ -119,12 +119,12 @@ func TestInstanceConfigCreate(t *testing.T) { }, } size := int32(3) - machinePool := &infrav1exp.OCIMachinePool{ + machinePool := &infrav2exp.OCIMachinePool{ ObjectMeta: metav1.ObjectMeta{ Name: "test", ResourceVersion: "20", }, - Spec: infrav1exp.OCIMachinePoolSpec{}, + Spec: infrav2exp.OCIMachinePoolSpec{}, } client := fake.NewClientBuilder().WithObjects(secret, machinePool).Build() ms, err = NewMachinePoolScope(MachinePoolScopeParams{ @@ -171,7 +171,7 @@ func TestInstanceConfigCreate(t *testing.T) { name: "instance config exists", errorExpected: false, testSpecificSetup: func(ms *MachinePoolScope) { - ms.OCIMachinePool.Spec.InstanceConfiguration = infrav1exp.InstanceConfiguration{ + ms.OCIMachinePool.Spec.InstanceConfiguration = infrav2exp.InstanceConfiguration{ Shape: common.String("test-shape"), InstanceConfigurationId: common.String("test"), } @@ -205,15 +205,15 @@ func TestInstanceConfigCreate(t *testing.T) { name: "instance config create", errorExpected: false, testSpecificSetup: func(ms *MachinePoolScope) { - ms.OCIMachinePool.Spec.InstanceConfiguration = infrav1exp.InstanceConfiguration{ + ms.OCIMachinePool.Spec.InstanceConfiguration = infrav2exp.InstanceConfiguration{ Shape: common.String("test-shape"), - ShapeConfig: &infrav1exp.ShapeConfig{ + ShapeConfig: &infrav2exp.ShapeConfig{ Ocpus: common.String("2"), MemoryInGBs: common.String("65"), BaselineOcpuUtilization: "BASELINE_1_1", Nvmes: common.Int(5), }, - InstanceVnicConfiguration: &infrastructurev1beta1.NetworkDetails{ + InstanceVnicConfiguration: &infrastructurev1beta2.NetworkDetails{ AssignPublicIp: true, SubnetName: "worker-subnet", SkipSourceDestCheck: common.Bool(true), @@ -222,23 +222,23 @@ func TestInstanceConfigCreate(t *testing.T) { DisplayName: common.String("test-display"), AssignPrivateDnsRecord: common.Bool(true), }, - PlatformConfig: &infrastructurev1beta1.PlatformConfig{ - PlatformConfigType: infrastructurev1beta1.PlatformConfigTypeAmdvm, - AmdVmPlatformConfig: infrastructurev1beta1.AmdVmPlatformConfig{ + PlatformConfig: &infrastructurev1beta2.PlatformConfig{ + PlatformConfigType: infrastructurev1beta2.PlatformConfigTypeAmdvm, + AmdVmPlatformConfig: infrastructurev1beta2.AmdVmPlatformConfig{ IsMeasuredBootEnabled: common.Bool(false), IsTrustedPlatformModuleEnabled: common.Bool(true), IsSecureBootEnabled: common.Bool(true), IsMemoryEncryptionEnabled: common.Bool(true), }, }, - AgentConfig: &infrastructurev1beta1.LaunchInstanceAgentConfig{ + AgentConfig: &infrastructurev1beta2.LaunchInstanceAgentConfig{ IsMonitoringDisabled: common.Bool(false), IsManagementDisabled: common.Bool(true), AreAllPluginsDisabled: common.Bool(true), - PluginsConfig: []infrastructurev1beta1.InstanceAgentPluginConfig{ + PluginsConfig: []infrastructurev1beta2.InstanceAgentPluginConfig{ { Name: common.String("test-plugin"), - DesiredState: infrastructurev1beta1.InstanceAgentPluginConfigDetailsDesiredStateEnabled, + DesiredState: infrastructurev1beta2.InstanceAgentPluginConfigDetailsDesiredStateEnabled, }, }, }, @@ -311,7 +311,7 @@ func TestInstanceConfigCreate(t *testing.T) { name: "instance config update", errorExpected: false, testSpecificSetup: func(ms *MachinePoolScope) { - ms.OCIMachinePool.Spec.InstanceConfiguration = infrav1exp.InstanceConfiguration{ + ms.OCIMachinePool.Spec.InstanceConfiguration = infrav2exp.InstanceConfiguration{ Shape: common.String("test-shape"), InstanceConfigurationId: common.String("test"), } @@ -438,37 +438,37 @@ func TestInstancePoolCreate(t *testing.T) { }, } computeManagementClient = mock_computemanagement.NewMockClient(mockCtrl) - ociCluster := &infrastructurev1beta1.OCICluster{ + ociCluster := &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, - Spec: infrastructurev1beta1.OCIClusterSpec{ + Spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "test-compartment", DefinedTags: definedTags, OCIResourceIdentifier: "resource_uid", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn-id"), - Subnets: []*infrastructurev1beta1.Subnet{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.WorkerRole, + Role: infrastructurev1beta2.WorkerRole, ID: common.String("subnet-id"), - Type: infrastructurev1beta1.Private, + Type: infrastructurev1beta2.Private, Name: "worker-subnet", }, }, - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - Role: infrastructurev1beta1.WorkerRole, - ID: common.String("nsg-id"), - Name: "worker-nsg", + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + Role: infrastructurev1beta2.WorkerRole, + ID: common.String("nsg-id"), + Name: "worker-nsg", + }, }, }, }, }, - }, - Status: infrastructurev1beta1.OCIClusterStatus{ - AvailabilityDomains: map[string]infrastructurev1beta1.OCIAvailabilityDomain{ + AvailabilityDomains: map[string]infrastructurev1beta2.OCIAvailabilityDomain{ "ad-1": { Name: "ad-1", FaultDomains: []string{"fd-5", "fd-6"}, @@ -477,12 +477,12 @@ func TestInstancePoolCreate(t *testing.T) { }, } size := int32(3) - machinePool := &infrav1exp.OCIMachinePool{ + machinePool := &infrav2exp.OCIMachinePool{ ObjectMeta: metav1.ObjectMeta{ Name: "test", ResourceVersion: "20", }, - Spec: infrav1exp.OCIMachinePoolSpec{}, + Spec: infrav2exp.OCIMachinePoolSpec{}, } client := fake.NewClientBuilder().WithObjects(secret, machinePool).Build() ms, err = NewMachinePoolScope(MachinePoolScopeParams{ @@ -619,37 +619,37 @@ func TestInstancePoolUpdate(t *testing.T) { }, } computeManagementClient = mock_computemanagement.NewMockClient(mockCtrl) - ociCluster := &infrastructurev1beta1.OCICluster{ + ociCluster := &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, - Spec: infrastructurev1beta1.OCIClusterSpec{ + Spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "test-compartment", DefinedTags: definedTags, OCIResourceIdentifier: "resource_uid", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn-id"), - Subnets: []*infrastructurev1beta1.Subnet{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.WorkerRole, + Role: infrastructurev1beta2.WorkerRole, ID: common.String("subnet-id"), - Type: infrastructurev1beta1.Private, + Type: infrastructurev1beta2.Private, Name: "worker-subnet", }, }, - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - Role: infrastructurev1beta1.WorkerRole, - ID: common.String("nsg-id"), - Name: "worker-nsg", + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + Role: infrastructurev1beta2.WorkerRole, + ID: common.String("nsg-id"), + Name: "worker-nsg", + }, }, }, }, }, - }, - Status: infrastructurev1beta1.OCIClusterStatus{ - AvailabilityDomains: map[string]infrastructurev1beta1.OCIAvailabilityDomain{ + AvailabilityDomains: map[string]infrastructurev1beta2.OCIAvailabilityDomain{ "ad-1": { Name: "ad-1", FaultDomains: []string{"fd-5", "fd-6"}, @@ -658,12 +658,12 @@ func TestInstancePoolUpdate(t *testing.T) { }, } size := int32(3) - machinePool := &infrav1exp.OCIMachinePool{ + machinePool := &infrav2exp.OCIMachinePool{ ObjectMeta: metav1.ObjectMeta{ Name: "test", ResourceVersion: "20", }, - Spec: infrav1exp.OCIMachinePoolSpec{}, + Spec: infrav2exp.OCIMachinePoolSpec{}, } client := fake.NewClientBuilder().WithObjects(secret, machinePool).Build() ms, err = NewMachinePoolScope(MachinePoolScopeParams{ diff --git a/cloud/scope/machine_test.go b/cloud/scope/machine_test.go index e06c0ffc..b3faf40a 100644 --- a/cloud/scope/machine_test.go +++ b/cloud/scope/machine_test.go @@ -29,7 +29,7 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/compute/mock_compute" "github.com/oracle/oci-go-sdk/v65/common" @@ -46,7 +46,7 @@ func TestInstanceReconciliation(t *testing.T) { ms *MachineScope mockCtrl *gomock.Controller computeClient *mock_compute.MockComputeClient - ociCluster infrastructurev1beta1.OCICluster + ociCluster infrastructurev1beta2.OCICluster ) setup := func(t *testing.T, g *WithT) { @@ -64,22 +64,22 @@ func TestInstanceReconciliation(t *testing.T) { mockCtrl = gomock.NewController(t) computeClient = mock_compute.NewMockComputeClient(mockCtrl) client := fake.NewClientBuilder().WithObjects(secret).Build() - ociCluster = infrastructurev1beta1.OCICluster{ + ociCluster = infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "uid", }, - Spec: infrastructurev1beta1.OCIClusterSpec{ + Spec: infrastructurev1beta2.OCIClusterSpec{ OCIResourceIdentifier: "resource_uid", }, } ociCluster.Spec.ControlPlaneEndpoint.Port = 6443 ms, err = NewMachineScope(MachineScopeParams{ ComputeClient: computeClient, - OCIMachine: &infrastructurev1beta1.OCIMachine{ + OCIMachine: &infrastructurev1beta2.OCIMachine{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: infrastructurev1beta1.OCIMachineSpec{ + Spec: infrastructurev1beta2.OCIMachineSpec{ CompartmentId: "test", }, }, @@ -324,7 +324,7 @@ func TestInstanceReconciliation(t *testing.T) { ms.OCIMachine.Spec.NetworkDetails.SkipSourceDestCheck = common.Bool(true) ms.OCIMachine.Spec.NetworkDetails.AssignPrivateDnsRecord = common.Bool(true) ms.OCIMachine.Spec.NetworkDetails.DisplayName = common.String("display-name") - ms.OCIMachine.Spec.InstanceSourceViaImageDetails = &infrastructurev1beta1.InstanceSourceViaImageConfig{ + ms.OCIMachine.Spec.InstanceSourceViaImageDetails = &infrastructurev1beta2.InstanceSourceViaImageConfig{ KmsKeyId: common.String("kms-key-id"), BootVolumeVpusPerGB: common.Int64(32), } @@ -384,7 +384,7 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCIMachine.Spec.ShapeConfig = infrastructurev1beta1.ShapeConfig{} + ms.OCIMachine.Spec.ShapeConfig = infrastructurev1beta2.ShapeConfig{} computeClient.EXPECT().ListInstances(gomock.Any(), gomock.Eq(core.ListInstancesRequest{ DisplayName: common.String("name"), CompartmentId: common.String("test"), @@ -428,8 +428,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, &infrastructurev1beta1.Subnet{ - Role: infrastructurev1beta1.WorkerRole, + ms.OCICluster.Spec.NetworkSpec.Vcn.Subnets = append(ms.OCICluster.Spec.NetworkSpec.Vcn.Subnets, &infrastructurev1beta2.Subnet{ + Role: infrastructurev1beta2.WorkerRole, ID: common.String("test-subnet-1"), }) computeClient.EXPECT().ListInstances(gomock.Any(), gomock.Eq(core.ListInstancesRequest{ @@ -480,8 +480,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, &infrastructurev1beta1.Subnet{ - Role: infrastructurev1beta1.WorkerRole, + ms.OCICluster.Spec.NetworkSpec.Vcn.Subnets = append(ms.OCICluster.Spec.NetworkSpec.Vcn.Subnets, &infrastructurev1beta2.Subnet{ + Role: infrastructurev1beta2.WorkerRole, Name: "test-subnet-name", ID: common.String("test-subnet-1"), }) @@ -534,12 +534,12 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroups = append(ms.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroups, &infrastructurev1beta1.NSG{ - Role: infrastructurev1beta1.WorkerRole, + ms.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List = append(ms.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List, &infrastructurev1beta2.NSG{ + Role: infrastructurev1beta2.WorkerRole, ID: common.String("test-nsg-1"), Name: "test-nsg", - }, &infrastructurev1beta1.NSG{ - Role: infrastructurev1beta1.WorkerRole, + }, &infrastructurev1beta2.NSG{ + Role: infrastructurev1beta2.WorkerRole, ID: common.String("test-nsg-2"), Name: "test-nsg-2", }) @@ -591,16 +591,16 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroups = append(ms.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroups, &infrastructurev1beta1.NSG{ - Role: infrastructurev1beta1.WorkerRole, + ms.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List = append(ms.OCICluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List, &infrastructurev1beta2.NSG{ + Role: infrastructurev1beta2.WorkerRole, ID: common.String("test-nsg-1"), Name: "test-nsg", - }, &infrastructurev1beta1.NSG{ - Role: infrastructurev1beta1.WorkerRole, + }, &infrastructurev1beta2.NSG{ + Role: infrastructurev1beta2.WorkerRole, ID: common.String("test-nsg-2"), Name: "test-nsg-name-2", }) - ms.OCIMachine.Spec.NSGName = "test-nsg-name-2" + ms.OCIMachine.Spec.NetworkDetails.NsgNames = []string{"test-nsg-name-2"} computeClient.EXPECT().ListInstances(gomock.Any(), gomock.Eq(core.ListInstancesRequest{ DisplayName: common.String("name"), CompartmentId: common.String("test"), @@ -649,9 +649,9 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCIMachine.Spec.PlatformConfig = &infrastructurev1beta1.PlatformConfig{ - PlatformConfigType: infrastructurev1beta1.PlatformConfigTypeAmdvm, - AmdVmPlatformConfig: infrastructurev1beta1.AmdVmPlatformConfig{ + ms.OCIMachine.Spec.PlatformConfig = &infrastructurev1beta2.PlatformConfig{ + PlatformConfigType: infrastructurev1beta2.PlatformConfigTypeAmdvm, + AmdVmPlatformConfig: infrastructurev1beta2.AmdVmPlatformConfig{ IsMeasuredBootEnabled: common.Bool(false), IsTrustedPlatformModuleEnabled: common.Bool(true), IsSecureBootEnabled: common.Bool(true), @@ -677,9 +677,9 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCIMachine.Spec.PlatformConfig = &infrastructurev1beta1.PlatformConfig{ - PlatformConfigType: infrastructurev1beta1.PlatformConfigTypeIntelVm, - IntelVmPlatformConfig: infrastructurev1beta1.IntelVmPlatformConfig{ + ms.OCIMachine.Spec.PlatformConfig = &infrastructurev1beta2.PlatformConfig{ + PlatformConfigType: infrastructurev1beta2.PlatformConfigTypeIntelVm, + IntelVmPlatformConfig: infrastructurev1beta2.IntelVmPlatformConfig{ IsMeasuredBootEnabled: common.Bool(false), IsTrustedPlatformModuleEnabled: common.Bool(true), IsSecureBootEnabled: common.Bool(true), @@ -705,9 +705,9 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCIMachine.Spec.PlatformConfig = &infrastructurev1beta1.PlatformConfig{ - PlatformConfigType: infrastructurev1beta1.PlatformConfigTypeAmdRomeBm, - AmdRomeBmPlatformConfig: infrastructurev1beta1.AmdRomeBmPlatformConfig{ + ms.OCIMachine.Spec.PlatformConfig = &infrastructurev1beta2.PlatformConfig{ + PlatformConfigType: infrastructurev1beta2.PlatformConfigTypeAmdRomeBm, + AmdRomeBmPlatformConfig: infrastructurev1beta2.AmdRomeBmPlatformConfig{ IsMeasuredBootEnabled: common.Bool(false), IsTrustedPlatformModuleEnabled: common.Bool(true), IsSecureBootEnabled: common.Bool(true), @@ -717,7 +717,7 @@ func TestInstanceReconciliation(t *testing.T) { AreVirtualInstructionsEnabled: common.Bool(false), IsInputOutputMemoryManagementUnitEnabled: common.Bool(false), PercentageOfCoresEnabled: common.Int(50), - NumaNodesPerSocket: infrastructurev1beta1.AmdRomeBmPlatformConfigNumaNodesPerSocketNps4, + NumaNodesPerSocket: infrastructurev1beta2.AmdRomeBmPlatformConfigNumaNodesPerSocketNps4, }, } computeClient.EXPECT().ListInstances(gomock.Any(), gomock.Eq(core.ListInstancesRequest{ @@ -745,9 +745,9 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCIMachine.Spec.PlatformConfig = &infrastructurev1beta1.PlatformConfig{ - PlatformConfigType: infrastructurev1beta1.PlatformConfigTypeAmdRomeBmGpu, - AmdRomeBmGpuPlatformConfig: infrastructurev1beta1.AmdRomeBmGpuPlatformConfig{ + ms.OCIMachine.Spec.PlatformConfig = &infrastructurev1beta2.PlatformConfig{ + PlatformConfigType: infrastructurev1beta2.PlatformConfigTypeAmdRomeBmGpu, + AmdRomeBmGpuPlatformConfig: infrastructurev1beta2.AmdRomeBmGpuPlatformConfig{ IsMeasuredBootEnabled: common.Bool(false), IsTrustedPlatformModuleEnabled: common.Bool(true), IsSecureBootEnabled: common.Bool(true), @@ -756,7 +756,7 @@ func TestInstanceReconciliation(t *testing.T) { IsAccessControlServiceEnabled: common.Bool(true), AreVirtualInstructionsEnabled: common.Bool(false), IsInputOutputMemoryManagementUnitEnabled: common.Bool(false), - NumaNodesPerSocket: infrastructurev1beta1.AmdRomeBmGpuPlatformConfigNumaNodesPerSocketNps2, + NumaNodesPerSocket: infrastructurev1beta2.AmdRomeBmGpuPlatformConfigNumaNodesPerSocketNps2, }, } computeClient.EXPECT().ListInstances(gomock.Any(), gomock.Eq(core.ListInstancesRequest{ @@ -783,9 +783,9 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCIMachine.Spec.PlatformConfig = &infrastructurev1beta1.PlatformConfig{ - PlatformConfigType: infrastructurev1beta1.PlatformConfigTypeIntelIcelakeBm, - IntelIcelakeBmPlatformConfig: infrastructurev1beta1.IntelIcelakeBmPlatformConfig{ + ms.OCIMachine.Spec.PlatformConfig = &infrastructurev1beta2.PlatformConfig{ + PlatformConfigType: infrastructurev1beta2.PlatformConfigTypeIntelIcelakeBm, + IntelIcelakeBmPlatformConfig: infrastructurev1beta2.IntelIcelakeBmPlatformConfig{ IsMeasuredBootEnabled: common.Bool(false), IsTrustedPlatformModuleEnabled: common.Bool(true), IsSecureBootEnabled: common.Bool(true), @@ -793,7 +793,7 @@ func TestInstanceReconciliation(t *testing.T) { IsSymmetricMultiThreadingEnabled: common.Bool(false), IsInputOutputMemoryManagementUnitEnabled: common.Bool(false), PercentageOfCoresEnabled: common.Int(56), - NumaNodesPerSocket: infrastructurev1beta1.IntelIcelakeBmPlatformConfigNumaNodesPerSocketNps1, + NumaNodesPerSocket: infrastructurev1beta2.IntelIcelakeBmPlatformConfigNumaNodesPerSocketNps1, }, } computeClient.EXPECT().ListInstances(gomock.Any(), gomock.Eq(core.ListInstancesRequest{ @@ -819,9 +819,9 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCIMachine.Spec.PlatformConfig = &infrastructurev1beta1.PlatformConfig{ - PlatformConfigType: infrastructurev1beta1.PlatformConfigTypeIntelSkylakeBm, - IntelSkylakeBmPlatformConfig: infrastructurev1beta1.IntelSkylakeBmPlatformConfig{ + ms.OCIMachine.Spec.PlatformConfig = &infrastructurev1beta2.PlatformConfig{ + PlatformConfigType: infrastructurev1beta2.PlatformConfigTypeIntelSkylakeBm, + IntelSkylakeBmPlatformConfig: infrastructurev1beta2.IntelSkylakeBmPlatformConfig{ IsMeasuredBootEnabled: common.Bool(false), IsTrustedPlatformModuleEnabled: common.Bool(true), IsSecureBootEnabled: common.Bool(true), @@ -847,9 +847,9 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCIMachine.Spec.PlatformConfig = &infrastructurev1beta1.PlatformConfig{ - PlatformConfigType: infrastructurev1beta1.PlatformConfigTypeAmdMilanBm, - AmdMilanBmPlatformConfig: infrastructurev1beta1.AmdMilanBmPlatformConfig{ + ms.OCIMachine.Spec.PlatformConfig = &infrastructurev1beta2.PlatformConfig{ + PlatformConfigType: infrastructurev1beta2.PlatformConfigTypeAmdMilanBm, + AmdMilanBmPlatformConfig: infrastructurev1beta2.AmdMilanBmPlatformConfig{ IsMeasuredBootEnabled: common.Bool(false), IsTrustedPlatformModuleEnabled: common.Bool(true), IsSecureBootEnabled: common.Bool(true), @@ -859,7 +859,7 @@ func TestInstanceReconciliation(t *testing.T) { IsInputOutputMemoryManagementUnitEnabled: common.Bool(false), AreVirtualInstructionsEnabled: common.Bool(true), PercentageOfCoresEnabled: common.Int(56), - NumaNodesPerSocket: infrastructurev1beta1.AmdMilanBmPlatformConfigNumaNodesPerSocketNps1, + NumaNodesPerSocket: infrastructurev1beta2.AmdMilanBmPlatformConfigNumaNodesPerSocketNps1, }, } computeClient.EXPECT().ListInstances(gomock.Any(), gomock.Eq(core.ListInstancesRequest{ @@ -887,14 +887,14 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCIMachine.Spec.AgentConfig = &infrastructurev1beta1.LaunchInstanceAgentConfig{ + ms.OCIMachine.Spec.AgentConfig = &infrastructurev1beta2.LaunchInstanceAgentConfig{ IsMonitoringDisabled: common.Bool(false), IsManagementDisabled: common.Bool(true), AreAllPluginsDisabled: common.Bool(true), - PluginsConfig: []infrastructurev1beta1.InstanceAgentPluginConfig{ + PluginsConfig: []infrastructurev1beta2.InstanceAgentPluginConfig{ { Name: common.String("test-plugin"), - DesiredState: infrastructurev1beta1.InstanceAgentPluginConfigDetailsDesiredStateEnabled, + DesiredState: infrastructurev1beta2.InstanceAgentPluginConfigDetailsDesiredStateEnabled, }, }, } @@ -922,11 +922,11 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCIMachine.Spec.LaunchOptions = &infrastructurev1beta1.LaunchOptions{ - BootVolumeType: infrastructurev1beta1.LaunchOptionsBootVolumeTypeIde, - Firmware: infrastructurev1beta1.LaunchOptionsFirmwareUefi64, - NetworkType: infrastructurev1beta1.LaunchOptionsNetworkTypeVfio, - RemoteDataVolumeType: infrastructurev1beta1.LaunchOptionsRemoteDataVolumeTypeIde, + ms.OCIMachine.Spec.LaunchOptions = &infrastructurev1beta2.LaunchOptions{ + BootVolumeType: infrastructurev1beta2.LaunchOptionsBootVolumeTypeIde, + Firmware: infrastructurev1beta2.LaunchOptionsFirmwareUefi64, + NetworkType: infrastructurev1beta2.LaunchOptionsNetworkTypeVfio, + RemoteDataVolumeType: infrastructurev1beta2.LaunchOptionsRemoteDataVolumeTypeIde, IsConsistentVolumeNamingEnabled: common.Bool(true), } computeClient.EXPECT().ListInstances(gomock.Any(), gomock.Eq(core.ListInstancesRequest{ @@ -949,7 +949,7 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCIMachine.Spec.InstanceOptions = &infrastructurev1beta1.InstanceOptions{ + ms.OCIMachine.Spec.InstanceOptions = &infrastructurev1beta2.InstanceOptions{ AreLegacyImdsEndpointsDisabled: common.Bool(true), } computeClient.EXPECT().ListInstances(gomock.Any(), gomock.Eq(core.ListInstancesRequest{ @@ -968,9 +968,9 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCIMachine.Spec.AvailabilityConfig = &infrastructurev1beta1.LaunchInstanceAvailabilityConfig{ + ms.OCIMachine.Spec.AvailabilityConfig = &infrastructurev1beta2.LaunchInstanceAvailabilityConfig{ IsLiveMigrationPreferred: common.Bool(true), - RecoveryAction: infrastructurev1beta1.LaunchInstanceAvailabilityConfigDetailsRecoveryActionRestoreInstance, + RecoveryAction: infrastructurev1beta2.LaunchInstanceAvailabilityConfigDetailsRecoveryActionRestoreInstance, } computeClient.EXPECT().ListInstances(gomock.Any(), gomock.Eq(core.ListInstancesRequest{ DisplayName: common.String("name"), @@ -989,8 +989,8 @@ func TestInstanceReconciliation(t *testing.T) { errorExpected: false, testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { setupAllParams(ms) - ms.OCIMachine.Spec.PreemptibleInstanceConfig = &infrastructurev1beta1.PreemptibleInstanceConfig{ - TerminatePreemptionAction: &infrastructurev1beta1.TerminatePreemptionAction{ + ms.OCIMachine.Spec.PreemptibleInstanceConfig = &infrastructurev1beta2.PreemptibleInstanceConfig{ + TerminatePreemptionAction: &infrastructurev1beta2.TerminatePreemptionAction{ PreserveBootVolume: common.Bool(true), }, } @@ -1122,14 +1122,14 @@ func TestLBReconciliationCreation(t *testing.T) { ms *MachineScope mockCtrl *gomock.Controller nlbClient *mock_nlb.MockNetworkLoadBalancerClient - ociCluster infrastructurev1beta1.OCICluster + ociCluster infrastructurev1beta2.OCICluster ) setup := func(t *testing.T, g *WithT) { var err error mockCtrl = gomock.NewController(t) nlbClient = mock_nlb.NewMockNetworkLoadBalancerClient(mockCtrl) client := fake.NewClientBuilder().WithObjects().Build() - ociCluster = infrastructurev1beta1.OCICluster{ + ociCluster = infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "uid", }, @@ -1138,12 +1138,12 @@ func TestLBReconciliationCreation(t *testing.T) { ociCluster.Spec.ControlPlaneEndpoint.Port = 6443 ms, err = NewMachineScope(MachineScopeParams{ NetworkLoadBalancerClient: nlbClient, - OCIMachine: &infrastructurev1beta1.OCIMachine{ + OCIMachine: &infrastructurev1beta2.OCIMachine{ ObjectMeta: metav1.ObjectMeta{ Name: "test", UID: "uid", }, - Spec: infrastructurev1beta1.OCIMachineSpec{ + Spec: infrastructurev1beta2.OCIMachineSpec{ CompartmentId: "test", }, }, @@ -1444,14 +1444,14 @@ func TestLBReconciliationDeletion(t *testing.T) { ms *MachineScope mockCtrl *gomock.Controller nlbClient *mock_nlb.MockNetworkLoadBalancerClient - ociCluster infrastructurev1beta1.OCICluster + ociCluster infrastructurev1beta2.OCICluster ) setup := func(t *testing.T, g *WithT) { var err error mockCtrl = gomock.NewController(t) nlbClient = mock_nlb.NewMockNetworkLoadBalancerClient(mockCtrl) client := fake.NewClientBuilder().WithObjects().Build() - ociCluster = infrastructurev1beta1.OCICluster{ + ociCluster = infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "uid", }, @@ -1460,12 +1460,12 @@ func TestLBReconciliationDeletion(t *testing.T) { ociCluster.Spec.ControlPlaneEndpoint.Port = 6443 ms, err = NewMachineScope(MachineScopeParams{ NetworkLoadBalancerClient: nlbClient, - OCIMachine: &infrastructurev1beta1.OCIMachine{ + OCIMachine: &infrastructurev1beta2.OCIMachine{ ObjectMeta: metav1.ObjectMeta{ Name: "test", UID: "uid", }, - Spec: infrastructurev1beta1.OCIMachineSpec{ + Spec: infrastructurev1beta2.OCIMachineSpec{ CompartmentId: "test", }, }, @@ -1682,7 +1682,7 @@ func TestInstanceDeletion(t *testing.T) { ms *MachineScope mockCtrl *gomock.Controller computeClient *mock_compute.MockComputeClient - ociCluster infrastructurev1beta1.OCICluster + ociCluster infrastructurev1beta2.OCICluster ) setup := func(t *testing.T, g *WithT) { @@ -1690,11 +1690,11 @@ func TestInstanceDeletion(t *testing.T) { mockCtrl = gomock.NewController(t) computeClient = mock_compute.NewMockComputeClient(mockCtrl) client := fake.NewClientBuilder().Build() - ociCluster = infrastructurev1beta1.OCICluster{} + ociCluster = infrastructurev1beta2.OCICluster{} ms, err = NewMachineScope(MachineScopeParams{ ComputeClient: computeClient, - OCIMachine: &infrastructurev1beta1.OCIMachine{ - Spec: infrastructurev1beta1.OCIMachineSpec{ + OCIMachine: &infrastructurev1beta2.OCIMachine{ + Spec: infrastructurev1beta2.OCIMachineSpec{ CompartmentId: "test", InstanceId: common.String("test"), }, @@ -1794,9 +1794,9 @@ func setupAllParams(ms *MachineScope) { }, } ms.Machine.Spec.FailureDomain = common.String("2") - ms.OCICluster.Spec.NetworkSpec.Vcn.Subnets = []*infrastructurev1beta1.Subnet{ + ms.OCICluster.Spec.NetworkSpec.Vcn.Subnets = []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.WorkerRole, + Role: infrastructurev1beta2.WorkerRole, ID: common.String("nodesubnet"), }, } diff --git a/cloud/scope/managed_control_plane.go b/cloud/scope/managed_control_plane.go index cfd2aca8..fb89d0c4 100644 --- a/cloud/scope/managed_control_plane.go +++ b/cloud/scope/managed_control_plane.go @@ -24,11 +24,11 @@ import ( "reflect" "github.com/go-logr/logr" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "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" - 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" "github.com/pkg/errors" @@ -54,7 +54,7 @@ type ManagedControlPlaneScopeParams struct { ContainerEngineClient containerengine.Client BaseClient baseclient.BaseClient ClientProvider *ClientProvider - OCIManagedControlPlane *infrav1exp.OCIManagedControlPlane + OCIManagedControlPlane *infrav2exp.OCIManagedControlPlane OCIClusterAccessor OCIClusterAccessor RegionIdentifier string } @@ -66,7 +66,7 @@ type ManagedControlPlaneScope struct { ContainerEngineClient containerengine.Client BaseClient baseclient.BaseClient ClientProvider *ClientProvider - OCIManagedControlPlane *infrav1exp.OCIManagedControlPlane + OCIManagedControlPlane *infrav2exp.OCIManagedControlPlane OCIClusterAccessor OCIClusterAccessor RegionIdentifier string patchHelper *patch.Helper @@ -120,9 +120,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 == infrav1exp.FlannelCNI { + if cniOption.CniType == infrav2exp.FlannelCNI { podNetworks = append(podNetworks, oke.FlannelOverlayClusterPodNetworkOptionDetails{}) - } else if cniOption.CniType == infrav1exp.VCNNativeCNI { + } else if cniOption.CniType == infrav2exp.VCNNativeCNI { podNetworks = append(podNetworks, oke.OciVcnIpNativeClusterPodNetworkOptionDetails{}) } } @@ -315,7 +315,7 @@ func (s *ManagedControlPlaneScope) getFreeFormTags() map[string]string { func (s *ManagedControlPlaneScope) getServiceLbSubnets() []string { subnets := make([]string, 0) for _, subnet := range s.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets { - if subnet.Role == infrastructurev1beta1.ServiceLoadBalancerRole { + if subnet.Role == infrastructurev1beta2.ServiceLoadBalancerRole { subnets = append(subnets, *subnet.ID) } } @@ -324,7 +324,7 @@ func (s *ManagedControlPlaneScope) getServiceLbSubnets() []string { func (s *ManagedControlPlaneScope) getControlPlaneEndpointSubnet() *string { for _, subnet := range s.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets { - if subnet.Role == infrastructurev1beta1.ControlPlaneEndpointRole { + if subnet.Role == infrastructurev1beta2.ControlPlaneEndpointRole { return subnet.ID } } @@ -333,8 +333,8 @@ func (s *ManagedControlPlaneScope) getControlPlaneEndpointSubnet() *string { func (s *ManagedControlPlaneScope) getControlPlaneEndpointNSGList() []string { nsgs := make([]string, 0) - for _, nsg := range s.OCIClusterAccessor.GetNetworkSpec().Vcn.NetworkSecurityGroups { - if nsg.Role == infrastructurev1beta1.ControlPlaneEndpointRole { + for _, nsg := range s.OCIClusterAccessor.GetNetworkSpec().Vcn.NetworkSecurityGroup.List { + if nsg.Role == infrastructurev1beta2.ControlPlaneEndpointRole { nsgs = append(nsgs, *nsg.ID) } } @@ -344,7 +344,7 @@ func (s *ManagedControlPlaneScope) getControlPlaneEndpointNSGList() []string { // IsControlPlaneEndpointSubnetPublic returns true if the control plane endpoint subnet is public func (s *ManagedControlPlaneScope) IsControlPlaneEndpointSubnetPublic() bool { for _, subnet := range s.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets { - if subnet.Role == infrastructurev1beta1.ControlPlaneEndpointRole && subnet.Type == infrastructurev1beta1.Public { + if subnet.Role == infrastructurev1beta2.ControlPlaneEndpointRole && subnet.Type == infrastructurev1beta2.Public { return true } } @@ -359,7 +359,7 @@ func (s *ManagedControlPlaneScope) DeleteOKECluster(ctx context.Context, cluster } func (s *ManagedControlPlaneScope) createCAPIKubeconfigSecret(ctx context.Context, okeCluster *oke.Cluster, clusterRef types.NamespacedName) error { - controllerOwnerRef := *metav1.NewControllerRef(s.OCIManagedControlPlane, infrastructurev1beta1.GroupVersion.WithKind("OCIManagedControlPlane")) + controllerOwnerRef := *metav1.NewControllerRef(s.OCIManagedControlPlane, infrastructurev1beta2.GroupVersion.WithKind("OCIManagedControlPlane")) req := oke.CreateKubeconfigRequest{ClusterId: okeCluster.Id} response, err := s.ContainerEngineClient.CreateKubeconfig(ctx, req) if err != nil { @@ -565,56 +565,56 @@ 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 *infrav1exp.OCIManagedControlPlaneSpec) { +func setControlPlaneSpecDefaults(spec *infrav2exp.OCIManagedControlPlaneSpec) { spec.ControlPlaneEndpoint = clusterv1.APIEndpoint{} if spec.ImagePolicyConfig == nil { - spec.ImagePolicyConfig = &infrav1exp.ImagePolicyConfig{ + spec.ImagePolicyConfig = &infrav2exp.ImagePolicyConfig{ IsPolicyEnabled: common.Bool(false), - KeyDetails: make([]infrav1exp.KeyDetails, 0), + KeyDetails: make([]infrav2exp.KeyDetails, 0), } } if spec.ClusterOption.AdmissionControllerOptions == nil { - spec.ClusterOption.AdmissionControllerOptions = &infrav1exp.AdmissionControllerOptions{ + spec.ClusterOption.AdmissionControllerOptions = &infrav2exp.AdmissionControllerOptions{ IsPodSecurityPolicyEnabled: common.Bool(false), } } if spec.ClusterOption.AddOnOptions == nil { - spec.ClusterOption.AddOnOptions = &infrav1exp.AddOnOptions{ + spec.ClusterOption.AddOnOptions = &infrav2exp.AddOnOptions{ IsTillerEnabled: common.Bool(false), IsKubernetesDashboardEnabled: common.Bool(false), } } } -func (s *ManagedControlPlaneScope) getSpecFromActual(cluster *oke.Cluster) *infrav1exp.OCIManagedControlPlaneSpec { - spec := infrav1exp.OCIManagedControlPlaneSpec{ +func (s *ManagedControlPlaneScope) getSpecFromActual(cluster *oke.Cluster) *infrav2exp.OCIManagedControlPlaneSpec { + spec := infrav2exp.OCIManagedControlPlaneSpec{ Version: cluster.KubernetesVersion, KmsKeyId: cluster.KmsKeyId, ID: cluster.Id, } if cluster.ImagePolicyConfig != nil { - keys := make([]infrav1exp.KeyDetails, 0) + keys := make([]infrav2exp.KeyDetails, 0) for _, key := range cluster.ImagePolicyConfig.KeyDetails { - keys = append(keys, infrav1exp.KeyDetails{ + keys = append(keys, infrav2exp.KeyDetails{ KmsKeyId: key.KmsKeyId, }) } - spec.ImagePolicyConfig = &infrav1exp.ImagePolicyConfig{ + spec.ImagePolicyConfig = &infrav2exp.ImagePolicyConfig{ IsPolicyEnabled: cluster.ImagePolicyConfig.IsPolicyEnabled, KeyDetails: keys, } } if len(cluster.ClusterPodNetworkOptions) > 0 { - podNetworks := make([]infrav1exp.ClusterPodNetworkOptions, 0) + podNetworks := make([]infrav2exp.ClusterPodNetworkOptions, 0) for _, cniOption := range cluster.ClusterPodNetworkOptions { _, ok := cniOption.(oke.OciVcnIpNativeClusterPodNetworkOptionDetails) if ok { - podNetworks = append(podNetworks, infrav1exp.ClusterPodNetworkOptions{ - CniType: infrav1exp.VCNNativeCNI, + podNetworks = append(podNetworks, infrav2exp.ClusterPodNetworkOptions{ + CniType: infrav2exp.VCNNativeCNI, }) } else { - podNetworks = append(podNetworks, infrav1exp.ClusterPodNetworkOptions{ - CniType: infrav1exp.FlannelCNI, + podNetworks = append(podNetworks, infrav2exp.ClusterPodNetworkOptions{ + CniType: infrav2exp.FlannelCNI, }) } } @@ -622,12 +622,12 @@ func (s *ManagedControlPlaneScope) getSpecFromActual(cluster *oke.Cluster) *infr } if cluster.Options != nil { if cluster.Options.AdmissionControllerOptions != nil { - spec.ClusterOption.AdmissionControllerOptions = &infrav1exp.AdmissionControllerOptions{ + spec.ClusterOption.AdmissionControllerOptions = &infrav2exp.AdmissionControllerOptions{ IsPodSecurityPolicyEnabled: cluster.Options.AdmissionControllerOptions.IsPodSecurityPolicyEnabled, } } if cluster.Options.AddOns != nil { - spec.ClusterOption.AddOnOptions = &infrav1exp.AddOnOptions{ + spec.ClusterOption.AddOnOptions = &infrav2exp.AddOnOptions{ IsTillerEnabled: cluster.Options.AddOns.IsTillerEnabled, IsKubernetesDashboardEnabled: cluster.Options.AddOns.IsKubernetesDashboardEnabled, } diff --git a/cloud/scope/managed_control_plane_test.go b/cloud/scope/managed_control_plane_test.go index 2fe05321..1509b982 100644 --- a/cloud/scope/managed_control_plane_test.go +++ b/cloud/scope/managed_control_plane_test.go @@ -24,11 +24,11 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/base/mock_base" "github.com/oracle/cluster-api-provider-oci/cloud/services/containerengine/mock_containerengine" - 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" corev1 "k8s.io/api/core/v1" @@ -77,31 +77,33 @@ func TestControlPlaneReconciliation(t *testing.T) { mockCtrl = gomock.NewController(t) okeClient = mock_containerengine.NewMockClient(mockCtrl) ociClusterAccessor := OCIManagedCluster{ - &infrav1exp.OCIManagedCluster{ + &infrav2exp.OCIManagedCluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, - Spec: infrav1exp.OCIManagedClusterSpec{ + Spec: infrav2exp.OCIManagedClusterSpec{ CompartmentId: "test-compartment", DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn-id"), - Subnets: []*infrastructurev1beta1.Subnet{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, ID: common.String("subnet-id"), - Type: infrastructurev1beta1.Public, + Type: infrastructurev1beta2.Public, }, { - Role: infrastructurev1beta1.ServiceLoadBalancerRole, + Role: infrastructurev1beta2.ServiceLoadBalancerRole, ID: common.String("lb-subnet-id"), }, }, - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, - ID: common.String("nsg-id"), + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + Role: infrastructurev1beta2.ControlPlaneEndpointRole, + ID: common.String("nsg-id"), + }, }, }, }, @@ -112,11 +114,11 @@ func TestControlPlaneReconciliation(t *testing.T) { ociClusterAccessor.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" cs, err = NewManagedControlPlaneScope(ManagedControlPlaneScopeParams{ ContainerEngineClient: okeClient, - OCIManagedControlPlane: &infrav1exp.OCIManagedControlPlane{ + OCIManagedControlPlane: &infrav2exp.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: infrav1exp.OCIManagedControlPlaneSpec{}, + Spec: infrav2exp.OCIManagedControlPlaneSpec{}, }, OCIClusterAccessor: ociClusterAccessor, Cluster: &clusterv1.Cluster{ @@ -195,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 = infrav1exp.OCIManagedControlPlaneSpec{ - ClusterPodNetworkOptions: []infrav1exp.ClusterPodNetworkOptions{ + cs.OCIManagedControlPlane.Spec = infrav2exp.OCIManagedControlPlaneSpec{ + ClusterPodNetworkOptions: []infrav2exp.ClusterPodNetworkOptions{ { - CniType: infrav1exp.FlannelCNI, + CniType: infrav2exp.FlannelCNI, }, { - CniType: infrav1exp.VCNNativeCNI, + CniType: infrav2exp.VCNNativeCNI, }, }, - ImagePolicyConfig: &infrav1exp.ImagePolicyConfig{ + ImagePolicyConfig: &infrav2exp.ImagePolicyConfig{ IsPolicyEnabled: common.Bool(true), - KeyDetails: []infrav1exp.KeyDetails{{ + KeyDetails: []infrav2exp.KeyDetails{{ KmsKeyId: common.String("kms-key-id"), }}, }, - ClusterOption: infrav1exp.ClusterOptions{ - AdmissionControllerOptions: &infrav1exp.AdmissionControllerOptions{ + ClusterOption: infrav2exp.ClusterOptions{ + AdmissionControllerOptions: &infrav2exp.AdmissionControllerOptions{ IsPodSecurityPolicyEnabled: common.Bool(true), }, - AddOnOptions: &infrav1exp.AddOnOptions{ + AddOnOptions: &infrav2exp.AddOnOptions{ IsKubernetesDashboardEnabled: common.Bool(true), IsTillerEnabled: common.Bool(false), }, @@ -363,31 +365,33 @@ func TestControlPlaneUpdation(t *testing.T) { mockCtrl = gomock.NewController(t) okeClient = mock_containerengine.NewMockClient(mockCtrl) ociClusterAccessor := OCIManagedCluster{ - &infrav1exp.OCIManagedCluster{ + &infrav2exp.OCIManagedCluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, - Spec: infrav1exp.OCIManagedClusterSpec{ + Spec: infrav2exp.OCIManagedClusterSpec{ CompartmentId: "test-compartment", DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn-id"), - Subnets: []*infrastructurev1beta1.Subnet{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, ID: common.String("subnet-id"), - Type: infrastructurev1beta1.Public, + Type: infrastructurev1beta2.Public, }, { - Role: infrastructurev1beta1.ServiceLoadBalancerRole, + Role: infrastructurev1beta2.ServiceLoadBalancerRole, ID: common.String("lb-subnet-id"), }, }, - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, - ID: common.String("nsg-id"), + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + Role: infrastructurev1beta2.ControlPlaneEndpointRole, + ID: common.String("nsg-id"), + }, }, }, }, @@ -398,11 +402,11 @@ func TestControlPlaneUpdation(t *testing.T) { ociClusterAccessor.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" cs, err = NewManagedControlPlaneScope(ManagedControlPlaneScopeParams{ ContainerEngineClient: okeClient, - OCIManagedControlPlane: &infrav1exp.OCIManagedControlPlane{ + OCIManagedControlPlane: &infrav2exp.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: infrav1exp.OCIManagedControlPlaneSpec{}, + Spec: infrav2exp.OCIManagedControlPlaneSpec{}, }, OCIClusterAccessor: ociClusterAccessor, Cluster: &clusterv1.Cluster{ @@ -439,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 = infrav1exp.OCIManagedControlPlaneSpec{ - ClusterPodNetworkOptions: []infrav1exp.ClusterPodNetworkOptions{ + cs.OCIManagedControlPlane.Spec = infrav2exp.OCIManagedControlPlaneSpec{ + ClusterPodNetworkOptions: []infrav2exp.ClusterPodNetworkOptions{ { - CniType: infrav1exp.FlannelCNI, + CniType: infrav2exp.FlannelCNI, }, }, - ImagePolicyConfig: &infrav1exp.ImagePolicyConfig{ + ImagePolicyConfig: &infrav2exp.ImagePolicyConfig{ IsPolicyEnabled: common.Bool(true), - KeyDetails: []infrav1exp.KeyDetails{{ + KeyDetails: []infrav2exp.KeyDetails{{ KmsKeyId: common.String("kms-key-id"), }}, }, - ClusterOption: infrav1exp.ClusterOptions{ - AdmissionControllerOptions: &infrav1exp.AdmissionControllerOptions{ + ClusterOption: infrav2exp.ClusterOptions{ + AdmissionControllerOptions: &infrav2exp.AdmissionControllerOptions{ IsPodSecurityPolicyEnabled: common.Bool(true), }, - AddOnOptions: &infrav1exp.AddOnOptions{ + AddOnOptions: &infrav2exp.AddOnOptions{ IsKubernetesDashboardEnabled: common.Bool(true), IsTillerEnabled: common.Bool(false), }, @@ -514,26 +518,26 @@ func TestControlPlaneUpdation(t *testing.T) { name: "control plane change", errorExpected: false, testSpecificSetup: func(cs *ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { - cs.OCIManagedControlPlane.Spec = infrav1exp.OCIManagedControlPlaneSpec{ - ClusterPodNetworkOptions: []infrav1exp.ClusterPodNetworkOptions{ + cs.OCIManagedControlPlane.Spec = infrav2exp.OCIManagedControlPlaneSpec{ + ClusterPodNetworkOptions: []infrav2exp.ClusterPodNetworkOptions{ { - CniType: infrav1exp.FlannelCNI, + CniType: infrav2exp.FlannelCNI, }, { - CniType: infrav1exp.VCNNativeCNI, + CniType: infrav2exp.VCNNativeCNI, }, }, - ImagePolicyConfig: &infrav1exp.ImagePolicyConfig{ + ImagePolicyConfig: &infrav2exp.ImagePolicyConfig{ IsPolicyEnabled: common.Bool(true), - KeyDetails: []infrav1exp.KeyDetails{{ + KeyDetails: []infrav2exp.KeyDetails{{ KmsKeyId: common.String("new-kms-key-id"), }}, }, - ClusterOption: infrav1exp.ClusterOptions{ - AdmissionControllerOptions: &infrav1exp.AdmissionControllerOptions{ + ClusterOption: infrav2exp.ClusterOptions{ + AdmissionControllerOptions: &infrav2exp.AdmissionControllerOptions{ IsPodSecurityPolicyEnabled: common.Bool(true), }, - AddOnOptions: &infrav1exp.AddOnOptions{ + AddOnOptions: &infrav2exp.AddOnOptions{ IsKubernetesDashboardEnabled: common.Bool(true), IsTillerEnabled: common.Bool(false), }, @@ -649,17 +653,17 @@ func TestControlPlaneKubeconfigReconcile(t *testing.T) { okeClient = mock_containerengine.NewMockClient(mockCtrl) baseClient = mock_base.NewMockBaseClient(mockCtrl) ociClusterAccessor := OCIManagedCluster{ - &infrav1exp.OCIManagedCluster{}, + &infrav2exp.OCIManagedCluster{}, } ociClusterAccessor.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" cs, err = NewManagedControlPlaneScope(ManagedControlPlaneScopeParams{ ContainerEngineClient: okeClient, BaseClient: baseClient, - OCIManagedControlPlane: &infrav1exp.OCIManagedControlPlane{ + OCIManagedControlPlane: &infrav2exp.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: infrav1exp.OCIManagedControlPlaneSpec{}, + Spec: infrav2exp.OCIManagedControlPlaneSpec{}, }, OCIClusterAccessor: ociClusterAccessor, Cluster: &clusterv1.Cluster{ diff --git a/cloud/scope/managed_machine_pool.go b/cloud/scope/managed_machine_pool.go index 927d5f3d..a5ca1338 100644 --- a/cloud/scope/managed_machine_pool.go +++ b/cloud/scope/managed_machine_pool.go @@ -26,12 +26,12 @@ import ( "strings" "github.com/go-logr/logr" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/computemanagement" "github.com/oracle/cluster-api-provider-oci/cloud/services/containerengine" - expinfra1 "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1" - infrav1exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1" + expinfra1 "github.com/oracle/cluster-api-provider-oci/exp/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" "github.com/pkg/errors" @@ -55,8 +55,8 @@ type ManagedMachinePoolScopeParams struct { MachinePool *expclusterv1.MachinePool Client client.Client ComputeManagementClient computemanagement.Client - OCIManagedCluster *infrav1exp.OCIManagedCluster - OCIManagedControlPlane *infrav1exp.OCIManagedControlPlane + OCIManagedCluster *infrav2exp.OCIManagedCluster + OCIManagedControlPlane *infrav2exp.OCIManagedControlPlane OCIManagedMachinePool *expinfra1.OCIManagedMachinePool ContainerEngineClient containerengine.Client } @@ -68,10 +68,10 @@ type ManagedMachinePoolScope struct { Cluster *clusterv1.Cluster MachinePool *expclusterv1.MachinePool ComputeManagementClient computemanagement.Client - OCIManagedCluster *infrav1exp.OCIManagedCluster + OCIManagedCluster *infrav2exp.OCIManagedCluster OCIManagedMachinePool *expinfra1.OCIManagedMachinePool ContainerEngineClient containerengine.Client - OCIManagedControlPlane *infrav1exp.OCIManagedControlPlane + OCIManagedControlPlane *infrav2exp.OCIManagedControlPlane } // NewManagedMachinePoolScope creates a ManagedMachinePoolScope given the ManagedMachinePoolScopeParams @@ -128,7 +128,7 @@ func (m *ManagedMachinePoolScope) SetReplicaCount(count int32) { // GetWorkerMachineSubnet returns the WorkerRole core.Subnet id for the cluster func (m *ManagedMachinePoolScope) GetWorkerMachineSubnet() *string { for _, subnet := range m.OCIManagedCluster.Spec.NetworkSpec.Vcn.Subnets { - if subnet.Role == infrastructurev1beta1.WorkerRole { + if subnet.Role == infrastructurev1beta2.WorkerRole { return subnet.ID } } @@ -222,7 +222,7 @@ func (m *ManagedMachinePoolScope) CreateNodePool(ctx context.Context) (*oke.Node if len(workerSubnets) == 0 { return nil, errors.New("worker subnets are not specified") } - adMap := m.OCIManagedCluster.Status.AvailabilityDomains + adMap := m.OCIManagedCluster.Spec.AvailabilityDomains for k, v := range adMap { placementConfigs = append(placementConfigs, expinfra1.PlacementConfig{ AvailabilityDomain: common.String(k), @@ -475,7 +475,7 @@ func (m *ManagedMachinePoolScope) getFreeFormTags() map[string]string { func (m *ManagedMachinePoolScope) getWorkerMachineSubnets() []string { subnetList := make([]string, 0) for _, subnet := range m.OCIManagedCluster.Spec.NetworkSpec.Vcn.Subnets { - if subnet.Role == infrastructurev1beta1.WorkerRole { + if subnet.Role == infrastructurev1beta2.WorkerRole { subnetList = append(subnetList, subnet.Name) } } @@ -487,15 +487,15 @@ func (m *ManagedMachinePoolScope) getWorkerMachineNSGs() []string { specNsgNames := m.OCIManagedMachinePool.Spec.NodePoolNodeConfig.NsgNames if len(specNsgNames) > 0 { for _, nsgName := range specNsgNames { - for _, nsg := range m.OCIManagedCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroups { + for _, nsg := range m.OCIManagedCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List { if nsg.Name == nsgName { nsgList = append(nsgList, *nsg.ID) } } } } else { - for _, nsg := range m.OCIManagedCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroups { - if nsg.Role == infrastructurev1beta1.WorkerRole { + for _, nsg := range m.OCIManagedCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List { + if nsg.Role == infrastructurev1beta2.WorkerRole { nsgList = append(nsgList, *nsg.ID) } } @@ -505,8 +505,8 @@ func (m *ManagedMachinePoolScope) getWorkerMachineNSGs() []string { func (m *ManagedMachinePoolScope) getWorkerMachineNSGList() []string { nsgList := make([]string, 0) - for _, nsg := range m.OCIManagedCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroups { - if nsg.Role == infrastructurev1beta1.WorkerRole { + for _, nsg := range m.OCIManagedCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List { + if nsg.Role == infrastructurev1beta2.WorkerRole { nsgList = append(nsgList, nsg.Name) } } @@ -531,7 +531,7 @@ func (m *ManagedMachinePoolScope) getPodNSGs(nsgs []string) []string { nsgList := make([]string, 0) if len(nsgs) > 0 { for _, nsgName := range nsgs { - for _, nsg := range m.OCIManagedCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroups { + for _, nsg := range m.OCIManagedCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List { if nsg.Name == nsgName { nsgList = append(nsgList, *nsg.ID) } @@ -698,7 +698,7 @@ func (m *ManagedMachinePoolScope) UpdateNodePool(ctx context.Context, pool *oke. // setMachinePoolSpecDefaults sets the defaults in the spec as returned by OKE API. We need to set defaults here rather than webhook as // there is a chance user will edit the cluster -func setMachinePoolSpecDefaults(spec *infrav1exp.OCIManagedMachinePoolSpec) { +func setMachinePoolSpecDefaults(spec *infrav2exp.OCIManagedMachinePoolSpec) { spec.ProviderIDList = nil spec.ProviderID = nil if spec.NodePoolNodeConfig != nil { @@ -724,7 +724,7 @@ func (m *ManagedMachinePoolScope) getSpecFromAPIObject(pool *oke.NodePool) *expi if actualNodeConfigDetails != nil { nodePoolNodeConfig.IsPvEncryptionInTransitEnabled = actualNodeConfigDetails.IsPvEncryptionInTransitEnabled nodePoolNodeConfig.KmsKeyId = actualNodeConfigDetails.KmsKeyId - nodePoolNodeConfig.NsgNames = GetNsgNamesFromId(actualNodeConfigDetails.NsgIds, m.OCIManagedCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroups) + nodePoolNodeConfig.NsgNames = GetNsgNamesFromId(actualNodeConfigDetails.NsgIds, m.OCIManagedCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List) configs := m.buildPlacementConfigFromActual(actualNodeConfigDetails.PlacementConfigs) sort.Slice(configs, func(i, j int) bool { return *configs[i].AvailabilityDomain < *configs[j].AvailabilityDomain @@ -736,7 +736,7 @@ func (m *ManagedMachinePoolScope) getSpecFromAPIObject(pool *oke.NodePool) *expi CniType: expinfra1.VCNNativeCNI, VcnIpNativePodNetworkOptions: expinfra1.VcnIpNativePodNetworkOptions{ MaxPodsPerNode: podDetails.MaxPodsPerNode, - NSGNames: GetNsgNamesFromId(podDetails.PodNsgIds, m.OCIManagedCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroups), + NSGNames: GetNsgNamesFromId(podDetails.PodNsgIds, m.OCIManagedCluster.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List), SubnetNames: GetSubnetNamesFromId(podDetails.PodSubnetIds, m.OCIManagedCluster.Spec.NetworkSpec.Vcn.Subnets), }, } diff --git a/cloud/scope/managed_machine_pool_test.go b/cloud/scope/managed_machine_pool_test.go index 5179ff4d..a8028e19 100644 --- a/cloud/scope/managed_machine_pool_test.go +++ b/cloud/scope/managed_machine_pool_test.go @@ -23,10 +23,10 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/containerengine/mock_containerengine" - 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" "github.com/pkg/errors" @@ -72,47 +72,47 @@ func TestManagedMachinePoolCreate(t *testing.T) { var err error mockCtrl = gomock.NewController(t) okeClient = mock_containerengine.NewMockClient(mockCtrl) - ociManagedCluster := &infrav1exp.OCIManagedCluster{ + ociManagedCluster := &infrav2exp.OCIManagedCluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, - Spec: infrav1exp.OCIManagedClusterSpec{ + Spec: infrav2exp.OCIManagedClusterSpec{ CompartmentId: "test-compartment", DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn-id"), - Subnets: []*infrastructurev1beta1.Subnet{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.WorkerRole, + Role: infrastructurev1beta2.WorkerRole, ID: common.String("subnet-id"), - Type: infrastructurev1beta1.Private, + Type: infrastructurev1beta2.Private, Name: "worker-subnet", }, { - Role: infrastructurev1beta1.PodRole, + Role: infrastructurev1beta2.PodRole, ID: common.String("pod-subnet-id"), - Type: infrastructurev1beta1.Private, + Type: infrastructurev1beta2.Private, Name: "pod-subnet", }, }, - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - Role: infrastructurev1beta1.WorkerRole, - ID: common.String("nsg-id"), - Name: "worker-nsg", - }, - { - Role: infrastructurev1beta1.PodRole, - ID: common.String("pod-nsg-id"), - Name: "pod-nsg", + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + Role: infrastructurev1beta2.WorkerRole, + ID: common.String("nsg-id"), + Name: "worker-nsg", + }, + { + Role: infrastructurev1beta2.PodRole, + ID: common.String("pod-nsg-id"), + Name: "pod-nsg", + }, }, }, }, }, - }, - Status: infrav1exp.OCIManagedClusterStatus{ - AvailabilityDomains: map[string]infrastructurev1beta1.OCIAvailabilityDomain{ + AvailabilityDomains: map[string]infrastructurev1beta2.OCIAvailabilityDomain{ "ad-1": { Name: "ad-1", FaultDomains: []string{"fd-5", "fd-6"}, @@ -125,19 +125,19 @@ func TestManagedMachinePoolCreate(t *testing.T) { ms, err = NewManagedMachinePoolScope(ManagedMachinePoolScopeParams{ ContainerEngineClient: okeClient, - OCIManagedControlPlane: &infrav1exp.OCIManagedControlPlane{ + OCIManagedControlPlane: &infrav2exp.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: infrav1exp.OCIManagedControlPlaneSpec{ + Spec: infrav2exp.OCIManagedControlPlaneSpec{ ID: common.String("cluster-id"), }, }, - OCIManagedMachinePool: &infrav1exp.OCIManagedMachinePool{ + OCIManagedMachinePool: &infrav2exp.OCIManagedMachinePool{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: infrav1exp.OCIManagedMachinePoolSpec{ + Spec: infrav2exp.OCIManagedMachinePoolSpec{ Version: common.String("v1.24.5"), }, }, @@ -173,25 +173,25 @@ func TestManagedMachinePoolCreate(t *testing.T) { errorExpected: false, testSpecificSetup: func(cs *ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { ms.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" - ms.OCIManagedMachinePool.Spec = infrav1exp.OCIManagedMachinePoolSpec{ + ms.OCIManagedMachinePool.Spec = infrav2exp.OCIManagedMachinePoolSpec{ Version: common.String("v1.24.5"), NodeMetadata: map[string]string{"key1": "value1"}, - InitialNodeLabels: []infrav1exp.KeyValue{{ + InitialNodeLabels: []infrav2exp.KeyValue{{ Key: common.String("key"), Value: common.String("value"), }}, NodeShape: "test-shape", - NodeShapeConfig: &infrav1exp.NodeShapeConfig{ + NodeShapeConfig: &infrav2exp.NodeShapeConfig{ Ocpus: common.String("2"), MemoryInGBs: common.String("16"), }, - NodeSourceViaImage: &infrav1exp.NodeSourceViaImage{ + NodeSourceViaImage: &infrav2exp.NodeSourceViaImage{ ImageId: common.String("test-image-id"), BootVolumeSizeInGBs: common.Int64(75), }, SshPublicKey: "test-ssh-public-key", - NodePoolNodeConfig: &infrav1exp.NodePoolNodeConfig{ - PlacementConfigs: []infrav1exp.PlacementConfig{ + NodePoolNodeConfig: &infrav2exp.NodePoolNodeConfig{ + PlacementConfigs: []infrav2exp.PlacementConfig{ { AvailabilityDomain: common.String("test-ad"), SubnetName: common.String("worker-subnet"), @@ -202,16 +202,16 @@ func TestManagedMachinePoolCreate(t *testing.T) { NsgNames: []string{"worker-nsg"}, KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), - NodePoolPodNetworkOptionDetails: &infrav1exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav1exp.VCNNativeCNI, - VcnIpNativePodNetworkOptions: infrav1exp.VcnIpNativePodNetworkOptions{ + NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ + CniType: infrav2exp.VCNNativeCNI, + VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(25), NSGNames: []string{"pod-nsg"}, }, }, }, - NodeEvictionNodePoolSettings: &infrav1exp.NodeEvictionNodePoolSettings{ + NodeEvictionNodePoolSettings: &infrav2exp.NodeEvictionNodePoolSettings{ EvictionGraceDuration: common.String("PT30M"), IsForceDeleteAfterGraceDuration: common.Bool(true), }, @@ -299,24 +299,24 @@ func TestManagedMachinePoolCreate(t *testing.T) { errorExpected: false, testSpecificSetup: func(cs *ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { ms.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" - ms.OCIManagedMachinePool.Spec = infrav1exp.OCIManagedMachinePoolSpec{ + ms.OCIManagedMachinePool.Spec = infrav2exp.OCIManagedMachinePoolSpec{ Version: common.String("v1.24.5"), NodeMetadata: map[string]string{"key1": "value1"}, - InitialNodeLabels: []infrav1exp.KeyValue{{ + InitialNodeLabels: []infrav2exp.KeyValue{{ Key: common.String("key"), Value: common.String("value"), }}, NodeShape: "test-shape", - NodeShapeConfig: &infrav1exp.NodeShapeConfig{ + NodeShapeConfig: &infrav2exp.NodeShapeConfig{ Ocpus: common.String("2"), MemoryInGBs: common.String("16"), }, - NodeSourceViaImage: &infrav1exp.NodeSourceViaImage{ + NodeSourceViaImage: &infrav2exp.NodeSourceViaImage{ BootVolumeSizeInGBs: common.Int64(75), }, SshPublicKey: "test-ssh-public-key", - NodePoolNodeConfig: &infrav1exp.NodePoolNodeConfig{ - PlacementConfigs: []infrav1exp.PlacementConfig{ + NodePoolNodeConfig: &infrav2exp.NodePoolNodeConfig{ + PlacementConfigs: []infrav2exp.PlacementConfig{ { AvailabilityDomain: common.String("test-ad"), SubnetName: common.String("worker-subnet"), @@ -327,16 +327,16 @@ func TestManagedMachinePoolCreate(t *testing.T) { NsgNames: []string{"worker-nsg"}, KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), - NodePoolPodNetworkOptionDetails: &infrav1exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav1exp.VCNNativeCNI, - VcnIpNativePodNetworkOptions: infrav1exp.VcnIpNativePodNetworkOptions{ + NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ + CniType: infrav2exp.VCNNativeCNI, + VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(25), NSGNames: []string{"pod-nsg"}, }, }, }, - NodeEvictionNodePoolSettings: &infrav1exp.NodeEvictionNodePoolSettings{ + NodeEvictionNodePoolSettings: &infrav2exp.NodeEvictionNodePoolSettings{ EvictionGraceDuration: common.String("PT30M"), IsForceDeleteAfterGraceDuration: common.Bool(true), }, @@ -446,24 +446,24 @@ func TestManagedMachinePoolCreate(t *testing.T) { errorExpected: false, testSpecificSetup: func(cs *ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { ms.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" - ms.OCIManagedMachinePool.Spec = infrav1exp.OCIManagedMachinePoolSpec{ + ms.OCIManagedMachinePool.Spec = infrav2exp.OCIManagedMachinePoolSpec{ Version: common.String("v1.24.5"), NodeMetadata: map[string]string{"key1": "value1"}, - InitialNodeLabels: []infrav1exp.KeyValue{{ + InitialNodeLabels: []infrav2exp.KeyValue{{ Key: common.String("key"), Value: common.String("value"), }}, NodeShape: "test-shape-A1", - NodeShapeConfig: &infrav1exp.NodeShapeConfig{ + NodeShapeConfig: &infrav2exp.NodeShapeConfig{ Ocpus: common.String("2"), MemoryInGBs: common.String("16"), }, - NodeSourceViaImage: &infrav1exp.NodeSourceViaImage{ + NodeSourceViaImage: &infrav2exp.NodeSourceViaImage{ BootVolumeSizeInGBs: common.Int64(75), }, SshPublicKey: "test-ssh-public-key", - NodePoolNodeConfig: &infrav1exp.NodePoolNodeConfig{ - PlacementConfigs: []infrav1exp.PlacementConfig{ + NodePoolNodeConfig: &infrav2exp.NodePoolNodeConfig{ + PlacementConfigs: []infrav2exp.PlacementConfig{ { AvailabilityDomain: common.String("test-ad"), SubnetName: common.String("worker-subnet"), @@ -474,16 +474,16 @@ func TestManagedMachinePoolCreate(t *testing.T) { NsgNames: []string{"worker-nsg"}, KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), - NodePoolPodNetworkOptionDetails: &infrav1exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav1exp.VCNNativeCNI, - VcnIpNativePodNetworkOptions: infrav1exp.VcnIpNativePodNetworkOptions{ + NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ + CniType: infrav2exp.VCNNativeCNI, + VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(25), NSGNames: []string{"pod-nsg"}, }, }, }, - NodeEvictionNodePoolSettings: &infrav1exp.NodeEvictionNodePoolSettings{ + NodeEvictionNodePoolSettings: &infrav2exp.NodeEvictionNodePoolSettings{ EvictionGraceDuration: common.String("PT30M"), IsForceDeleteAfterGraceDuration: common.Bool(true), }, @@ -595,24 +595,24 @@ func TestManagedMachinePoolCreate(t *testing.T) { matchError: errors.New("could not lookup nodepool image id from nodepool options"), testSpecificSetup: func(cs *ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { ms.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" - ms.OCIManagedMachinePool.Spec = infrav1exp.OCIManagedMachinePoolSpec{ + ms.OCIManagedMachinePool.Spec = infrav2exp.OCIManagedMachinePoolSpec{ Version: common.String("v1.24.5"), NodeMetadata: map[string]string{"key1": "value1"}, - InitialNodeLabels: []infrav1exp.KeyValue{{ + InitialNodeLabels: []infrav2exp.KeyValue{{ Key: common.String("key"), Value: common.String("value"), }}, NodeShape: "test-shape-A1", - NodeShapeConfig: &infrav1exp.NodeShapeConfig{ + NodeShapeConfig: &infrav2exp.NodeShapeConfig{ Ocpus: common.String("2"), MemoryInGBs: common.String("16"), }, - NodeSourceViaImage: &infrav1exp.NodeSourceViaImage{ + NodeSourceViaImage: &infrav2exp.NodeSourceViaImage{ BootVolumeSizeInGBs: common.Int64(75), }, SshPublicKey: "test-ssh-public-key", - NodePoolNodeConfig: &infrav1exp.NodePoolNodeConfig{ - PlacementConfigs: []infrav1exp.PlacementConfig{ + NodePoolNodeConfig: &infrav2exp.NodePoolNodeConfig{ + PlacementConfigs: []infrav2exp.PlacementConfig{ { AvailabilityDomain: common.String("test-ad"), SubnetName: common.String("worker-subnet"), @@ -623,16 +623,16 @@ func TestManagedMachinePoolCreate(t *testing.T) { NsgNames: []string{"worker-nsg"}, KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), - NodePoolPodNetworkOptionDetails: &infrav1exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav1exp.VCNNativeCNI, - VcnIpNativePodNetworkOptions: infrav1exp.VcnIpNativePodNetworkOptions{ + NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ + CniType: infrav2exp.VCNNativeCNI, + VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(25), NSGNames: []string{"pod-nsg"}, }, }, }, - NodeEvictionNodePoolSettings: &infrav1exp.NodeEvictionNodePoolSettings{ + NodeEvictionNodePoolSettings: &infrav2exp.NodeEvictionNodePoolSettings{ EvictionGraceDuration: common.String("PT30M"), IsForceDeleteAfterGraceDuration: common.Bool(true), }, @@ -666,36 +666,36 @@ func TestManagedMachinePoolCreate(t *testing.T) { errorExpected: false, testSpecificSetup: func(cs *ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { ms.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" - ms.OCIManagedMachinePool.Spec = infrav1exp.OCIManagedMachinePoolSpec{ + ms.OCIManagedMachinePool.Spec = infrav2exp.OCIManagedMachinePoolSpec{ Version: common.String("v1.24.5"), NodeMetadata: map[string]string{"key1": "value1"}, - InitialNodeLabels: []infrav1exp.KeyValue{{ + InitialNodeLabels: []infrav2exp.KeyValue{{ Key: common.String("key"), Value: common.String("value"), }}, NodeShape: "test-shape", - NodeShapeConfig: &infrav1exp.NodeShapeConfig{ + NodeShapeConfig: &infrav2exp.NodeShapeConfig{ Ocpus: common.String("2"), MemoryInGBs: common.String("16"), }, - NodeSourceViaImage: &infrav1exp.NodeSourceViaImage{ + NodeSourceViaImage: &infrav2exp.NodeSourceViaImage{ ImageId: common.String("test-image-id"), }, SshPublicKey: "test-ssh-public-key", - NodePoolNodeConfig: &infrav1exp.NodePoolNodeConfig{ + NodePoolNodeConfig: &infrav2exp.NodePoolNodeConfig{ NsgNames: []string{"worker-nsg"}, KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), - NodePoolPodNetworkOptionDetails: &infrav1exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav1exp.VCNNativeCNI, - VcnIpNativePodNetworkOptions: infrav1exp.VcnIpNativePodNetworkOptions{ + NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ + CniType: infrav2exp.VCNNativeCNI, + VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(15), NSGNames: []string{"pod-nsg"}, }, }, }, - NodeEvictionNodePoolSettings: &infrav1exp.NodeEvictionNodePoolSettings{ + NodeEvictionNodePoolSettings: &infrav2exp.NodeEvictionNodePoolSettings{ EvictionGraceDuration: common.String("PT30M"), IsForceDeleteAfterGraceDuration: common.Bool(true), }, @@ -782,8 +782,8 @@ func TestManagedMachinePoolCreate(t *testing.T) { matchError: errors.New("worker subnets are not specified"), testSpecificSetup: func(cs *ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { ms.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" - ms.OCIManagedCluster.Spec.NetworkSpec.Vcn.Subnets = []*infrastructurev1beta1.Subnet{} - ms.OCIManagedMachinePool.Spec = infrav1exp.OCIManagedMachinePoolSpec{} + ms.OCIManagedCluster.Spec.NetworkSpec.Vcn.Subnets = []*infrastructurev1beta2.Subnet{} + ms.OCIManagedMachinePool.Spec = infrav2exp.OCIManagedMachinePoolSpec{} }, }, { @@ -793,10 +793,10 @@ func TestManagedMachinePoolCreate(t *testing.T) { "worker-subnet-invalid")), testSpecificSetup: func(cs *ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { ms.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" - ms.OCIManagedMachinePool.Spec = infrav1exp.OCIManagedMachinePoolSpec{ + ms.OCIManagedMachinePool.Spec = infrav2exp.OCIManagedMachinePoolSpec{ SshPublicKey: "test-ssh-public-key", - NodePoolNodeConfig: &infrav1exp.NodePoolNodeConfig{ - PlacementConfigs: []infrav1exp.PlacementConfig{ + NodePoolNodeConfig: &infrav2exp.NodePoolNodeConfig{ + PlacementConfigs: []infrav2exp.PlacementConfig{ { AvailabilityDomain: common.String("test-ad"), SubnetName: common.String("worker-subnet-invalid"), @@ -866,47 +866,47 @@ func TestManagedMachinePoolUpdate(t *testing.T) { var err error mockCtrl = gomock.NewController(t) okeClient = mock_containerengine.NewMockClient(mockCtrl) - ociManagedCluster := &infrav1exp.OCIManagedCluster{ + ociManagedCluster := &infrav2exp.OCIManagedCluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, - Spec: infrav1exp.OCIManagedClusterSpec{ + Spec: infrav2exp.OCIManagedClusterSpec{ CompartmentId: "test-compartment", DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn-id"), - Subnets: []*infrastructurev1beta1.Subnet{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.WorkerRole, + Role: infrastructurev1beta2.WorkerRole, ID: common.String("subnet-id"), - Type: infrastructurev1beta1.Private, + Type: infrastructurev1beta2.Private, Name: "worker-subnet", }, { - Role: infrastructurev1beta1.PodRole, + Role: infrastructurev1beta2.PodRole, ID: common.String("pod-subnet-id"), - Type: infrastructurev1beta1.Private, + Type: infrastructurev1beta2.Private, Name: "pod-subnet", }, }, - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - Role: infrastructurev1beta1.WorkerRole, - ID: common.String("nsg-id"), - Name: "worker-nsg", - }, - { - Role: infrastructurev1beta1.PodRole, - ID: common.String("pod-nsg-id"), - Name: "pod-nsg", + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + Role: infrastructurev1beta2.WorkerRole, + ID: common.String("nsg-id"), + Name: "worker-nsg", + }, + { + Role: infrastructurev1beta2.PodRole, + ID: common.String("pod-nsg-id"), + Name: "pod-nsg", + }, }, }, }, }, - }, - Status: infrav1exp.OCIManagedClusterStatus{ - AvailabilityDomains: map[string]infrastructurev1beta1.OCIAvailabilityDomain{ + AvailabilityDomains: map[string]infrastructurev1beta2.OCIAvailabilityDomain{ "ad-1": { Name: "ad-1", FaultDomains: []string{"fd-5", "fd-6"}, @@ -919,19 +919,19 @@ func TestManagedMachinePoolUpdate(t *testing.T) { ms, err = NewManagedMachinePoolScope(ManagedMachinePoolScopeParams{ ContainerEngineClient: okeClient, - OCIManagedControlPlane: &infrav1exp.OCIManagedControlPlane{ + OCIManagedControlPlane: &infrav2exp.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: infrav1exp.OCIManagedControlPlaneSpec{ + Spec: infrav2exp.OCIManagedControlPlaneSpec{ ID: common.String("cluster-id"), }, }, - OCIManagedMachinePool: &infrav1exp.OCIManagedMachinePool{ + OCIManagedMachinePool: &infrav2exp.OCIManagedMachinePool{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: infrav1exp.OCIManagedMachinePoolSpec{ + Spec: infrav2exp.OCIManagedMachinePoolSpec{ Version: common.String("v1.24.5"), }, }, @@ -969,24 +969,24 @@ func TestManagedMachinePoolUpdate(t *testing.T) { errorExpected: false, testSpecificSetup: func(cs *ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { ms.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" - ms.OCIManagedMachinePool.Spec = infrav1exp.OCIManagedMachinePoolSpec{ + ms.OCIManagedMachinePool.Spec = infrav2exp.OCIManagedMachinePoolSpec{ Version: common.String("v1.24.5"), NodeMetadata: map[string]string{"key1": "value1"}, - InitialNodeLabels: []infrav1exp.KeyValue{{ + InitialNodeLabels: []infrav2exp.KeyValue{{ Key: common.String("key"), Value: common.String("value"), }}, NodeShape: "test-shape", - NodeShapeConfig: &infrav1exp.NodeShapeConfig{ + NodeShapeConfig: &infrav2exp.NodeShapeConfig{ Ocpus: common.String("2"), MemoryInGBs: common.String("16"), }, - NodeSourceViaImage: &infrav1exp.NodeSourceViaImage{ + NodeSourceViaImage: &infrav2exp.NodeSourceViaImage{ ImageId: common.String("test-image-id"), }, SshPublicKey: "test-ssh-public-key", - NodePoolNodeConfig: &infrav1exp.NodePoolNodeConfig{ - PlacementConfigs: []infrav1exp.PlacementConfig{ + NodePoolNodeConfig: &infrav2exp.NodePoolNodeConfig{ + PlacementConfigs: []infrav2exp.PlacementConfig{ { AvailabilityDomain: common.String("test-ad"), SubnetName: common.String("worker-subnet"), @@ -997,15 +997,15 @@ func TestManagedMachinePoolUpdate(t *testing.T) { NsgNames: []string{"worker-nsg"}, KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), - NodePoolPodNetworkOptionDetails: &infrav1exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav1exp.VCNNativeCNI, - VcnIpNativePodNetworkOptions: infrav1exp.VcnIpNativePodNetworkOptions{ + NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ + CniType: infrav2exp.VCNNativeCNI, + VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, NSGNames: []string{"pod-nsg"}, }, }, }, - NodeEvictionNodePoolSettings: &infrav1exp.NodeEvictionNodePoolSettings{ + NodeEvictionNodePoolSettings: &infrav2exp.NodeEvictionNodePoolSettings{ EvictionGraceDuration: common.String("PT30M"), IsForceDeleteAfterGraceDuration: common.Bool(true), }, @@ -1066,25 +1066,25 @@ func TestManagedMachinePoolUpdate(t *testing.T) { ms.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" newReplicas := int32(4) ms.MachinePool.Spec.Replicas = &newReplicas - ms.OCIManagedMachinePool.Spec = infrav1exp.OCIManagedMachinePoolSpec{ + ms.OCIManagedMachinePool.Spec = infrav2exp.OCIManagedMachinePoolSpec{ Version: common.String("v1.24.5"), ID: common.String("node-pool-id"), NodeMetadata: map[string]string{"key1": "value1"}, - InitialNodeLabels: []infrav1exp.KeyValue{{ + InitialNodeLabels: []infrav2exp.KeyValue{{ Key: common.String("key"), Value: common.String("value"), }}, NodeShape: "test-shape", - NodeShapeConfig: &infrav1exp.NodeShapeConfig{ + NodeShapeConfig: &infrav2exp.NodeShapeConfig{ Ocpus: common.String("2"), MemoryInGBs: common.String("16"), }, - NodeSourceViaImage: &infrav1exp.NodeSourceViaImage{ + NodeSourceViaImage: &infrav2exp.NodeSourceViaImage{ ImageId: common.String("test-image-id"), }, SshPublicKey: "test-ssh-public-key", - NodePoolNodeConfig: &infrav1exp.NodePoolNodeConfig{ - PlacementConfigs: []infrav1exp.PlacementConfig{ + NodePoolNodeConfig: &infrav2exp.NodePoolNodeConfig{ + PlacementConfigs: []infrav2exp.PlacementConfig{ { AvailabilityDomain: common.String("test-ad"), SubnetName: common.String("worker-subnet"), @@ -1095,16 +1095,16 @@ func TestManagedMachinePoolUpdate(t *testing.T) { NsgNames: []string{"worker-nsg"}, KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), - NodePoolPodNetworkOptionDetails: &infrav1exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav1exp.VCNNativeCNI, - VcnIpNativePodNetworkOptions: infrav1exp.VcnIpNativePodNetworkOptions{ + NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ + CniType: infrav2exp.VCNNativeCNI, + VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(31), NSGNames: []string{"pod-nsg"}, }, }, }, - NodeEvictionNodePoolSettings: &infrav1exp.NodeEvictionNodePoolSettings{ + NodeEvictionNodePoolSettings: &infrav2exp.NodeEvictionNodePoolSettings{ EvictionGraceDuration: common.String("PT30M"), IsForceDeleteAfterGraceDuration: common.Bool(true), }, @@ -1215,25 +1215,25 @@ func TestManagedMachinePoolUpdate(t *testing.T) { ms.MachinePool.Annotations[clusterv1.ReplicasManagedByAnnotation] = "" newReplicas := int32(4) ms.MachinePool.Spec.Replicas = &newReplicas - ms.OCIManagedMachinePool.Spec = infrav1exp.OCIManagedMachinePoolSpec{ + ms.OCIManagedMachinePool.Spec = infrav2exp.OCIManagedMachinePoolSpec{ Version: common.String("v1.24.5"), ID: common.String("node-pool-id"), NodeMetadata: map[string]string{"key1": "value1"}, - InitialNodeLabels: []infrav1exp.KeyValue{{ + InitialNodeLabels: []infrav2exp.KeyValue{{ Key: common.String("key"), Value: common.String("value"), }}, NodeShape: "test-shape", - NodeShapeConfig: &infrav1exp.NodeShapeConfig{ + NodeShapeConfig: &infrav2exp.NodeShapeConfig{ Ocpus: common.String("2"), MemoryInGBs: common.String("16"), }, - NodeSourceViaImage: &infrav1exp.NodeSourceViaImage{ + NodeSourceViaImage: &infrav2exp.NodeSourceViaImage{ ImageId: common.String("test-image-id"), }, SshPublicKey: "test-ssh-public-key", - NodePoolNodeConfig: &infrav1exp.NodePoolNodeConfig{ - PlacementConfigs: []infrav1exp.PlacementConfig{ + NodePoolNodeConfig: &infrav2exp.NodePoolNodeConfig{ + PlacementConfigs: []infrav2exp.PlacementConfig{ { AvailabilityDomain: common.String("test-ad"), SubnetName: common.String("worker-subnet"), @@ -1244,16 +1244,16 @@ func TestManagedMachinePoolUpdate(t *testing.T) { NsgNames: []string{"worker-nsg"}, KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), - NodePoolPodNetworkOptionDetails: &infrav1exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav1exp.VCNNativeCNI, - VcnIpNativePodNetworkOptions: infrav1exp.VcnIpNativePodNetworkOptions{ + NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ + CniType: infrav2exp.VCNNativeCNI, + VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(31), NSGNames: []string{"pod-nsg"}, }, }, }, - NodeEvictionNodePoolSettings: &infrav1exp.NodeEvictionNodePoolSettings{ + NodeEvictionNodePoolSettings: &infrav2exp.NodeEvictionNodePoolSettings{ EvictionGraceDuration: common.String("PT30M"), IsForceDeleteAfterGraceDuration: common.Bool(true), }, @@ -1313,25 +1313,25 @@ func TestManagedMachinePoolUpdate(t *testing.T) { errorExpected: false, testSpecificSetup: func(cs *ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { ms.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" - ms.OCIManagedMachinePool.Spec = infrav1exp.OCIManagedMachinePoolSpec{ + ms.OCIManagedMachinePool.Spec = infrav2exp.OCIManagedMachinePoolSpec{ Version: common.String("v1.24.5"), ID: common.String("node-pool-id"), NodeMetadata: map[string]string{"key1": "value1"}, - InitialNodeLabels: []infrav1exp.KeyValue{{ + InitialNodeLabels: []infrav2exp.KeyValue{{ Key: common.String("key"), Value: common.String("value"), }}, NodeShape: "test-shape", - NodeShapeConfig: &infrav1exp.NodeShapeConfig{ + NodeShapeConfig: &infrav2exp.NodeShapeConfig{ Ocpus: common.String("2"), MemoryInGBs: common.String("16"), }, - NodeSourceViaImage: &infrav1exp.NodeSourceViaImage{ + NodeSourceViaImage: &infrav2exp.NodeSourceViaImage{ ImageId: common.String("test-image-id"), }, SshPublicKey: "test-ssh-public-key", - NodePoolNodeConfig: &infrav1exp.NodePoolNodeConfig{ - PlacementConfigs: []infrav1exp.PlacementConfig{ + NodePoolNodeConfig: &infrav2exp.NodePoolNodeConfig{ + PlacementConfigs: []infrav2exp.PlacementConfig{ { AvailabilityDomain: common.String("test-ad"), SubnetName: common.String("worker-subnet"), @@ -1342,16 +1342,16 @@ func TestManagedMachinePoolUpdate(t *testing.T) { NsgNames: []string{"worker-nsg"}, KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), - NodePoolPodNetworkOptionDetails: &infrav1exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav1exp.VCNNativeCNI, - VcnIpNativePodNetworkOptions: infrav1exp.VcnIpNativePodNetworkOptions{ + NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ + CniType: infrav2exp.VCNNativeCNI, + VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(31), NSGNames: []string{"pod-nsg"}, }, }, }, - NodeEvictionNodePoolSettings: &infrav1exp.NodeEvictionNodePoolSettings{ + NodeEvictionNodePoolSettings: &infrav2exp.NodeEvictionNodePoolSettings{ EvictionGraceDuration: common.String("PT30M"), IsForceDeleteAfterGraceDuration: common.Bool(true), }, @@ -1457,25 +1457,25 @@ func TestManagedMachinePoolUpdate(t *testing.T) { errorExpected: false, testSpecificSetup: func(cs *ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { ms.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" - ms.OCIManagedMachinePool.Spec = infrav1exp.OCIManagedMachinePoolSpec{ + ms.OCIManagedMachinePool.Spec = infrav2exp.OCIManagedMachinePoolSpec{ Version: common.String("v1.24.5"), ID: common.String("node-pool-id"), NodeMetadata: map[string]string{"key1": "value1"}, - InitialNodeLabels: []infrav1exp.KeyValue{{ + InitialNodeLabels: []infrav2exp.KeyValue{{ Key: common.String("key"), Value: common.String("value"), }}, NodeShape: "test-shape", - NodeShapeConfig: &infrav1exp.NodeShapeConfig{ + NodeShapeConfig: &infrav2exp.NodeShapeConfig{ Ocpus: common.String("2"), MemoryInGBs: common.String("16"), }, - NodeSourceViaImage: &infrav1exp.NodeSourceViaImage{ + NodeSourceViaImage: &infrav2exp.NodeSourceViaImage{ ImageId: common.String("test-image-id"), }, SshPublicKey: "test-ssh-public-key", - NodePoolNodeConfig: &infrav1exp.NodePoolNodeConfig{ - PlacementConfigs: []infrav1exp.PlacementConfig{ + NodePoolNodeConfig: &infrav2exp.NodePoolNodeConfig{ + PlacementConfigs: []infrav2exp.PlacementConfig{ { AvailabilityDomain: common.String("test-ad"), SubnetName: common.String("worker-subnet"), @@ -1486,16 +1486,16 @@ func TestManagedMachinePoolUpdate(t *testing.T) { NsgNames: []string{"worker-nsg"}, KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), - NodePoolPodNetworkOptionDetails: &infrav1exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav1exp.VCNNativeCNI, - VcnIpNativePodNetworkOptions: infrav1exp.VcnIpNativePodNetworkOptions{ + NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ + CniType: infrav2exp.VCNNativeCNI, + VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(31), NSGNames: []string{"pod-nsg"}, }, }, }, - NodeEvictionNodePoolSettings: &infrav1exp.NodeEvictionNodePoolSettings{ + NodeEvictionNodePoolSettings: &infrav2exp.NodeEvictionNodePoolSettings{ EvictionGraceDuration: common.String("PT30M"), IsForceDeleteAfterGraceDuration: common.Bool(true), }, @@ -1602,25 +1602,25 @@ func TestManagedMachinePoolUpdate(t *testing.T) { testSpecificSetup: func(cs *ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { ms.OCIManagedCluster.Spec.OCIResourceIdentifier = "resource_uid" ms.OCIManagedMachinePool.Name = "changed" - ms.OCIManagedMachinePool.Spec = infrav1exp.OCIManagedMachinePoolSpec{ + ms.OCIManagedMachinePool.Spec = infrav2exp.OCIManagedMachinePoolSpec{ Version: common.String("v1.24.5"), ID: common.String("node-pool-id"), NodeMetadata: map[string]string{"key1": "value1"}, - InitialNodeLabels: []infrav1exp.KeyValue{{ + InitialNodeLabels: []infrav2exp.KeyValue{{ Key: common.String("key"), Value: common.String("value"), }}, NodeShape: "test-shape", - NodeShapeConfig: &infrav1exp.NodeShapeConfig{ + NodeShapeConfig: &infrav2exp.NodeShapeConfig{ Ocpus: common.String("2"), MemoryInGBs: common.String("16"), }, - NodeSourceViaImage: &infrav1exp.NodeSourceViaImage{ + NodeSourceViaImage: &infrav2exp.NodeSourceViaImage{ ImageId: common.String("test-image-id"), }, SshPublicKey: "test-ssh-public-key", - NodePoolNodeConfig: &infrav1exp.NodePoolNodeConfig{ - PlacementConfigs: []infrav1exp.PlacementConfig{ + NodePoolNodeConfig: &infrav2exp.NodePoolNodeConfig{ + PlacementConfigs: []infrav2exp.PlacementConfig{ { AvailabilityDomain: common.String("test-ad"), SubnetName: common.String("worker-subnet"), @@ -1631,16 +1631,16 @@ func TestManagedMachinePoolUpdate(t *testing.T) { NsgNames: []string{"worker-nsg"}, KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), - NodePoolPodNetworkOptionDetails: &infrav1exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav1exp.VCNNativeCNI, - VcnIpNativePodNetworkOptions: infrav1exp.VcnIpNativePodNetworkOptions{ + NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ + CniType: infrav2exp.VCNNativeCNI, + VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(31), NSGNames: []string{"pod-nsg"}, }, }, }, - NodeEvictionNodePoolSettings: &infrav1exp.NodeEvictionNodePoolSettings{ + NodeEvictionNodePoolSettings: &infrav2exp.NodeEvictionNodePoolSettings{ EvictionGraceDuration: common.String("PT30M"), IsForceDeleteAfterGraceDuration: common.Bool(true), }, diff --git a/cloud/scope/nat_gateway_reconciler.go b/cloud/scope/nat_gateway_reconciler.go index e939c8f3..c3831871 100644 --- a/cloud/scope/nat_gateway_reconciler.go +++ b/cloud/scope/nat_gateway_reconciler.go @@ -27,6 +27,10 @@ import ( // ReconcileNatGateway tries to move the NAT Gateway to the desired OCICluster Spec func (s *ClusterScope) ReconcileNatGateway(ctx context.Context) error { + if s.OCIClusterAccessor.GetNetworkSpec().Vcn.NATGateway.Skip { + s.Logger.Info("Skipping NAT Gateway reconciliation as per spec") + return nil + } if s.IsAllSubnetsPublic() { s.Logger.Info("All subnets are public, we don't need NAT gateway") return nil @@ -37,12 +41,12 @@ func (s *ClusterScope) ReconcileNatGateway(ctx context.Context) error { return err } if ngw != nil { - s.OCIClusterAccessor.GetNetworkSpec().Vcn.NatGatewayId = ngw.Id + s.OCIClusterAccessor.GetNetworkSpec().Vcn.NATGateway.Id = ngw.Id s.Logger.Info("No Reconciliation Required for Nat Gateway", "nat_gateway", ngw.Id) return nil } natGateway, err := s.CreateNatGateway(ctx) - s.OCIClusterAccessor.GetNetworkSpec().Vcn.NatGatewayId = natGateway + s.OCIClusterAccessor.GetNetworkSpec().Vcn.NATGateway.Id = natGateway return err } @@ -52,7 +56,7 @@ func (s *ClusterScope) ReconcileNatGateway(ctx context.Context) error { // // 2. Listing the NAT Gateways for the Compartment (by ID), VCN and DisplayName and filtering by tag func (s *ClusterScope) GetNatGateway(ctx context.Context) (*core.NatGateway, error) { - ngwId := s.OCIClusterAccessor.GetNetworkSpec().Vcn.NatGatewayId + ngwId := s.OCIClusterAccessor.GetNetworkSpec().Vcn.NATGateway.Id if ngwId != nil { resp, err := s.VCNClient.GetNatGateway(ctx, core.GetNatGatewayRequest{ NatGatewayId: ngwId, @@ -91,7 +95,7 @@ func (s *ClusterScope) UpdateNatGateway(ctx context.Context) error { DefinedTags: s.GetDefinedTags(), } igwResponse, err := s.VCNClient.UpdateNatGateway(ctx, core.UpdateNatGatewayRequest{ - NatGatewayId: s.OCIClusterAccessor.GetNetworkSpec().Vcn.NatGatewayId, + NatGatewayId: s.OCIClusterAccessor.GetNetworkSpec().Vcn.NATGateway.Id, UpdateNatGatewayDetails: updateNGWDetails, }) if err != nil { @@ -124,6 +128,10 @@ func (s *ClusterScope) CreateNatGateway(ctx context.Context) (*string, error) { // DeleteNatGateway retrieves and attempts to delete the NAT Gateway if found. func (s *ClusterScope) DeleteNatGateway(ctx context.Context) error { + if s.OCIClusterAccessor.GetNetworkSpec().Vcn.NATGateway.Skip { + s.Logger.Info("Skipping NAT Gateway reconciliation as per spec") + return nil + } ngw, err := s.GetNatGateway(ctx) if err != nil && !ociutil.IsNotFound(err) { return err diff --git a/cloud/scope/nat_gateway_reconciler_test.go b/cloud/scope/nat_gateway_reconciler_test.go index 8047f8e0..44c72e68 100644 --- a/cloud/scope/nat_gateway_reconciler_test.go +++ b/cloud/scope/nat_gateway_reconciler_test.go @@ -21,7 +21,7 @@ import ( "testing" "github.com/golang/mock/gomock" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/vcn/mock_vcn" "github.com/oracle/oci-go-sdk/v65/common" @@ -130,23 +130,23 @@ func TestClusterScope_ReconcileNatGateway(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec wantErr bool expectedError string }{ { name: "all subnets are public", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Type: infrastructurev1beta1.Public, - Role: infrastructurev1beta1.ControlPlaneRole, + Type: infrastructurev1beta2.Public, + Role: infrastructurev1beta2.ControlPlaneRole, }, { - Type: infrastructurev1beta1.Public, - Role: infrastructurev1beta1.WorkerRole, + Type: infrastructurev1beta2.Public, + Role: infrastructurev1beta2.WorkerRole, }, }, }, @@ -156,11 +156,13 @@ func TestClusterScope_ReconcileNatGateway(t *testing.T) { }, { name: "no update needed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - NatGatewayId: common.String("foo"), + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + NATGateway: infrastructurev1beta2.NATGateway{ + Id: common.String("foo"), + }, }, }, }, @@ -168,14 +170,16 @@ func TestClusterScope_ReconcileNatGateway(t *testing.T) { }, { name: "no update needed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ DefinedTags: definedTags, FreeformTags: map[string]string{ "foo": "bar", }, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - NatGatewayId: common.String("foo"), + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + NATGateway: infrastructurev1beta2.NATGateway{ + Id: common.String("foo"), + }, }, }, }, @@ -183,14 +187,14 @@ func TestClusterScope_ReconcileNatGateway(t *testing.T) { }, { name: "id not present in spec but found by name and no update needed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", FreeformTags: map[string]string{ "foo": "bar", }, DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn"), }, }, @@ -199,14 +203,14 @@ func TestClusterScope_ReconcileNatGateway(t *testing.T) { }, { name: "creation needed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", FreeformTags: map[string]string{ "foo": "bar", }, DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn1"), }, }, @@ -215,11 +219,11 @@ func TestClusterScope_ReconcileNatGateway(t *testing.T) { }, { name: "creation failed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn1"), }, }, @@ -227,12 +231,28 @@ func TestClusterScope_ReconcileNatGateway(t *testing.T) { wantErr: true, expectedError: "failed create nat gateway: some error", }, + { + name: "creation skip", + spec: infrastructurev1beta2.OCIClusterSpec{ + CompartmentId: "foo", + DefinedTags: definedTags, + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + ID: common.String("vcn1"), + NATGateway: infrastructurev1beta2.NATGateway{ + Skip: true, + }, + }, + }, + }, + wantErr: false, + }, } l := log.FromContext(context.Background()) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAcccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, @@ -306,16 +326,18 @@ func TestClusterScope_DeleteNatGateway(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec wantErr bool expectedError string }{ { name: "delete nat gateway is successful", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - NatGatewayId: common.String("normal_id"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + NATGateway: infrastructurev1beta2.NATGateway{ + Id: common.String("normal_id"), + }, }, }, }, @@ -323,10 +345,12 @@ func TestClusterScope_DeleteNatGateway(t *testing.T) { }, { name: "nat gateway already deleted", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - NatGatewayId: common.String("ngw_deleted"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + NATGateway: infrastructurev1beta2.NATGateway{ + Id: common.String("ngw_deleted"), + }, }, }, }, @@ -334,10 +358,12 @@ func TestClusterScope_DeleteNatGateway(t *testing.T) { }, { name: "delete nat gateway error when calling get nat gateway", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - NatGatewayId: common.String("error"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + NATGateway: infrastructurev1beta2.NATGateway{ + Id: common.String("error"), + }, }, }, }, @@ -346,10 +372,12 @@ func TestClusterScope_DeleteNatGateway(t *testing.T) { }, { name: "delete nat gateway error when calling delete nat gateway", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - NatGatewayId: common.String("error_delete_ngw"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + NATGateway: infrastructurev1beta2.NATGateway{ + Id: common.String("error_delete_ngw"), + }, }, }, }, @@ -361,7 +389,7 @@ func TestClusterScope_DeleteNatGateway(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ Spec: tt.spec, ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", diff --git a/cloud/scope/nsg_reconciler.go b/cloud/scope/nsg_reconciler.go index 29ce8f56..66cf26ad 100644 --- a/cloud/scope/nsg_reconciler.go +++ b/cloud/scope/nsg_reconciler.go @@ -22,7 +22,7 @@ import ( "reflect" "strings" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/cluster-api-provider-oci/cloud/ociutil" "github.com/oracle/oci-go-sdk/v65/common" "github.com/oracle/oci-go-sdk/v65/core" @@ -30,8 +30,8 @@ import ( ) func (s *ClusterScope) ReconcileNSG(ctx context.Context) error { - desiredNSGs := s.OCIClusterAccessor.GetNetworkSpec().Vcn.NetworkSecurityGroups - for _, desiredNSG := range desiredNSGs { + desiredNSGs := s.OCIClusterAccessor.GetNetworkSpec().Vcn.NetworkSecurityGroup + for _, desiredNSG := range desiredNSGs.List { nsg, err := s.GetNSG(ctx, *desiredNSG) if err != nil { s.Logger.Error(err, "error to get nsg") @@ -73,18 +73,18 @@ func (s *ClusterScope) ReconcileNSG(ctx context.Context) error { return nil } -func (s *ClusterScope) adjustNSGRulesSpec(desiredNSG *infrastructurev1beta1.NSG) { - ingressRules := make([]infrastructurev1beta1.IngressSecurityRuleForNSG, 0) +func (s *ClusterScope) adjustNSGRulesSpec(desiredNSG *infrastructurev1beta2.NSG) { + ingressRules := make([]infrastructurev1beta2.IngressSecurityRuleForNSG, 0) for _, ingressRule := range desiredNSG.IngressRules { - if ingressRule.SourceType == infrastructurev1beta1.IngressSecurityRuleSourceTypeServiceCidrBlock { + if ingressRule.SourceType == infrastructurev1beta2.IngressSecurityRuleSourceTypeServiceCidrBlock { ingressRule.Source = common.String(fmt.Sprintf("all-%s-services-in-oracle-services-network", strings.ToLower(s.RegionKey))) } ingressRules = append(ingressRules, ingressRule) } desiredNSG.IngressRules = ingressRules - egressRules := make([]infrastructurev1beta1.EgressSecurityRuleForNSG, 0) + egressRules := make([]infrastructurev1beta2.EgressSecurityRuleForNSG, 0) for _, egressRule := range desiredNSG.EgressRules { - if egressRule.DestinationType == infrastructurev1beta1.EgressSecurityRuleSourceTypeServiceCidrBlock { + if egressRule.DestinationType == infrastructurev1beta2.EgressSecurityRuleSourceTypeServiceCidrBlock { egressRule.Destination = common.String(fmt.Sprintf("all-%s-services-in-oracle-services-network", strings.ToLower(s.RegionKey))) } egressRules = append(egressRules, egressRule) @@ -92,7 +92,7 @@ func (s *ClusterScope) adjustNSGRulesSpec(desiredNSG *infrastructurev1beta1.NSG) desiredNSG.EgressRules = egressRules } -func (s *ClusterScope) GetNSG(ctx context.Context, spec infrastructurev1beta1.NSG) (*core.NetworkSecurityGroup, error) { +func (s *ClusterScope) GetNSG(ctx context.Context, spec infrastructurev1beta2.NSG) (*core.NetworkSecurityGroup, error) { nsgOCID := spec.ID if nsgOCID != nil { resp, err := s.VCNClient.GetNetworkSecurityGroup(ctx, core.GetNetworkSecurityGroupRequest{ @@ -126,8 +126,8 @@ func (s *ClusterScope) GetNSG(ctx context.Context, spec infrastructurev1beta1.NS } func (s *ClusterScope) DeleteNSGs(ctx context.Context) error { - desiredNSGs := s.OCIClusterAccessor.GetNetworkSpec().Vcn.NetworkSecurityGroups - for _, desiredNSG := range desiredNSGs { + desiredNSGs := s.OCIClusterAccessor.GetNetworkSpec().Vcn.NetworkSecurityGroup + for _, desiredNSG := range desiredNSGs.List { nsg, err := s.GetNSG(ctx, *desiredNSG) if err != nil && !ociutil.IsNotFound(err) { return err @@ -148,11 +148,11 @@ func (s *ClusterScope) DeleteNSGs(ctx context.Context) error { return nil } -func (s *ClusterScope) GetNSGSpec() []*infrastructurev1beta1.NSG { - return s.OCIClusterAccessor.GetNetworkSpec().Vcn.NetworkSecurityGroups +func (s *ClusterScope) GetNSGSpec() []*infrastructurev1beta2.NSG { + return s.OCIClusterAccessor.GetNetworkSpec().Vcn.NetworkSecurityGroup.List } -func (s *ClusterScope) IsNSGExitsByRole(role infrastructurev1beta1.Role) bool { +func (s *ClusterScope) IsNSGExitsByRole(role infrastructurev1beta2.Role) bool { for _, nsg := range s.GetNSGSpec() { if role == nsg.Role { return true @@ -162,7 +162,7 @@ func (s *ClusterScope) IsNSGExitsByRole(role infrastructurev1beta1.Role) bool { } // IsNSGEqual compares the actual and desired NSG using name. -func (s *ClusterScope) IsNSGEqual(actual *core.NetworkSecurityGroup, desired infrastructurev1beta1.NSG) bool { +func (s *ClusterScope) IsNSGEqual(actual *core.NetworkSecurityGroup, desired infrastructurev1beta2.NSG) bool { if *actual.DisplayName != desired.Name { return false } @@ -170,10 +170,10 @@ func (s *ClusterScope) IsNSGEqual(actual *core.NetworkSecurityGroup, desired inf } // UpdateNSGSecurityRulesIfNeeded updates NSG rules if required by comparing actual and desired. -func (s *ClusterScope) UpdateNSGSecurityRulesIfNeeded(ctx context.Context, desired infrastructurev1beta1.NSG, +func (s *ClusterScope) UpdateNSGSecurityRulesIfNeeded(ctx context.Context, desired infrastructurev1beta2.NSG, actual *core.NetworkSecurityGroup) (bool, error) { - var ingressRulesToAdd []infrastructurev1beta1.IngressSecurityRuleForNSG - var egressRulesToAdd []infrastructurev1beta1.EgressSecurityRuleForNSG + var ingressRulesToAdd []infrastructurev1beta2.IngressSecurityRuleForNSG + var egressRulesToAdd []infrastructurev1beta2.EgressSecurityRuleForNSG var securityRulesToRemove []string var isNSGUpdated bool listSecurityRulesResponse, err := s.VCNClient.ListNetworkSecurityGroupSecurityRules(ctx, core.ListNetworkSecurityGroupSecurityRulesRequest{ @@ -274,7 +274,7 @@ func (s *ClusterScope) UpdateNSGSecurityRulesIfNeeded(ctx context.Context, desir return isNSGUpdated, nil } -func (s *ClusterScope) UpdateNSG(ctx context.Context, nsgSpec infrastructurev1beta1.NSG) error { +func (s *ClusterScope) UpdateNSG(ctx context.Context, nsgSpec infrastructurev1beta2.NSG) error { updateNSGDetails := core.UpdateNetworkSecurityGroupDetails{ DisplayName: common.String(nsgSpec.Name), } @@ -290,8 +290,8 @@ func (s *ClusterScope) UpdateNSG(ctx context.Context, nsgSpec infrastructurev1be return nil } -func (s *ClusterScope) generateAddSecurityRuleFromSpec(ingressRules []infrastructurev1beta1.IngressSecurityRuleForNSG, - egressRules []infrastructurev1beta1.EgressSecurityRuleForNSG) []core.AddSecurityRuleDetails { +func (s *ClusterScope) generateAddSecurityRuleFromSpec(ingressRules []infrastructurev1beta2.IngressSecurityRuleForNSG, + egressRules []infrastructurev1beta2.EgressSecurityRuleForNSG) []core.AddSecurityRuleDetails { var securityRules []core.AddSecurityRuleDetails var icmpOptions *core.IcmpOptions var tcpOptions *core.TcpOptions @@ -343,9 +343,9 @@ func (s *ClusterScope) generateAddSecurityRuleFromSpec(ingressRules []infrastruc return securityRules } -func generateSpecFromSecurityRules(rules []core.SecurityRule) (map[string]infrastructurev1beta1.IngressSecurityRuleForNSG, map[string]infrastructurev1beta1.EgressSecurityRuleForNSG) { - var ingressRules = make(map[string]infrastructurev1beta1.IngressSecurityRuleForNSG) - var egressRules = make(map[string]infrastructurev1beta1.EgressSecurityRuleForNSG) +func generateSpecFromSecurityRules(rules []core.SecurityRule) (map[string]infrastructurev1beta2.IngressSecurityRuleForNSG, map[string]infrastructurev1beta2.EgressSecurityRuleForNSG) { + var ingressRules = make(map[string]infrastructurev1beta2.IngressSecurityRuleForNSG) + var egressRules = make(map[string]infrastructurev1beta2.EgressSecurityRuleForNSG) var stateless *bool for _, rule := range rules { @@ -356,13 +356,13 @@ func generateSpecFromSecurityRules(rules []core.SecurityRule) (map[string]infras } switch rule.Direction { case core.SecurityRuleDirectionIngress: - ingressRule := infrastructurev1beta1.IngressSecurityRuleForNSG{ - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ + ingressRule := infrastructurev1beta2.IngressSecurityRuleForNSG{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ Protocol: rule.Protocol, Source: rule.Source, IcmpOptions: icmpOptions, IsStateless: stateless, - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeEnum(rule.SourceType), + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeEnum(rule.SourceType), TcpOptions: tcpOptions, UdpOptions: udpOptions, Description: rule.Description, @@ -370,11 +370,11 @@ func generateSpecFromSecurityRules(rules []core.SecurityRule) (map[string]infras } ingressRules[*rule.Id] = ingressRule case core.SecurityRuleDirectionEgress: - egressRule := infrastructurev1beta1.EgressSecurityRuleForNSG{ - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + egressRule := infrastructurev1beta2.EgressSecurityRuleForNSG{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Destination: rule.Destination, Protocol: rule.Protocol, - DestinationType: infrastructurev1beta1.EgressSecurityRuleDestinationTypeEnum(rule.DestinationType), + DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeEnum(rule.DestinationType), IcmpOptions: icmpOptions, IsStateless: stateless, TcpOptions: tcpOptions, @@ -389,8 +389,8 @@ func generateSpecFromSecurityRules(rules []core.SecurityRule) (map[string]infras } -func (s *ClusterScope) AddNSGSecurityRules(ctx context.Context, nsgId *string, ingress []infrastructurev1beta1.IngressSecurityRuleForNSG, - egress []infrastructurev1beta1.EgressSecurityRuleForNSG) error { +func (s *ClusterScope) AddNSGSecurityRules(ctx context.Context, nsgId *string, ingress []infrastructurev1beta2.IngressSecurityRuleForNSG, + egress []infrastructurev1beta2.EgressSecurityRuleForNSG) error { securityRules := s.generateAddSecurityRuleFromSpec(ingress, egress) _, err := s.VCNClient.AddNetworkSecurityGroupSecurityRules(ctx, core.AddNetworkSecurityGroupSecurityRulesRequest{ @@ -406,7 +406,7 @@ func (s *ClusterScope) AddNSGSecurityRules(ctx context.Context, nsgId *string, i return nil } -func (s *ClusterScope) CreateNSG(ctx context.Context, nsg infrastructurev1beta1.NSG) (*string, error) { +func (s *ClusterScope) CreateNSG(ctx context.Context, nsg infrastructurev1beta2.NSG) (*string, error) { createNetworkSecurityGroupDetails := core.CreateNetworkSecurityGroupDetails{ CompartmentId: common.String(s.GetCompartmentId()), VcnId: s.getVcnId(), @@ -426,39 +426,39 @@ func (s *ClusterScope) CreateNSG(ctx context.Context, nsg infrastructurev1beta1. return nsgResponse.Id, nil } -func getProtocolOptionsForSpec(icmp *core.IcmpOptions, tcp *core.TcpOptions, udp *core.UdpOptions) (*infrastructurev1beta1.IcmpOptions, *infrastructurev1beta1.TcpOptions, - *infrastructurev1beta1.UdpOptions) { - var icmpOptions *infrastructurev1beta1.IcmpOptions - var tcpOptions *infrastructurev1beta1.TcpOptions - var udpOptions *infrastructurev1beta1.UdpOptions +func getProtocolOptionsForSpec(icmp *core.IcmpOptions, tcp *core.TcpOptions, udp *core.UdpOptions) (*infrastructurev1beta2.IcmpOptions, *infrastructurev1beta2.TcpOptions, + *infrastructurev1beta2.UdpOptions) { + var icmpOptions *infrastructurev1beta2.IcmpOptions + var tcpOptions *infrastructurev1beta2.TcpOptions + var udpOptions *infrastructurev1beta2.UdpOptions if icmp != nil { - icmpOptions = &infrastructurev1beta1.IcmpOptions{ + icmpOptions = &infrastructurev1beta2.IcmpOptions{ Type: icmp.Type, Code: icmp.Code, } } if tcp != nil { - tcpOptions = &infrastructurev1beta1.TcpOptions{} + tcpOptions = &infrastructurev1beta2.TcpOptions{} if tcp.DestinationPortRange != nil { - tcpOptions.DestinationPortRange = &infrastructurev1beta1.PortRange{} + tcpOptions.DestinationPortRange = &infrastructurev1beta2.PortRange{} tcpOptions.DestinationPortRange.Max = tcp.DestinationPortRange.Max tcpOptions.DestinationPortRange.Min = tcp.DestinationPortRange.Min } if tcp.SourcePortRange != nil { - tcpOptions.SourcePortRange = &infrastructurev1beta1.PortRange{} + tcpOptions.SourcePortRange = &infrastructurev1beta2.PortRange{} tcpOptions.SourcePortRange.Max = tcp.SourcePortRange.Max tcpOptions.SourcePortRange.Min = tcp.SourcePortRange.Min } } if udp != nil { - udpOptions = &infrastructurev1beta1.UdpOptions{} + udpOptions = &infrastructurev1beta2.UdpOptions{} if udp.DestinationPortRange != nil { - udpOptions.DestinationPortRange = &infrastructurev1beta1.PortRange{} + udpOptions.DestinationPortRange = &infrastructurev1beta2.PortRange{} udpOptions.DestinationPortRange.Max = udp.DestinationPortRange.Max udpOptions.DestinationPortRange.Min = udp.DestinationPortRange.Min } if udp.SourcePortRange != nil { - udpOptions.SourcePortRange = &infrastructurev1beta1.PortRange{} + udpOptions.SourcePortRange = &infrastructurev1beta2.PortRange{} udpOptions.SourcePortRange.Max = udp.SourcePortRange.Max udpOptions.SourcePortRange.Min = udp.SourcePortRange.Min } diff --git a/cloud/scope/nsg_reconciler_test.go b/cloud/scope/nsg_reconciler_test.go index 7dbbf256..904cba48 100644 --- a/cloud/scope/nsg_reconciler_test.go +++ b/cloud/scope/nsg_reconciler_test.go @@ -22,7 +22,7 @@ import ( "testing" "github.com/golang/mock/gomock" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/vcn/mock_vcn" "github.com/oracle/oci-go-sdk/v65/common" @@ -91,21 +91,23 @@ func TestClusterScope_DeleteNSGs(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec wantErr bool expectedError string }{ { name: "delete nsg is successful", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - ID: common.String("nsg1"), - }, - { - ID: common.String("nsg2"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + ID: common.String("nsg1"), + }, + { + ID: common.String("nsg2"), + }, }, }, }, @@ -115,12 +117,14 @@ func TestClusterScope_DeleteNSGs(t *testing.T) { }, { name: "nsg already deleted", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - ID: common.String("nsg_deleted"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + ID: common.String("nsg_deleted"), + }, }, }, }, @@ -130,12 +134,14 @@ func TestClusterScope_DeleteNSGs(t *testing.T) { }, { name: "delete nsg error when calling get route table", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - ID: common.String("nsg_get_error"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + ID: common.String("nsg_get_error"), + }, }, }, }, @@ -146,12 +152,14 @@ func TestClusterScope_DeleteNSGs(t *testing.T) { }, { name: "delete nsg error when calling delete route table", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - ID: common.String("nsg_error_delete"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + ID: common.String("nsg_error_delete"), + }, }, }, }, @@ -165,7 +173,7 @@ func TestClusterScope_DeleteNSGs(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ Spec: tt.spec, ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", @@ -218,34 +226,34 @@ func TestClusterScope_ReconcileNSG(t *testing.T) { } updatedTags["foo"] = "bar" - customNSGIngress := []infrastructurev1beta1.IngressSecurityRuleForNSG{ + customNSGIngress := []infrastructurev1beta2.IngressSecurityRuleForNSG{ { - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ Description: common.String("External access to Kubernetes API endpoint"), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(6443), Min: common.Int(6443), }, }, - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, Source: common.String("0.0.0.0/0"), }, }, } - customNSGEgress := []infrastructurev1beta1.EgressSecurityRuleForNSG{ + customNSGEgress := []infrastructurev1beta2.EgressSecurityRuleForNSG{ { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("All traffic to control plane nodes"), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(6443), Min: common.Int(6443), }, }, - DestinationType: infrastructurev1beta1.EgressSecurityRuleDestinationTypeCidrBlock, + DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, Destination: common.String(ControlPlaneMachineSubnetDefaultCIDR), }, }, @@ -260,46 +268,48 @@ func TestClusterScope_ReconcileNSG(t *testing.T) { definedTagsInterface[ns] = mapValues } - customNSGEgressWithId := make([]infrastructurev1beta1.EgressSecurityRuleForNSG, len(customNSGEgress)) + customNSGEgressWithId := make([]infrastructurev1beta2.EgressSecurityRuleForNSG, len(customNSGEgress)) copy(customNSGEgressWithId, customNSGEgress) - customNSGIngressWithId := make([]infrastructurev1beta1.IngressSecurityRuleForNSG, len(customNSGIngress)) + customNSGIngressWithId := make([]infrastructurev1beta2.IngressSecurityRuleForNSG, len(customNSGIngress)) copy(customNSGIngressWithId, customNSGIngress) tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec wantErr bool expectedError string testSpecificSetup func(clusterScope *ClusterScope, nlbClient *mock_vcn.MockClient) }{ { name: "one creation - one update - one update security rule - one no update", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn"), - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - ID: common.String("no-update-id"), - Name: "no-update", - Role: "control-plane-endpoint", - EgressRules: customNSGEgressWithId, - IngressRules: customNSGIngressWithId, - }, - { - ID: common.String("update-rules-id"), - Name: "update-rules", - Role: "control-plane", - EgressRules: customNSGEgress, - IngressRules: customNSGIngressWithId, - }, - { - ID: common.String("update-id"), - Name: "update-nsg", - Role: "worker", - EgressRules: customNSGEgressWithId, - IngressRules: customNSGIngressWithId, + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + ID: common.String("no-update-id"), + Name: "no-update", + Role: "control-plane-endpoint", + EgressRules: customNSGEgressWithId, + IngressRules: customNSGIngressWithId, + }, + { + ID: common.String("update-rules-id"), + Name: "update-rules", + Role: "control-plane", + EgressRules: customNSGEgress, + IngressRules: customNSGIngressWithId, + }, + { + ID: common.String("update-id"), + Name: "update-nsg", + Role: "worker", + EgressRules: customNSGEgressWithId, + IngressRules: customNSGIngressWithId, + }, }, }, }, @@ -522,39 +532,41 @@ func TestClusterScope_ReconcileNSG(t *testing.T) { }, { name: "update failed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn"), - Subnets: []*infrastructurev1beta1.Subnet{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, - SecurityList: &infrastructurev1beta1.SecurityList{ + Role: infrastructurev1beta2.ControlPlaneEndpointRole, + SecurityList: &infrastructurev1beta2.SecurityList{ Name: "foo", }, }, { - Role: infrastructurev1beta1.ServiceLoadBalancerRole, - SecurityList: &infrastructurev1beta1.SecurityList{ + Role: infrastructurev1beta2.ServiceLoadBalancerRole, + SecurityList: &infrastructurev1beta2.SecurityList{ Name: "foo", }, }, { - Role: infrastructurev1beta1.ControlPlaneRole, - SecurityList: &infrastructurev1beta1.SecurityList{ + Role: infrastructurev1beta2.ControlPlaneRole, + SecurityList: &infrastructurev1beta2.SecurityList{ Name: "foo", }, }, }, - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - ID: common.String("update-id"), - Name: "update-nsg-error", - Role: "worker", - EgressRules: customNSGEgressWithId, - IngressRules: customNSGIngressWithId, + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + ID: common.String("update-id"), + Name: "update-nsg-error", + Role: "worker", + EgressRules: customNSGEgressWithId, + IngressRules: customNSGIngressWithId, + }, }, }, }, @@ -574,39 +586,41 @@ func TestClusterScope_ReconcileNSG(t *testing.T) { }, { name: "creation failed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", DefinedTags: definedTags, FreeformTags: map[string]string{ "foo": "bar", }, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn"), - Subnets: []*infrastructurev1beta1.Subnet{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, - SecurityList: &infrastructurev1beta1.SecurityList{ + Role: infrastructurev1beta2.ControlPlaneEndpointRole, + SecurityList: &infrastructurev1beta2.SecurityList{ Name: "foo", }, }, { - Role: infrastructurev1beta1.WorkerRole, - SecurityList: &infrastructurev1beta1.SecurityList{ + Role: infrastructurev1beta2.WorkerRole, + SecurityList: &infrastructurev1beta2.SecurityList{ Name: "foo", }, }, { - Role: infrastructurev1beta1.ControlPlaneRole, - SecurityList: &infrastructurev1beta1.SecurityList{ + Role: infrastructurev1beta2.ControlPlaneRole, + SecurityList: &infrastructurev1beta2.SecurityList{ Name: "foo", }, }, }, - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - Name: "service-lb", - Role: "service-lb", + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + Name: "service-lb", + Role: "service-lb", + }, }, }, }, @@ -636,38 +650,40 @@ func TestClusterScope_ReconcileNSG(t *testing.T) { }, { name: "add rules failed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn"), - Subnets: []*infrastructurev1beta1.Subnet{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, - SecurityList: &infrastructurev1beta1.SecurityList{ + Role: infrastructurev1beta2.ControlPlaneEndpointRole, + SecurityList: &infrastructurev1beta2.SecurityList{ Name: "foo", }, }, { - Role: infrastructurev1beta1.WorkerRole, - SecurityList: &infrastructurev1beta1.SecurityList{ + Role: infrastructurev1beta2.WorkerRole, + SecurityList: &infrastructurev1beta2.SecurityList{ Name: "foo", }, }, { - Role: infrastructurev1beta1.ControlPlaneRole, - SecurityList: &infrastructurev1beta1.SecurityList{ + Role: infrastructurev1beta2.ControlPlaneRole, + SecurityList: &infrastructurev1beta2.SecurityList{ Name: "foo", }, }, }, - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - ID: common.String("loadbalancer-nsg-id"), - Name: "service-lb", - Role: "service-lb", - EgressRules: customNSGEgress, + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + ID: common.String("loadbalancer-nsg-id"), + Name: "service-lb", + Role: "service-lb", + EgressRules: customNSGEgress, + }, }, }, }, @@ -719,7 +735,7 @@ func TestClusterScope_ReconcileNSG(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, @@ -751,7 +767,7 @@ func TestClusterScope_ReconcileNSG(t *testing.T) { } } -func isNSGEqual(desiredNSGs []*infrastructurev1beta1.NSG, actualNSGs []*infrastructurev1beta1.NSG) bool { +func isNSGEqual(desiredNSGs []*infrastructurev1beta2.NSG, actualNSGs []*infrastructurev1beta2.NSG) bool { var found bool if len(desiredNSGs) != len(actualNSGs) { return false diff --git a/cloud/scope/oci_managed_cluster.go b/cloud/scope/oci_managed_cluster.go index 97d11fcf..7b6bd99d 100644 --- a/cloud/scope/oci_managed_cluster.go +++ b/cloud/scope/oci_managed_cluster.go @@ -17,8 +17,8 @@ limitations under the License. package scope import ( - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" - infrav1exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1" + 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 +26,7 @@ import ( // OCIManagedCluster is the ClusterAccessor implementation for managed clusters(OKE) type OCIManagedCluster struct { - OCIManagedCluster *infrav1exp.OCIManagedCluster + OCIManagedCluster *infrav2exp.OCIManagedCluster } func (c OCIManagedCluster) GetNameSpace() string { @@ -38,7 +38,7 @@ func (c OCIManagedCluster) GetRegion() string { } func (c OCIManagedCluster) MarkConditionFalse(t clusterv1.ConditionType, reason string, severity clusterv1.ConditionSeverity, messageFormat string, messageArgs ...interface{}) { - conditions.MarkFalse(c.OCIManagedCluster, infrastructurev1beta1.ClusterReadyCondition, reason, severity, messageFormat, messageArgs...) + conditions.MarkFalse(c.OCIManagedCluster, infrastructurev1beta2.ClusterReadyCondition, reason, severity, messageFormat, messageArgs...) } @@ -66,15 +66,15 @@ func (c OCIManagedCluster) GetFreeformTags() map[string]string { return c.OCIManagedCluster.Spec.FreeformTags } -func (c OCIManagedCluster) GetDRG() *infrastructurev1beta1.DRG { +func (c OCIManagedCluster) GetDRG() *infrastructurev1beta2.DRG { return c.OCIManagedCluster.Spec.NetworkSpec.VCNPeering.DRG } -func (c OCIManagedCluster) GetVCNPeering() *infrastructurev1beta1.VCNPeering { +func (c OCIManagedCluster) GetVCNPeering() *infrastructurev1beta2.VCNPeering { return c.OCIManagedCluster.Spec.NetworkSpec.VCNPeering } -func (c OCIManagedCluster) GetNetworkSpec() *infrastructurev1beta1.NetworkSpec { +func (c OCIManagedCluster) GetNetworkSpec() *infrastructurev1beta2.NetworkSpec { return &c.OCIManagedCluster.Spec.NetworkSpec } @@ -92,7 +92,9 @@ func (c OCIManagedCluster) SetFailureDomain(id string, spec clusterv1.FailureDom } c.OCIManagedCluster.Status.FailureDomains[id] = spec } - -func (c OCIManagedCluster) SetAvailabilityDomains(ads map[string]infrastructurev1beta1.OCIAvailabilityDomain) { - c.OCIManagedCluster.Status.AvailabilityDomains = ads +func (c OCIManagedCluster) GetAvailabilityDomains() map[string]infrastructurev1beta2.OCIAvailabilityDomain { + return c.OCIManagedCluster.Spec.AvailabilityDomains +} +func (c OCIManagedCluster) SetAvailabilityDomains(ads map[string]infrastructurev1beta2.OCIAvailabilityDomain) { + c.OCIManagedCluster.Spec.AvailabilityDomains = ads } diff --git a/cloud/scope/oci_selfmanaged_cluster.go b/cloud/scope/oci_selfmanaged_cluster.go index 1a30a766..2e7b60bf 100644 --- a/cloud/scope/oci_selfmanaged_cluster.go +++ b/cloud/scope/oci_selfmanaged_cluster.go @@ -17,7 +17,7 @@ limitations under the License. package scope import ( - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" corev1 "k8s.io/api/core/v1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/util/conditions" @@ -25,7 +25,7 @@ import ( // OCISelfManagedCluster is the ClusterAccessor implementation for self managed clusters type OCISelfManagedCluster struct { - OCICluster *infrastructurev1beta1.OCICluster + OCICluster *infrastructurev1beta2.OCICluster } func (c OCISelfManagedCluster) GetNameSpace() string { @@ -41,7 +41,7 @@ func (c OCISelfManagedCluster) GetIdentityRef() *corev1.ObjectReference { } func (c OCISelfManagedCluster) MarkConditionFalse(t clusterv1.ConditionType, reason string, severity clusterv1.ConditionSeverity, messageFormat string, messageArgs ...interface{}) { - conditions.MarkFalse(c.OCICluster, infrastructurev1beta1.ClusterReadyCondition, reason, severity, messageFormat, messageArgs...) + conditions.MarkFalse(c.OCICluster, infrastructurev1beta2.ClusterReadyCondition, reason, severity, messageFormat, messageArgs...) } func (c OCISelfManagedCluster) GetOCIResourceIdentifier() string { @@ -64,15 +64,15 @@ func (c OCISelfManagedCluster) GetFreeformTags() map[string]string { return c.OCICluster.Spec.FreeformTags } -func (c OCISelfManagedCluster) GetDRG() *infrastructurev1beta1.DRG { +func (c OCISelfManagedCluster) GetDRG() *infrastructurev1beta2.DRG { return c.OCICluster.Spec.NetworkSpec.VCNPeering.DRG } -func (c OCISelfManagedCluster) GetVCNPeering() *infrastructurev1beta1.VCNPeering { +func (c OCISelfManagedCluster) GetVCNPeering() *infrastructurev1beta2.VCNPeering { return c.OCICluster.Spec.NetworkSpec.VCNPeering } -func (c OCISelfManagedCluster) GetNetworkSpec() *infrastructurev1beta1.NetworkSpec { +func (c OCISelfManagedCluster) GetNetworkSpec() *infrastructurev1beta2.NetworkSpec { return &c.OCICluster.Spec.NetworkSpec } @@ -91,6 +91,9 @@ func (c OCISelfManagedCluster) SetFailureDomain(id string, spec clusterv1.Failur c.OCICluster.Status.FailureDomains[id] = spec } -func (c OCISelfManagedCluster) SetAvailabilityDomains(ads map[string]infrastructurev1beta1.OCIAvailabilityDomain) { - c.OCICluster.Status.AvailabilityDomains = ads +func (c OCISelfManagedCluster) GetAvailabilityDomains() map[string]infrastructurev1beta2.OCIAvailabilityDomain { + return c.OCICluster.Spec.AvailabilityDomains +} +func (c OCISelfManagedCluster) SetAvailabilityDomains(ads map[string]infrastructurev1beta2.OCIAvailabilityDomain) { + c.OCICluster.Spec.AvailabilityDomains = ads } diff --git a/cloud/scope/route_table_reconciler.go b/cloud/scope/route_table_reconciler.go index 217c5522..fbbffb75 100644 --- a/cloud/scope/route_table_reconciler.go +++ b/cloud/scope/route_table_reconciler.go @@ -21,7 +21,7 @@ import ( "fmt" "strings" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/cluster-api-provider-oci/cloud/ociutil" "github.com/oracle/oci-go-sdk/v65/common" "github.com/oracle/oci-go-sdk/v65/core" @@ -29,6 +29,10 @@ import ( ) func (s *ClusterScope) ReconcileRouteTable(ctx context.Context) error { + if s.OCIClusterAccessor.GetNetworkSpec().Vcn.RouteTable.Skip { + s.Logger.Info("Skipping Route table reconciliation as per spec") + return nil + } desiredRouteTables := s.GetDesiredRouteTables() for _, rt := range desiredRouteTables { routeTable, err := s.getRouteTable(ctx, rt) @@ -56,19 +60,19 @@ func (s *ClusterScope) ReconcileRouteTable(ctx context.Context) error { func (s *ClusterScope) GetDesiredRouteTables() []string { var desiredRouteTables []string if s.IsAllSubnetsPrivate() { - desiredRouteTables = []string{infrastructurev1beta1.Private} + desiredRouteTables = []string{infrastructurev1beta2.Private} } else if s.IsAllSubnetsPublic() { - desiredRouteTables = []string{infrastructurev1beta1.Public} + desiredRouteTables = []string{infrastructurev1beta2.Public} } else { - desiredRouteTables = []string{infrastructurev1beta1.Private, infrastructurev1beta1.Public} + desiredRouteTables = []string{infrastructurev1beta2.Private, infrastructurev1beta2.Public} } return desiredRouteTables } func (s *ClusterScope) getRouteTable(ctx context.Context, routeTableType string) (*core.RouteTable, error) { - routeTableId := s.OCIClusterAccessor.GetNetworkSpec().Vcn.PublicRouteTableId - if routeTableType == infrastructurev1beta1.Private { - routeTableId = s.OCIClusterAccessor.GetNetworkSpec().Vcn.PrivateRouteTableId + routeTableId := s.OCIClusterAccessor.GetNetworkSpec().Vcn.RouteTable.PublicRouteTableId + if routeTableType == infrastructurev1beta2.Private { + routeTableId = s.OCIClusterAccessor.GetNetworkSpec().Vcn.RouteTable.PrivateRouteTableId } if routeTableId != nil { resp, err := s.VCNClient.GetRouteTable(ctx, core.GetRouteTableRequest{ @@ -87,7 +91,7 @@ func (s *ClusterScope) getRouteTable(ctx context.Context, routeTableType string) } vcId := s.getVcnId() routeTableName := PublicRouteTableName - if routeTableType == infrastructurev1beta1.Private { + if routeTableType == infrastructurev1beta2.Private { routeTableName = PrivateRouteTableName } rts, err := s.VCNClient.ListRouteTables(ctx, core.ListRouteTablesRequest{ @@ -110,18 +114,18 @@ func (s *ClusterScope) getRouteTable(ctx context.Context, routeTableType string) func (s *ClusterScope) CreateRouteTable(ctx context.Context, routeTableType string) (*string, error) { var routeRules []core.RouteRule var routeTableName string - if routeTableType == infrastructurev1beta1.Private { + if routeTableType == infrastructurev1beta2.Private { routeRules = []core.RouteRule{ { DestinationType: core.RouteRuleDestinationTypeCidrBlock, Destination: common.String("0.0.0.0/0"), - NetworkEntityId: s.OCIClusterAccessor.GetNetworkSpec().Vcn.NatGatewayId, + NetworkEntityId: s.OCIClusterAccessor.GetNetworkSpec().Vcn.NATGateway.Id, Description: common.String("traffic to the internet"), }, { DestinationType: core.RouteRuleDestinationTypeServiceCidrBlock, Destination: common.String(fmt.Sprintf("all-%s-services-in-oracle-services-network", strings.ToLower(s.RegionKey))), - NetworkEntityId: s.OCIClusterAccessor.GetNetworkSpec().Vcn.ServiceGatewayId, + NetworkEntityId: s.OCIClusterAccessor.GetNetworkSpec().Vcn.ServiceGateway.Id, Description: common.String("traffic to OCI services"), }, } @@ -143,7 +147,7 @@ func (s *ClusterScope) CreateRouteTable(ctx context.Context, routeTableType stri { DestinationType: core.RouteRuleDestinationTypeCidrBlock, Destination: common.String("0.0.0.0/0"), - NetworkEntityId: s.OCIClusterAccessor.GetNetworkSpec().Vcn.InternetGatewayId, + NetworkEntityId: s.OCIClusterAccessor.GetNetworkSpec().Vcn.InternetGateway.Id, Description: common.String("traffic to/from internet"), }, } @@ -170,14 +174,18 @@ func (s *ClusterScope) CreateRouteTable(ctx context.Context, routeTableType stri } func (s *ClusterScope) setRTStatus(id *string, routeTableType string) { - if routeTableType == infrastructurev1beta1.Private { - s.OCIClusterAccessor.GetNetworkSpec().Vcn.PrivateRouteTableId = id + if routeTableType == infrastructurev1beta2.Private { + s.OCIClusterAccessor.GetNetworkSpec().Vcn.RouteTable.PrivateRouteTableId = id return } - s.OCIClusterAccessor.GetNetworkSpec().Vcn.PublicRouteTableId = id + s.OCIClusterAccessor.GetNetworkSpec().Vcn.RouteTable.PublicRouteTableId = id } func (s *ClusterScope) DeleteRouteTables(ctx context.Context) error { + if s.OCIClusterAccessor.GetNetworkSpec().Vcn.RouteTable.Skip { + s.Logger.Info("Skipping Route table reconciliation as per spec") + return nil + } desiredRouteTables := s.GetDesiredRouteTables() for _, routeTable := range desiredRouteTables { rt, err := s.getRouteTable(ctx, routeTable) @@ -201,8 +209,8 @@ func (s *ClusterScope) DeleteRouteTables(ctx context.Context) error { } func (s *ClusterScope) getRouteTableId(routeTableType string) *string { - if routeTableType == infrastructurev1beta1.Private { - return s.OCIClusterAccessor.GetNetworkSpec().Vcn.PrivateRouteTableId + if routeTableType == infrastructurev1beta2.Private { + return s.OCIClusterAccessor.GetNetworkSpec().Vcn.RouteTable.PrivateRouteTableId } - return s.OCIClusterAccessor.GetNetworkSpec().Vcn.PublicRouteTableId + return s.OCIClusterAccessor.GetNetworkSpec().Vcn.RouteTable.PublicRouteTableId } diff --git a/cloud/scope/route_table_reconciler_test.go b/cloud/scope/route_table_reconciler_test.go index e6ba7ffc..78f654d6 100644 --- a/cloud/scope/route_table_reconciler_test.go +++ b/cloud/scope/route_table_reconciler_test.go @@ -18,10 +18,11 @@ package scope import ( "context" + infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" "testing" "github.com/golang/mock/gomock" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/identity/mock_identity" "github.com/oracle/cluster-api-provider-oci/cloud/services/vcn/mock_vcn" @@ -197,30 +198,34 @@ func TestClusterScope_ReconcileRouteTable(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec wantErr bool expectedError string }{ { name: "all subnets are private and route table doesn't exists", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Type: infrastructurev1beta1.Private, - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Type: infrastructurev1beta2.Private, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, }, { - Type: infrastructurev1beta1.Private, - Role: infrastructurev1beta1.ServiceLoadBalancerRole, + Type: infrastructurev1beta2.Private, + Role: infrastructurev1beta2.ServiceLoadBalancerRole, }, }, - ID: common.String("vcn1"), - ServiceGatewayId: common.String("sgw"), - NatGatewayId: common.String("ngw"), + ID: common.String("vcn1"), + ServiceGateway: infrastructurev1beta2.ServiceGateway{ + Id: common.String("sgw"), + }, + NATGateway: infrastructurev1beta2.NATGateway{ + Id: common.String("ngw"), + }, }, }, }, @@ -228,23 +233,25 @@ func TestClusterScope_ReconcileRouteTable(t *testing.T) { }, { name: "all subnets are public and route table doesn't exists", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Type: infrastructurev1beta1.Public, - Role: infrastructurev1beta1.ControlPlaneRole, + Type: infrastructurev1beta2.Public, + Role: infrastructurev1beta2.ControlPlaneRole, }, { - Type: infrastructurev1beta1.Public, - Role: infrastructurev1beta1.WorkerRole, + Type: infrastructurev1beta2.Public, + Role: infrastructurev1beta2.WorkerRole, }, }, - ID: common.String("vcn1"), - InternetGatewayId: common.String("igw"), + ID: common.String("vcn1"), + InternetGateway: infrastructurev1beta2.InternetGateway{ + Id: common.String("igw"), + }, }, }, }, @@ -252,15 +259,21 @@ func TestClusterScope_ReconcileRouteTable(t *testing.T) { }, { name: "subnets are public and private and route table doesn't exists", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - ID: common.String("vcn1"), - InternetGatewayId: common.String("igw"), - ServiceGatewayId: common.String("sgw"), - NatGatewayId: common.String("ngw"), + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + ID: common.String("vcn1"), + InternetGateway: infrastructurev1beta2.InternetGateway{ + Id: common.String("igw"), + }, + ServiceGateway: infrastructurev1beta2.ServiceGateway{ + Id: common.String("sgw"), + }, + NATGateway: infrastructurev1beta2.NATGateway{ + Id: common.String("ngw"), + }, }, }, }, @@ -268,12 +281,14 @@ func TestClusterScope_ReconcileRouteTable(t *testing.T) { }, { name: "no update needed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - PrivateRouteTableId: common.String("private"), - PublicRouteTableId: common.String("public"), + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + RouteTable: infrastructurev1beta2.RouteTable{ + PrivateRouteTableId: common.String("private"), + PublicRouteTableId: common.String("public"), + }, }, }, }, @@ -281,24 +296,26 @@ func TestClusterScope_ReconcileRouteTable(t *testing.T) { }, { name: "update needed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ FreeformTags: map[string]string{ "foo": "bar", }, DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Type: infrastructurev1beta1.Private, - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Type: infrastructurev1beta2.Private, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, }, { - Type: infrastructurev1beta1.Private, - Role: infrastructurev1beta1.ServiceLoadBalancerRole, + Type: infrastructurev1beta2.Private, + Role: infrastructurev1beta2.ServiceLoadBalancerRole, }, }, - PrivateRouteTableId: common.String("private"), + RouteTable: infrastructurev1beta2.RouteTable{ + PrivateRouteTableId: common.String("private"), + }, }, }, }, @@ -306,23 +323,23 @@ func TestClusterScope_ReconcileRouteTable(t *testing.T) { }, { name: "id not present in spec but found by name and no update", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", FreeformTags: map[string]string{ "foo": "bar", }, DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn"), - Subnets: []*infrastructurev1beta1.Subnet{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Type: infrastructurev1beta1.Private, - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Type: infrastructurev1beta2.Private, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, }, { - Type: infrastructurev1beta1.Private, - Role: infrastructurev1beta1.ServiceLoadBalancerRole, + Type: infrastructurev1beta2.Private, + Role: infrastructurev1beta2.ServiceLoadBalancerRole, }, }, }, @@ -332,15 +349,52 @@ func TestClusterScope_ReconcileRouteTable(t *testing.T) { }, { name: "creation failed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ + CompartmentId: "foo", + DefinedTags: definedTags, + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + ID: common.String("vcn1"), + ServiceGateway: infrastructurev1beta2.ServiceGateway{ + Id: common.String("sgw"), + }, + NATGateway: infrastructurev1beta2.NATGateway{ + Id: common.String("ngw"), + }, + Subnets: []*infrastructurev1beta2.Subnet{ + { + Type: infrastructurev1beta2.Private, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, + }, + { + Type: infrastructurev1beta2.Private, + Role: infrastructurev1beta2.ServiceLoadBalancerRole, + }, + }, + }, + }, + }, + wantErr: true, + expectedError: "failed create route table: some error", + }, + { + name: "route table creation skip", + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - ID: common.String("vcn1"), - NatGatewayId: common.String("ngw"), - ServiceGatewayId: common.String("sgw"), - Subnets: []*infrastructurev1beta1.Subnet{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + ID: common.String("vcn1"), + NATGateway: infrastructurev1beta2.NATGateway{ + Id: common.String("ngw"), + }, + ServiceGateway: infrastructurev1beta2.ServiceGateway{ + Id: common.String("sgw"), + }, + RouteTable: infrastructurev1beta2.RouteTable{ + Skip: true, + }, + Subnets: []*infrastructurev1beta2.Subnet{ { Type: infrastructurev1beta1.Private, Role: infrastructurev1beta1.ControlPlaneEndpointRole, @@ -353,15 +407,14 @@ func TestClusterScope_ReconcileRouteTable(t *testing.T) { }, }, }, - wantErr: true, - expectedError: "failed create route table: some error", + wantErr: false, }, } l := log.FromContext(context.Background()) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, @@ -451,17 +504,19 @@ func TestClusterScope_DeleteRouteTables(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec wantErr bool expectedError string }{ { name: "delete route table is successful", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - PrivateRouteTableId: common.String("private_id"), - PublicRouteTableId: common.String("public_id"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + RouteTable: infrastructurev1beta2.RouteTable{ + PrivateRouteTableId: common.String("private_id"), + PublicRouteTableId: common.String("public_id"), + }, }, }, }, @@ -469,20 +524,22 @@ func TestClusterScope_DeleteRouteTables(t *testing.T) { }, { name: "route table already deleted", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Type: infrastructurev1beta1.Private, - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Type: infrastructurev1beta2.Private, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, }, { - Type: infrastructurev1beta1.Private, - Role: infrastructurev1beta1.ServiceLoadBalancerRole, + Type: infrastructurev1beta2.Private, + Role: infrastructurev1beta2.ServiceLoadBalancerRole, }, }, - PrivateRouteTableId: common.String("rt_deleted"), + RouteTable: infrastructurev1beta2.RouteTable{ + PrivateRouteTableId: common.String("rt_deleted"), + }, }, }, }, @@ -490,20 +547,22 @@ func TestClusterScope_DeleteRouteTables(t *testing.T) { }, { name: "delete route table error when calling get route table", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Type: infrastructurev1beta1.Private, - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Type: infrastructurev1beta2.Private, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, }, { - Type: infrastructurev1beta1.Private, - Role: infrastructurev1beta1.ServiceLoadBalancerRole, + Type: infrastructurev1beta2.Private, + Role: infrastructurev1beta2.ServiceLoadBalancerRole, }, }, - PrivateRouteTableId: common.String("private_id_error"), + RouteTable: infrastructurev1beta2.RouteTable{ + PrivateRouteTableId: common.String("private_id_error"), + }, }, }, }, @@ -512,20 +571,22 @@ func TestClusterScope_DeleteRouteTables(t *testing.T) { }, { name: "delete route table error when calling delete route table", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Type: infrastructurev1beta1.Private, - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Type: infrastructurev1beta2.Private, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, }, { - Type: infrastructurev1beta1.Private, - Role: infrastructurev1beta1.ServiceLoadBalancerRole, + Type: infrastructurev1beta2.Private, + Role: infrastructurev1beta2.ServiceLoadBalancerRole, }, }, - PrivateRouteTableId: common.String("private_id_error_delete"), + RouteTable: infrastructurev1beta2.RouteTable{ + PrivateRouteTableId: common.String("private_id_error_delete"), + }, }, }, }, @@ -537,7 +598,7 @@ func TestClusterScope_DeleteRouteTables(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ Spec: tt.spec, ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", diff --git a/cloud/scope/security_list_reconciler.go b/cloud/scope/security_list_reconciler.go index dff83dc4..0510f191 100644 --- a/cloud/scope/security_list_reconciler.go +++ b/cloud/scope/security_list_reconciler.go @@ -22,7 +22,7 @@ import ( "github.com/oracle/cluster-api-provider-oci/cloud/ociutil" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/oci-go-sdk/v65/common" "github.com/oracle/oci-go-sdk/v65/core" "github.com/pkg/errors" @@ -53,7 +53,7 @@ func (s *ClusterScope) DeleteSecurityLists(ctx context.Context) error { return nil } -func (s *ClusterScope) CreateSecurityList(ctx context.Context, secList infrastructurev1beta1.SecurityList) (*string, error) { +func (s *ClusterScope) CreateSecurityList(ctx context.Context, secList infrastructurev1beta2.SecurityList) (*string, error) { var ingressRules []core.IngressSecurityRule var egressRules []core.EgressSecurityRule for _, rule := range secList.EgressRules { @@ -88,7 +88,7 @@ func (s *ClusterScope) CreateSecurityList(ctx context.Context, secList infrastru return securityListResponse.Id, nil } -func (s *ClusterScope) IsSecurityListEqual(actual core.SecurityList, desired infrastructurev1beta1.SecurityList) bool { +func (s *ClusterScope) IsSecurityListEqual(actual core.SecurityList, desired infrastructurev1beta2.SecurityList) bool { if *actual.DisplayName != desired.Name { return false } @@ -126,7 +126,7 @@ func (s *ClusterScope) IsSecurityListEqual(actual core.SecurityList, desired inf return true } -func (s *ClusterScope) UpdateSecurityList(ctx context.Context, securityListSpec infrastructurev1beta1.SecurityList) error { +func (s *ClusterScope) UpdateSecurityList(ctx context.Context, securityListSpec infrastructurev1beta2.SecurityList) error { var ingressRules []core.IngressSecurityRule var egressRules []core.EgressSecurityRule for _, rule := range securityListSpec.EgressRules { @@ -158,7 +158,7 @@ func (s *ClusterScope) UpdateSecurityList(ctx context.Context, securityListSpec return nil } -func convertSecurityListIngressRule(rule infrastructurev1beta1.IngressSecurityRule) core.IngressSecurityRule { +func convertSecurityListIngressRule(rule infrastructurev1beta2.IngressSecurityRule) core.IngressSecurityRule { var icmpOptions *core.IcmpOptions var tcpOptions *core.TcpOptions var udpOptions *core.UdpOptions @@ -181,7 +181,7 @@ func convertSecurityListIngressRule(rule infrastructurev1beta1.IngressSecurityRu } } -func convertSecurityListEgressRule(rule infrastructurev1beta1.EgressSecurityRule) core.EgressSecurityRule { +func convertSecurityListEgressRule(rule infrastructurev1beta2.EgressSecurityRule) core.EgressSecurityRule { var icmpOptions *core.IcmpOptions var tcpOptions *core.TcpOptions var udpOptions *core.UdpOptions @@ -204,8 +204,8 @@ func convertSecurityListEgressRule(rule infrastructurev1beta1.EgressSecurityRule } } -func getProtocolOptions(icmp *infrastructurev1beta1.IcmpOptions, tcp *infrastructurev1beta1.TcpOptions, - udp *infrastructurev1beta1.UdpOptions) (*core.IcmpOptions, *core.TcpOptions, *core.UdpOptions) { +func getProtocolOptions(icmp *infrastructurev1beta2.IcmpOptions, tcp *infrastructurev1beta2.TcpOptions, + udp *infrastructurev1beta2.UdpOptions) (*core.IcmpOptions, *core.TcpOptions, *core.UdpOptions) { var icmpOptions *core.IcmpOptions var tcpOptions *core.TcpOptions var udpOptions *core.UdpOptions @@ -244,7 +244,7 @@ func getProtocolOptions(icmp *infrastructurev1beta1.IcmpOptions, tcp *infrastruc return icmpOptions, tcpOptions, udpOptions } -func (s *ClusterScope) IsSecurityListExitsByRole(role infrastructurev1beta1.Role) bool { +func (s *ClusterScope) IsSecurityListExitsByRole(role infrastructurev1beta2.Role) bool { for _, subnet := range s.GetSubnetsSpec() { if role == subnet.Role { if subnet.SecurityList != nil { @@ -255,7 +255,7 @@ func (s *ClusterScope) IsSecurityListExitsByRole(role infrastructurev1beta1.Role return false } -func (s *ClusterScope) GetSecurityList(ctx context.Context, spec infrastructurev1beta1.SecurityList) (*core.SecurityList, error) { +func (s *ClusterScope) GetSecurityList(ctx context.Context, spec infrastructurev1beta2.SecurityList) (*core.SecurityList, error) { securityListOcid := spec.ID if securityListOcid != nil { resp, err := s.VCNClient.GetSecurityList(ctx, core.GetSecurityListRequest{ diff --git a/cloud/scope/security_list_reconciler_test.go b/cloud/scope/security_list_reconciler_test.go index ce07760b..d90a6481 100644 --- a/cloud/scope/security_list_reconciler_test.go +++ b/cloud/scope/security_list_reconciler_test.go @@ -29,7 +29,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/log" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" ) func TestClusterScope_DeleteSecurityLists(t *testing.T) { @@ -91,23 +91,23 @@ func TestClusterScope_DeleteSecurityLists(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec wantErr bool expectedError string }{ { name: "delete SecurityList is successful", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { - SecurityList: &infrastructurev1beta1.SecurityList{ + SecurityList: &infrastructurev1beta2.SecurityList{ ID: common.String("cp_mc_id"), }, }, { - SecurityList: &infrastructurev1beta1.SecurityList{ + SecurityList: &infrastructurev1beta2.SecurityList{ ID: common.String("cp_endpoint_id"), }, }, @@ -119,17 +119,17 @@ func TestClusterScope_DeleteSecurityLists(t *testing.T) { }, { name: "SecurityList already deleted", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { - SecurityList: &infrastructurev1beta1.SecurityList{ + SecurityList: &infrastructurev1beta2.SecurityList{ ID: common.String("ep_SecurityList_deleted"), }, }, { - SecurityList: &infrastructurev1beta1.SecurityList{ + SecurityList: &infrastructurev1beta2.SecurityList{ ID: common.String("mc_SecurityList_deleted"), }, }, @@ -141,12 +141,12 @@ func TestClusterScope_DeleteSecurityLists(t *testing.T) { }, { name: "delete SecurityList error when calling get SecurityList", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { - SecurityList: &infrastructurev1beta1.SecurityList{ + SecurityList: &infrastructurev1beta2.SecurityList{ ID: common.String("cp_endpoint_id_error"), }, }, @@ -159,12 +159,12 @@ func TestClusterScope_DeleteSecurityLists(t *testing.T) { }, { name: "delete security list error when calling delete security list", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { - SecurityList: &infrastructurev1beta1.SecurityList{ + SecurityList: &infrastructurev1beta2.SecurityList{ ID: common.String("cp_endpoint_id_error_delete"), }, }, @@ -180,7 +180,7 @@ func TestClusterScope_DeleteSecurityLists(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ Spec: tt.spec, ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", diff --git a/cloud/scope/service_gateway_reconciler.go b/cloud/scope/service_gateway_reconciler.go index dd891a69..92eec535 100644 --- a/cloud/scope/service_gateway_reconciler.go +++ b/cloud/scope/service_gateway_reconciler.go @@ -37,12 +37,12 @@ func (s *ClusterScope) ReconcileServiceGateway(ctx context.Context) error { return err } if sgw != nil { - s.OCIClusterAccessor.GetNetworkSpec().Vcn.ServiceGatewayId = sgw.Id + s.OCIClusterAccessor.GetNetworkSpec().Vcn.ServiceGateway.Id = sgw.Id s.Logger.Info("No Reconciliation Required for Service Gateway", "service_gateway", sgw.Id) return nil } serviceGateway, err := s.CreateServiceGateway(ctx) - s.OCIClusterAccessor.GetNetworkSpec().Vcn.ServiceGatewayId = serviceGateway + s.OCIClusterAccessor.GetNetworkSpec().Vcn.ServiceGateway.Id = serviceGateway return err } @@ -106,7 +106,7 @@ func (s *ClusterScope) DeleteServiceGateway(ctx context.Context) error { } func (s *ClusterScope) GetServiceGateway(ctx context.Context) (*core.ServiceGateway, error) { - sgwId := s.OCIClusterAccessor.GetNetworkSpec().Vcn.ServiceGatewayId + sgwId := s.OCIClusterAccessor.GetNetworkSpec().Vcn.ServiceGateway.Id if sgwId != nil { resp, err := s.VCNClient.GetServiceGateway(ctx, core.GetServiceGatewayRequest{ ServiceGatewayId: sgwId, diff --git a/cloud/scope/service_gateway_reconciler_test.go b/cloud/scope/service_gateway_reconciler_test.go index 06d00594..d2ef2b0b 100644 --- a/cloud/scope/service_gateway_reconciler_test.go +++ b/cloud/scope/service_gateway_reconciler_test.go @@ -21,7 +21,7 @@ import ( "testing" "github.com/golang/mock/gomock" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/vcn/mock_vcn" "github.com/oracle/oci-go-sdk/v65/common" @@ -151,23 +151,23 @@ func TestClusterScope_ReconcileServiceGateway(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec wantErr bool expectedError string }{ { name: "all subnets are public", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Type: infrastructurev1beta1.Public, - Role: infrastructurev1beta1.ControlPlaneRole, + Type: infrastructurev1beta2.Public, + Role: infrastructurev1beta2.ControlPlaneRole, }, { - Type: infrastructurev1beta1.Public, - Role: infrastructurev1beta1.WorkerRole, + Type: infrastructurev1beta2.Public, + Role: infrastructurev1beta2.WorkerRole, }, }, }, @@ -177,11 +177,13 @@ func TestClusterScope_ReconcileServiceGateway(t *testing.T) { }, { name: "no update needed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - ServiceGatewayId: common.String("foo"), + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + ServiceGateway: infrastructurev1beta2.ServiceGateway{ + Id: common.String("foo"), + }, }, }, }, @@ -189,14 +191,14 @@ func TestClusterScope_ReconcileServiceGateway(t *testing.T) { }, { name: "id not present in spec but found by name and no update", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", FreeformTags: map[string]string{ "foo": "bar", }, DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn"), }, }, @@ -205,14 +207,14 @@ func TestClusterScope_ReconcileServiceGateway(t *testing.T) { }, { name: "creation needed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", FreeformTags: map[string]string{ "foo": "bar", }, DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn1"), }, }, @@ -221,11 +223,11 @@ func TestClusterScope_ReconcileServiceGateway(t *testing.T) { }, { name: "creation failed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn1"), }, }, @@ -238,7 +240,7 @@ func TestClusterScope_ReconcileServiceGateway(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, @@ -307,16 +309,18 @@ func TestClusterScope_DeleteServiceGateway(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec wantErr bool expectedError string }{ { name: "delete Service gateway is successful", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - ServiceGatewayId: common.String("normal_id"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + ServiceGateway: infrastructurev1beta2.ServiceGateway{ + Id: common.String("normal_id"), + }, }, }, }, @@ -324,10 +328,12 @@ func TestClusterScope_DeleteServiceGateway(t *testing.T) { }, { name: "Service gateway already deleted", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - ServiceGatewayId: common.String("sgw_deleted"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + ServiceGateway: infrastructurev1beta2.ServiceGateway{ + Id: common.String("sgw_deleted"), + }, }, }, }, @@ -335,10 +341,12 @@ func TestClusterScope_DeleteServiceGateway(t *testing.T) { }, { name: "delete Service gateway error when calling get Service gateway", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - ServiceGatewayId: common.String("error"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + ServiceGateway: infrastructurev1beta2.ServiceGateway{ + Id: common.String("error"), + }, }, }, }, @@ -347,10 +355,12 @@ func TestClusterScope_DeleteServiceGateway(t *testing.T) { }, { name: "delete Service gateway error when calling delete Service gateway", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - ServiceGatewayId: common.String("error_delete_sgw"), + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + ServiceGateway: infrastructurev1beta2.ServiceGateway{ + Id: common.String("error_delete_sgw"), + }, }, }, }, @@ -362,7 +372,7 @@ func TestClusterScope_DeleteServiceGateway(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ Spec: tt.spec, ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", diff --git a/cloud/scope/subnet_reconciler.go b/cloud/scope/subnet_reconciler.go index 674a5501..83a8cbbc 100644 --- a/cloud/scope/subnet_reconciler.go +++ b/cloud/scope/subnet_reconciler.go @@ -19,7 +19,7 @@ package scope import ( "context" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/cluster-api-provider-oci/cloud/ociutil" "github.com/oracle/oci-go-sdk/v65/common" "github.com/oracle/oci-go-sdk/v65/core" @@ -91,15 +91,15 @@ func (s *ClusterScope) ReconcileSubnet(ctx context.Context) error { return nil } -func (s *ClusterScope) CreateSubnet(ctx context.Context, spec infrastructurev1beta1.Subnet) (*string, error) { +func (s *ClusterScope) CreateSubnet(ctx context.Context, spec infrastructurev1beta2.Subnet) (*string, error) { var err error var routeTable *string var isPrivate bool - if spec.Type == infrastructurev1beta1.Private { + if spec.Type == infrastructurev1beta2.Private { isPrivate = true - routeTable = s.getRouteTableId(infrastructurev1beta1.Private) + routeTable = s.getRouteTableId(infrastructurev1beta2.Private) } else { - routeTable = s.getRouteTableId(infrastructurev1beta1.Public) + routeTable = s.getRouteTableId(infrastructurev1beta2.Public) } createSubnetDetails := core.CreateSubnetDetails{ CompartmentId: common.String(s.GetCompartmentId()), @@ -126,7 +126,7 @@ func (s *ClusterScope) CreateSubnet(ctx context.Context, spec infrastructurev1be return subnetResponse.Subnet.Id, nil } -func (s *ClusterScope) UpdateSubnet(ctx context.Context, spec infrastructurev1beta1.Subnet) error { +func (s *ClusterScope) UpdateSubnet(ctx context.Context, spec infrastructurev1beta2.Subnet) error { updateSubnetDetails := core.UpdateSubnetDetails{ DisplayName: common.String(spec.Name), CidrBlock: common.String(spec.CIDR), @@ -169,7 +169,7 @@ func (s *ClusterScope) DeleteSubnets(ctx context.Context) error { return nil } -func (s *ClusterScope) GetSubnet(ctx context.Context, spec infrastructurev1beta1.Subnet) (*core.Subnet, error) { +func (s *ClusterScope) GetSubnet(ctx context.Context, spec infrastructurev1beta2.Subnet) (*core.Subnet, error) { subnetOcid := spec.ID if subnetOcid != nil { resp, err := s.VCNClient.GetSubnet(ctx, core.GetSubnetRequest{ @@ -202,48 +202,48 @@ func (s *ClusterScope) GetSubnet(ctx context.Context, spec infrastructurev1beta1 return nil, nil } -func (s *ClusterScope) GetControlPlaneEndpointSubnet() *infrastructurev1beta1.Subnet { +func (s *ClusterScope) GetControlPlaneEndpointSubnet() *infrastructurev1beta2.Subnet { for _, subnet := range s.GetSubnetsSpec() { - if subnet.Role == infrastructurev1beta1.ControlPlaneEndpointRole { + if subnet.Role == infrastructurev1beta2.ControlPlaneEndpointRole { return subnet } } return nil } -func (s *ClusterScope) GetControlPlaneMachineSubnet() *infrastructurev1beta1.Subnet { +func (s *ClusterScope) GetControlPlaneMachineSubnet() *infrastructurev1beta2.Subnet { for _, subnet := range s.GetSubnetsSpec() { - if subnet.Role == infrastructurev1beta1.ControlPlaneRole { + if subnet.Role == infrastructurev1beta2.ControlPlaneRole { return subnet } } return nil } -func (s *ClusterScope) GetServiceLoadBalancerSubnet() *infrastructurev1beta1.Subnet { +func (s *ClusterScope) GetServiceLoadBalancerSubnet() *infrastructurev1beta2.Subnet { for _, subnet := range s.GetSubnetsSpec() { - if subnet.Role == infrastructurev1beta1.ServiceLoadBalancerRole { + if subnet.Role == infrastructurev1beta2.ServiceLoadBalancerRole { return subnet } } return nil } -func (s *ClusterScope) GetNodeSubnet() []*infrastructurev1beta1.Subnet { - var nodeSubnets []*infrastructurev1beta1.Subnet +func (s *ClusterScope) GetNodeSubnet() []*infrastructurev1beta2.Subnet { + var nodeSubnets []*infrastructurev1beta2.Subnet for _, subnet := range s.GetSubnetsSpec() { - if subnet.Role == infrastructurev1beta1.WorkerRole { + if subnet.Role == infrastructurev1beta2.WorkerRole { nodeSubnets = append(nodeSubnets, subnet) } } return nodeSubnets } -func (s *ClusterScope) GetSubnetsSpec() []*infrastructurev1beta1.Subnet { +func (s *ClusterScope) GetSubnetsSpec() []*infrastructurev1beta2.Subnet { return s.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets } -func (s *ClusterScope) IsSubnetsEqual(actual *core.Subnet, desired infrastructurev1beta1.Subnet) bool { +func (s *ClusterScope) IsSubnetsEqual(actual *core.Subnet, desired infrastructurev1beta2.Subnet) bool { if desired.Name != *actual.DisplayName { return false } @@ -260,7 +260,7 @@ func (s *ClusterScope) IsSubnetsEqual(actual *core.Subnet, desired infrastructur func (s *ClusterScope) isControlPlaneEndpointSubnetPrivate() bool { for _, subnet := range s.OCIClusterAccessor.GetNetworkSpec().Vcn.Subnets { - if subnet.Role == infrastructurev1beta1.ControlPlaneEndpointRole && subnet.Type == infrastructurev1beta1.Private { + if subnet.Role == infrastructurev1beta2.ControlPlaneEndpointRole && subnet.Type == infrastructurev1beta2.Private { return true } } @@ -269,7 +269,7 @@ func (s *ClusterScope) isControlPlaneEndpointSubnetPrivate() bool { func (s *ClusterScope) GetControlPlaneEndpointSubnetCidr() string { for _, subnet := range s.GetSubnetsSpec() { - if subnet.Role == infrastructurev1beta1.ControlPlaneEndpointRole { + if subnet.Role == infrastructurev1beta2.ControlPlaneEndpointRole { if subnet.CIDR != "" { return subnet.CIDR } @@ -280,7 +280,7 @@ func (s *ClusterScope) GetControlPlaneEndpointSubnetCidr() string { func (s *ClusterScope) GetServiceLoadBalancerSubnetCidr() string { for _, subnet := range s.GetSubnetsSpec() { - if subnet.Role == infrastructurev1beta1.ServiceLoadBalancerRole { + if subnet.Role == infrastructurev1beta2.ServiceLoadBalancerRole { if subnet.CIDR != "" { return subnet.CIDR } @@ -316,7 +316,7 @@ func (s *ClusterScope) GetControlPlaneMachineSubnetCidr() string { // IsAllSubnetsPrivate determines if all the ClusterScope's subnets are private func (s *ClusterScope) IsAllSubnetsPrivate() bool { for _, subnet := range s.GetSubnetsSpec() { - if subnet.Type == infrastructurev1beta1.Public { + if subnet.Type == infrastructurev1beta2.Public { return false } } @@ -329,7 +329,7 @@ func (s *ClusterScope) IsAllSubnetsPrivate() bool { // IsAllSubnetsPublic determines if all the ClusterScope's subnets are public func (s *ClusterScope) IsAllSubnetsPublic() bool { for _, subnet := range s.GetSubnetsSpec() { - if subnet.Type == infrastructurev1beta1.Private { + if subnet.Type == infrastructurev1beta2.Private { return false } } diff --git a/cloud/scope/subnet_reconciler_test.go b/cloud/scope/subnet_reconciler_test.go index 0a47ac52..155e9e64 100644 --- a/cloud/scope/subnet_reconciler_test.go +++ b/cloud/scope/subnet_reconciler_test.go @@ -22,7 +22,7 @@ import ( "testing" "github.com/golang/mock/gomock" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/vcn/mock_vcn" "github.com/oracle/oci-go-sdk/v65/common" @@ -62,53 +62,53 @@ func TestClusterScope_ReconcileSubnet(t *testing.T) { definedTagsInterface[ns] = mapValues } - customIngress := []infrastructurev1beta1.IngressSecurityRule{ + customIngress := []infrastructurev1beta2.IngressSecurityRule{ { Description: common.String("test-ingress"), Protocol: common.String("8"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(123), Min: common.Int(234), }, }, - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, Source: common.String("1.1.1.1/1"), }, } - customEgress := []infrastructurev1beta1.EgressSecurityRule{ + customEgress := []infrastructurev1beta2.EgressSecurityRule{ { Description: common.String("test-egress"), Protocol: common.String("1"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(345), Min: common.Int(567), }, }, - DestinationType: infrastructurev1beta1.EgressSecurityRuleDestinationTypeCidrBlock, + DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, Destination: common.String("2.2.2.2/2"), }, } - customIngress_updated := []infrastructurev1beta1.IngressSecurityRule{ + customIngress_updated := []infrastructurev1beta2.IngressSecurityRule{ { Description: common.String("test-ingress-updated"), Protocol: common.String("7"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(789), Min: common.Int(343), }, }, - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, Source: common.String("1.1.1.2/1"), }, } tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec wantErr bool expectedError string testSpecificSetup func(clusterScope *ClusterScope, nlbClient *mock_vcn.MockClient) @@ -116,48 +116,48 @@ func TestClusterScope_ReconcileSubnet(t *testing.T) { { name: "subnet reconciliation successful - one creation - one update - one no update - one security list " + "creation - one security list update", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ DefinedTags: definedTags, CompartmentId: "foo", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn"), - Subnets: []*infrastructurev1beta1.Subnet{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, Name: "creation_needed", CIDR: "2.2.2.2/10", - Type: infrastructurev1beta1.Private, - SecurityList: &infrastructurev1beta1.SecurityList{ + Type: infrastructurev1beta2.Private, + SecurityList: &infrastructurev1beta2.SecurityList{ Name: "test-cp-endpoint-seclist", EgressRules: customEgress, IngressRules: customIngress, }, }, { - Role: infrastructurev1beta1.ServiceLoadBalancerRole, + Role: infrastructurev1beta2.ServiceLoadBalancerRole, ID: common.String("update_needed_id"), Name: "update_needed", - Type: infrastructurev1beta1.Private, + Type: infrastructurev1beta2.Private, CIDR: "10.0.0.32/27", }, { - Role: infrastructurev1beta1.WorkerRole, + Role: infrastructurev1beta2.WorkerRole, ID: common.String("sec_list_added_id"), Name: "sec_list_added", CIDR: "10.0.64.0/20", - SecurityList: &infrastructurev1beta1.SecurityList{ + SecurityList: &infrastructurev1beta2.SecurityList{ Name: "test-cp-endpoint-seclist", IngressRules: customIngress, EgressRules: customEgress, }, }, { - Role: infrastructurev1beta1.WorkerRole, + Role: infrastructurev1beta2.WorkerRole, ID: common.String("sec_list_updated_id"), Name: "sec_list_added", CIDR: "10.0.64.0/20", - SecurityList: &infrastructurev1beta1.SecurityList{ + SecurityList: &infrastructurev1beta2.SecurityList{ ID: common.String("seclist_id"), Name: "update_seclist", IngressRules: customIngress, @@ -165,7 +165,9 @@ func TestClusterScope_ReconcileSubnet(t *testing.T) { }, }, }, - PrivateRouteTableId: common.String("private"), + RouteTable: infrastructurev1beta2.RouteTable{ + PrivateRouteTableId: common.String("private"), + }, }, }, }, @@ -412,12 +414,12 @@ func TestClusterScope_ReconcileSubnet(t *testing.T) { }, { name: "update subnet error", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, ID: common.String("update_subnet_error"), Name: "update", CIDR: "2.2.2.2/1", @@ -454,15 +456,17 @@ func TestClusterScope_ReconcileSubnet(t *testing.T) { }, { name: "create subnet error", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - ID: common.String("vcn"), - PublicRouteTableId: common.String("public"), - Subnets: []*infrastructurev1beta1.Subnet{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + ID: common.String("vcn"), + RouteTable: infrastructurev1beta2.RouteTable{ + PublicRouteTableId: common.String("public"), + }, + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, Name: "creation_needed", CIDR: "2.2.2.2/10", }, @@ -499,18 +503,20 @@ func TestClusterScope_ReconcileSubnet(t *testing.T) { }, { name: "create security list error", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - ID: common.String("vcn"), - PublicRouteTableId: common.String("public"), - Subnets: []*infrastructurev1beta1.Subnet{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + ID: common.String("vcn"), + RouteTable: infrastructurev1beta2.RouteTable{ + PublicRouteTableId: common.String("public"), + }, + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, ID: common.String("sec_list_added_id"), Name: "sec_list_added", - SecurityList: &infrastructurev1beta1.SecurityList{ + SecurityList: &infrastructurev1beta2.SecurityList{ Name: "test-cp-endpoint-seclist", IngressRules: customIngress_updated, EgressRules: customEgress, @@ -587,18 +593,20 @@ func TestClusterScope_ReconcileSubnet(t *testing.T) { }, { name: "update security list error", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "foo", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - ID: common.String("vcn"), - PublicRouteTableId: common.String("public"), - Subnets: []*infrastructurev1beta1.Subnet{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + ID: common.String("vcn"), + RouteTable: infrastructurev1beta2.RouteTable{ + PublicRouteTableId: common.String("public"), + }, + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, ID: common.String("sec_list_updated_id"), Name: "sec_list_added", - SecurityList: &infrastructurev1beta1.SecurityList{ + SecurityList: &infrastructurev1beta2.SecurityList{ ID: common.String("seclist_id"), Name: "bar", IngressRules: customIngress_updated, @@ -679,7 +687,7 @@ func TestClusterScope_ReconcileSubnet(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, @@ -770,16 +778,16 @@ func TestClusterScope_DeleteSubnets(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec wantErr bool expectedError string }{ { name: "delete subnet is successful", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { ID: common.String("cp_endpoint_id"), }, @@ -794,10 +802,10 @@ func TestClusterScope_DeleteSubnets(t *testing.T) { }, { name: "subnet already deleted", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { ID: common.String("ep_subnet_deleted"), }, @@ -812,10 +820,10 @@ func TestClusterScope_DeleteSubnets(t *testing.T) { }, { name: "delete subnet error when calling get subnet", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { ID: common.String("cp_endpoint_id_error"), }, @@ -828,10 +836,10 @@ func TestClusterScope_DeleteSubnets(t *testing.T) { }, { name: "delete subnet error when calling delete subnet", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - Subnets: []*infrastructurev1beta1.Subnet{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + Subnets: []*infrastructurev1beta2.Subnet{ { ID: common.String("cp_endpoint_id_error_delete"), }, @@ -847,7 +855,7 @@ func TestClusterScope_DeleteSubnets(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ Spec: tt.spec, ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", @@ -874,7 +882,7 @@ func TestClusterScope_DeleteSubnets(t *testing.T) { } } -func isSubnetsEqual(desiredSubnets []*infrastructurev1beta1.Subnet, actualSubnets []*infrastructurev1beta1.Subnet) bool { +func isSubnetsEqual(desiredSubnets []*infrastructurev1beta2.Subnet, actualSubnets []*infrastructurev1beta2.Subnet) bool { var found bool if len(desiredSubnets) != len(actualSubnets) { return false diff --git a/cloud/scope/suite_test.go b/cloud/scope/suite_test.go index 2d8f894e..c9857b4a 100644 --- a/cloud/scope/suite_test.go +++ b/cloud/scope/suite_test.go @@ -20,8 +20,8 @@ import ( "os" "testing" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" - infrav1exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" + infrav2exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/client-go/kubernetes/scheme" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" @@ -35,7 +35,7 @@ func TestMain(m *testing.M) { } func setup() { - utilruntime.Must(infrastructurev1beta1.AddToScheme(scheme.Scheme)) + utilruntime.Must(infrastructurev1beta2.AddToScheme(scheme.Scheme)) utilruntime.Must(clusterv1.AddToScheme(scheme.Scheme)) - utilruntime.Must(infrav1exp.AddToScheme(scheme.Scheme)) + utilruntime.Must(infrav2exp.AddToScheme(scheme.Scheme)) } diff --git a/cloud/scope/util.go b/cloud/scope/util.go index 92f7ee5f..53df2a72 100644 --- a/cloud/scope/util.go +++ b/cloud/scope/util.go @@ -17,11 +17,11 @@ limitations under the License. package scope import ( - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" ) // GetNsgNamesFromId returns the names of the NSGs with the provided IDs -func GetNsgNamesFromId(ids []string, nsgs []*infrastructurev1beta1.NSG) []string { +func GetNsgNamesFromId(ids []string, nsgs []*infrastructurev1beta2.NSG) []string { names := make([]string, 0) for _, id := range ids { for _, nsg := range nsgs { @@ -34,7 +34,7 @@ func GetNsgNamesFromId(ids []string, nsgs []*infrastructurev1beta1.NSG) []string } // GetSubnetNameFromId returns the name of the Subnet with the provided ID -func GetSubnetNameFromId(id *string, subnets []*infrastructurev1beta1.Subnet) string { +func GetSubnetNameFromId(id *string, subnets []*infrastructurev1beta2.Subnet) string { for _, subnet := range subnets { if *id == *subnet.ID { return subnet.Name @@ -44,7 +44,7 @@ func GetSubnetNameFromId(id *string, subnets []*infrastructurev1beta1.Subnet) st } // GetSubnetNamesFromId returns the names of the Subnets with the provided IDs -func GetSubnetNamesFromId(ids []string, subnets []*infrastructurev1beta1.Subnet) []string { +func GetSubnetNamesFromId(ids []string, subnets []*infrastructurev1beta2.Subnet) []string { names := make([]string, 0) for _, id := range ids { for _, subnet := range subnets { diff --git a/cloud/scope/util_test.go b/cloud/scope/util_test.go index 0c21f893..5359e35a 100644 --- a/cloud/scope/util_test.go +++ b/cloud/scope/util_test.go @@ -20,7 +20,7 @@ import ( "testing" "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/oci-go-sdk/v65/common" ) @@ -28,13 +28,13 @@ func Test_GetNsgNamesFromId(t *testing.T) { tests := []struct { name string ids []string - nsgs []*infrastructurev1beta1.NSG + nsgs []*infrastructurev1beta2.NSG expected []string }{ { name: "single", ids: []string{"id-1"}, - nsgs: []*infrastructurev1beta1.NSG{ + nsgs: []*infrastructurev1beta2.NSG{ { ID: common.String("id-1"), Name: "test-1", @@ -49,7 +49,7 @@ func Test_GetNsgNamesFromId(t *testing.T) { { name: "multiple", ids: []string{"id-1", "id-2"}, - nsgs: []*infrastructurev1beta1.NSG{ + nsgs: []*infrastructurev1beta2.NSG{ { ID: common.String("id-1"), Name: "test-1", @@ -64,7 +64,7 @@ func Test_GetNsgNamesFromId(t *testing.T) { { name: "none", ids: []string{"id-3"}, - nsgs: []*infrastructurev1beta1.NSG{ + nsgs: []*infrastructurev1beta2.NSG{ { ID: common.String("id-1"), Name: "test-1", @@ -90,13 +90,13 @@ func Test_GetSubnetNameFromId(t *testing.T) { tests := []struct { name string id string - nsgs []*infrastructurev1beta1.Subnet + nsgs []*infrastructurev1beta2.Subnet expected string }{ { name: "single", id: "id-1", - nsgs: []*infrastructurev1beta1.Subnet{ + nsgs: []*infrastructurev1beta2.Subnet{ { ID: common.String("id-1"), Name: "test-1", @@ -111,7 +111,7 @@ func Test_GetSubnetNameFromId(t *testing.T) { { name: "none", id: "id-3", - nsgs: []*infrastructurev1beta1.Subnet{ + nsgs: []*infrastructurev1beta2.Subnet{ { ID: common.String("id-1"), Name: "test-1", @@ -137,13 +137,13 @@ func Test_GetSubnetNamesFromId(t *testing.T) { tests := []struct { name string ids []string - subnets []*infrastructurev1beta1.Subnet + subnets []*infrastructurev1beta2.Subnet expected []string }{ { name: "single", ids: []string{"id-1"}, - subnets: []*infrastructurev1beta1.Subnet{ + subnets: []*infrastructurev1beta2.Subnet{ { ID: common.String("id-1"), Name: "test-1", @@ -158,7 +158,7 @@ func Test_GetSubnetNamesFromId(t *testing.T) { { name: "multiple", ids: []string{"id-1", "id-2"}, - subnets: []*infrastructurev1beta1.Subnet{ + subnets: []*infrastructurev1beta2.Subnet{ { ID: common.String("id-1"), Name: "test-1", @@ -173,7 +173,7 @@ func Test_GetSubnetNamesFromId(t *testing.T) { { name: "none", ids: []string{"id-3"}, - subnets: []*infrastructurev1beta1.Subnet{ + subnets: []*infrastructurev1beta2.Subnet{ { ID: common.String("id-1"), Name: "test-1", diff --git a/cloud/scope/vcn_reconciler.go b/cloud/scope/vcn_reconciler.go index c033da72..20f1e66f 100644 --- a/cloud/scope/vcn_reconciler.go +++ b/cloud/scope/vcn_reconciler.go @@ -20,7 +20,7 @@ import ( "context" "fmt" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/cluster-api-provider-oci/cloud/ociutil" "github.com/oracle/oci-go-sdk/v65/common" "github.com/oracle/oci-go-sdk/v65/core" @@ -48,7 +48,7 @@ func (s *ClusterScope) ReconcileVCN(ctx context.Context) error { return err } -func (s *ClusterScope) IsVcnEquals(actual *core.Vcn, desired infrastructurev1beta1.VCN) bool { +func (s *ClusterScope) IsVcnEquals(actual *core.Vcn, desired infrastructurev1beta2.VCN) bool { if *actual.DisplayName != desired.Name { return false } @@ -69,8 +69,8 @@ func (s *ClusterScope) GetVcnCidr() string { return VcnDefaultCidr } -func (s *ClusterScope) VCNSpec() infrastructurev1beta1.VCN { - vcnSpec := infrastructurev1beta1.VCN{ +func (s *ClusterScope) VCNSpec() infrastructurev1beta2.VCN { + vcnSpec := infrastructurev1beta2.VCN{ Name: s.GetVcnName(), CIDR: s.GetVcnCidr(), } @@ -110,7 +110,7 @@ func (s *ClusterScope) GetVCN(ctx context.Context) (*core.Vcn, error) { return nil, nil } -func (s *ClusterScope) UpdateVCN(ctx context.Context, vcn infrastructurev1beta1.VCN) error { +func (s *ClusterScope) UpdateVCN(ctx context.Context, vcn infrastructurev1beta2.VCN) error { updateVCNDetails := core.UpdateVcnDetails{ DisplayName: common.String(vcn.Name), } @@ -126,7 +126,7 @@ func (s *ClusterScope) UpdateVCN(ctx context.Context, vcn infrastructurev1beta1. return nil } -func (s *ClusterScope) CreateVCN(ctx context.Context, spec infrastructurev1beta1.VCN) (*string, error) { +func (s *ClusterScope) CreateVCN(ctx context.Context, spec infrastructurev1beta2.VCN) (*string, error) { vcnDetails := core.CreateVcnDetails{ CompartmentId: common.String(s.GetCompartmentId()), DisplayName: common.String(spec.Name), diff --git a/cloud/scope/vcn_reconciler_test.go b/cloud/scope/vcn_reconciler_test.go index 769775b5..8013e9e2 100644 --- a/cloud/scope/vcn_reconciler_test.go +++ b/cloud/scope/vcn_reconciler_test.go @@ -23,7 +23,7 @@ import ( "testing" "github.com/golang/mock/gomock" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/vcn/mock_vcn" "github.com/oracle/oci-go-sdk/v65/common" @@ -54,15 +54,15 @@ func TestClusterScope_CreateVCN(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec want *string wantErr bool }{ { name: "create vcn is successful", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ Name: "normal", }, }, @@ -72,9 +72,9 @@ func TestClusterScope_CreateVCN(t *testing.T) { }, { name: "create vcn error", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ Name: "error", }, }, @@ -87,7 +87,7 @@ func TestClusterScope_CreateVCN(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ Spec: tt.spec, }, } @@ -157,15 +157,15 @@ func TestClusterScope_DeleteVCN(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec wantErr bool expectedError string }{ { name: "delete vcn is successful", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("normal_id"), }, }, @@ -174,9 +174,9 @@ func TestClusterScope_DeleteVCN(t *testing.T) { }, { name: "vcn already deleted", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn_deleted"), }, }, @@ -185,9 +185,9 @@ func TestClusterScope_DeleteVCN(t *testing.T) { }, { name: "delete vcn error when calling get vcn", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("error"), }, }, @@ -197,9 +197,9 @@ func TestClusterScope_DeleteVCN(t *testing.T) { }, { name: "delete vcn error when calling delete vcn", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("error_delete_vcn"), }, }, @@ -212,7 +212,7 @@ func TestClusterScope_DeleteVCN(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", }, @@ -288,17 +288,17 @@ func TestClusterScope_GetVCN(t *testing.T) { }, nil) tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec want *core.Vcn expectedError string wantErr bool }{ { name: "vcn id not present in spec find by name successful", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "bar", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ Name: "foo", }, }, @@ -311,10 +311,10 @@ func TestClusterScope_GetVCN(t *testing.T) { }, { name: "vcn id not present in spec find by name error", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "bar", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ Name: "error", }, }, @@ -324,10 +324,10 @@ func TestClusterScope_GetVCN(t *testing.T) { }, { name: "vcn id not present in spec not found by name", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "bar", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ Name: "not_found", }, }, @@ -336,9 +336,9 @@ func TestClusterScope_GetVCN(t *testing.T) { }, { name: "vcn id not present in spec but not managed by clusterapi", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("not_managed"), }, }, @@ -351,7 +351,7 @@ func TestClusterScope_GetVCN(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ Spec: tt.spec, ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", @@ -390,7 +390,7 @@ func TestClusterScope_GetVCN(t *testing.T) { func TestClusterScope_GetVcnCidr(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec want string }{ { @@ -399,9 +399,9 @@ func TestClusterScope_GetVcnCidr(t *testing.T) { }, { name: "cidr present", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ CIDR: "foo", }, }, @@ -413,7 +413,7 @@ func TestClusterScope_GetVcnCidr(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ Spec: tt.spec, ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", @@ -435,7 +435,7 @@ func TestClusterScope_GetVcnCidr(t *testing.T) { func TestClusterScope_GetVcnName(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec want string }{ { @@ -444,9 +444,9 @@ func TestClusterScope_GetVcnName(t *testing.T) { }, { name: "name present", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ Name: "foo", }, }, @@ -458,7 +458,7 @@ func TestClusterScope_GetVcnName(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ Name: "bar", UID: "cluster_uid", @@ -481,9 +481,9 @@ func TestClusterScope_GetVcnName(t *testing.T) { func TestClusterScope_IsVcnEquals(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec actual *core.Vcn - desired infrastructurev1beta1.VCN + desired infrastructurev1beta2.VCN want bool }{ { @@ -491,7 +491,7 @@ func TestClusterScope_IsVcnEquals(t *testing.T) { actual: &core.Vcn{ DisplayName: common.String("foo"), }, - desired: infrastructurev1beta1.VCN{ + desired: infrastructurev1beta2.VCN{ Name: "bar", }, want: false, @@ -501,7 +501,7 @@ func TestClusterScope_IsVcnEquals(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ Spec: tt.spec, ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", @@ -612,16 +612,16 @@ func TestClusterScope_ReconcileVCN(t *testing.T) { tests := []struct { name string - spec infrastructurev1beta1.OCIClusterSpec + spec infrastructurev1beta2.OCIClusterSpec wantErr bool expectedError string }{ { name: "no reconciliation needed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ DefinedTags: definedTags, - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("normal_id"), Name: "foo", CIDR: "bar", @@ -632,9 +632,9 @@ func TestClusterScope_ReconcileVCN(t *testing.T) { }, { name: "vcn update needed", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("normal_id"), Name: "foo1", CIDR: "bar", @@ -645,9 +645,9 @@ func TestClusterScope_ReconcileVCN(t *testing.T) { }, { name: "vcn update needed but error out", - spec: infrastructurev1beta1.OCIClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + spec: infrastructurev1beta2.OCIClusterSpec{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("normal_id"), Name: "foo2", CIDR: "bar", @@ -659,10 +659,10 @@ func TestClusterScope_ReconcileVCN(t *testing.T) { }, { name: "vcn creation needed", - spec: infrastructurev1beta1.OCIClusterSpec{ + spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "bar", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ Name: "not_found", }, }, @@ -674,7 +674,7 @@ func TestClusterScope_ReconcileVCN(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ociClusterAccessor := OCISelfManagedCluster{ - &infrastructurev1beta1.OCICluster{ + &infrastructurev1beta2.OCICluster{ Spec: tt.spec, ObjectMeta: metav1.ObjectMeta{ UID: "cluster_uid", diff --git a/cloud/scope/vnic_reconciler.go b/cloud/scope/vnic_reconciler.go index 60ad9e12..06c9a902 100644 --- a/cloud/scope/vnic_reconciler.go +++ b/cloud/scope/vnic_reconciler.go @@ -21,7 +21,7 @@ import ( "fmt" "github.com/oracle/cluster-api-provider-oci/cloud/ociutil" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/oci-go-sdk/v65/common" "github.com/oracle/oci-go-sdk/v65/core" "github.com/pkg/errors" @@ -52,7 +52,7 @@ func (m *MachineScope) ReconcileVnicAttachments(ctx context.Context) error { return nil } -func (m *MachineScope) createVnicAttachment(ctx context.Context, spec infrastructurev1beta1.VnicAttachment) (*string, error) { +func (m *MachineScope) createVnicAttachment(ctx context.Context, spec infrastructurev1beta2.VnicAttachment) (*string, error) { vnicName := spec.DisplayName // Default to machine subnet if spec doesn't supply one @@ -99,7 +99,7 @@ func (m *MachineScope) createVnicAttachment(ctx context.Context, spec infrastruc return resp.Id, nil } -func (m *MachineScope) vnicAttachmentExists(ctx context.Context, vnic infrastructurev1beta1.VnicAttachment) bool { +func (m *MachineScope) vnicAttachmentExists(ctx context.Context, vnic infrastructurev1beta2.VnicAttachment) bool { found := false var page *string diff --git a/cloud/scope/vnic_reconciler_test.go b/cloud/scope/vnic_reconciler_test.go index 4bef4089..97f49ea7 100644 --- a/cloud/scope/vnic_reconciler_test.go +++ b/cloud/scope/vnic_reconciler_test.go @@ -23,7 +23,7 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/services/compute/mock_compute" "github.com/oracle/oci-go-sdk/v65/common" @@ -41,7 +41,7 @@ func TestReconcileVnicAttachment(t *testing.T) { ms *MachineScope mockCtrl *gomock.Controller computeClient *mock_compute.MockComputeClient - ociCluster infrastructurev1beta1.OCICluster + ociCluster infrastructurev1beta2.OCICluster ) setup := func(t *testing.T, g *WithT) { @@ -59,24 +59,24 @@ func TestReconcileVnicAttachment(t *testing.T) { mockCtrl = gomock.NewController(t) computeClient = mock_compute.NewMockComputeClient(mockCtrl) client := fake.NewClientBuilder().WithObjects(secret).Build() - ociCluster = infrastructurev1beta1.OCICluster{ + ociCluster = infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ UID: "uid", }, - Spec: infrastructurev1beta1.OCIClusterSpec{ + Spec: infrastructurev1beta2.OCIClusterSpec{ OCIResourceIdentifier: "resource_uid", }, } ociCluster.Spec.ControlPlaneEndpoint.Port = 6443 ms, err = NewMachineScope(MachineScopeParams{ ComputeClient: computeClient, - OCIMachine: &infrastructurev1beta1.OCIMachine{ + OCIMachine: &infrastructurev1beta2.OCIMachine{ ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Spec: infrastructurev1beta1.OCIMachineSpec{ + Spec: infrastructurev1beta2.OCIMachineSpec{ CompartmentId: "testCompartment", - VnicAttachments: []infrastructurev1beta1.VnicAttachment{ + VnicAttachments: []infrastructurev1beta2.VnicAttachment{ { DisplayName: common.String("VnicTest"), NicIndex: common.Int(0), diff --git a/cloud/util/suite_test.go b/cloud/util/suite_test.go index b11da607..77412f55 100644 --- a/cloud/util/suite_test.go +++ b/cloud/util/suite_test.go @@ -20,7 +20,7 @@ import ( "os" "testing" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/client-go/kubernetes/scheme" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" @@ -34,6 +34,6 @@ func TestMain(m *testing.M) { } func setup() { - utilruntime.Must(infrastructurev1beta1.AddToScheme(scheme.Scheme)) + utilruntime.Must(infrastructurev1beta2.AddToScheme(scheme.Scheme)) utilruntime.Must(clusterv1.AddToScheme(scheme.Scheme)) } diff --git a/cloud/util/util.go b/cloud/util/util.go index abe53983..bc6bc521 100644 --- a/cloud/util/util.go +++ b/cloud/util/util.go @@ -21,7 +21,7 @@ import ( "fmt" "reflect" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/cluster-api-provider-oci/cloud/config" "github.com/oracle/cluster-api-provider-oci/cloud/scope" "github.com/oracle/oci-go-sdk/v65/common" @@ -34,8 +34,8 @@ import ( ) // GetClusterIdentityFromRef returns the OCIClusterIdentity referenced by the OCICluster. -func GetClusterIdentityFromRef(ctx context.Context, c client.Client, ociClusterNamespace string, ref *corev1.ObjectReference) (*infrastructurev1beta1.OCIClusterIdentity, error) { - identity := &infrastructurev1beta1.OCIClusterIdentity{} +func GetClusterIdentityFromRef(ctx context.Context, c client.Client, ociClusterNamespace string, ref *corev1.ObjectReference) (*infrastructurev1beta2.OCIClusterIdentity, error) { + identity := &infrastructurev1beta2.OCIClusterIdentity{} if ref != nil { namespace := ref.Namespace if namespace == "" { @@ -51,8 +51,8 @@ func GetClusterIdentityFromRef(ctx context.Context, c client.Client, ociClusterN } // GetOrBuildClientFromIdentity creates ClientProvider from OCIClusterIdentity object -func GetOrBuildClientFromIdentity(ctx context.Context, c client.Client, identity *infrastructurev1beta1.OCIClusterIdentity, defaultRegion string) (*scope.ClientProvider, error) { - if identity.Spec.Type == infrastructurev1beta1.UserPrincipal { +func GetOrBuildClientFromIdentity(ctx context.Context, c client.Client, identity *infrastructurev1beta2.OCIClusterIdentity, defaultRegion string) (*scope.ClientProvider, error) { + if identity.Spec.Type == infrastructurev1beta2.UserPrincipal { secretRef := identity.Spec.PrincipalSecret key := types.NamespacedName{ Namespace: secretRef.Namespace, @@ -92,13 +92,13 @@ func GetOrBuildClientFromIdentity(ctx context.Context, c client.Client, identity } // IsClusterNamespaceAllowed indicates if the cluster namespace is allowed. -func IsClusterNamespaceAllowed(ctx context.Context, k8sClient client.Client, allowedNamespaces *infrastructurev1beta1.AllowedNamespaces, namespace string) bool { +func IsClusterNamespaceAllowed(ctx context.Context, k8sClient client.Client, allowedNamespaces *infrastructurev1beta2.AllowedNamespaces, namespace string) bool { if allowedNamespaces == nil { return false } // empty value matches with all namespaces - if reflect.DeepEqual(*allowedNamespaces, infrastructurev1beta1.AllowedNamespaces{}) { + if reflect.DeepEqual(*allowedNamespaces, infrastructurev1beta2.AllowedNamespaces{}) { return true } @@ -179,7 +179,7 @@ func CreateClientProviderFromClusterIdentity(ctx context.Context, client client. return nil, err } if !IsClusterNamespaceAllowed(ctx, client, identity.Spec.AllowedNamespaces, namespace) { - clusterAccessor.MarkConditionFalse(infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.NamespaceNotAllowedByIdentity, clusterv1.ConditionSeverityError, "") + clusterAccessor.MarkConditionFalse(infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.NamespaceNotAllowedByIdentity, clusterv1.ConditionSeverityError, "") return nil, errors.Errorf("OCIClusterIdentity list of allowed namespaces doesn't include current cluster namespace %s", namespace) } clientProvider, err := GetOrBuildClientFromIdentity(ctx, client, identity, defaultRegion) diff --git a/cloud/util/util_test.go b/cloud/util/util_test.go index 4c71f375..0900c42b 100644 --- a/cloud/util/util_test.go +++ b/cloud/util/util_test.go @@ -21,7 +21,7 @@ import ( "testing" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/cluster-api-provider-oci/cloud/config" "github.com/oracle/cluster-api-provider-oci/cloud/scope" corev1 "k8s.io/api/core/v1" @@ -37,7 +37,7 @@ func TestGetClusterIdentityFromRef(t *testing.T) { ref *corev1.ObjectReference objects []client.Object errorExpected bool - expectedSpec infrastructurev1beta1.OCIClusterIdentitySpec + expectedSpec infrastructurev1beta2.OCIClusterIdentitySpec }{ { name: "simple", @@ -48,21 +48,21 @@ func TestGetClusterIdentityFromRef(t *testing.T) { Name: "test-identity", APIVersion: "infrastructure.cluster.x-k8s.io/v1beta1", }, - objects: []client.Object{&infrastructurev1beta1.OCIClusterIdentity{ + objects: []client.Object{&infrastructurev1beta2.OCIClusterIdentity{ ObjectMeta: metav1.ObjectMeta{ Name: "test-identity", Namespace: "default", }, - Spec: infrastructurev1beta1.OCIClusterIdentitySpec{ - Type: infrastructurev1beta1.UserPrincipal, + Spec: infrastructurev1beta2.OCIClusterIdentitySpec{ + Type: infrastructurev1beta2.UserPrincipal, PrincipalSecret: corev1.SecretReference{ Name: "test", Namespace: "test", }, }, }}, - expectedSpec: infrastructurev1beta1.OCIClusterIdentitySpec{ - Type: infrastructurev1beta1.UserPrincipal, + expectedSpec: infrastructurev1beta2.OCIClusterIdentitySpec{ + Type: infrastructurev1beta2.UserPrincipal, PrincipalSecret: corev1.SecretReference{ Name: "test", Namespace: "test", @@ -103,7 +103,7 @@ func TestGetOrBuildClientFromIdentity(t *testing.T) { testCases := []struct { name string namespace string - clusterIdentity *infrastructurev1beta1.OCIClusterIdentity + clusterIdentity *infrastructurev1beta2.OCIClusterIdentity objects []client.Object errorExpected bool defaultRegion string @@ -111,9 +111,9 @@ func TestGetOrBuildClientFromIdentity(t *testing.T) { { name: "error - secret not found", namespace: "default", - clusterIdentity: &infrastructurev1beta1.OCIClusterIdentity{ - Spec: infrastructurev1beta1.OCIClusterIdentitySpec{ - Type: infrastructurev1beta1.UserPrincipal, + clusterIdentity: &infrastructurev1beta2.OCIClusterIdentity{ + Spec: infrastructurev1beta2.OCIClusterIdentitySpec{ + Type: infrastructurev1beta2.UserPrincipal, PrincipalSecret: corev1.SecretReference{ Name: "test", Namespace: "test", @@ -126,8 +126,8 @@ func TestGetOrBuildClientFromIdentity(t *testing.T) { { name: "error - invalid principal type", namespace: "default", - clusterIdentity: &infrastructurev1beta1.OCIClusterIdentity{ - Spec: infrastructurev1beta1.OCIClusterIdentitySpec{ + clusterIdentity: &infrastructurev1beta2.OCIClusterIdentity{ + Spec: infrastructurev1beta2.OCIClusterIdentitySpec{ Type: "invalid", }, }, @@ -137,9 +137,9 @@ func TestGetOrBuildClientFromIdentity(t *testing.T) { { name: "secret found", namespace: "default", - clusterIdentity: &infrastructurev1beta1.OCIClusterIdentity{ - Spec: infrastructurev1beta1.OCIClusterIdentitySpec{ - Type: infrastructurev1beta1.UserPrincipal, + clusterIdentity: &infrastructurev1beta2.OCIClusterIdentity{ + Spec: infrastructurev1beta2.OCIClusterIdentitySpec{ + Type: infrastructurev1beta2.UserPrincipal, PrincipalSecret: corev1.SecretReference{ Name: "test", Namespace: "test", @@ -175,7 +175,7 @@ func TestIsClusterNamespaceAllowed(t *testing.T) { testCases := []struct { name string namespace string - allowedNamespaces *infrastructurev1beta1.AllowedNamespaces + allowedNamespaces *infrastructurev1beta2.AllowedNamespaces objects []client.Object expected bool }{ @@ -188,14 +188,14 @@ func TestIsClusterNamespaceAllowed(t *testing.T) { { name: "empty allowednamespace, allowed", namespace: "default", - allowedNamespaces: &infrastructurev1beta1.AllowedNamespaces{}, + allowedNamespaces: &infrastructurev1beta2.AllowedNamespaces{}, objects: []client.Object{}, expected: true, }, { name: "not allowed", namespace: "test", - allowedNamespaces: &infrastructurev1beta1.AllowedNamespaces{ + allowedNamespaces: &infrastructurev1beta2.AllowedNamespaces{ NamespaceList: []string{"test123"}, }, objects: []client.Object{}, @@ -204,7 +204,7 @@ func TestIsClusterNamespaceAllowed(t *testing.T) { { name: "allowed", namespace: "test", - allowedNamespaces: &infrastructurev1beta1.AllowedNamespaces{ + allowedNamespaces: &infrastructurev1beta2.AllowedNamespaces{ NamespaceList: []string{"test"}, }, objects: []client.Object{}, @@ -213,7 +213,7 @@ func TestIsClusterNamespaceAllowed(t *testing.T) { { name: "empty label selector", namespace: "test", - allowedNamespaces: &infrastructurev1beta1.AllowedNamespaces{ + allowedNamespaces: &infrastructurev1beta2.AllowedNamespaces{ Selector: &metav1.LabelSelector{}, }, objects: []client.Object{}, @@ -222,7 +222,7 @@ func TestIsClusterNamespaceAllowed(t *testing.T) { { name: "allowed label selector", namespace: "test", - allowedNamespaces: &infrastructurev1beta1.AllowedNamespaces{ + allowedNamespaces: &infrastructurev1beta2.AllowedNamespaces{ Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{"key": "value"}, }, @@ -261,7 +261,7 @@ func TestCreateClientProviderFromClusterIdentity(t *testing.T) { name: "error - secret not found", namespace: "default", clusterAccessor: scope.OCISelfManagedCluster{ - OCICluster: &infrastructurev1beta1.OCICluster{}, + OCICluster: &infrastructurev1beta2.OCICluster{}, }, ref: &corev1.ObjectReference{ Kind: "OCIClusterIdentity", @@ -269,13 +269,13 @@ func TestCreateClientProviderFromClusterIdentity(t *testing.T) { Name: "test-identity", APIVersion: "infrastructure.cluster.x-k8s.io/v1beta1", }, - objects: []client.Object{&infrastructurev1beta1.OCIClusterIdentity{ + objects: []client.Object{&infrastructurev1beta2.OCIClusterIdentity{ ObjectMeta: metav1.ObjectMeta{ Name: "test-identity", Namespace: "default", }, - Spec: infrastructurev1beta1.OCIClusterIdentitySpec{ - Type: infrastructurev1beta1.UserPrincipal, + Spec: infrastructurev1beta2.OCIClusterIdentitySpec{ + Type: infrastructurev1beta2.UserPrincipal, PrincipalSecret: corev1.SecretReference{ Name: "test", Namespace: "test", diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ociclusteridentities.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ociclusteridentities.yaml index b073342d..ab18d0bf 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ociclusteridentities.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ociclusteridentities.yaml @@ -179,6 +179,173 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v1beta2 + schema: + openAPIV3Schema: + description: OCIClusterIdentity is the Schema for the OCI Cluster Identity + API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: OCIClusterIdentitySpec defines the parameters that are used + to create an OCIClusterIdentity. + properties: + allowedNamespaces: + description: AllowedNamespaces is used to identify the namespaces + the clusters are allowed to use the identity from. Namespaces can + be selected either using an array of namespaces or with label selector. + An empty allowedNamespaces object indicates that OCIClusters can + use this identity from any namespace. If this object is nil, no + namespaces will be allowed (default behaviour, if this field is + not provided) A namespace should be either in the NamespaceList + or match with Selector to use the identity. + nullable: true + properties: + list: + description: A nil or empty list indicates that OCICluster cannot + use the identity from any namespace. NamespaceList takes precedence + over the Selector. + items: + type: string + nullable: true + type: array + selector: + description: "Selector is a selector of namespaces that OCICluster + can use this Identity from. This is a standard Kubernetes LabelSelector, + a label query over a set of resources. The result of matchLabels + and matchExpressions are ANDed. \n A nil or empty selector indicates + that OCICluster cannot use this OCIClusterIdentity from any + namespace." + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector + that contains values, a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are In, NotIn, + Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If + the operator is In or NotIn, the values array must + be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced + during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A + single {key,value} in the matchLabels map is equivalent + to an element of matchExpressions, whose key field is "key", + the operator is "In", and the values array contains only + "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + type: object + principalSecret: + description: PrincipalSecret is a secret reference which contains + the authentication credentials for the principal. + properties: + name: + description: name is unique within a namespace to reference a + secret resource. + type: string + namespace: + description: namespace defines the space within which the secret + name must be unique. + type: string + type: object + x-kubernetes-map-type: atomic + type: + description: Type is the type of OCI Principal used. UserPrincipal + is the only supported value + type: string + required: + - type + type: object + status: + description: OCIClusterIdentityStatus defines the observed state of OCIClusterIdentity. + properties: + conditions: + description: Conditions defines current service state of the OCIClusterIdentity. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ociclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ociclusters.yaml index 2e346aa1..298a1116 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ociclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ociclusters.yaml @@ -1085,3 +1085,1126 @@ spec: storage: true subresources: status: {} + - name: v1beta2 + schema: + openAPIV3Schema: + description: OCICluster is the Schema for the ociclusters API. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: OCIClusterSpec defines the desired state of OciCluster + properties: + availabilityDomains: + additionalProperties: + description: OCIAvailabilityDomain contains information about an + Availability Domain (AD). + properties: + faultDomains: + description: 'FaultDomains a list of fault domain (FD) names. + Example: ["FAULT-DOMAIN-1"]' + items: + type: string + type: array + name: + description: 'Name is the AD''s full name. Example: Uocm:PHX-AD-1' + type: string + type: object + description: 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. + type: object + compartmentId: + description: Compartment to create the cluster network. + type: string + controlPlaneEndpoint: + description: ControlPlaneEndpoint represents the endpoint used to + communicate with the control plane. + properties: + host: + description: The hostname on which the API server is serving. + type: string + port: + description: The port on which the API server is serving. + format: int32 + type: integer + required: + - host + - port + type: object + definedTags: + additionalProperties: + additionalProperties: + type: string + type: object + description: 'Defined tags for this resource. Each key is predefined + and scoped to a namespace. For more information, see Resource Tags + (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + Example: `{"Operations": {"CostCenter": "42"}}`' + type: object + freeformTags: + additionalProperties: + type: string + description: Free-form tags for this resource. + type: object + identityRef: + description: IdentityRef is a reference to an identity(principal) + to be used when reconciling this cluster + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead of + an entire object, this string should contain a valid JSON/Go + field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within + a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" + (container with index 2 in this pod). This syntax is chosen + only to have some well-defined way of referencing a part of + an object. TODO: this design is not final and this field is + subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + 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: + apiServerLoadBalancer: + description: API Server LB configuration. + properties: + loadBalancerId: + description: ID of Load Balancer. + type: string + name: + description: LoadBalancer Name. + type: string + type: object + skipNetworkManagement: + description: SkipNetworkManagement defines if the networking spec(VCN + related) specified by the user needs to be reconciled(actioned-upon) + or used as it is. APIServerLB will still be reconciled. + type: boolean + vcn: + description: VCN configuration. + properties: + cidr: + description: VCN CIDR. + type: string + id: + description: VCN OCID. + type: string + internetGateway: + description: Configuration for Internet Gateway. + properties: + id: + description: ID of Internet Gateway. + type: string + skip: + description: Skip specifies whether to skip creating internet + gateway even if any one Subnet is public. + type: boolean + type: object + name: + description: VCN Name. + type: string + natGateway: + description: Configuration for NAT Gateway. + properties: + id: + description: ID of Nat Gateway. + type: string + skip: + description: Skip specifies whether to skip creating NAT + gateway even if any one Subnet is private. + type: boolean + type: object + networkSecurityGroup: + description: Configuration for NSG management. + properties: + list: + description: NetworkSecurityGroup is the configuration + for the Network Security Groups required in the VCN. + items: + description: NSG defines configuration for a Network + Security Group. https://docs.oracle.com/en-us/iaas/Content/Network/Concepts/networksecuritygroups.htm + properties: + egressRules: + description: EgressRules on the NSG. + items: + description: EgressSecurityRuleForNSG is EgressSecurityRule + for NSG. + properties: + egressRule: + description: EgressSecurityRule A rule for + allowing outbound IP packets. + properties: + description: + description: An optional description of + your choice for the rule. + type: string + destination: + description: 'Conceptually, this is the + range of IP addresses that a packet + originating from the instance can go + to. Allowed values: * IP address range + in CIDR notation. For example: `192.168.1.0/24` + or `2001:0db8:0123:45::/56` Note that + IPv6 addressing is currently supported + only in certain regions. See IPv6 Addresses + (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + * The `cidrBlock` value for a Service, + if you''re setting up a security list + rule for traffic destined for a particular + `Service` through a service gateway. + For example: `oci-phx-objectstorage`.' + type: string + destinationType: + description: 'Type of destination for + the rule. The default is `CIDR_BLOCK`. + Allowed values: * `CIDR_BLOCK`: If the + rule''s `destination` is an IP address + range in CIDR notation. * `SERVICE_CIDR_BLOCK`: + If the rule''s `destination` is the + `cidrBlock` value for a Service (the + rule is for traffic destined for a particular + `Service` through a service gateway).' + type: string + icmpOptions: + description: 'IcmpOptions Optional and + valid only for ICMP and ICMPv6. Use + to specify a particular ICMP type and + code as defined in: - ICMP Parameters + (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) + - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) + If you specify ICMP or ICMPv6 as the + protocol but omit this object, then + all ICMP types and codes are allowed. + If you do provide this object, the type + is required and the code is optional. + To enable MTU negotiation for ingress + internet traffic via IPv4, make sure + to allow type 3 ("Destination Unreachable") + code 4 ("Fragmentation Needed and Don''t + Fragment was Set"). If you need to specify + multiple codes for a single type, create + a separate security list rule for each.' + properties: + code: + description: The ICMP code (optional). + type: integer + type: + description: The ICMP type. + type: integer + type: object + isStateless: + description: A stateless rule allows traffic + in one direction. Remember to add a + corresponding stateless rule in the + other direction if you need to support + bidirectional traffic. For example, + if egress traffic allows TCP destination + port 80, there should be an ingress + rule to allow TCP source port 80. Defaults + to false, which means the rule is stateful + and a corresponding rule is not necessary + for bidirectional traffic. + type: boolean + protocol: + description: The transport protocol. Specify + either `all` or an IPv4 protocol number + as defined in Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + Options are supported only for ICMP + ("1"), TCP ("6"), UDP ("17"), and ICMPv6 + ("58"). + type: string + tcpOptions: + description: TcpOptions Optional and valid + only for TCP. Use to specify particular + destination ports for TCP rules. If + you specify TCP as the protocol but + omit this object, then all destination + ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be less + than the minimum port number. + To specify a single port number, + set both the min and max to + the same value. + type: integer + min: + description: The minimum port + number, which must not be greater + than the maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be less + than the minimum port number. + To specify a single port number, + set both the min and max to + the same value. + type: integer + min: + description: The minimum port + number, which must not be greater + than the maximum port number. + type: integer + type: object + type: object + udpOptions: + description: UdpOptions Optional and valid + only for UDP. Use to specify particular + destination ports for UDP rules. If + you specify UDP as the protocol but + omit this object, then all destination + ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be less + than the minimum port number. + To specify a single port number, + set both the min and max to + the same value. + type: integer + min: + description: The minimum port + number, which must not be greater + than the maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be less + than the minimum port number. + To specify a single port number, + set both the min and max to + the same value. + type: integer + min: + description: The minimum port + number, which must not be greater + than the maximum port number. + type: integer + type: object + type: object + type: object + type: object + type: array + id: + description: NSG OCID. + type: string + ingressRules: + description: IngressRules on the NSG. + items: + description: IngressSecurityRuleForNSG is IngressSecurityRule + for NSG + properties: + ingressRule: + description: IngressSecurityRule A rule for + allowing inbound IP packets. + properties: + description: + description: An optional description of + your choice for the rule. + type: string + icmpOptions: + description: 'IcmpOptions Optional and + valid only for ICMP and ICMPv6. Use + to specify a particular ICMP type and + code as defined in: - ICMP Parameters + (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) + - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) + If you specify ICMP or ICMPv6 as the + protocol but omit this object, then + all ICMP types and codes are allowed. + If you do provide this object, the type + is required and the code is optional. + To enable MTU negotiation for ingress + internet traffic via IPv4, make sure + to allow type 3 ("Destination Unreachable") + code 4 ("Fragmentation Needed and Don''t + Fragment was Set"). If you need to specify + multiple codes for a single type, create + a separate security list rule for each.' + properties: + code: + description: The ICMP code (optional). + type: integer + type: + description: The ICMP type. + type: integer + type: object + isStateless: + description: A stateless rule allows traffic + in one direction. Remember to add a + corresponding stateless rule in the + other direction if you need to support + bidirectional traffic. For example, + if ingress traffic allows TCP destination + port 80, there should be an egress rule + to allow TCP source port 80. Defaults + to false, which means the rule is stateful + and a corresponding rule is not necessary + for bidirectional traffic. + type: boolean + protocol: + description: The transport protocol. Specify + either `all` or an IPv4 protocol number + as defined in Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + Options are supported only for ICMP + ("1"), TCP ("6"), UDP ("17"), and ICMPv6 + ("58"). + type: string + source: + description: 'Conceptually, this is the + range of IP addresses that a packet + coming into the instance can come from. + Allowed values: * IP address range in + CIDR notation. For example: `192.168.1.0/24` + or `2001:0db8:0123:45::/56`. IPv6 addressing + is supported for all commercial and + government regions. See IPv6 Addresses + (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + * The `cidrBlock` value for a Service, + if you''re setting up a security list + rule for traffic coming from a particular + `Service` through a service gateway. + For example: `oci-phx-objectstorage`.' + type: string + sourceType: + description: 'Type of source for the rule. + The default is `CIDR_BLOCK`. * `CIDR_BLOCK`: + If the rule''s `source` is an IP address + range in CIDR notation. * `SERVICE_CIDR_BLOCK`: + If the rule''s `source` is the `cidrBlock` + value for a Service (the rule is for + traffic coming from a particular `Service` + through a service gateway).' + type: string + tcpOptions: + description: TcpOptions Optional and valid + only for TCP. Use to specify particular + destination ports for TCP rules. If + you specify TCP as the protocol but + omit this object, then all destination + ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be less + than the minimum port number. + To specify a single port number, + set both the min and max to + the same value. + type: integer + min: + description: The minimum port + number, which must not be greater + than the maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be less + than the minimum port number. + To specify a single port number, + set both the min and max to + the same value. + type: integer + min: + description: The minimum port + number, which must not be greater + than the maximum port number. + type: integer + type: object + type: object + udpOptions: + description: UdpOptions Optional and valid + only for UDP. Use to specify particular + destination ports for UDP rules. If + you specify UDP as the protocol but + omit this object, then all destination + ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be less + than the minimum port number. + To specify a single port number, + set both the min and max to + the same value. + type: integer + min: + description: The minimum port + number, which must not be greater + than the maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be less + than the minimum port number. + To specify a single port number, + set both the min and max to + the same value. + type: integer + min: + description: The minimum port + number, which must not be greater + than the maximum port number. + type: integer + type: object + type: object + type: object + type: object + type: array + name: + description: NSG Name. + type: string + role: + description: Role defines the NSG role (eg. control-plane, + control-plane-endpoint, service-lb, worker). + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + skip: + description: Skip specifies whether to skip creating network + security groups. + type: boolean + type: object + routeTable: + description: Configuration for Route table. + properties: + privateRouteTableId: + description: ID of Private Route Table. + type: string + publicRouteTableId: + description: ID of Public Route Table. + type: string + skip: + description: Skip specifies whether to skip creating Route + table. + type: boolean + type: object + serviceGateway: + description: Configuration for Service Gateway. + properties: + id: + description: ID of Service Gateway. + type: string + skip: + description: Skip specifies whether to skip creating Service + gateway. + type: boolean + type: object + subnets: + description: Subnets is the configuration for subnets required + in the VCN. + items: + description: Subnet defines the configuration for a network's + subnet https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/managingVCNs_topic-Overview_of_VCNs_and_Subnets.htm#Overview + properties: + cidr: + description: Subnet CIDR. + type: string + id: + description: Subnet OCID. + type: string + name: + description: Subnet Name. + type: string + role: + description: Role defines the subnet role (eg. control-plane, + control-plane-endpoint, service-lb, worker). + type: string + securityList: + description: The security list associated with Subnet. + properties: + egressRules: + description: EgressRules on the SecurityList. + items: + description: EgressSecurityRule A rule for allowing + outbound IP packets. + properties: + description: + description: An optional description of your + choice for the rule. + type: string + destination: + description: 'Conceptually, this is the range + of IP addresses that a packet originating + from the instance can go to. Allowed values: + * IP address range in CIDR notation. For + example: `192.168.1.0/24` or `2001:0db8:0123:45::/56` + Note that IPv6 addressing is currently supported + only in certain regions. See IPv6 Addresses + (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + * The `cidrBlock` value for a Service, if + you''re setting up a security list rule + for traffic destined for a particular `Service` + through a service gateway. For example: + `oci-phx-objectstorage`.' + type: string + destinationType: + description: 'Type of destination for the + rule. The default is `CIDR_BLOCK`. Allowed + values: * `CIDR_BLOCK`: If the rule''s `destination` + is an IP address range in CIDR notation. + * `SERVICE_CIDR_BLOCK`: If the rule''s `destination` + is the `cidrBlock` value for a Service (the + rule is for traffic destined for a particular + `Service` through a service gateway).' + type: string + icmpOptions: + description: 'IcmpOptions Optional and valid + only for ICMP and ICMPv6. Use to specify + a particular ICMP type and code as defined + in: - ICMP Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) + - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) + If you specify ICMP or ICMPv6 as the protocol + but omit this object, then all ICMP types + and codes are allowed. If you do provide + this object, the type is required and the + code is optional. To enable MTU negotiation + for ingress internet traffic via IPv4, make + sure to allow type 3 ("Destination Unreachable") + code 4 ("Fragmentation Needed and Don''t + Fragment was Set"). If you need to specify + multiple codes for a single type, create + a separate security list rule for each.' + properties: + code: + description: The ICMP code (optional). + type: integer + type: + description: The ICMP type. + type: integer + type: object + isStateless: + description: A stateless rule allows traffic + in one direction. Remember to add a corresponding + stateless rule in the other direction if + you need to support bidirectional traffic. + For example, if egress traffic allows TCP + destination port 80, there should be an + ingress rule to allow TCP source port 80. + Defaults to false, which means the rule + is stateful and a corresponding rule is + not necessary for bidirectional traffic. + type: boolean + protocol: + description: The transport protocol. Specify + either `all` or an IPv4 protocol number + as defined in Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + Options are supported only for ICMP ("1"), + TCP ("6"), UDP ("17"), and ICMPv6 ("58"). + type: string + tcpOptions: + description: TcpOptions Optional and valid + only for TCP. Use to specify particular + destination ports for TCP rules. If you + specify TCP as the protocol but omit this + object, then all destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port number, + which must not be less than the + minimum port number. To specify + a single port number, set both the + min and max to the same value. + type: integer + min: + description: The minimum port number, + which must not be greater than the + maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port number, + which must not be less than the + minimum port number. To specify + a single port number, set both the + min and max to the same value. + type: integer + min: + description: The minimum port number, + which must not be greater than the + maximum port number. + type: integer + type: object + type: object + udpOptions: + description: UdpOptions Optional and valid + only for UDP. Use to specify particular + destination ports for UDP rules. If you + specify UDP as the protocol but omit this + object, then all destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port number, + which must not be less than the + minimum port number. To specify + a single port number, set both the + min and max to the same value. + type: integer + min: + description: The minimum port number, + which must not be greater than the + maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port number, + which must not be less than the + minimum port number. To specify + a single port number, set both the + min and max to the same value. + type: integer + min: + description: The minimum port number, + which must not be greater than the + maximum port number. + type: integer + type: object + type: object + type: object + type: array + id: + description: ID of the SecurityList. + type: string + ingressRules: + description: IngressRules on the SecurityList. + items: + description: IngressSecurityRule A rule for allowing + inbound IP packets. + properties: + description: + description: An optional description of your + choice for the rule. + type: string + icmpOptions: + description: 'IcmpOptions Optional and valid + only for ICMP and ICMPv6. Use to specify + a particular ICMP type and code as defined + in: - ICMP Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) + - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) + If you specify ICMP or ICMPv6 as the protocol + but omit this object, then all ICMP types + and codes are allowed. If you do provide + this object, the type is required and the + code is optional. To enable MTU negotiation + for ingress internet traffic via IPv4, make + sure to allow type 3 ("Destination Unreachable") + code 4 ("Fragmentation Needed and Don''t + Fragment was Set"). If you need to specify + multiple codes for a single type, create + a separate security list rule for each.' + properties: + code: + description: The ICMP code (optional). + type: integer + type: + description: The ICMP type. + type: integer + type: object + isStateless: + description: A stateless rule allows traffic + in one direction. Remember to add a corresponding + stateless rule in the other direction if + you need to support bidirectional traffic. + For example, if ingress traffic allows TCP + destination port 80, there should be an + egress rule to allow TCP source port 80. + Defaults to false, which means the rule + is stateful and a corresponding rule is + not necessary for bidirectional traffic. + type: boolean + protocol: + description: The transport protocol. Specify + either `all` or an IPv4 protocol number + as defined in Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + Options are supported only for ICMP ("1"), + TCP ("6"), UDP ("17"), and ICMPv6 ("58"). + type: string + source: + description: 'Conceptually, this is the range + of IP addresses that a packet coming into + the instance can come from. Allowed values: + * IP address range in CIDR notation. For + example: `192.168.1.0/24` or `2001:0db8:0123:45::/56`. + IPv6 addressing is supported for all commercial + and government regions. See IPv6 Addresses + (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + * The `cidrBlock` value for a Service, if + you''re setting up a security list rule + for traffic coming from a particular `Service` + through a service gateway. For example: + `oci-phx-objectstorage`.' + type: string + sourceType: + description: 'Type of source for the rule. + The default is `CIDR_BLOCK`. * `CIDR_BLOCK`: + If the rule''s `source` is an IP address + range in CIDR notation. * `SERVICE_CIDR_BLOCK`: + If the rule''s `source` is the `cidrBlock` + value for a Service (the rule is for traffic + coming from a particular `Service` through + a service gateway).' + type: string + tcpOptions: + description: TcpOptions Optional and valid + only for TCP. Use to specify particular + destination ports for TCP rules. If you + specify TCP as the protocol but omit this + object, then all destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port number, + which must not be less than the + minimum port number. To specify + a single port number, set both the + min and max to the same value. + type: integer + min: + description: The minimum port number, + which must not be greater than the + maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port number, + which must not be less than the + minimum port number. To specify + a single port number, set both the + min and max to the same value. + type: integer + min: + description: The minimum port number, + which must not be greater than the + maximum port number. + type: integer + type: object + type: object + udpOptions: + description: UdpOptions Optional and valid + only for UDP. Use to specify particular + destination ports for UDP rules. If you + specify UDP as the protocol but omit this + object, then all destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port number, + which must not be less than the + minimum port number. To specify + a single port number, set both the + min and max to the same value. + type: integer + min: + description: The minimum port number, + which must not be greater than the + maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port number, + which must not be less than the + minimum port number. To specify + a single port number, set both the + min and max to the same value. + type: integer + min: + description: The minimum port number, + which must not be greater than the + maximum port number. + type: integer + type: object + type: object + type: object + type: array + name: + description: SecurityList Name. + type: string + type: object + type: + description: Type defines the subnet type (e.g. public, + private). + type: string + required: + - name + - role + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + type: object + vcnPeering: + description: VCNPeering configuration. + properties: + drg: + description: DRG configuration refers to the DRG which has + to be created if required. If management cluster and workload + cluster shares the same DRG, this fields is not required + to be specified. + properties: + id: + description: ID is the OCID for the created DRG. + type: string + manage: + description: Manage defines whether the DRG has to be + managed(including create). If set to false(the default) + the ID has to be specified by the user to a valid DRG + ID to which the VCN has to be attached. + type: boolean + name: + description: Name is the name of the created DRG. + type: string + vcnAttachmentId: + description: VcnAttachmentId is the ID of the VCN attachment + of the DRG. The workload cluster VCN can be attached + to either the management cluster VCN if they are sharing + the same DRG or to the workload cluster DRG. + type: string + type: object + peerRouteRules: + description: PeerRouteRules defines the routing rules which + will be added to the private route tables of the workload + cluster VCN. The routes defined here will be directed to + DRG. + items: + description: PeerRouteRule defines a Route Rule to be routed + via a DRG. + properties: + vcnCIDRRange: + description: VCNCIDRRange is the CIDR Range of peer + VCN to which the workload cluster VCN will be peered. + The CIDR range is required to add the route rule in + the workload cluster VCN, the route rule will forward + any traffic to the CIDR to the DRG. + type: string + type: object + type: array + remotePeeringConnections: + description: RemotePeeringConnections defines the RPC connections + which be established with the workload cluster DRG. + items: + description: RemotePeeringConnection is used to peer VCNs + residing in different regions(typically). Remote VCN Peering + is explained here - https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/remoteVCNpeering.htm + properties: + managePeerRPC: + description: ManagePeerRPC will define if the Peer VCN + needs to be managed. If set to true a Remote Peering + Connection will be created in the Peer DRG and the + connection will be created between local and peer + RPC. + type: boolean + peerDRGId: + description: PeerDRGId defines the DRG ID of the peer. + type: string + peerRPCConnectionId: + description: PeerRPCConnectionId defines the RPC ID + of peer. If ManagePeerRPC is set to true this will + be created by Cluster API Provider for OCI, otherwise + this has be defined by the user. + type: string + peerRegionName: + description: PeerRegionName defined the region name + of Peer VCN. + type: string + rpcConnectionId: + description: RPCConnectionId is the connection ID of + the connection between peer and local RPC. + type: string + type: object + type: array + type: object + type: object + ociResourceIdentifier: + description: The unique ID which will be used to tag all the resources + created by this Cluster. The tag will be used to identify resources + belonging to this cluster. this will be auto-generated and should + not be set by the user. + type: string + region: + description: Region the cluster operates in. It must be one of available + regions in Region Identifier format. See https://docs.oracle.com/en-us/iaas/Content/General/Concepts/regions.htm + type: string + type: object + status: + description: OCIClusterStatus defines the observed state of OCICluster + properties: + conditions: + description: NetworkSpec encapsulates all things related to OCI network. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + failureDomains: + additionalProperties: + description: FailureDomainSpec is the Schema for Cluster API failure + domains. It allows controllers to understand how many failure + domains a cluster can optionally span across. + properties: + attributes: + additionalProperties: + type: string + description: Attributes is a free form map of attributes an + infrastructure provider might use or require. + type: object + controlPlane: + description: ControlPlane determines if this failure domain + is suitable for use by control plane machines. + type: boolean + type: object + description: FailureDomains is a slice of FailureDomains. + type: object + ready: + type: boolean + type: object + type: object + served: true + storage: false + subresources: + status: {} diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ociclustertemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ociclustertemplates.yaml index d807e43f..4ae6b4ac 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ociclustertemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ociclustertemplates.yaml @@ -1127,4 +1127,1193 @@ spec: type: object type: object served: true + storage: false + - name: v1beta2 + schema: + openAPIV3Schema: + description: OCIClusterTemplate is the Schema for the ociclustertemplates + API. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: OCIClusterTemplateSpec defines the desired state of OCIClusterTemplate. + properties: + template: + description: OCIClusterTemplateResource describes the data needed + to create an OCICluster from a template. + properties: + spec: + description: OCIClusterSpec defines the desired state of OciCluster + properties: + availabilityDomains: + additionalProperties: + description: OCIAvailabilityDomain contains information + about an Availability Domain (AD). + properties: + faultDomains: + description: 'FaultDomains a list of fault domain (FD) + names. Example: ["FAULT-DOMAIN-1"]' + items: + type: string + type: array + name: + description: 'Name is the AD''s full name. Example: + Uocm:PHX-AD-1' + type: string + type: object + description: 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. + type: object + compartmentId: + description: Compartment to create the cluster network. + type: string + controlPlaneEndpoint: + description: ControlPlaneEndpoint represents the endpoint + used to communicate with the control plane. + properties: + host: + description: The hostname on which the API server is serving. + type: string + port: + description: The port on which the API server is serving. + format: int32 + type: integer + required: + - host + - port + type: object + definedTags: + additionalProperties: + additionalProperties: + type: string + type: object + description: 'Defined tags for this resource. Each key is + predefined and scoped to a namespace. For more information, + see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + Example: `{"Operations": {"CostCenter": "42"}}`' + type: object + freeformTags: + additionalProperties: + type: string + description: Free-form tags for this resource. + type: object + identityRef: + description: IdentityRef is a reference to an identity(principal) + to be used when reconciling this cluster + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead + of an entire object, this string should contain a valid + JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container + within a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that + triggered the event) or if no container name is specified + "spec.containers[2]" (container with index 2 in this + pod). This syntax is chosen only to have some well-defined + way of referencing a part of an object. TODO: this design + is not final and this field is subject to change in + the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + 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: + apiServerLoadBalancer: + description: API Server LB configuration. + properties: + loadBalancerId: + description: ID of Load Balancer. + type: string + name: + description: LoadBalancer Name. + type: string + type: object + skipNetworkManagement: + description: SkipNetworkManagement defines if the networking + spec(VCN related) specified by the user needs to be + reconciled(actioned-upon) or used as it is. APIServerLB + will still be reconciled. + type: boolean + vcn: + description: VCN configuration. + properties: + cidr: + description: VCN CIDR. + type: string + id: + description: VCN OCID. + type: string + internetGateway: + description: Configuration for Internet Gateway. + properties: + id: + description: ID of Internet Gateway. + type: string + skip: + description: Skip specifies whether to skip creating + internet gateway even if any one Subnet is public. + type: boolean + type: object + name: + description: VCN Name. + type: string + natGateway: + description: Configuration for NAT Gateway. + properties: + id: + description: ID of Nat Gateway. + type: string + skip: + description: Skip specifies whether to skip creating + NAT gateway even if any one Subnet is private. + type: boolean + type: object + networkSecurityGroup: + description: Configuration for NSG management. + properties: + list: + description: NetworkSecurityGroup is the configuration + for the Network Security Groups required in + the VCN. + items: + description: NSG defines configuration for a + Network Security Group. https://docs.oracle.com/en-us/iaas/Content/Network/Concepts/networksecuritygroups.htm + properties: + egressRules: + description: EgressRules on the NSG. + items: + description: EgressSecurityRuleForNSG + is EgressSecurityRule for NSG. + properties: + egressRule: + description: EgressSecurityRule A + rule for allowing outbound IP packets. + properties: + description: + description: An optional description + of your choice for the rule. + type: string + destination: + description: 'Conceptually, this + is the range of IP addresses + that a packet originating from + the instance can go to. Allowed + values: * IP address range in + CIDR notation. For example: + `192.168.1.0/24` or `2001:0db8:0123:45::/56` + Note that IPv6 addressing is + currently supported only in + certain regions. See IPv6 Addresses + (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + * The `cidrBlock` value for + a Service, if you''re setting + up a security list rule for + traffic destined for a particular + `Service` through a service + gateway. For example: `oci-phx-objectstorage`.' + type: string + destinationType: + description: 'Type of destination + for the rule. The default is + `CIDR_BLOCK`. Allowed values: + * `CIDR_BLOCK`: If the rule''s + `destination` is an IP address + range in CIDR notation. * `SERVICE_CIDR_BLOCK`: + If the rule''s `destination` + is the `cidrBlock` value for + a Service (the rule is for traffic + destined for a particular `Service` + through a service gateway).' + type: string + icmpOptions: + description: 'IcmpOptions Optional + and valid only for ICMP and + ICMPv6. Use to specify a particular + ICMP type and code as defined + in: - ICMP Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) + - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) + If you specify ICMP or ICMPv6 + as the protocol but omit this + object, then all ICMP types + and codes are allowed. If you + do provide this object, the + type is required and the code + is optional. To enable MTU negotiation + for ingress internet traffic + via IPv4, make sure to allow + type 3 ("Destination Unreachable") + code 4 ("Fragmentation Needed + and Don''t Fragment was Set"). + If you need to specify multiple + codes for a single type, create + a separate security list rule + for each.' + properties: + code: + description: The ICMP code + (optional). + type: integer + type: + description: The ICMP type. + type: integer + type: object + isStateless: + description: A stateless rule + allows traffic in one direction. + Remember to add a corresponding + stateless rule in the other + direction if you need to support + bidirectional traffic. For example, + if egress traffic allows TCP + destination port 80, there should + be an ingress rule to allow + TCP source port 80. Defaults + to false, which means the rule + is stateful and a corresponding + rule is not necessary for bidirectional + traffic. + type: boolean + protocol: + description: The transport protocol. + Specify either `all` or an IPv4 + protocol number as defined in + Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + Options are supported only for + ICMP ("1"), TCP ("6"), UDP ("17"), + and ICMPv6 ("58"). + type: string + tcpOptions: + description: TcpOptions Optional + and valid only for TCP. Use + to specify particular destination + ports for TCP rules. If you + specify TCP as the protocol + but omit this object, then all + destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The + representation of PortRange. + properties: + max: + description: The maximum + port number, which must + not be less than the + minimum port number. + To specify a single + port number, set both + the min and max to the + same value. + type: integer + min: + description: The minimum + port number, which must + not be greater than + the maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The + representation of PortRange. + properties: + max: + description: The maximum + port number, which must + not be less than the + minimum port number. + To specify a single + port number, set both + the min and max to the + same value. + type: integer + min: + description: The minimum + port number, which must + not be greater than + the maximum port number. + type: integer + type: object + type: object + udpOptions: + description: UdpOptions Optional + and valid only for UDP. Use + to specify particular destination + ports for UDP rules. If you + specify UDP as the protocol + but omit this object, then all + destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The + representation of PortRange. + properties: + max: + description: The maximum + port number, which must + not be less than the + minimum port number. + To specify a single + port number, set both + the min and max to the + same value. + type: integer + min: + description: The minimum + port number, which must + not be greater than + the maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The + representation of PortRange. + properties: + max: + description: The maximum + port number, which must + not be less than the + minimum port number. + To specify a single + port number, set both + the min and max to the + same value. + type: integer + min: + description: The minimum + port number, which must + not be greater than + the maximum port number. + type: integer + type: object + type: object + type: object + type: object + type: array + id: + description: NSG OCID. + type: string + ingressRules: + description: IngressRules on the NSG. + items: + description: IngressSecurityRuleForNSG + is IngressSecurityRule for NSG + properties: + ingressRule: + description: IngressSecurityRule A + rule for allowing inbound IP packets. + properties: + description: + description: An optional description + of your choice for the rule. + type: string + icmpOptions: + description: 'IcmpOptions Optional + and valid only for ICMP and + ICMPv6. Use to specify a particular + ICMP type and code as defined + in: - ICMP Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) + - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) + If you specify ICMP or ICMPv6 + as the protocol but omit this + object, then all ICMP types + and codes are allowed. If you + do provide this object, the + type is required and the code + is optional. To enable MTU negotiation + for ingress internet traffic + via IPv4, make sure to allow + type 3 ("Destination Unreachable") + code 4 ("Fragmentation Needed + and Don''t Fragment was Set"). + If you need to specify multiple + codes for a single type, create + a separate security list rule + for each.' + properties: + code: + description: The ICMP code + (optional). + type: integer + type: + description: The ICMP type. + type: integer + type: object + isStateless: + description: A stateless rule + allows traffic in one direction. + Remember to add a corresponding + stateless rule in the other + direction if you need to support + bidirectional traffic. For example, + if ingress traffic allows TCP + destination port 80, there should + be an egress rule to allow TCP + source port 80. Defaults to + false, which means the rule + is stateful and a corresponding + rule is not necessary for bidirectional + traffic. + type: boolean + protocol: + description: The transport protocol. + Specify either `all` or an IPv4 + protocol number as defined in + Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + Options are supported only for + ICMP ("1"), TCP ("6"), UDP ("17"), + and ICMPv6 ("58"). + type: string + source: + description: 'Conceptually, this + is the range of IP addresses + that a packet coming into the + instance can come from. Allowed + values: * IP address range in + CIDR notation. For example: + `192.168.1.0/24` or `2001:0db8:0123:45::/56`. + IPv6 addressing is supported + for all commercial and government + regions. See IPv6 Addresses + (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + * The `cidrBlock` value for + a Service, if you''re setting + up a security list rule for + traffic coming from a particular + `Service` through a service + gateway. For example: `oci-phx-objectstorage`.' + type: string + sourceType: + description: 'Type of source for + the rule. The default is `CIDR_BLOCK`. + * `CIDR_BLOCK`: If the rule''s + `source` is an IP address range + in CIDR notation. * `SERVICE_CIDR_BLOCK`: + If the rule''s `source` is the + `cidrBlock` value for a Service + (the rule is for traffic coming + from a particular `Service` + through a service gateway).' + type: string + tcpOptions: + description: TcpOptions Optional + and valid only for TCP. Use + to specify particular destination + ports for TCP rules. If you + specify TCP as the protocol + but omit this object, then all + destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The + representation of PortRange. + properties: + max: + description: The maximum + port number, which must + not be less than the + minimum port number. + To specify a single + port number, set both + the min and max to the + same value. + type: integer + min: + description: The minimum + port number, which must + not be greater than + the maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The + representation of PortRange. + properties: + max: + description: The maximum + port number, which must + not be less than the + minimum port number. + To specify a single + port number, set both + the min and max to the + same value. + type: integer + min: + description: The minimum + port number, which must + not be greater than + the maximum port number. + type: integer + type: object + type: object + udpOptions: + description: UdpOptions Optional + and valid only for UDP. Use + to specify particular destination + ports for UDP rules. If you + specify UDP as the protocol + but omit this object, then all + destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The + representation of PortRange. + properties: + max: + description: The maximum + port number, which must + not be less than the + minimum port number. + To specify a single + port number, set both + the min and max to the + same value. + type: integer + min: + description: The minimum + port number, which must + not be greater than + the maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The + representation of PortRange. + properties: + max: + description: The maximum + port number, which must + not be less than the + minimum port number. + To specify a single + port number, set both + the min and max to the + same value. + type: integer + min: + description: The minimum + port number, which must + not be greater than + the maximum port number. + type: integer + type: object + type: object + type: object + type: object + type: array + name: + description: NSG Name. + type: string + role: + description: Role defines the NSG role (eg. + control-plane, control-plane-endpoint, + service-lb, worker). + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + skip: + description: Skip specifies whether to skip creating + network security groups. + type: boolean + type: object + routeTable: + description: Configuration for Route table. + properties: + privateRouteTableId: + description: ID of Private Route Table. + type: string + publicRouteTableId: + description: ID of Public Route Table. + type: string + skip: + description: Skip specifies whether to skip creating + Route table. + type: boolean + type: object + serviceGateway: + description: Configuration for Service Gateway. + properties: + id: + description: ID of Service Gateway. + type: string + skip: + description: Skip specifies whether to skip creating + Service gateway. + type: boolean + type: object + subnets: + description: Subnets is the configuration for subnets + required in the VCN. + items: + description: Subnet defines the configuration for + a network's subnet https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/managingVCNs_topic-Overview_of_VCNs_and_Subnets.htm#Overview + properties: + cidr: + description: Subnet CIDR. + type: string + id: + description: Subnet OCID. + type: string + name: + description: Subnet Name. + type: string + role: + description: Role defines the subnet role (eg. + control-plane, control-plane-endpoint, service-lb, + worker). + type: string + securityList: + description: The security list associated with + Subnet. + properties: + egressRules: + description: EgressRules on the SecurityList. + items: + description: EgressSecurityRule A rule + for allowing outbound IP packets. + properties: + description: + description: An optional description + of your choice for the rule. + type: string + destination: + description: 'Conceptually, this is + the range of IP addresses that a + packet originating from the instance + can go to. Allowed values: * IP + address range in CIDR notation. + For example: `192.168.1.0/24` or + `2001:0db8:0123:45::/56` Note that + IPv6 addressing is currently supported + only in certain regions. See IPv6 + Addresses (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + * The `cidrBlock` value for a Service, + if you''re setting up a security + list rule for traffic destined for + a particular `Service` through a + service gateway. For example: `oci-phx-objectstorage`.' + type: string + destinationType: + description: 'Type of destination + for the rule. The default is `CIDR_BLOCK`. + Allowed values: * `CIDR_BLOCK`: + If the rule''s `destination` is + an IP address range in CIDR notation. + * `SERVICE_CIDR_BLOCK`: If the rule''s + `destination` is the `cidrBlock` + value for a Service (the rule is + for traffic destined for a particular + `Service` through a service gateway).' + type: string + icmpOptions: + description: 'IcmpOptions Optional + and valid only for ICMP and ICMPv6. + Use to specify a particular ICMP + type and code as defined in: - ICMP + Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) + - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) + If you specify ICMP or ICMPv6 as + the protocol but omit this object, + then all ICMP types and codes are + allowed. If you do provide this + object, the type is required and + the code is optional. To enable + MTU negotiation for ingress internet + traffic via IPv4, make sure to allow + type 3 ("Destination Unreachable") + code 4 ("Fragmentation Needed and + Don''t Fragment was Set"). If you + need to specify multiple codes for + a single type, create a separate + security list rule for each.' + properties: + code: + description: The ICMP code (optional). + type: integer + type: + description: The ICMP type. + type: integer + type: object + isStateless: + description: A stateless rule allows + traffic in one direction. Remember + to add a corresponding stateless + rule in the other direction if you + need to support bidirectional traffic. + For example, if egress traffic allows + TCP destination port 80, there should + be an ingress rule to allow TCP + source port 80. Defaults to false, + which means the rule is stateful + and a corresponding rule is not + necessary for bidirectional traffic. + type: boolean + protocol: + description: The transport protocol. + Specify either `all` or an IPv4 + protocol number as defined in Protocol + Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + Options are supported only for ICMP + ("1"), TCP ("6"), UDP ("17"), and + ICMPv6 ("58"). + type: string + tcpOptions: + description: TcpOptions Optional and + valid only for TCP. Use to specify + particular destination ports for + TCP rules. If you specify TCP as + the protocol but omit this object, + then all destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be + less than the minimum port + number. To specify a single + port number, set both the + min and max to the same + value. + type: integer + min: + description: The minimum port + number, which must not be + greater than the maximum + port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be + less than the minimum port + number. To specify a single + port number, set both the + min and max to the same + value. + type: integer + min: + description: The minimum port + number, which must not be + greater than the maximum + port number. + type: integer + type: object + type: object + udpOptions: + description: UdpOptions Optional and + valid only for UDP. Use to specify + particular destination ports for + UDP rules. If you specify UDP as + the protocol but omit this object, + then all destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be + less than the minimum port + number. To specify a single + port number, set both the + min and max to the same + value. + type: integer + min: + description: The minimum port + number, which must not be + greater than the maximum + port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be + less than the minimum port + number. To specify a single + port number, set both the + min and max to the same + value. + type: integer + min: + description: The minimum port + number, which must not be + greater than the maximum + port number. + type: integer + type: object + type: object + type: object + type: array + id: + description: ID of the SecurityList. + type: string + ingressRules: + description: IngressRules on the SecurityList. + items: + description: IngressSecurityRule A rule + for allowing inbound IP packets. + properties: + description: + description: An optional description + of your choice for the rule. + type: string + icmpOptions: + description: 'IcmpOptions Optional + and valid only for ICMP and ICMPv6. + Use to specify a particular ICMP + type and code as defined in: - ICMP + Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) + - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) + If you specify ICMP or ICMPv6 as + the protocol but omit this object, + then all ICMP types and codes are + allowed. If you do provide this + object, the type is required and + the code is optional. To enable + MTU negotiation for ingress internet + traffic via IPv4, make sure to allow + type 3 ("Destination Unreachable") + code 4 ("Fragmentation Needed and + Don''t Fragment was Set"). If you + need to specify multiple codes for + a single type, create a separate + security list rule for each.' + properties: + code: + description: The ICMP code (optional). + type: integer + type: + description: The ICMP type. + type: integer + type: object + isStateless: + description: A stateless rule allows + traffic in one direction. Remember + to add a corresponding stateless + rule in the other direction if you + need to support bidirectional traffic. + For example, if ingress traffic + allows TCP destination port 80, + there should be an egress rule to + allow TCP source port 80. Defaults + to false, which means the rule is + stateful and a corresponding rule + is not necessary for bidirectional + traffic. + type: boolean + protocol: + description: The transport protocol. + Specify either `all` or an IPv4 + protocol number as defined in Protocol + Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + Options are supported only for ICMP + ("1"), TCP ("6"), UDP ("17"), and + ICMPv6 ("58"). + type: string + source: + description: 'Conceptually, this is + the range of IP addresses that a + packet coming into the instance + can come from. Allowed values: * + IP address range in CIDR notation. + For example: `192.168.1.0/24` or + `2001:0db8:0123:45::/56`. IPv6 addressing + is supported for all commercial + and government regions. See IPv6 + Addresses (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + * The `cidrBlock` value for a Service, + if you''re setting up a security + list rule for traffic coming from + a particular `Service` through a + service gateway. For example: `oci-phx-objectstorage`.' + type: string + sourceType: + description: 'Type of source for the + rule. The default is `CIDR_BLOCK`. + * `CIDR_BLOCK`: If the rule''s `source` + is an IP address range in CIDR notation. + * `SERVICE_CIDR_BLOCK`: If the rule''s + `source` is the `cidrBlock` value + for a Service (the rule is for traffic + coming from a particular `Service` + through a service gateway).' + type: string + tcpOptions: + description: TcpOptions Optional and + valid only for TCP. Use to specify + particular destination ports for + TCP rules. If you specify TCP as + the protocol but omit this object, + then all destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be + less than the minimum port + number. To specify a single + port number, set both the + min and max to the same + value. + type: integer + min: + description: The minimum port + number, which must not be + greater than the maximum + port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be + less than the minimum port + number. To specify a single + port number, set both the + min and max to the same + value. + type: integer + min: + description: The minimum port + number, which must not be + greater than the maximum + port number. + type: integer + type: object + type: object + udpOptions: + description: UdpOptions Optional and + valid only for UDP. Use to specify + particular destination ports for + UDP rules. If you specify UDP as + the protocol but omit this object, + then all destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be + less than the minimum port + number. To specify a single + port number, set both the + min and max to the same + value. + type: integer + min: + description: The minimum port + number, which must not be + greater than the maximum + port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be + less than the minimum port + number. To specify a single + port number, set both the + min and max to the same + value. + type: integer + min: + description: The minimum port + number, which must not be + greater than the maximum + port number. + type: integer + type: object + type: object + type: object + type: array + name: + description: SecurityList Name. + type: string + type: object + type: + description: Type defines the subnet type (e.g. + public, private). + type: string + required: + - name + - role + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + type: object + vcnPeering: + description: VCNPeering configuration. + properties: + drg: + description: DRG configuration refers to the DRG which + has to be created if required. If management cluster + and workload cluster shares the same DRG, this fields + is not required to be specified. + properties: + id: + description: ID is the OCID for the created DRG. + type: string + manage: + description: Manage defines whether the DRG has + to be managed(including create). If set to false(the + default) the ID has to be specified by the user + to a valid DRG ID to which the VCN has to be + attached. + type: boolean + name: + description: Name is the name of the created DRG. + type: string + vcnAttachmentId: + description: VcnAttachmentId is the ID of the + VCN attachment of the DRG. The workload cluster + VCN can be attached to either the management + cluster VCN if they are sharing the same DRG + or to the workload cluster DRG. + type: string + type: object + peerRouteRules: + description: PeerRouteRules defines the routing rules + which will be added to the private route tables + of the workload cluster VCN. The routes defined + here will be directed to DRG. + items: + description: PeerRouteRule defines a Route Rule + to be routed via a DRG. + properties: + vcnCIDRRange: + description: VCNCIDRRange is the CIDR Range + of peer VCN to which the workload cluster + VCN will be peered. The CIDR range is required + to add the route rule in the workload cluster + VCN, the route rule will forward any traffic + to the CIDR to the DRG. + type: string + type: object + type: array + remotePeeringConnections: + description: RemotePeeringConnections defines the + RPC connections which be established with the workload + cluster DRG. + items: + description: RemotePeeringConnection is used to + peer VCNs residing in different regions(typically). + Remote VCN Peering is explained here - https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/remoteVCNpeering.htm + properties: + managePeerRPC: + description: ManagePeerRPC will define if the + Peer VCN needs to be managed. If set to true + a Remote Peering Connection will be created + in the Peer DRG and the connection will be + created between local and peer RPC. + type: boolean + peerDRGId: + description: PeerDRGId defines the DRG ID of + the peer. + type: string + peerRPCConnectionId: + description: PeerRPCConnectionId defines the + RPC ID of peer. If ManagePeerRPC is set to + true this will be created by Cluster API Provider + for OCI, otherwise this has be defined by + the user. + type: string + peerRegionName: + description: PeerRegionName defined the region + name of Peer VCN. + type: string + rpcConnectionId: + description: RPCConnectionId is the connection + ID of the connection between peer and local + RPC. + type: string + type: object + type: array + type: object + type: object + ociResourceIdentifier: + description: The unique ID which will be used to tag all the + resources created by this Cluster. The tag will be used + to identify resources belonging to this cluster. this will + be auto-generated and should not be set by the user. + type: string + region: + description: Region the cluster operates in. It must be one + of available regions in Region Identifier format. See https://docs.oracle.com/en-us/iaas/Content/General/Concepts/regions.htm + type: string + type: object + required: + - spec + type: object + required: + - template + type: object + type: object + served: true storage: true diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachinepools.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachinepools.yaml index 6f3ac14c..bb25051e 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachinepools.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachinepools.yaml @@ -732,3 +732,712 @@ spec: storage: true subresources: status: {} + - name: v1beta2 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: OCIMachinePoolSpec defines the desired state of OCIMachinePool + properties: + instanceConfiguration: + description: InstanceConfiguration defines the configuration of the + instance pool instances. + properties: + agentConfig: + description: AgentConfig defines the options for the Oracle Cloud + Agent software running on the instance. + properties: + areAllPluginsDisabled: + description: AreAllPluginsDisabled defines whether Oracle + Cloud Agent can run all the available plugins. This includes + the management and monitoring plugins. To get a list of + available plugins, use the ListInstanceagentAvailablePlugins + operation in the Oracle Cloud Agent API. For more information + about the available plugins, see Managing Plugins with Oracle + Cloud Agent (https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/manage-plugins.htm). + type: boolean + isManagementDisabled: + description: 'IsManagementDisabled defines whether Oracle + Cloud Agent can run all the available management plugins. + Default value is false (management plugins are enabled). + These are the management plugins: OS Management Service + Agent and Compute Instance Run Command. The management plugins + are controlled by this parameter and by the per-plugin configuration + in the `pluginsConfig` object. - If `isManagementDisabled` + is true, all of the management plugins are disabled, regardless + of the per-plugin configuration. - If `isManagementDisabled` + is false, all of the management plugins are enabled. You + can optionally disable individual management plugins by + providing a value in the `pluginsConfig` object.' + type: boolean + isMonitoringDisabled: + description: 'IsMonitoringDisabled defines whether Oracle + Cloud Agent can gather performance metrics and monitor the + instance using the monitoring plugins. Default value is + false (monitoring plugins are enabled). These are the monitoring + plugins: Compute Instance Monitoring and Custom Logs Monitoring. + The monitoring plugins are controlled by this parameter + and by the per-plugin configuration in the `pluginsConfig` + object. - If `isMonitoringDisabled` is true, all of the + monitoring plugins are disabled, regardless of the per-plugin + configuration. - If `isMonitoringDisabled` is false, all + of the monitoring plugins are enabled. You can optionally + disable individual monitoring plugins by providing a value + in the `pluginsConfig` object.' + type: boolean + pluginsConfigs: + description: PluginsConfig defines the configuration of plugins + associated with this instance. + items: + description: InstanceAgentPluginConfig defines the configuration + of plugins associated with this instance. + properties: + desiredState: + description: 'DesiredState defines whether the plugin + should be enabled or disabled. To enable the monitoring + and management plugins, the `isMonitoringDisabled` + and `isManagementDisabled` attributes must also be + set to false. The following values are supported: + * `ENABLED` * `DISABLED`' + type: string + name: + description: Name defines the name of the plugin. To + get a list of available plugins, use the ListInstanceagentAvailablePlugins + operation in the Oracle Cloud Agent API. For more + information about the available plugins, see Managing + Plugins with Oracle Cloud Agent (https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/manage-plugins.htm). + type: string + type: object + type: array + type: object + availabilityConfig: + description: LaunchInstanceAvailabilityConfig defines the options + for VM migration during infrastructure maintenance events and + for defining the availability of a VM instance after a maintenance + event that impacts the underlying hardware. + properties: + isLiveMigrationPreferred: + description: IsLiveMigrationPreferred defines whether to live + migrate supported VM instances to a healthy physical VM + host without disrupting running instances during infrastructure + maintenance events. If null, Oracle chooses the best option + for migrating the VM during infrastructure maintenance events. + type: boolean + recoveryAction: + description: RecoveryAction defines the lifecycle state for + an instance when it is recovered after infrastructure maintenance. + * `RESTORE_INSTANCE` - The instance is restored to the lifecycle + state it was in before the maintenance event. If the instance + was running, it is automatically rebooted. This is the default + action when a value is not set. * `STOP_INSTANCE` - The + instance is recovered in the stopped state. + type: string + type: object + capacityReservationId: + description: CapacityReservationId defines the OCID of the compute + capacity reservation this instance is launched under. You can + opt out of all default reservations by specifying an empty string + as input for this field. For more information, see Capacity + Reservations (https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/reserve-capacity.htm#default). + type: string + dedicatedVmHostId: + description: DedicatedVmHostId defines the OCID of the dedicated + VM host. + type: string + instanceConfigurationId: + type: string + instanceOptions: + description: InstanceOptions defines the instance options + properties: + areLegacyImdsEndpointsDisabled: + description: Whether to disable the legacy (/v1) instance + metadata service endpoints. Customers who have migrated + to /v2 should set this to true for added security. Default + is false. + type: boolean + type: object + instanceSourceViaImageConfig: + description: InstanceSourceViaImageConfig defines the options + for booting up instances via images + properties: + bootVolumeSizeInGBs: + description: The size of boot volume. Please see https://docs.oracle.com/en-us/iaas/Content/Block/Tasks/extendingbootpartition.htm + to extend the boot volume size. + format: int64 + type: integer + bootVolumeVpusPerGB: + description: 'BootVolumeVpusPerGB defines the number of volume + performance units (VPUs) that will be applied to this volume + per GB, representing the Block Volume service''s elastic + performance options. See Block Volume Performance Levels + (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/blockvolumeperformance.htm#perf_levels) + for more information. Allowed values: * `10`: Represents + Balanced option. * `20`: Represents Higher Performance option. + * `30`-`120`: Represents the Ultra High Performance option. + For volumes with the auto-tuned performance feature enabled, + this is set to the default (minimum) VPUs/GB.' + format: int64 + type: integer + imageId: + description: OCID of the image to be used to launch the instance. + type: string + kmsKeyId: + description: KmsKeyId defines the OCID of the Key Management + key to assign as the master encryption key for the boot + volume. + type: string + type: object + instanceVnicConfiguration: + description: NetworkDetails defines the configuration options + for the network + properties: + assignPrivateDnsRecord: + description: AssignPrivateDnsRecord defines whether the VNIC + should be assigned a DNS record. + type: boolean + assignPublicIp: + description: AssignPublicIp defines whether the instance should + have a public IP address + type: boolean + displayName: + description: DisplayName defines a user-friendly name. Does + not have to be unique, and it's changeable. Avoid entering + confidential information. + type: string + hostnameLabel: + description: HostnameLabel defines the hostname for the VNIC's + primary private IP. Used for DNS. + type: string + nsgNames: + description: NsgNames defines a list of the nsg names of the + network security groups (NSGs) to add the VNIC to. + items: + type: string + type: array + skipSourceDestCheck: + description: SkipSourceDestCheck defines whether the source/destination + check is disabled on the VNIC. + type: boolean + subnetName: + description: SubnetName defines the subnet name to use for + the VNIC + type: string + type: object + isPvEncryptionInTransitEnabled: + default: true + description: Is in transit encryption of volumes required. + type: boolean + launchOptions: + description: LaunchOptions defines the options for tuning the + compatibility and performance of VM shapes + properties: + bootVolumeType: + description: BootVolumeType defines Emulation type for the + boot volume. * `ISCSI` - ISCSI attached block storage device. + * `SCSI` - Emulated SCSI disk. * `IDE` - Emulated IDE disk. + * `VFIO` - Direct attached Virtual Function storage. This + is the default option for local data volumes on platform + images. * `PARAVIRTUALIZED` - Paravirtualized disk. This + is the default for boot volumes and remote block storage + volumes on platform images. + type: string + firmware: + description: Firmware defines the firmware used to boot VM. + Select the option that matches your operating system. * + `BIOS` - Boot VM using BIOS style firmware. This is compatible + with both 32 bit and 64 bit operating systems that boot + using MBR style bootloaders. * `UEFI_64` - Boot VM using + UEFI style firmware compatible with 64 bit operating systems. + This is the default for platform images. + type: string + isConsistentVolumeNamingEnabled: + description: IsConsistentVolumeNamingEnabled defines whether + to enable consistent volume naming feature. Defaults to + false. + type: boolean + networkType: + description: NetworkType defines the emulation type for the + physical network interface card (NIC). * `E1000` - Emulated + Gigabit ethernet controller. Compatible with Linux e1000 + network driver. * `VFIO` - Direct attached Virtual Function + network controller. This is the networking type when you + launch an instance using hardware-assisted (SR-IOV) networking. + * `PARAVIRTUALIZED` - VM instances launch with paravirtualized + devices using VirtIO drivers. + type: string + remoteDataVolumeType: + description: RemoteDataVolumeType defines the emulation type + for volume. * `ISCSI` - ISCSI attached block storage device. + * `SCSI` - Emulated SCSI disk. * `IDE` - Emulated IDE disk. + * `VFIO` - Direct attached Virtual Function storage. This + is the default option for local data volumes on platform + images. * `PARAVIRTUALIZED` - Paravirtualized disk. This + is the default for boot volumes and remote block storage + volumes on platform images. + type: string + type: object + metadata: + additionalProperties: + type: string + description: Custom metadata key/value pairs that you provide, + such as the SSH public key required to connect to the instance. + type: object + platformConfig: + description: PlatformConfig defines the platform config parameters + properties: + amdMilanBmPlatformConfig: + description: AmdMilanBmPlatformConfig describe AMD Milan BM + platform configuration + properties: + areVirtualInstructionsEnabled: + description: Whether virtualization instructions are available. + For example, Secure Virtual Machine for AMD shapes or + VT-x for Intel shapes. + type: boolean + isAccessControlServiceEnabled: + description: Whether the Access Control Service is enabled + on the instance. When enabled, the platform can enforce + PCIe device isolation, required for VFIO device pass-through. + type: boolean + isInputOutputMemoryManagementUnitEnabled: + description: Whether the input-output memory management + unit is enabled. + type: boolean + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is enabled + on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential instance. + If this value is `true`, the instance is a confidential + instance. The default value is `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the instance. + type: boolean + isSymmetricMultiThreadingEnabled: + description: Whether symmetric multithreading is enabled + on the instance. Symmetric multithreading is also called + simultaneous multithreading (SMT) or Intel Hyper-Threading. + Intel and AMD processors have two hardware execution + threads per core (OCPU). SMT permits multiple independent + threads of execution, to better use the resources and + increase the efficiency of the CPU. When multithreading + is disabled, only one thread is permitted to run on + each core, which can provide higher or more predictable + performance for some workloads. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) + is enabled on the instance. + type: boolean + numaNodesPerSocket: + description: 'The number of NUMA nodes per socket (NPS). + The following values are supported: * `NPS0` * `NPS1` + * `NPS2` * `NPS4`' + type: string + percentageOfCoresEnabled: + description: The percentage of cores enabled. Value must + be a multiple of 25%. If the requested percentage results + in a fractional number of cores, the system rounds up + the number of cores across processors and provisions + an instance with a whole number of cores. If the applications + that you run on the instance use a core-based licensing + model and need fewer cores than the full size of the + shape, you can disable cores to reduce your licensing + costs. The instance itself is billed for the full shape, + regardless of whether all cores are enabled. + type: integer + type: object + amdRomeBmGpuPlatformConfig: + description: AmdMilanBmPlatformConfig describe AMD Rome BM + platform configuration + properties: + areVirtualInstructionsEnabled: + description: Whether virtualization instructions are available. + For example, Secure Virtual Machine for AMD shapes or + VT-x for Intel shapes. + type: boolean + isAccessControlServiceEnabled: + description: Whether the Access Control Service is enabled + on the instance. When enabled, the platform can enforce + PCIe device isolation, required for VFIO device pass-through. + type: boolean + isInputOutputMemoryManagementUnitEnabled: + description: Whether the input-output memory management + unit is enabled. + type: boolean + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is enabled + on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential instance. + If this value is `true`, the instance is a confidential + instance. The default value is `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the instance. + type: boolean + isSymmetricMultiThreadingEnabled: + description: Whether symmetric multithreading is enabled + on the instance. Symmetric multithreading is also called + simultaneous multithreading (SMT) or Intel Hyper-Threading. + Intel and AMD processors have two hardware execution + threads per core (OCPU). SMT permits multiple independent + threads of execution, to better use the resources and + increase the efficiency of the CPU. When multithreading + is disabled, only one thread is permitted to run on + each core, which can provide higher or more predictable + performance for some workloads. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) + is enabled on the instance. + type: boolean + numaNodesPerSocket: + description: 'The number of NUMA nodes per socket (NPS). + The following values are supported: * `NPS0` * `NPS1` + * `NPS2` * `NPS4`' + type: string + type: object + amdRomeBmPlatformConfig: + description: AmdMilanBmPlatformConfig describe AMD Rome BM + platform configuration + properties: + areVirtualInstructionsEnabled: + description: Whether virtualization instructions are available. + For example, Secure Virtual Machine for AMD shapes or + VT-x for Intel shapes. + type: boolean + isAccessControlServiceEnabled: + description: Whether the Access Control Service is enabled + on the instance. When enabled, the platform can enforce + PCIe device isolation, required for VFIO device pass-through. + type: boolean + isInputOutputMemoryManagementUnitEnabled: + description: Whether the input-output memory management + unit is enabled. + type: boolean + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is enabled + on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential instance. + If this value is `true`, the instance is a confidential + instance. The default value is `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the instance. + type: boolean + isSymmetricMultiThreadingEnabled: + description: Whether symmetric multithreading is enabled + on the instance. Symmetric multithreading is also called + simultaneous multithreading (SMT) or Intel Hyper-Threading. + Intel and AMD processors have two hardware execution + threads per core (OCPU). SMT permits multiple independent + threads of execution, to better use the resources and + increase the efficiency of the CPU. When multithreading + is disabled, only one thread is permitted to run on + each core, which can provide higher or more predictable + performance for some workloads. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) + is enabled on the instance. + type: boolean + numaNodesPerSocket: + description: 'The number of NUMA nodes per socket (NPS). + The following values are supported: * `NPS0` * `NPS1` + * `NPS2` * `NPS4`' + type: string + percentageOfCoresEnabled: + description: The percentage of cores enabled. Value must + be a multiple of 25%. If the requested percentage results + in a fractional number of cores, the system rounds up + the number of cores across processors and provisions + an instance with a whole number of cores. If the applications + that you run on the instance use a core-based licensing + model and need fewer cores than the full size of the + shape, you can disable cores to reduce your licensing + costs. The instance itself is billed for the full shape, + regardless of whether all cores are enabled. + type: integer + type: object + amdVmPlatformConfig: + description: AmdMilanBmPlatformConfig describe AMD VM platform + configuration + properties: + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is enabled + on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential instance. + If this value is `true`, the instance is a confidential + instance. The default value is `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the instance. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) + is enabled on the instance. + type: boolean + type: object + intelIcelakeBmPlatformConfig: + description: AmdMilanBmPlatformConfig describe Intel Skylke + BM platform configuration + properties: + isInputOutputMemoryManagementUnitEnabled: + description: Whether the input-output memory management + unit is enabled. + type: boolean + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is enabled + on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential instance. + If this value is `true`, the instance is a confidential + instance. The default value is `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the instance. + type: boolean + isSymmetricMultiThreadingEnabled: + description: Whether symmetric multithreading is enabled + on the instance. Symmetric multithreading is also called + simultaneous multithreading (SMT) or Intel Hyper-Threading. + Intel and AMD processors have two hardware execution + threads per core (OCPU). SMT permits multiple independent + threads of execution, to better use the resources and + increase the efficiency of the CPU. When multithreading + is disabled, only one thread is permitted to run on + each core, which can provide higher or more predictable + performance for some workloads. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) + is enabled on the instance. + type: boolean + numaNodesPerSocket: + description: 'The number of NUMA nodes per socket (NPS). + The following values are supported: * `NPS1` * `NPS2`' + type: string + percentageOfCoresEnabled: + description: The percentage of cores enabled. Value must + be a multiple of 25%. If the requested percentage results + in a fractional number of cores, the system rounds up + the number of cores across processors and provisions + an instance with a whole number of cores. If the applications + that you run on the instance use a core-based licensing + model and need fewer cores than the full size of the + shape, you can disable cores to reduce your licensing + costs. The instance itself is billed for the full shape, + regardless of whether all cores are enabled. + type: integer + type: object + intelSkylakeBmPlatformConfig: + description: AmdMilanBmPlatformConfig describe Intel Skylke + BM platform configuration + properties: + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is enabled + on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential instance. + If this value is `true`, the instance is a confidential + instance. The default value is `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the instance. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) + is enabled on the instance. + type: boolean + type: object + intelVmPlatformConfig: + description: AmdMilanBmPlatformConfig describe Intel VM platform + configuration + properties: + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is enabled + on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential instance. + If this value is `true`, the instance is a confidential + instance. The default value is `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the instance. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) + is enabled on the instance. + type: boolean + type: object + platformConfigType: + description: The type of platform configuration. Valid values + are * `AMD_ROME_BM_GPU` * `AMD_ROME_BM` * `INTEL_ICELAKE_BM` + * `AMD_VM` * `INTEL_VM` * `INTEL_SKYLAKE_BM` * `AMD_MILAN_BM` + Based on the enum, exactly one of the specific configuration + types must be set + type: string + type: object + preemptibleInstanceConfig: + description: PreemptibleInstanceConfig Configuration options for + preemptible instances. + properties: + terminatePreemptionAction: + description: TerminatePreemptionAction terminates the preemptible + instance when it is interrupted for eviction. + properties: + preserveBootVolume: + description: PreserveBootVolume defines whether to preserve + the boot volume that was used to launch the preemptible + instance when the instance is terminated. Defaults to + false if not specified. + type: boolean + type: object + type: object + shape: + type: string + shapeConfig: + description: The shape configuration of the instance, applicable + for flex instances. + properties: + baselineOcpuUtilization: + description: 'The baseline OCPU utilization for a subcore + burstable VM instance. Leave this attribute blank for a + non-burstable instance, or explicitly specify non-burstable + with `BASELINE_1_1`. The following values are supported: + - `BASELINE_1_8` - baseline usage is 1/8 of an OCPU. - `BASELINE_1_2` + - baseline usage is 1/2 of an OCPU. - `BASELINE_1_1` - baseline + usage is an entire OCPU. This represents a non-burstable + instance.' + type: string + memoryInGBs: + description: The total amount of memory available to the instance, + in gigabytes. + type: string + nvmes: + description: Nvmes defines the number of NVMe drives to be + used for storage. A single drive has 6.8 TB available. + type: integer + ocpus: + description: The total number of OCPUs available to the instance. + type: string + type: object + type: object + ocid: + description: OCID is the OCID of the associated InstancePool + type: string + placementDetails: + description: PlacementDetails defines the placement details of the + instance pool. + items: + properties: + availabilityDomain: + description: The availability domain to place instances. + type: integer + required: + - availabilityDomain + type: object + type: array + providerID: + description: ProviderID is the OCID of the associated InstancePool + in a provider format + type: string + providerIDList: + description: ProviderIDList are the identification IDs of machine + instances provided by the provider. This field must match the provider + IDs as seen on the node objects corresponding to a machine pool's + machine instances. + items: + type: string + type: array + type: object + status: + description: OCIMachinePoolStatus defines the observed state of OCIMachinePool + properties: + conditions: + description: Conditions defines current service state of the OCIMachinePool. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + failureMessage: + type: string + failureReason: + description: MachineStatusError defines errors states for Machine + objects. + type: string + ready: + description: Ready is true when the provider resource is ready. + type: boolean + replicas: + description: Replicas is the most recently observed number of replicas + format: int32 + type: integer + type: object + type: object + served: true + storage: false + subresources: + status: {} diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachines.yaml index f727d1b0..a2dd23bf 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachines.yaml @@ -774,6 +774,754 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v1beta2 + schema: + openAPIV3Schema: + description: OCIMachine is the Schema for the ocimachines API. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: OCIMachineSpec defines the desired state of OCIMachine Please + read the API https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/Instance/LaunchInstance + for more information about the parameters below + properties: + agentConfig: + description: AgentConfig defines the options for the Oracle Cloud + Agent software running on the instance. + properties: + areAllPluginsDisabled: + description: AreAllPluginsDisabled defines whether Oracle Cloud + Agent can run all the available plugins. This includes the management + and monitoring plugins. To get a list of available plugins, + use the ListInstanceagentAvailablePlugins operation in the Oracle + Cloud Agent API. For more information about the available plugins, + see Managing Plugins with Oracle Cloud Agent (https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/manage-plugins.htm). + type: boolean + isManagementDisabled: + description: 'IsManagementDisabled defines whether Oracle Cloud + Agent can run all the available management plugins. Default + value is false (management plugins are enabled). These are the + management plugins: OS Management Service Agent and Compute + Instance Run Command. The management plugins are controlled + by this parameter and by the per-plugin configuration in the + `pluginsConfig` object. - If `isManagementDisabled` is true, + all of the management plugins are disabled, regardless of the + per-plugin configuration. - If `isManagementDisabled` is false, + all of the management plugins are enabled. You can optionally + disable individual management plugins by providing a value in + the `pluginsConfig` object.' + type: boolean + isMonitoringDisabled: + description: 'IsMonitoringDisabled defines whether Oracle Cloud + Agent can gather performance metrics and monitor the instance + using the monitoring plugins. Default value is false (monitoring + plugins are enabled). These are the monitoring plugins: Compute + Instance Monitoring and Custom Logs Monitoring. The monitoring + plugins are controlled by this parameter and by the per-plugin + configuration in the `pluginsConfig` object. - If `isMonitoringDisabled` + is true, all of the monitoring plugins are disabled, regardless + of the per-plugin configuration. - If `isMonitoringDisabled` + is false, all of the monitoring plugins are enabled. You can + optionally disable individual monitoring plugins by providing + a value in the `pluginsConfig` object.' + type: boolean + pluginsConfigs: + description: PluginsConfig defines the configuration of plugins + associated with this instance. + items: + description: InstanceAgentPluginConfig defines the configuration + of plugins associated with this instance. + properties: + desiredState: + description: 'DesiredState defines whether the plugin should + be enabled or disabled. To enable the monitoring and management + plugins, the `isMonitoringDisabled` and `isManagementDisabled` + attributes must also be set to false. The following values + are supported: * `ENABLED` * `DISABLED`' + type: string + name: + description: Name defines the name of the plugin. To get + a list of available plugins, use the ListInstanceagentAvailablePlugins + operation in the Oracle Cloud Agent API. For more information + about the available plugins, see Managing Plugins with + Oracle Cloud Agent (https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/manage-plugins.htm). + type: string + type: object + type: array + type: object + availabilityConfig: + description: LaunchInstanceAvailabilityConfig defines the options + for VM migration during infrastructure maintenance events and for + defining the availability of a VM instance after a maintenance event + that impacts the underlying hardware. + properties: + isLiveMigrationPreferred: + description: IsLiveMigrationPreferred defines whether to live + migrate supported VM instances to a healthy physical VM host + without disrupting running instances during infrastructure maintenance + events. If null, Oracle chooses the best option for migrating + the VM during infrastructure maintenance events. + type: boolean + recoveryAction: + description: RecoveryAction defines the lifecycle state for an + instance when it is recovered after infrastructure maintenance. + * `RESTORE_INSTANCE` - The instance is restored to the lifecycle + state it was in before the maintenance event. If the instance + was running, it is automatically rebooted. This is the default + action when a value is not set. * `STOP_INSTANCE` - The instance + is recovered in the stopped state. + type: string + type: object + bootVolumeSizeInGBs: + description: The size of boot volume. Please see https://docs.oracle.com/en-us/iaas/Content/Block/Tasks/extendingbootpartition.htm + to extend the boot volume size. + type: string + capacityReservationId: + description: CapacityReservationId defines the OCID of the compute + capacity reservation this instance is launched under. You can opt + out of all default reservations by specifying an empty string as + input for this field. For more information, see Capacity Reservations + (https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/reserve-capacity.htm#default). + type: string + compartmentId: + description: Compartment to launch the instance in. + type: string + dedicatedVmHostId: + description: DedicatedVmHostId defines the OCID of the dedicated VM + host. + type: string + definedTags: + additionalProperties: + additionalProperties: + type: string + type: object + description: 'Defined tags for this resource. Each key is predefined + and scoped to a namespace. For more information, see Resource Tags + (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + Example: `{"Operations": {"CostCenter": "42"}}`' + type: object + freeformTags: + additionalProperties: + type: string + description: Free-form tags for this resource. + type: object + imageId: + description: OCID of the image to be used to launch the instance. + type: string + instanceId: + description: OCID of launched compute instance. + type: string + instanceOptions: + description: InstanceOptions defines the instance options + properties: + areLegacyImdsEndpointsDisabled: + description: Whether to disable the legacy (/v1) instance metadata + service endpoints. Customers who have migrated to /v2 should + set this to true for added security. Default is false. + type: boolean + type: object + instanceSourceViaImageConfig: + description: InstanceSourceViaImageConfig defines the options for + booting up instances via images + properties: + bootVolumeVpusPerGB: + description: 'BootVolumeVpusPerGB defines the number of volume + performance units (VPUs) that will be applied to this volume + per GB, representing the Block Volume service''s elastic performance + options. See Block Volume Performance Levels (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/blockvolumeperformance.htm#perf_levels) + for more information. Allowed values: * `10`: Represents Balanced + option. * `20`: Represents Higher Performance option. * `30`-`120`: + Represents the Ultra High Performance option. For volumes with + the auto-tuned performance feature enabled, this is set to the + default (minimum) VPUs/GB.' + format: int64 + type: integer + kmsKeyId: + description: KmsKeyId defines the OCID of the Key Management key + to assign as the master encryption key for the boot volume. + type: string + type: object + ipxeScript: + type: string + isPvEncryptionInTransitEnabled: + default: true + description: Is in transit encryption of volumes required. + type: boolean + launchOptions: + description: LaunchOptions defines the options for tuning the compatibility + and performance of VM shapes + properties: + bootVolumeType: + description: BootVolumeType defines Emulation type for the boot + volume. * `ISCSI` - ISCSI attached block storage device. * `SCSI` + - Emulated SCSI disk. * `IDE` - Emulated IDE disk. * `VFIO` + - Direct attached Virtual Function storage. This is the default + option for local data volumes on platform images. * `PARAVIRTUALIZED` + - Paravirtualized disk. This is the default for boot volumes + and remote block storage volumes on platform images. + type: string + firmware: + description: Firmware defines the firmware used to boot VM. Select + the option that matches your operating system. * `BIOS` - Boot + VM using BIOS style firmware. This is compatible with both 32 + bit and 64 bit operating systems that boot using MBR style bootloaders. + * `UEFI_64` - Boot VM using UEFI style firmware compatible with + 64 bit operating systems. This is the default for platform images. + type: string + isConsistentVolumeNamingEnabled: + description: IsConsistentVolumeNamingEnabled defines whether to + enable consistent volume naming feature. Defaults to false. + type: boolean + networkType: + description: NetworkType defines the emulation type for the physical + network interface card (NIC). * `E1000` - Emulated Gigabit ethernet + controller. Compatible with Linux e1000 network driver. * `VFIO` + - Direct attached Virtual Function network controller. This + is the networking type when you launch an instance using hardware-assisted + (SR-IOV) networking. * `PARAVIRTUALIZED` - VM instances launch + with paravirtualized devices using VirtIO drivers. + type: string + remoteDataVolumeType: + description: RemoteDataVolumeType defines the emulation type for + volume. * `ISCSI` - ISCSI attached block storage device. * `SCSI` + - Emulated SCSI disk. * `IDE` - Emulated IDE disk. * `VFIO` + - Direct attached Virtual Function storage. This is the default + option for local data volumes on platform images. * `PARAVIRTUALIZED` + - Paravirtualized disk. This is the default for boot volumes + and remote block storage volumes on platform images. + type: string + type: object + metadata: + additionalProperties: + type: string + description: Custom metadata key/value pairs that you provide, such + as the SSH public key required to connect to the instance. + type: object + networkDetails: + description: NetworkDetails defines the configuration options for + the network + properties: + assignPrivateDnsRecord: + description: AssignPrivateDnsRecord defines whether the VNIC should + be assigned a DNS record. + type: boolean + assignPublicIp: + description: AssignPublicIp defines whether the instance should + have a public IP address + type: boolean + displayName: + description: DisplayName defines a user-friendly name. Does not + have to be unique, and it's changeable. Avoid entering confidential + information. + type: string + hostnameLabel: + description: HostnameLabel defines the hostname for the VNIC's + primary private IP. Used for DNS. + type: string + nsgNames: + description: NsgNames defines a list of the nsg names of the network + security groups (NSGs) to add the VNIC to. + items: + type: string + type: array + skipSourceDestCheck: + description: SkipSourceDestCheck defines whether the source/destination + check is disabled on the VNIC. + type: boolean + subnetName: + description: SubnetName defines the subnet name to use for the + VNIC + type: string + type: object + platformConfig: + description: PlatformConfig defines the platform config parameters + properties: + amdMilanBmPlatformConfig: + description: AmdMilanBmPlatformConfig describe AMD Milan BM platform + configuration + properties: + areVirtualInstructionsEnabled: + description: Whether virtualization instructions are available. + For example, Secure Virtual Machine for AMD shapes or VT-x + for Intel shapes. + type: boolean + isAccessControlServiceEnabled: + description: Whether the Access Control Service is enabled + on the instance. When enabled, the platform can enforce + PCIe device isolation, required for VFIO device pass-through. + type: boolean + isInputOutputMemoryManagementUnitEnabled: + description: Whether the input-output memory management unit + is enabled. + type: boolean + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is enabled + on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential instance. + If this value is `true`, the instance is a confidential + instance. The default value is `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the instance. + type: boolean + isSymmetricMultiThreadingEnabled: + description: Whether symmetric multithreading is enabled on + the instance. Symmetric multithreading is also called simultaneous + multithreading (SMT) or Intel Hyper-Threading. Intel and + AMD processors have two hardware execution threads per core + (OCPU). SMT permits multiple independent threads of execution, + to better use the resources and increase the efficiency + of the CPU. When multithreading is disabled, only one thread + is permitted to run on each core, which can provide higher + or more predictable performance for some workloads. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) is + enabled on the instance. + type: boolean + numaNodesPerSocket: + description: 'The number of NUMA nodes per socket (NPS). The + following values are supported: * `NPS0` * `NPS1` * `NPS2` + * `NPS4`' + type: string + percentageOfCoresEnabled: + description: The percentage of cores enabled. Value must be + a multiple of 25%. If the requested percentage results in + a fractional number of cores, the system rounds up the number + of cores across processors and provisions an instance with + a whole number of cores. If the applications that you run + on the instance use a core-based licensing model and need + fewer cores than the full size of the shape, you can disable + cores to reduce your licensing costs. The instance itself + is billed for the full shape, regardless of whether all + cores are enabled. + type: integer + type: object + amdRomeBmGpuPlatformConfig: + description: AmdMilanBmPlatformConfig describe AMD Rome BM platform + configuration + properties: + areVirtualInstructionsEnabled: + description: Whether virtualization instructions are available. + For example, Secure Virtual Machine for AMD shapes or VT-x + for Intel shapes. + type: boolean + isAccessControlServiceEnabled: + description: Whether the Access Control Service is enabled + on the instance. When enabled, the platform can enforce + PCIe device isolation, required for VFIO device pass-through. + type: boolean + isInputOutputMemoryManagementUnitEnabled: + description: Whether the input-output memory management unit + is enabled. + type: boolean + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is enabled + on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential instance. + If this value is `true`, the instance is a confidential + instance. The default value is `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the instance. + type: boolean + isSymmetricMultiThreadingEnabled: + description: Whether symmetric multithreading is enabled on + the instance. Symmetric multithreading is also called simultaneous + multithreading (SMT) or Intel Hyper-Threading. Intel and + AMD processors have two hardware execution threads per core + (OCPU). SMT permits multiple independent threads of execution, + to better use the resources and increase the efficiency + of the CPU. When multithreading is disabled, only one thread + is permitted to run on each core, which can provide higher + or more predictable performance for some workloads. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) is + enabled on the instance. + type: boolean + numaNodesPerSocket: + description: 'The number of NUMA nodes per socket (NPS). The + following values are supported: * `NPS0` * `NPS1` * `NPS2` + * `NPS4`' + type: string + type: object + amdRomeBmPlatformConfig: + description: AmdMilanBmPlatformConfig describe AMD Rome BM platform + configuration + properties: + areVirtualInstructionsEnabled: + description: Whether virtualization instructions are available. + For example, Secure Virtual Machine for AMD shapes or VT-x + for Intel shapes. + type: boolean + isAccessControlServiceEnabled: + description: Whether the Access Control Service is enabled + on the instance. When enabled, the platform can enforce + PCIe device isolation, required for VFIO device pass-through. + type: boolean + isInputOutputMemoryManagementUnitEnabled: + description: Whether the input-output memory management unit + is enabled. + type: boolean + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is enabled + on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential instance. + If this value is `true`, the instance is a confidential + instance. The default value is `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the instance. + type: boolean + isSymmetricMultiThreadingEnabled: + description: Whether symmetric multithreading is enabled on + the instance. Symmetric multithreading is also called simultaneous + multithreading (SMT) or Intel Hyper-Threading. Intel and + AMD processors have two hardware execution threads per core + (OCPU). SMT permits multiple independent threads of execution, + to better use the resources and increase the efficiency + of the CPU. When multithreading is disabled, only one thread + is permitted to run on each core, which can provide higher + or more predictable performance for some workloads. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) is + enabled on the instance. + type: boolean + numaNodesPerSocket: + description: 'The number of NUMA nodes per socket (NPS). The + following values are supported: * `NPS0` * `NPS1` * `NPS2` + * `NPS4`' + type: string + percentageOfCoresEnabled: + description: The percentage of cores enabled. Value must be + a multiple of 25%. If the requested percentage results in + a fractional number of cores, the system rounds up the number + of cores across processors and provisions an instance with + a whole number of cores. If the applications that you run + on the instance use a core-based licensing model and need + fewer cores than the full size of the shape, you can disable + cores to reduce your licensing costs. The instance itself + is billed for the full shape, regardless of whether all + cores are enabled. + type: integer + type: object + amdVmPlatformConfig: + description: AmdMilanBmPlatformConfig describe AMD VM platform + configuration + properties: + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is enabled + on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential instance. + If this value is `true`, the instance is a confidential + instance. The default value is `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the instance. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) is + enabled on the instance. + type: boolean + type: object + intelIcelakeBmPlatformConfig: + description: AmdMilanBmPlatformConfig describe Intel Skylke BM + platform configuration + properties: + isInputOutputMemoryManagementUnitEnabled: + description: Whether the input-output memory management unit + is enabled. + type: boolean + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is enabled + on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential instance. + If this value is `true`, the instance is a confidential + instance. The default value is `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the instance. + type: boolean + isSymmetricMultiThreadingEnabled: + description: Whether symmetric multithreading is enabled on + the instance. Symmetric multithreading is also called simultaneous + multithreading (SMT) or Intel Hyper-Threading. Intel and + AMD processors have two hardware execution threads per core + (OCPU). SMT permits multiple independent threads of execution, + to better use the resources and increase the efficiency + of the CPU. When multithreading is disabled, only one thread + is permitted to run on each core, which can provide higher + or more predictable performance for some workloads. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) is + enabled on the instance. + type: boolean + numaNodesPerSocket: + description: 'The number of NUMA nodes per socket (NPS). The + following values are supported: * `NPS1` * `NPS2`' + type: string + percentageOfCoresEnabled: + description: The percentage of cores enabled. Value must be + a multiple of 25%. If the requested percentage results in + a fractional number of cores, the system rounds up the number + of cores across processors and provisions an instance with + a whole number of cores. If the applications that you run + on the instance use a core-based licensing model and need + fewer cores than the full size of the shape, you can disable + cores to reduce your licensing costs. The instance itself + is billed for the full shape, regardless of whether all + cores are enabled. + type: integer + type: object + intelSkylakeBmPlatformConfig: + description: AmdMilanBmPlatformConfig describe Intel Skylke BM + platform configuration + properties: + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is enabled + on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential instance. + If this value is `true`, the instance is a confidential + instance. The default value is `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the instance. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) is + enabled on the instance. + type: boolean + type: object + intelVmPlatformConfig: + description: AmdMilanBmPlatformConfig describe Intel VM platform + configuration + properties: + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is enabled + on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential instance. + If this value is `true`, the instance is a confidential + instance. The default value is `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the instance. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) is + enabled on the instance. + type: boolean + type: object + platformConfigType: + description: The type of platform configuration. Valid values + are * `AMD_ROME_BM_GPU` * `AMD_ROME_BM` * `INTEL_ICELAKE_BM` + * `AMD_VM` * `INTEL_VM` * `INTEL_SKYLAKE_BM` * `AMD_MILAN_BM` + Based on the enum, exactly one of the specific configuration + types must be set + type: string + type: object + preemptibleInstanceConfig: + description: PreemptibleInstanceConfig Configuration options for preemptible + instances. + properties: + terminatePreemptionAction: + description: TerminatePreemptionAction terminates the preemptible + instance when it is interrupted for eviction. + properties: + preserveBootVolume: + description: PreserveBootVolume defines whether to preserve + the boot volume that was used to launch the preemptible + instance when the instance is terminated. Defaults to false + if not specified. + type: boolean + type: object + type: object + providerID: + description: Provider ID of the instance, this will be set by Cluster + API provider itself, users should not set this parameter. + type: string + shape: + description: Shape of the instance. + type: string + shapeConfig: + description: The shape configuration of rhe instance, applicable for + flex instances. + properties: + baselineOcpuUtilization: + description: 'The baseline OCPU utilization for a subcore burstable + VM instance. Leave this attribute blank for a non-burstable + instance, or explicitly specify non-burstable with `BASELINE_1_1`. + The following values are supported: - `BASELINE_1_8` - baseline + usage is 1/8 of an OCPU. - `BASELINE_1_2` - baseline usage is + 1/2 of an OCPU. - `BASELINE_1_1` - baseline usage is an entire + OCPU. This represents a non-burstable instance.' + type: string + memoryInGBs: + description: The total amount of memory available to the instance, + in gigabytes. + type: string + nvmes: + description: Nvmes defines the number of NVMe drives to be used + for storage. A single drive has 6.8 TB available. + type: integer + ocpus: + description: The total number of OCPUs available to the instance. + type: string + type: object + subnetName: + description: The name of the subnet to use. The name here refers to + the subnets defined in the OCICluster Spec. Optional, only if multiple + subnets of a type is defined, else the first element is used. + type: string + vnicAttachments: + description: VnicAttachments defines the configuration options for + the vnic(s) attached to the machine The network bandwidth and number + of VNICs scale proportionately with the number of OCPUs. + items: + properties: + assignPublicIp: + description: AssignPublicIp defines whether the vnic should + have a public IP address + type: boolean + displayName: + description: DisplayName defines a user-friendly name. Does + not have to be unique. Avoid entering confidential information. + type: string + nicIndex: + description: NicIndex defines which physical Network Interface + Card (NIC) to use You can determine which NICs are active + for a shape by reviewing the https://docs.oracle.com/en-us/iaas/Content/Compute/References/computeshapes.htm + type: integer + subnetName: + description: SubnetName defines the subnet name to use for the + VNIC Defaults to the "worker" subnet if not provided + type: string + vnicAttachmentId: + description: VnicAttachmentId defines the ID of the VnicAttachment + type: string + required: + - displayName + type: object + type: array + type: object + status: + description: OCIMachineStatus defines the observed state of OCIMachine. + properties: + addresses: + description: Addresses contains the addresses of the associated OCI + instance. + items: + description: MachineAddress contains information for the node's + address. + properties: + address: + description: The machine address. + type: string + type: + description: Machine address type, one of Hostname, ExternalIP + or InternalIP. + type: string + required: + - address + - type + type: object + type: array + conditions: + description: Conditions defines current service state of the OCIMachine. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + createBackendWorkRequestId: + description: Create Backend OPC work request ID for the machine backend. + type: string + deleteBackendWorkRequestId: + description: Delete Backend OPC work request ID for the machine backend. + type: string + failureMessage: + description: The error message corresponding to the error on the machine. + type: string + failureReason: + description: Error status on the machine. + type: string + launchInstanceWorkRequestId: + description: Launch instance work request ID. + type: string + ready: + description: Flag set to true when machine is ready. + type: boolean + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachinetemplates.yaml index bf1a3d1a..5f066122 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachinetemplates.yaml @@ -757,4 +757,731 @@ spec: type: object type: object served: true + storage: false + - name: v1beta2 + schema: + openAPIV3Schema: + description: OCIMachineTemplate is the schema for the OCI compute instance + machine template. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: OCIMachineTemplateSpec defines the desired state of OCIMachineTemplate. + properties: + template: + description: OCIMachineTemplateResource describes the data needed + to create an OCIMachine from a template. + properties: + spec: + description: Spec is the specification of the desired behavior + of the machine. + properties: + agentConfig: + description: AgentConfig defines the options for the Oracle + Cloud Agent software running on the instance. + properties: + areAllPluginsDisabled: + description: AreAllPluginsDisabled defines whether Oracle + Cloud Agent can run all the available plugins. This + includes the management and monitoring plugins. To get + a list of available plugins, use the ListInstanceagentAvailablePlugins + operation in the Oracle Cloud Agent API. For more information + about the available plugins, see Managing Plugins with + Oracle Cloud Agent (https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/manage-plugins.htm). + type: boolean + isManagementDisabled: + description: 'IsManagementDisabled defines whether Oracle + Cloud Agent can run all the available management plugins. + Default value is false (management plugins are enabled). + These are the management plugins: OS Management Service + Agent and Compute Instance Run Command. The management + plugins are controlled by this parameter and by the + per-plugin configuration in the `pluginsConfig` object. + - If `isManagementDisabled` is true, all of the management + plugins are disabled, regardless of the per-plugin configuration. + - If `isManagementDisabled` is false, all of the management + plugins are enabled. You can optionally disable individual + management plugins by providing a value in the `pluginsConfig` + object.' + type: boolean + isMonitoringDisabled: + description: 'IsMonitoringDisabled defines whether Oracle + Cloud Agent can gather performance metrics and monitor + the instance using the monitoring plugins. Default value + is false (monitoring plugins are enabled). These are + the monitoring plugins: Compute Instance Monitoring + and Custom Logs Monitoring. The monitoring plugins are + controlled by this parameter and by the per-plugin configuration + in the `pluginsConfig` object. - If `isMonitoringDisabled` + is true, all of the monitoring plugins are disabled, + regardless of the per-plugin configuration. - If `isMonitoringDisabled` + is false, all of the monitoring plugins are enabled. + You can optionally disable individual monitoring plugins + by providing a value in the `pluginsConfig` object.' + type: boolean + pluginsConfigs: + description: PluginsConfig defines the configuration of + plugins associated with this instance. + items: + description: InstanceAgentPluginConfig defines the configuration + of plugins associated with this instance. + properties: + desiredState: + description: 'DesiredState defines whether the plugin + should be enabled or disabled. To enable the monitoring + and management plugins, the `isMonitoringDisabled` + and `isManagementDisabled` attributes must also + be set to false. The following values are supported: + * `ENABLED` * `DISABLED`' + type: string + name: + description: Name defines the name of the plugin. + To get a list of available plugins, use the ListInstanceagentAvailablePlugins + operation in the Oracle Cloud Agent API. For more + information about the available plugins, see Managing + Plugins with Oracle Cloud Agent (https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/manage-plugins.htm). + type: string + type: object + type: array + type: object + availabilityConfig: + description: LaunchInstanceAvailabilityConfig defines the + options for VM migration during infrastructure maintenance + events and for defining the availability of a VM instance + after a maintenance event that impacts the underlying hardware. + properties: + isLiveMigrationPreferred: + description: IsLiveMigrationPreferred defines whether + to live migrate supported VM instances to a healthy + physical VM host without disrupting running instances + during infrastructure maintenance events. If null, Oracle + chooses the best option for migrating the VM during + infrastructure maintenance events. + type: boolean + recoveryAction: + description: RecoveryAction defines the lifecycle state + for an instance when it is recovered after infrastructure + maintenance. * `RESTORE_INSTANCE` - The instance is + restored to the lifecycle state it was in before the + maintenance event. If the instance was running, it is + automatically rebooted. This is the default action when + a value is not set. * `STOP_INSTANCE` - The instance + is recovered in the stopped state. + type: string + type: object + bootVolumeSizeInGBs: + description: The size of boot volume. Please see https://docs.oracle.com/en-us/iaas/Content/Block/Tasks/extendingbootpartition.htm + to extend the boot volume size. + type: string + capacityReservationId: + description: CapacityReservationId defines the OCID of the + compute capacity reservation this instance is launched under. + You can opt out of all default reservations by specifying + an empty string as input for this field. For more information, + see Capacity Reservations (https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/reserve-capacity.htm#default). + type: string + compartmentId: + description: Compartment to launch the instance in. + type: string + dedicatedVmHostId: + description: DedicatedVmHostId defines the OCID of the dedicated + VM host. + type: string + definedTags: + additionalProperties: + additionalProperties: + type: string + type: object + description: 'Defined tags for this resource. Each key is + predefined and scoped to a namespace. For more information, + see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + Example: `{"Operations": {"CostCenter": "42"}}`' + type: object + freeformTags: + additionalProperties: + type: string + description: Free-form tags for this resource. + type: object + imageId: + description: OCID of the image to be used to launch the instance. + type: string + instanceId: + description: OCID of launched compute instance. + type: string + instanceOptions: + description: InstanceOptions defines the instance options + properties: + areLegacyImdsEndpointsDisabled: + description: Whether to disable the legacy (/v1) instance + metadata service endpoints. Customers who have migrated + to /v2 should set this to true for added security. Default + is false. + type: boolean + type: object + instanceSourceViaImageConfig: + description: InstanceSourceViaImageConfig defines the options + for booting up instances via images + properties: + bootVolumeVpusPerGB: + description: 'BootVolumeVpusPerGB defines the number of + volume performance units (VPUs) that will be applied + to this volume per GB, representing the Block Volume + service''s elastic performance options. See Block Volume + Performance Levels (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/blockvolumeperformance.htm#perf_levels) + for more information. Allowed values: * `10`: Represents + Balanced option. * `20`: Represents Higher Performance + option. * `30`-`120`: Represents the Ultra High Performance + option. For volumes with the auto-tuned performance + feature enabled, this is set to the default (minimum) + VPUs/GB.' + format: int64 + type: integer + kmsKeyId: + description: KmsKeyId defines the OCID of the Key Management + key to assign as the master encryption key for the boot + volume. + type: string + type: object + ipxeScript: + type: string + isPvEncryptionInTransitEnabled: + default: true + description: Is in transit encryption of volumes required. + type: boolean + launchOptions: + description: LaunchOptions defines the options for tuning + the compatibility and performance of VM shapes + properties: + bootVolumeType: + description: BootVolumeType defines Emulation type for + the boot volume. * `ISCSI` - ISCSI attached block storage + device. * `SCSI` - Emulated SCSI disk. * `IDE` - Emulated + IDE disk. * `VFIO` - Direct attached Virtual Function + storage. This is the default option for local data volumes + on platform images. * `PARAVIRTUALIZED` - Paravirtualized + disk. This is the default for boot volumes and remote + block storage volumes on platform images. + type: string + firmware: + description: Firmware defines the firmware used to boot + VM. Select the option that matches your operating system. + * `BIOS` - Boot VM using BIOS style firmware. This is + compatible with both 32 bit and 64 bit operating systems + that boot using MBR style bootloaders. * `UEFI_64` - + Boot VM using UEFI style firmware compatible with 64 + bit operating systems. This is the default for platform + images. + type: string + isConsistentVolumeNamingEnabled: + description: IsConsistentVolumeNamingEnabled defines whether + to enable consistent volume naming feature. Defaults + to false. + type: boolean + networkType: + description: NetworkType defines the emulation type for + the physical network interface card (NIC). * `E1000` + - Emulated Gigabit ethernet controller. Compatible with + Linux e1000 network driver. * `VFIO` - Direct attached + Virtual Function network controller. This is the networking + type when you launch an instance using hardware-assisted + (SR-IOV) networking. * `PARAVIRTUALIZED` - VM instances + launch with paravirtualized devices using VirtIO drivers. + type: string + remoteDataVolumeType: + description: RemoteDataVolumeType defines the emulation + type for volume. * `ISCSI` - ISCSI attached block storage + device. * `SCSI` - Emulated SCSI disk. * `IDE` - Emulated + IDE disk. * `VFIO` - Direct attached Virtual Function + storage. This is the default option for local data volumes + on platform images. * `PARAVIRTUALIZED` - Paravirtualized + disk. This is the default for boot volumes and remote + block storage volumes on platform images. + type: string + type: object + metadata: + additionalProperties: + type: string + description: Custom metadata key/value pairs that you provide, + such as the SSH public key required to connect to the instance. + type: object + networkDetails: + description: NetworkDetails defines the configuration options + for the network + properties: + assignPrivateDnsRecord: + description: AssignPrivateDnsRecord defines whether the + VNIC should be assigned a DNS record. + type: boolean + assignPublicIp: + description: AssignPublicIp defines whether the instance + should have a public IP address + type: boolean + displayName: + description: DisplayName defines a user-friendly name. + Does not have to be unique, and it's changeable. Avoid + entering confidential information. + type: string + hostnameLabel: + description: HostnameLabel defines the hostname for the + VNIC's primary private IP. Used for DNS. + type: string + nsgNames: + description: NsgNames defines a list of the nsg names + of the network security groups (NSGs) to add the VNIC + to. + items: + type: string + type: array + skipSourceDestCheck: + description: SkipSourceDestCheck defines whether the source/destination + check is disabled on the VNIC. + type: boolean + subnetName: + description: SubnetName defines the subnet name to use + for the VNIC + type: string + type: object + platformConfig: + description: PlatformConfig defines the platform config parameters + properties: + amdMilanBmPlatformConfig: + description: AmdMilanBmPlatformConfig describe AMD Milan + BM platform configuration + properties: + areVirtualInstructionsEnabled: + description: Whether virtualization instructions are + available. For example, Secure Virtual Machine for + AMD shapes or VT-x for Intel shapes. + type: boolean + isAccessControlServiceEnabled: + description: Whether the Access Control Service is + enabled on the instance. When enabled, the platform + can enforce PCIe device isolation, required for + VFIO device pass-through. + type: boolean + isInputOutputMemoryManagementUnitEnabled: + description: Whether the input-output memory management + unit is enabled. + type: boolean + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is + enabled on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential + instance. If this value is `true`, the instance + is a confidential instance. The default value is + `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the + instance. + type: boolean + isSymmetricMultiThreadingEnabled: + description: Whether symmetric multithreading is enabled + on the instance. Symmetric multithreading is also + called simultaneous multithreading (SMT) or Intel + Hyper-Threading. Intel and AMD processors have two + hardware execution threads per core (OCPU). SMT + permits multiple independent threads of execution, + to better use the resources and increase the efficiency + of the CPU. When multithreading is disabled, only + one thread is permitted to run on each core, which + can provide higher or more predictable performance + for some workloads. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) + is enabled on the instance. + type: boolean + numaNodesPerSocket: + description: 'The number of NUMA nodes per socket + (NPS). The following values are supported: * `NPS0` + * `NPS1` * `NPS2` * `NPS4`' + type: string + percentageOfCoresEnabled: + description: The percentage of cores enabled. Value + must be a multiple of 25%. If the requested percentage + results in a fractional number of cores, the system + rounds up the number of cores across processors + and provisions an instance with a whole number of + cores. If the applications that you run on the instance + use a core-based licensing model and need fewer + cores than the full size of the shape, you can disable + cores to reduce your licensing costs. The instance + itself is billed for the full shape, regardless + of whether all cores are enabled. + type: integer + type: object + amdRomeBmGpuPlatformConfig: + description: AmdMilanBmPlatformConfig describe AMD Rome + BM platform configuration + properties: + areVirtualInstructionsEnabled: + description: Whether virtualization instructions are + available. For example, Secure Virtual Machine for + AMD shapes or VT-x for Intel shapes. + type: boolean + isAccessControlServiceEnabled: + description: Whether the Access Control Service is + enabled on the instance. When enabled, the platform + can enforce PCIe device isolation, required for + VFIO device pass-through. + type: boolean + isInputOutputMemoryManagementUnitEnabled: + description: Whether the input-output memory management + unit is enabled. + type: boolean + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is + enabled on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential + instance. If this value is `true`, the instance + is a confidential instance. The default value is + `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the + instance. + type: boolean + isSymmetricMultiThreadingEnabled: + description: Whether symmetric multithreading is enabled + on the instance. Symmetric multithreading is also + called simultaneous multithreading (SMT) or Intel + Hyper-Threading. Intel and AMD processors have two + hardware execution threads per core (OCPU). SMT + permits multiple independent threads of execution, + to better use the resources and increase the efficiency + of the CPU. When multithreading is disabled, only + one thread is permitted to run on each core, which + can provide higher or more predictable performance + for some workloads. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) + is enabled on the instance. + type: boolean + numaNodesPerSocket: + description: 'The number of NUMA nodes per socket + (NPS). The following values are supported: * `NPS0` + * `NPS1` * `NPS2` * `NPS4`' + type: string + type: object + amdRomeBmPlatformConfig: + description: AmdMilanBmPlatformConfig describe AMD Rome + BM platform configuration + properties: + areVirtualInstructionsEnabled: + description: Whether virtualization instructions are + available. For example, Secure Virtual Machine for + AMD shapes or VT-x for Intel shapes. + type: boolean + isAccessControlServiceEnabled: + description: Whether the Access Control Service is + enabled on the instance. When enabled, the platform + can enforce PCIe device isolation, required for + VFIO device pass-through. + type: boolean + isInputOutputMemoryManagementUnitEnabled: + description: Whether the input-output memory management + unit is enabled. + type: boolean + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is + enabled on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential + instance. If this value is `true`, the instance + is a confidential instance. The default value is + `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the + instance. + type: boolean + isSymmetricMultiThreadingEnabled: + description: Whether symmetric multithreading is enabled + on the instance. Symmetric multithreading is also + called simultaneous multithreading (SMT) or Intel + Hyper-Threading. Intel and AMD processors have two + hardware execution threads per core (OCPU). SMT + permits multiple independent threads of execution, + to better use the resources and increase the efficiency + of the CPU. When multithreading is disabled, only + one thread is permitted to run on each core, which + can provide higher or more predictable performance + for some workloads. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) + is enabled on the instance. + type: boolean + numaNodesPerSocket: + description: 'The number of NUMA nodes per socket + (NPS). The following values are supported: * `NPS0` + * `NPS1` * `NPS2` * `NPS4`' + type: string + percentageOfCoresEnabled: + description: The percentage of cores enabled. Value + must be a multiple of 25%. If the requested percentage + results in a fractional number of cores, the system + rounds up the number of cores across processors + and provisions an instance with a whole number of + cores. If the applications that you run on the instance + use a core-based licensing model and need fewer + cores than the full size of the shape, you can disable + cores to reduce your licensing costs. The instance + itself is billed for the full shape, regardless + of whether all cores are enabled. + type: integer + type: object + amdVmPlatformConfig: + description: AmdMilanBmPlatformConfig describe AMD VM + platform configuration + properties: + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is + enabled on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential + instance. If this value is `true`, the instance + is a confidential instance. The default value is + `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the + instance. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) + is enabled on the instance. + type: boolean + type: object + intelIcelakeBmPlatformConfig: + description: AmdMilanBmPlatformConfig describe Intel Skylke + BM platform configuration + properties: + isInputOutputMemoryManagementUnitEnabled: + description: Whether the input-output memory management + unit is enabled. + type: boolean + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is + enabled on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential + instance. If this value is `true`, the instance + is a confidential instance. The default value is + `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the + instance. + type: boolean + isSymmetricMultiThreadingEnabled: + description: Whether symmetric multithreading is enabled + on the instance. Symmetric multithreading is also + called simultaneous multithreading (SMT) or Intel + Hyper-Threading. Intel and AMD processors have two + hardware execution threads per core (OCPU). SMT + permits multiple independent threads of execution, + to better use the resources and increase the efficiency + of the CPU. When multithreading is disabled, only + one thread is permitted to run on each core, which + can provide higher or more predictable performance + for some workloads. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) + is enabled on the instance. + type: boolean + numaNodesPerSocket: + description: 'The number of NUMA nodes per socket + (NPS). The following values are supported: * `NPS1` + * `NPS2`' + type: string + percentageOfCoresEnabled: + description: The percentage of cores enabled. Value + must be a multiple of 25%. If the requested percentage + results in a fractional number of cores, the system + rounds up the number of cores across processors + and provisions an instance with a whole number of + cores. If the applications that you run on the instance + use a core-based licensing model and need fewer + cores than the full size of the shape, you can disable + cores to reduce your licensing costs. The instance + itself is billed for the full shape, regardless + of whether all cores are enabled. + type: integer + type: object + intelSkylakeBmPlatformConfig: + description: AmdMilanBmPlatformConfig describe Intel Skylke + BM platform configuration + properties: + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is + enabled on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential + instance. If this value is `true`, the instance + is a confidential instance. The default value is + `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the + instance. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) + is enabled on the instance. + type: boolean + type: object + intelVmPlatformConfig: + description: AmdMilanBmPlatformConfig describe Intel VM + platform configuration + properties: + isMeasuredBootEnabled: + description: Whether the Measured Boot feature is + enabled on the instance. + type: boolean + isMemoryEncryptionEnabled: + description: Whether the instance is a confidential + instance. If this value is `true`, the instance + is a confidential instance. The default value is + `false`. + type: boolean + isSecureBootEnabled: + description: Whether Secure Boot is enabled on the + instance. + type: boolean + isTrustedPlatformModuleEnabled: + description: Whether the Trusted Platform Module (TPM) + is enabled on the instance. + type: boolean + type: object + platformConfigType: + description: The type of platform configuration. Valid + values are * `AMD_ROME_BM_GPU` * `AMD_ROME_BM` * `INTEL_ICELAKE_BM` + * `AMD_VM` * `INTEL_VM` * `INTEL_SKYLAKE_BM` * `AMD_MILAN_BM` + Based on the enum, exactly one of the specific configuration + types must be set + type: string + type: object + preemptibleInstanceConfig: + description: PreemptibleInstanceConfig Configuration options + for preemptible instances. + properties: + terminatePreemptionAction: + description: TerminatePreemptionAction terminates the + preemptible instance when it is interrupted for eviction. + properties: + preserveBootVolume: + description: PreserveBootVolume defines whether to + preserve the boot volume that was used to launch + the preemptible instance when the instance is terminated. + Defaults to false if not specified. + type: boolean + type: object + type: object + providerID: + description: Provider ID of the instance, this will be set + by Cluster API provider itself, users should not set this + parameter. + type: string + shape: + description: Shape of the instance. + type: string + shapeConfig: + description: The shape configuration of rhe instance, applicable + for flex instances. + properties: + baselineOcpuUtilization: + description: 'The baseline OCPU utilization for a subcore + burstable VM instance. Leave this attribute blank for + a non-burstable instance, or explicitly specify non-burstable + with `BASELINE_1_1`. The following values are supported: + - `BASELINE_1_8` - baseline usage is 1/8 of an OCPU. + - `BASELINE_1_2` - baseline usage is 1/2 of an OCPU. + - `BASELINE_1_1` - baseline usage is an entire OCPU. + This represents a non-burstable instance.' + type: string + memoryInGBs: + description: The total amount of memory available to the + instance, in gigabytes. + type: string + nvmes: + description: Nvmes defines the number of NVMe drives to + be used for storage. A single drive has 6.8 TB available. + type: integer + ocpus: + description: The total number of OCPUs available to the + instance. + type: string + type: object + subnetName: + description: The name of the subnet to use. The name here + refers to the subnets defined in the OCICluster Spec. Optional, + only if multiple subnets of a type is defined, else the + first element is used. + type: string + vnicAttachments: + description: VnicAttachments defines the configuration options + for the vnic(s) attached to the machine The network bandwidth + and number of VNICs scale proportionately with the number + of OCPUs. + items: + properties: + assignPublicIp: + description: AssignPublicIp defines whether the vnic + should have a public IP address + type: boolean + displayName: + description: DisplayName defines a user-friendly name. + Does not have to be unique. Avoid entering confidential + information. + type: string + nicIndex: + description: NicIndex defines which physical Network + Interface Card (NIC) to use You can determine which + NICs are active for a shape by reviewing the https://docs.oracle.com/en-us/iaas/Content/Compute/References/computeshapes.htm + type: integer + subnetName: + description: SubnetName defines the subnet name to use + for the VNIC Defaults to the "worker" subnet if not + provided + type: string + vnicAttachmentId: + description: VnicAttachmentId defines the ID of the + VnicAttachment + type: string + required: + - displayName + type: object + type: array + type: object + required: + - spec + type: object + required: + - template + type: object + type: object + served: true storage: true 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 c419c9df..cf1b3b07 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedclusters.yaml @@ -1084,6 +1084,1131 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v1beta2 + schema: + openAPIV3Schema: + description: OCIManagedCluster is the Schema for the ocimanagedclusters API. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: OCIManagedClusterSpec defines the desired state of OCI OKE + Cluster + properties: + availabilityDomains: + additionalProperties: + description: OCIAvailabilityDomain contains information about an + Availability Domain (AD). + properties: + faultDomains: + description: 'FaultDomains a list of fault domain (FD) names. + Example: ["FAULT-DOMAIN-1"]' + items: + type: string + type: array + name: + description: 'Name is the AD''s full name. Example: Uocm:PHX-AD-1' + type: string + type: object + description: 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. + type: object + compartmentId: + description: Compartment to create the cluster network. + type: string + controlPlaneEndpoint: + description: ControlPlaneEndpoint represents the endpoint used to + communicate with the control plane. This will not be set by the + user, this will be updated by the Cluster Reconciler after OKe cluster + has been created and the cluster has an endpoint address + properties: + host: + description: The hostname on which the API server is serving. + type: string + port: + description: The port on which the API server is serving. + format: int32 + type: integer + required: + - host + - port + type: object + definedTags: + additionalProperties: + additionalProperties: + type: string + type: object + description: 'Defined tags for this resource. Each key is predefined + and scoped to a namespace. For more information, see Resource Tags + (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + Example: `{"Operations": {"CostCenter": "42"}}`' + type: object + freeformTags: + additionalProperties: + type: string + description: Free-form tags for this resource. + type: object + identityRef: + description: IdentityRef is a reference to an identity(principal) + to be used when reconciling this cluster + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead of + an entire object, this string should contain a valid JSON/Go + field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within + a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" + (container with index 2 in this pod). This syntax is chosen + only to have some well-defined way of referencing a part of + an object. TODO: this design is not final and this field is + subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + networkSpec: + description: NetworkSpec encapsulates all things related to OCI network. + properties: + apiServerLoadBalancer: + description: API Server LB configuration. + properties: + loadBalancerId: + description: ID of Load Balancer. + type: string + name: + description: LoadBalancer Name. + type: string + type: object + skipNetworkManagement: + description: SkipNetworkManagement defines if the networking spec(VCN + related) specified by the user needs to be reconciled(actioned-upon) + or used as it is. APIServerLB will still be reconciled. + type: boolean + vcn: + description: VCN configuration. + properties: + cidr: + description: VCN CIDR. + type: string + id: + description: VCN OCID. + type: string + internetGateway: + description: Configuration for Internet Gateway. + properties: + id: + description: ID of Internet Gateway. + type: string + skip: + description: Skip specifies whether to skip creating internet + gateway even if any one Subnet is public. + type: boolean + type: object + name: + description: VCN Name. + type: string + natGateway: + description: Configuration for NAT Gateway. + properties: + id: + description: ID of Nat Gateway. + type: string + skip: + description: Skip specifies whether to skip creating NAT + gateway even if any one Subnet is private. + type: boolean + type: object + networkSecurityGroup: + description: Configuration for NSG management. + properties: + list: + description: NetworkSecurityGroup is the configuration + for the Network Security Groups required in the VCN. + items: + description: NSG defines configuration for a Network + Security Group. https://docs.oracle.com/en-us/iaas/Content/Network/Concepts/networksecuritygroups.htm + properties: + egressRules: + description: EgressRules on the NSG. + items: + description: EgressSecurityRuleForNSG is EgressSecurityRule + for NSG. + properties: + egressRule: + description: EgressSecurityRule A rule for + allowing outbound IP packets. + properties: + description: + description: An optional description of + your choice for the rule. + type: string + destination: + description: 'Conceptually, this is the + range of IP addresses that a packet + originating from the instance can go + to. Allowed values: * IP address range + in CIDR notation. For example: `192.168.1.0/24` + or `2001:0db8:0123:45::/56` Note that + IPv6 addressing is currently supported + only in certain regions. See IPv6 Addresses + (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + * The `cidrBlock` value for a Service, + if you''re setting up a security list + rule for traffic destined for a particular + `Service` through a service gateway. + For example: `oci-phx-objectstorage`.' + type: string + destinationType: + description: 'Type of destination for + the rule. The default is `CIDR_BLOCK`. + Allowed values: * `CIDR_BLOCK`: If the + rule''s `destination` is an IP address + range in CIDR notation. * `SERVICE_CIDR_BLOCK`: + If the rule''s `destination` is the + `cidrBlock` value for a Service (the + rule is for traffic destined for a particular + `Service` through a service gateway).' + type: string + icmpOptions: + description: 'IcmpOptions Optional and + valid only for ICMP and ICMPv6. Use + to specify a particular ICMP type and + code as defined in: - ICMP Parameters + (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) + - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) + If you specify ICMP or ICMPv6 as the + protocol but omit this object, then + all ICMP types and codes are allowed. + If you do provide this object, the type + is required and the code is optional. + To enable MTU negotiation for ingress + internet traffic via IPv4, make sure + to allow type 3 ("Destination Unreachable") + code 4 ("Fragmentation Needed and Don''t + Fragment was Set"). If you need to specify + multiple codes for a single type, create + a separate security list rule for each.' + properties: + code: + description: The ICMP code (optional). + type: integer + type: + description: The ICMP type. + type: integer + type: object + isStateless: + description: A stateless rule allows traffic + in one direction. Remember to add a + corresponding stateless rule in the + other direction if you need to support + bidirectional traffic. For example, + if egress traffic allows TCP destination + port 80, there should be an ingress + rule to allow TCP source port 80. Defaults + to false, which means the rule is stateful + and a corresponding rule is not necessary + for bidirectional traffic. + type: boolean + protocol: + description: The transport protocol. Specify + either `all` or an IPv4 protocol number + as defined in Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + Options are supported only for ICMP + ("1"), TCP ("6"), UDP ("17"), and ICMPv6 + ("58"). + type: string + tcpOptions: + description: TcpOptions Optional and valid + only for TCP. Use to specify particular + destination ports for TCP rules. If + you specify TCP as the protocol but + omit this object, then all destination + ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be less + than the minimum port number. + To specify a single port number, + set both the min and max to + the same value. + type: integer + min: + description: The minimum port + number, which must not be greater + than the maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be less + than the minimum port number. + To specify a single port number, + set both the min and max to + the same value. + type: integer + min: + description: The minimum port + number, which must not be greater + than the maximum port number. + type: integer + type: object + type: object + udpOptions: + description: UdpOptions Optional and valid + only for UDP. Use to specify particular + destination ports for UDP rules. If + you specify UDP as the protocol but + omit this object, then all destination + ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be less + than the minimum port number. + To specify a single port number, + set both the min and max to + the same value. + type: integer + min: + description: The minimum port + number, which must not be greater + than the maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be less + than the minimum port number. + To specify a single port number, + set both the min and max to + the same value. + type: integer + min: + description: The minimum port + number, which must not be greater + than the maximum port number. + type: integer + type: object + type: object + type: object + type: object + type: array + id: + description: NSG OCID. + type: string + ingressRules: + description: IngressRules on the NSG. + items: + description: IngressSecurityRuleForNSG is IngressSecurityRule + for NSG + properties: + ingressRule: + description: IngressSecurityRule A rule for + allowing inbound IP packets. + properties: + description: + description: An optional description of + your choice for the rule. + type: string + icmpOptions: + description: 'IcmpOptions Optional and + valid only for ICMP and ICMPv6. Use + to specify a particular ICMP type and + code as defined in: - ICMP Parameters + (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) + - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) + If you specify ICMP or ICMPv6 as the + protocol but omit this object, then + all ICMP types and codes are allowed. + If you do provide this object, the type + is required and the code is optional. + To enable MTU negotiation for ingress + internet traffic via IPv4, make sure + to allow type 3 ("Destination Unreachable") + code 4 ("Fragmentation Needed and Don''t + Fragment was Set"). If you need to specify + multiple codes for a single type, create + a separate security list rule for each.' + properties: + code: + description: The ICMP code (optional). + type: integer + type: + description: The ICMP type. + type: integer + type: object + isStateless: + description: A stateless rule allows traffic + in one direction. Remember to add a + corresponding stateless rule in the + other direction if you need to support + bidirectional traffic. For example, + if ingress traffic allows TCP destination + port 80, there should be an egress rule + to allow TCP source port 80. Defaults + to false, which means the rule is stateful + and a corresponding rule is not necessary + for bidirectional traffic. + type: boolean + protocol: + description: The transport protocol. Specify + either `all` or an IPv4 protocol number + as defined in Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + Options are supported only for ICMP + ("1"), TCP ("6"), UDP ("17"), and ICMPv6 + ("58"). + type: string + source: + description: 'Conceptually, this is the + range of IP addresses that a packet + coming into the instance can come from. + Allowed values: * IP address range in + CIDR notation. For example: `192.168.1.0/24` + or `2001:0db8:0123:45::/56`. IPv6 addressing + is supported for all commercial and + government regions. See IPv6 Addresses + (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + * The `cidrBlock` value for a Service, + if you''re setting up a security list + rule for traffic coming from a particular + `Service` through a service gateway. + For example: `oci-phx-objectstorage`.' + type: string + sourceType: + description: 'Type of source for the rule. + The default is `CIDR_BLOCK`. * `CIDR_BLOCK`: + If the rule''s `source` is an IP address + range in CIDR notation. * `SERVICE_CIDR_BLOCK`: + If the rule''s `source` is the `cidrBlock` + value for a Service (the rule is for + traffic coming from a particular `Service` + through a service gateway).' + type: string + tcpOptions: + description: TcpOptions Optional and valid + only for TCP. Use to specify particular + destination ports for TCP rules. If + you specify TCP as the protocol but + omit this object, then all destination + ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be less + than the minimum port number. + To specify a single port number, + set both the min and max to + the same value. + type: integer + min: + description: The minimum port + number, which must not be greater + than the maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be less + than the minimum port number. + To specify a single port number, + set both the min and max to + the same value. + type: integer + min: + description: The minimum port + number, which must not be greater + than the maximum port number. + type: integer + type: object + type: object + udpOptions: + description: UdpOptions Optional and valid + only for UDP. Use to specify particular + destination ports for UDP rules. If + you specify UDP as the protocol but + omit this object, then all destination + ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be less + than the minimum port number. + To specify a single port number, + set both the min and max to + the same value. + type: integer + min: + description: The minimum port + number, which must not be greater + than the maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be less + than the minimum port number. + To specify a single port number, + set both the min and max to + the same value. + type: integer + min: + description: The minimum port + number, which must not be greater + than the maximum port number. + type: integer + type: object + type: object + type: object + type: object + type: array + name: + description: NSG Name. + type: string + role: + description: Role defines the NSG role (eg. control-plane, + control-plane-endpoint, service-lb, worker). + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + skip: + description: Skip specifies whether to skip creating network + security groups. + type: boolean + type: object + routeTable: + description: Configuration for Route table. + properties: + privateRouteTableId: + description: ID of Private Route Table. + type: string + publicRouteTableId: + description: ID of Public Route Table. + type: string + skip: + description: Skip specifies whether to skip creating Route + table. + type: boolean + type: object + serviceGateway: + description: Configuration for Service Gateway. + properties: + id: + description: ID of Service Gateway. + type: string + skip: + description: Skip specifies whether to skip creating Service + gateway. + type: boolean + type: object + subnets: + description: Subnets is the configuration for subnets required + in the VCN. + items: + description: Subnet defines the configuration for a network's + subnet https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/managingVCNs_topic-Overview_of_VCNs_and_Subnets.htm#Overview + properties: + cidr: + description: Subnet CIDR. + type: string + id: + description: Subnet OCID. + type: string + name: + description: Subnet Name. + type: string + role: + description: Role defines the subnet role (eg. control-plane, + control-plane-endpoint, service-lb, worker). + type: string + securityList: + description: The security list associated with Subnet. + properties: + egressRules: + description: EgressRules on the SecurityList. + items: + description: EgressSecurityRule A rule for allowing + outbound IP packets. + properties: + description: + description: An optional description of your + choice for the rule. + type: string + destination: + description: 'Conceptually, this is the range + of IP addresses that a packet originating + from the instance can go to. Allowed values: + * IP address range in CIDR notation. For + example: `192.168.1.0/24` or `2001:0db8:0123:45::/56` + Note that IPv6 addressing is currently supported + only in certain regions. See IPv6 Addresses + (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + * The `cidrBlock` value for a Service, if + you''re setting up a security list rule + for traffic destined for a particular `Service` + through a service gateway. For example: + `oci-phx-objectstorage`.' + type: string + destinationType: + description: 'Type of destination for the + rule. The default is `CIDR_BLOCK`. Allowed + values: * `CIDR_BLOCK`: If the rule''s `destination` + is an IP address range in CIDR notation. + * `SERVICE_CIDR_BLOCK`: If the rule''s `destination` + is the `cidrBlock` value for a Service (the + rule is for traffic destined for a particular + `Service` through a service gateway).' + type: string + icmpOptions: + description: 'IcmpOptions Optional and valid + only for ICMP and ICMPv6. Use to specify + a particular ICMP type and code as defined + in: - ICMP Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) + - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) + If you specify ICMP or ICMPv6 as the protocol + but omit this object, then all ICMP types + and codes are allowed. If you do provide + this object, the type is required and the + code is optional. To enable MTU negotiation + for ingress internet traffic via IPv4, make + sure to allow type 3 ("Destination Unreachable") + code 4 ("Fragmentation Needed and Don''t + Fragment was Set"). If you need to specify + multiple codes for a single type, create + a separate security list rule for each.' + properties: + code: + description: The ICMP code (optional). + type: integer + type: + description: The ICMP type. + type: integer + type: object + isStateless: + description: A stateless rule allows traffic + in one direction. Remember to add a corresponding + stateless rule in the other direction if + you need to support bidirectional traffic. + For example, if egress traffic allows TCP + destination port 80, there should be an + ingress rule to allow TCP source port 80. + Defaults to false, which means the rule + is stateful and a corresponding rule is + not necessary for bidirectional traffic. + type: boolean + protocol: + description: The transport protocol. Specify + either `all` or an IPv4 protocol number + as defined in Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + Options are supported only for ICMP ("1"), + TCP ("6"), UDP ("17"), and ICMPv6 ("58"). + type: string + tcpOptions: + description: TcpOptions Optional and valid + only for TCP. Use to specify particular + destination ports for TCP rules. If you + specify TCP as the protocol but omit this + object, then all destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port number, + which must not be less than the + minimum port number. To specify + a single port number, set both the + min and max to the same value. + type: integer + min: + description: The minimum port number, + which must not be greater than the + maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port number, + which must not be less than the + minimum port number. To specify + a single port number, set both the + min and max to the same value. + type: integer + min: + description: The minimum port number, + which must not be greater than the + maximum port number. + type: integer + type: object + type: object + udpOptions: + description: UdpOptions Optional and valid + only for UDP. Use to specify particular + destination ports for UDP rules. If you + specify UDP as the protocol but omit this + object, then all destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port number, + which must not be less than the + minimum port number. To specify + a single port number, set both the + min and max to the same value. + type: integer + min: + description: The minimum port number, + which must not be greater than the + maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port number, + which must not be less than the + minimum port number. To specify + a single port number, set both the + min and max to the same value. + type: integer + min: + description: The minimum port number, + which must not be greater than the + maximum port number. + type: integer + type: object + type: object + type: object + type: array + id: + description: ID of the SecurityList. + type: string + ingressRules: + description: IngressRules on the SecurityList. + items: + description: IngressSecurityRule A rule for allowing + inbound IP packets. + properties: + description: + description: An optional description of your + choice for the rule. + type: string + icmpOptions: + description: 'IcmpOptions Optional and valid + only for ICMP and ICMPv6. Use to specify + a particular ICMP type and code as defined + in: - ICMP Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) + - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) + If you specify ICMP or ICMPv6 as the protocol + but omit this object, then all ICMP types + and codes are allowed. If you do provide + this object, the type is required and the + code is optional. To enable MTU negotiation + for ingress internet traffic via IPv4, make + sure to allow type 3 ("Destination Unreachable") + code 4 ("Fragmentation Needed and Don''t + Fragment was Set"). If you need to specify + multiple codes for a single type, create + a separate security list rule for each.' + properties: + code: + description: The ICMP code (optional). + type: integer + type: + description: The ICMP type. + type: integer + type: object + isStateless: + description: A stateless rule allows traffic + in one direction. Remember to add a corresponding + stateless rule in the other direction if + you need to support bidirectional traffic. + For example, if ingress traffic allows TCP + destination port 80, there should be an + egress rule to allow TCP source port 80. + Defaults to false, which means the rule + is stateful and a corresponding rule is + not necessary for bidirectional traffic. + type: boolean + protocol: + description: The transport protocol. Specify + either `all` or an IPv4 protocol number + as defined in Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + Options are supported only for ICMP ("1"), + TCP ("6"), UDP ("17"), and ICMPv6 ("58"). + type: string + source: + description: 'Conceptually, this is the range + of IP addresses that a packet coming into + the instance can come from. Allowed values: + * IP address range in CIDR notation. For + example: `192.168.1.0/24` or `2001:0db8:0123:45::/56`. + IPv6 addressing is supported for all commercial + and government regions. See IPv6 Addresses + (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + * The `cidrBlock` value for a Service, if + you''re setting up a security list rule + for traffic coming from a particular `Service` + through a service gateway. For example: + `oci-phx-objectstorage`.' + type: string + sourceType: + description: 'Type of source for the rule. + The default is `CIDR_BLOCK`. * `CIDR_BLOCK`: + If the rule''s `source` is an IP address + range in CIDR notation. * `SERVICE_CIDR_BLOCK`: + If the rule''s `source` is the `cidrBlock` + value for a Service (the rule is for traffic + coming from a particular `Service` through + a service gateway).' + type: string + tcpOptions: + description: TcpOptions Optional and valid + only for TCP. Use to specify particular + destination ports for TCP rules. If you + specify TCP as the protocol but omit this + object, then all destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port number, + which must not be less than the + minimum port number. To specify + a single port number, set both the + min and max to the same value. + type: integer + min: + description: The minimum port number, + which must not be greater than the + maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port number, + which must not be less than the + minimum port number. To specify + a single port number, set both the + min and max to the same value. + type: integer + min: + description: The minimum port number, + which must not be greater than the + maximum port number. + type: integer + type: object + type: object + udpOptions: + description: UdpOptions Optional and valid + only for UDP. Use to specify particular + destination ports for UDP rules. If you + specify UDP as the protocol but omit this + object, then all destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port number, + which must not be less than the + minimum port number. To specify + a single port number, set both the + min and max to the same value. + type: integer + min: + description: The minimum port number, + which must not be greater than the + maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port number, + which must not be less than the + minimum port number. To specify + a single port number, set both the + min and max to the same value. + type: integer + min: + description: The minimum port number, + which must not be greater than the + maximum port number. + type: integer + type: object + type: object + type: object + type: array + name: + description: SecurityList Name. + type: string + type: object + type: + description: Type defines the subnet type (e.g. public, + private). + type: string + required: + - name + - role + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + type: object + vcnPeering: + description: VCNPeering configuration. + properties: + drg: + description: DRG configuration refers to the DRG which has + to be created if required. If management cluster and workload + cluster shares the same DRG, this fields is not required + to be specified. + properties: + id: + description: ID is the OCID for the created DRG. + type: string + manage: + description: Manage defines whether the DRG has to be + managed(including create). If set to false(the default) + the ID has to be specified by the user to a valid DRG + ID to which the VCN has to be attached. + type: boolean + name: + description: Name is the name of the created DRG. + type: string + vcnAttachmentId: + description: VcnAttachmentId is the ID of the VCN attachment + of the DRG. The workload cluster VCN can be attached + to either the management cluster VCN if they are sharing + the same DRG or to the workload cluster DRG. + type: string + type: object + peerRouteRules: + description: PeerRouteRules defines the routing rules which + will be added to the private route tables of the workload + cluster VCN. The routes defined here will be directed to + DRG. + items: + description: PeerRouteRule defines a Route Rule to be routed + via a DRG. + properties: + vcnCIDRRange: + description: VCNCIDRRange is the CIDR Range of peer + VCN to which the workload cluster VCN will be peered. + The CIDR range is required to add the route rule in + the workload cluster VCN, the route rule will forward + any traffic to the CIDR to the DRG. + type: string + type: object + type: array + remotePeeringConnections: + description: RemotePeeringConnections defines the RPC connections + which be established with the workload cluster DRG. + items: + description: RemotePeeringConnection is used to peer VCNs + residing in different regions(typically). Remote VCN Peering + is explained here - https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/remoteVCNpeering.htm + properties: + managePeerRPC: + description: ManagePeerRPC will define if the Peer VCN + needs to be managed. If set to true a Remote Peering + Connection will be created in the Peer DRG and the + connection will be created between local and peer + RPC. + type: boolean + peerDRGId: + description: PeerDRGId defines the DRG ID of the peer. + type: string + peerRPCConnectionId: + description: PeerRPCConnectionId defines the RPC ID + of peer. If ManagePeerRPC is set to true this will + be created by Cluster API Provider for OCI, otherwise + this has be defined by the user. + type: string + peerRegionName: + description: PeerRegionName defined the region name + of Peer VCN. + type: string + rpcConnectionId: + description: RPCConnectionId is the connection ID of + the connection between peer and local RPC. + type: string + type: object + type: array + type: object + type: object + ociResourceIdentifier: + description: The unique ID which will be used to tag all the resources + created by this Cluster. The tag will be used to identify resources + belonging to this cluster. this will be auto-generated and should + not be set by the user. + type: string + region: + description: Region the cluster operates in. It must be one of available + regions in Region Identifier format. See https://docs.oracle.com/en-us/iaas/Content/General/Concepts/regions.htm + type: string + type: object + status: + description: OCIManagedClusterStatus defines the observed state of OCICluster + properties: + conditions: + description: NetworkSpec encapsulates all things related to OCI network. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + failureDomains: + additionalProperties: + description: FailureDomainSpec is the Schema for Cluster API failure + domains. It allows controllers to understand how many failure + domains a cluster can optionally span across. + properties: + attributes: + additionalProperties: + type: string + description: Attributes is a free form map of attributes an + infrastructure provider might use or require. + type: object + controlPlane: + description: ControlPlane determines if this failure domain + is suitable for use by control plane machines. + type: boolean + type: object + description: FailureDomains is a slice of FailureDomains. + type: object + ready: + type: boolean + type: object + type: object + served: true storage: true subresources: status: {} 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 d5f8d76a..4f9fcf54 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedclustertemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedclustertemplates.yaml @@ -1132,3 +1132,1196 @@ spec: type: object served: true storage: true + - name: v1beta2 + schema: + openAPIV3Schema: + description: OCIManagedClusterTemplate is the Schema for the ocimanagedclustertemplates + API. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: OCIManagedClusterTemplateSpec defines the desired state of + OCIManagedClusterTemplate. + properties: + template: + description: OCIManagedClusterSpec describes the data needed to create + an OCIManagedCluster from a template. + properties: + spec: + description: OCIManagedClusterSpec defines the desired state of + OCI OKE Cluster + properties: + availabilityDomains: + additionalProperties: + description: OCIAvailabilityDomain contains information + about an Availability Domain (AD). + properties: + faultDomains: + description: 'FaultDomains a list of fault domain (FD) + names. Example: ["FAULT-DOMAIN-1"]' + items: + type: string + type: array + name: + description: 'Name is the AD''s full name. Example: + Uocm:PHX-AD-1' + type: string + type: object + description: 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. + type: object + compartmentId: + description: Compartment to create the cluster network. + type: string + controlPlaneEndpoint: + description: ControlPlaneEndpoint represents the endpoint + used to communicate with the control plane. This will not + be set by the user, this will be updated by the Cluster + Reconciler after OKe cluster has been created and the cluster + has an endpoint address + properties: + host: + description: The hostname on which the API server is serving. + type: string + port: + description: The port on which the API server is serving. + format: int32 + type: integer + required: + - host + - port + type: object + definedTags: + additionalProperties: + additionalProperties: + type: string + type: object + description: 'Defined tags for this resource. Each key is + predefined and scoped to a namespace. For more information, + see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + Example: `{"Operations": {"CostCenter": "42"}}`' + type: object + freeformTags: + additionalProperties: + type: string + description: Free-form tags for this resource. + type: object + identityRef: + description: IdentityRef is a reference to an identity(principal) + to be used when reconciling this cluster + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead + of an entire object, this string should contain a valid + JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container + within a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that + triggered the event) or if no container name is specified + "spec.containers[2]" (container with index 2 in this + pod). This syntax is chosen only to have some well-defined + way of referencing a part of an object. TODO: this design + is not final and this field is subject to change in + the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + networkSpec: + description: NetworkSpec encapsulates all things related to + OCI network. + properties: + apiServerLoadBalancer: + description: API Server LB configuration. + properties: + loadBalancerId: + description: ID of Load Balancer. + type: string + name: + description: LoadBalancer Name. + type: string + type: object + skipNetworkManagement: + description: SkipNetworkManagement defines if the networking + spec(VCN related) specified by the user needs to be + reconciled(actioned-upon) or used as it is. APIServerLB + will still be reconciled. + type: boolean + vcn: + description: VCN configuration. + properties: + cidr: + description: VCN CIDR. + type: string + id: + description: VCN OCID. + type: string + internetGateway: + description: Configuration for Internet Gateway. + properties: + id: + description: ID of Internet Gateway. + type: string + skip: + description: Skip specifies whether to skip creating + internet gateway even if any one Subnet is public. + type: boolean + type: object + name: + description: VCN Name. + type: string + natGateway: + description: Configuration for NAT Gateway. + properties: + id: + description: ID of Nat Gateway. + type: string + skip: + description: Skip specifies whether to skip creating + NAT gateway even if any one Subnet is private. + type: boolean + type: object + networkSecurityGroup: + description: Configuration for NSG management. + properties: + list: + description: NetworkSecurityGroup is the configuration + for the Network Security Groups required in + the VCN. + items: + description: NSG defines configuration for a + Network Security Group. https://docs.oracle.com/en-us/iaas/Content/Network/Concepts/networksecuritygroups.htm + properties: + egressRules: + description: EgressRules on the NSG. + items: + description: EgressSecurityRuleForNSG + is EgressSecurityRule for NSG. + properties: + egressRule: + description: EgressSecurityRule A + rule for allowing outbound IP packets. + properties: + description: + description: An optional description + of your choice for the rule. + type: string + destination: + description: 'Conceptually, this + is the range of IP addresses + that a packet originating from + the instance can go to. Allowed + values: * IP address range in + CIDR notation. For example: + `192.168.1.0/24` or `2001:0db8:0123:45::/56` + Note that IPv6 addressing is + currently supported only in + certain regions. See IPv6 Addresses + (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + * The `cidrBlock` value for + a Service, if you''re setting + up a security list rule for + traffic destined for a particular + `Service` through a service + gateway. For example: `oci-phx-objectstorage`.' + type: string + destinationType: + description: 'Type of destination + for the rule. The default is + `CIDR_BLOCK`. Allowed values: + * `CIDR_BLOCK`: If the rule''s + `destination` is an IP address + range in CIDR notation. * `SERVICE_CIDR_BLOCK`: + If the rule''s `destination` + is the `cidrBlock` value for + a Service (the rule is for traffic + destined for a particular `Service` + through a service gateway).' + type: string + icmpOptions: + description: 'IcmpOptions Optional + and valid only for ICMP and + ICMPv6. Use to specify a particular + ICMP type and code as defined + in: - ICMP Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) + - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) + If you specify ICMP or ICMPv6 + as the protocol but omit this + object, then all ICMP types + and codes are allowed. If you + do provide this object, the + type is required and the code + is optional. To enable MTU negotiation + for ingress internet traffic + via IPv4, make sure to allow + type 3 ("Destination Unreachable") + code 4 ("Fragmentation Needed + and Don''t Fragment was Set"). + If you need to specify multiple + codes for a single type, create + a separate security list rule + for each.' + properties: + code: + description: The ICMP code + (optional). + type: integer + type: + description: The ICMP type. + type: integer + type: object + isStateless: + description: A stateless rule + allows traffic in one direction. + Remember to add a corresponding + stateless rule in the other + direction if you need to support + bidirectional traffic. For example, + if egress traffic allows TCP + destination port 80, there should + be an ingress rule to allow + TCP source port 80. Defaults + to false, which means the rule + is stateful and a corresponding + rule is not necessary for bidirectional + traffic. + type: boolean + protocol: + description: The transport protocol. + Specify either `all` or an IPv4 + protocol number as defined in + Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + Options are supported only for + ICMP ("1"), TCP ("6"), UDP ("17"), + and ICMPv6 ("58"). + type: string + tcpOptions: + description: TcpOptions Optional + and valid only for TCP. Use + to specify particular destination + ports for TCP rules. If you + specify TCP as the protocol + but omit this object, then all + destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The + representation of PortRange. + properties: + max: + description: The maximum + port number, which must + not be less than the + minimum port number. + To specify a single + port number, set both + the min and max to the + same value. + type: integer + min: + description: The minimum + port number, which must + not be greater than + the maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The + representation of PortRange. + properties: + max: + description: The maximum + port number, which must + not be less than the + minimum port number. + To specify a single + port number, set both + the min and max to the + same value. + type: integer + min: + description: The minimum + port number, which must + not be greater than + the maximum port number. + type: integer + type: object + type: object + udpOptions: + description: UdpOptions Optional + and valid only for UDP. Use + to specify particular destination + ports for UDP rules. If you + specify UDP as the protocol + but omit this object, then all + destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The + representation of PortRange. + properties: + max: + description: The maximum + port number, which must + not be less than the + minimum port number. + To specify a single + port number, set both + the min and max to the + same value. + type: integer + min: + description: The minimum + port number, which must + not be greater than + the maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The + representation of PortRange. + properties: + max: + description: The maximum + port number, which must + not be less than the + minimum port number. + To specify a single + port number, set both + the min and max to the + same value. + type: integer + min: + description: The minimum + port number, which must + not be greater than + the maximum port number. + type: integer + type: object + type: object + type: object + type: object + type: array + id: + description: NSG OCID. + type: string + ingressRules: + description: IngressRules on the NSG. + items: + description: IngressSecurityRuleForNSG + is IngressSecurityRule for NSG + properties: + ingressRule: + description: IngressSecurityRule A + rule for allowing inbound IP packets. + properties: + description: + description: An optional description + of your choice for the rule. + type: string + icmpOptions: + description: 'IcmpOptions Optional + and valid only for ICMP and + ICMPv6. Use to specify a particular + ICMP type and code as defined + in: - ICMP Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) + - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) + If you specify ICMP or ICMPv6 + as the protocol but omit this + object, then all ICMP types + and codes are allowed. If you + do provide this object, the + type is required and the code + is optional. To enable MTU negotiation + for ingress internet traffic + via IPv4, make sure to allow + type 3 ("Destination Unreachable") + code 4 ("Fragmentation Needed + and Don''t Fragment was Set"). + If you need to specify multiple + codes for a single type, create + a separate security list rule + for each.' + properties: + code: + description: The ICMP code + (optional). + type: integer + type: + description: The ICMP type. + type: integer + type: object + isStateless: + description: A stateless rule + allows traffic in one direction. + Remember to add a corresponding + stateless rule in the other + direction if you need to support + bidirectional traffic. For example, + if ingress traffic allows TCP + destination port 80, there should + be an egress rule to allow TCP + source port 80. Defaults to + false, which means the rule + is stateful and a corresponding + rule is not necessary for bidirectional + traffic. + type: boolean + protocol: + description: The transport protocol. + Specify either `all` or an IPv4 + protocol number as defined in + Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + Options are supported only for + ICMP ("1"), TCP ("6"), UDP ("17"), + and ICMPv6 ("58"). + type: string + source: + description: 'Conceptually, this + is the range of IP addresses + that a packet coming into the + instance can come from. Allowed + values: * IP address range in + CIDR notation. For example: + `192.168.1.0/24` or `2001:0db8:0123:45::/56`. + IPv6 addressing is supported + for all commercial and government + regions. See IPv6 Addresses + (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + * The `cidrBlock` value for + a Service, if you''re setting + up a security list rule for + traffic coming from a particular + `Service` through a service + gateway. For example: `oci-phx-objectstorage`.' + type: string + sourceType: + description: 'Type of source for + the rule. The default is `CIDR_BLOCK`. + * `CIDR_BLOCK`: If the rule''s + `source` is an IP address range + in CIDR notation. * `SERVICE_CIDR_BLOCK`: + If the rule''s `source` is the + `cidrBlock` value for a Service + (the rule is for traffic coming + from a particular `Service` + through a service gateway).' + type: string + tcpOptions: + description: TcpOptions Optional + and valid only for TCP. Use + to specify particular destination + ports for TCP rules. If you + specify TCP as the protocol + but omit this object, then all + destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The + representation of PortRange. + properties: + max: + description: The maximum + port number, which must + not be less than the + minimum port number. + To specify a single + port number, set both + the min and max to the + same value. + type: integer + min: + description: The minimum + port number, which must + not be greater than + the maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The + representation of PortRange. + properties: + max: + description: The maximum + port number, which must + not be less than the + minimum port number. + To specify a single + port number, set both + the min and max to the + same value. + type: integer + min: + description: The minimum + port number, which must + not be greater than + the maximum port number. + type: integer + type: object + type: object + udpOptions: + description: UdpOptions Optional + and valid only for UDP. Use + to specify particular destination + ports for UDP rules. If you + specify UDP as the protocol + but omit this object, then all + destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The + representation of PortRange. + properties: + max: + description: The maximum + port number, which must + not be less than the + minimum port number. + To specify a single + port number, set both + the min and max to the + same value. + type: integer + min: + description: The minimum + port number, which must + not be greater than + the maximum port number. + type: integer + type: object + sourcePortRange: + description: PortRange The + representation of PortRange. + properties: + max: + description: The maximum + port number, which must + not be less than the + minimum port number. + To specify a single + port number, set both + the min and max to the + same value. + type: integer + min: + description: The minimum + port number, which must + not be greater than + the maximum port number. + type: integer + type: object + type: object + type: object + type: object + type: array + name: + description: NSG Name. + type: string + role: + description: Role defines the NSG role (eg. + control-plane, control-plane-endpoint, + service-lb, worker). + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + skip: + description: Skip specifies whether to skip creating + network security groups. + type: boolean + type: object + routeTable: + description: Configuration for Route table. + properties: + privateRouteTableId: + description: ID of Private Route Table. + type: string + publicRouteTableId: + description: ID of Public Route Table. + type: string + skip: + description: Skip specifies whether to skip creating + Route table. + type: boolean + type: object + serviceGateway: + description: Configuration for Service Gateway. + properties: + id: + description: ID of Service Gateway. + type: string + skip: + description: Skip specifies whether to skip creating + Service gateway. + type: boolean + type: object + subnets: + description: Subnets is the configuration for subnets + required in the VCN. + items: + description: Subnet defines the configuration for + a network's subnet https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/managingVCNs_topic-Overview_of_VCNs_and_Subnets.htm#Overview + properties: + cidr: + description: Subnet CIDR. + type: string + id: + description: Subnet OCID. + type: string + name: + description: Subnet Name. + type: string + role: + description: Role defines the subnet role (eg. + control-plane, control-plane-endpoint, service-lb, + worker). + type: string + securityList: + description: The security list associated with + Subnet. + properties: + egressRules: + description: EgressRules on the SecurityList. + items: + description: EgressSecurityRule A rule + for allowing outbound IP packets. + properties: + description: + description: An optional description + of your choice for the rule. + type: string + destination: + description: 'Conceptually, this is + the range of IP addresses that a + packet originating from the instance + can go to. Allowed values: * IP + address range in CIDR notation. + For example: `192.168.1.0/24` or + `2001:0db8:0123:45::/56` Note that + IPv6 addressing is currently supported + only in certain regions. See IPv6 + Addresses (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + * The `cidrBlock` value for a Service, + if you''re setting up a security + list rule for traffic destined for + a particular `Service` through a + service gateway. For example: `oci-phx-objectstorage`.' + type: string + destinationType: + description: 'Type of destination + for the rule. The default is `CIDR_BLOCK`. + Allowed values: * `CIDR_BLOCK`: + If the rule''s `destination` is + an IP address range in CIDR notation. + * `SERVICE_CIDR_BLOCK`: If the rule''s + `destination` is the `cidrBlock` + value for a Service (the rule is + for traffic destined for a particular + `Service` through a service gateway).' + type: string + icmpOptions: + description: 'IcmpOptions Optional + and valid only for ICMP and ICMPv6. + Use to specify a particular ICMP + type and code as defined in: - ICMP + Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) + - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) + If you specify ICMP or ICMPv6 as + the protocol but omit this object, + then all ICMP types and codes are + allowed. If you do provide this + object, the type is required and + the code is optional. To enable + MTU negotiation for ingress internet + traffic via IPv4, make sure to allow + type 3 ("Destination Unreachable") + code 4 ("Fragmentation Needed and + Don''t Fragment was Set"). If you + need to specify multiple codes for + a single type, create a separate + security list rule for each.' + properties: + code: + description: The ICMP code (optional). + type: integer + type: + description: The ICMP type. + type: integer + type: object + isStateless: + description: A stateless rule allows + traffic in one direction. Remember + to add a corresponding stateless + rule in the other direction if you + need to support bidirectional traffic. + For example, if egress traffic allows + TCP destination port 80, there should + be an ingress rule to allow TCP + source port 80. Defaults to false, + which means the rule is stateful + and a corresponding rule is not + necessary for bidirectional traffic. + type: boolean + protocol: + description: The transport protocol. + Specify either `all` or an IPv4 + protocol number as defined in Protocol + Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + Options are supported only for ICMP + ("1"), TCP ("6"), UDP ("17"), and + ICMPv6 ("58"). + type: string + tcpOptions: + description: TcpOptions Optional and + valid only for TCP. Use to specify + particular destination ports for + TCP rules. If you specify TCP as + the protocol but omit this object, + then all destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be + less than the minimum port + number. To specify a single + port number, set both the + min and max to the same + value. + type: integer + min: + description: The minimum port + number, which must not be + greater than the maximum + port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be + less than the minimum port + number. To specify a single + port number, set both the + min and max to the same + value. + type: integer + min: + description: The minimum port + number, which must not be + greater than the maximum + port number. + type: integer + type: object + type: object + udpOptions: + description: UdpOptions Optional and + valid only for UDP. Use to specify + particular destination ports for + UDP rules. If you specify UDP as + the protocol but omit this object, + then all destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be + less than the minimum port + number. To specify a single + port number, set both the + min and max to the same + value. + type: integer + min: + description: The minimum port + number, which must not be + greater than the maximum + port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be + less than the minimum port + number. To specify a single + port number, set both the + min and max to the same + value. + type: integer + min: + description: The minimum port + number, which must not be + greater than the maximum + port number. + type: integer + type: object + type: object + type: object + type: array + id: + description: ID of the SecurityList. + type: string + ingressRules: + description: IngressRules on the SecurityList. + items: + description: IngressSecurityRule A rule + for allowing inbound IP packets. + properties: + description: + description: An optional description + of your choice for the rule. + type: string + icmpOptions: + description: 'IcmpOptions Optional + and valid only for ICMP and ICMPv6. + Use to specify a particular ICMP + type and code as defined in: - ICMP + Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) + - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) + If you specify ICMP or ICMPv6 as + the protocol but omit this object, + then all ICMP types and codes are + allowed. If you do provide this + object, the type is required and + the code is optional. To enable + MTU negotiation for ingress internet + traffic via IPv4, make sure to allow + type 3 ("Destination Unreachable") + code 4 ("Fragmentation Needed and + Don''t Fragment was Set"). If you + need to specify multiple codes for + a single type, create a separate + security list rule for each.' + properties: + code: + description: The ICMP code (optional). + type: integer + type: + description: The ICMP type. + type: integer + type: object + isStateless: + description: A stateless rule allows + traffic in one direction. Remember + to add a corresponding stateless + rule in the other direction if you + need to support bidirectional traffic. + For example, if ingress traffic + allows TCP destination port 80, + there should be an egress rule to + allow TCP source port 80. Defaults + to false, which means the rule is + stateful and a corresponding rule + is not necessary for bidirectional + traffic. + type: boolean + protocol: + description: The transport protocol. + Specify either `all` or an IPv4 + protocol number as defined in Protocol + Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + Options are supported only for ICMP + ("1"), TCP ("6"), UDP ("17"), and + ICMPv6 ("58"). + type: string + source: + description: 'Conceptually, this is + the range of IP addresses that a + packet coming into the instance + can come from. Allowed values: * + IP address range in CIDR notation. + For example: `192.168.1.0/24` or + `2001:0db8:0123:45::/56`. IPv6 addressing + is supported for all commercial + and government regions. See IPv6 + Addresses (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). + * The `cidrBlock` value for a Service, + if you''re setting up a security + list rule for traffic coming from + a particular `Service` through a + service gateway. For example: `oci-phx-objectstorage`.' + type: string + sourceType: + description: 'Type of source for the + rule. The default is `CIDR_BLOCK`. + * `CIDR_BLOCK`: If the rule''s `source` + is an IP address range in CIDR notation. + * `SERVICE_CIDR_BLOCK`: If the rule''s + `source` is the `cidrBlock` value + for a Service (the rule is for traffic + coming from a particular `Service` + through a service gateway).' + type: string + tcpOptions: + description: TcpOptions Optional and + valid only for TCP. Use to specify + particular destination ports for + TCP rules. If you specify TCP as + the protocol but omit this object, + then all destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be + less than the minimum port + number. To specify a single + port number, set both the + min and max to the same + value. + type: integer + min: + description: The minimum port + number, which must not be + greater than the maximum + port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be + less than the minimum port + number. To specify a single + port number, set both the + min and max to the same + value. + type: integer + min: + description: The minimum port + number, which must not be + greater than the maximum + port number. + type: integer + type: object + type: object + udpOptions: + description: UdpOptions Optional and + valid only for UDP. Use to specify + particular destination ports for + UDP rules. If you specify UDP as + the protocol but omit this object, + then all destination ports are allowed. + properties: + destinationPortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be + less than the minimum port + number. To specify a single + port number, set both the + min and max to the same + value. + type: integer + min: + description: The minimum port + number, which must not be + greater than the maximum + port number. + type: integer + type: object + sourcePortRange: + description: PortRange The representation + of PortRange. + properties: + max: + description: The maximum port + number, which must not be + less than the minimum port + number. To specify a single + port number, set both the + min and max to the same + value. + type: integer + min: + description: The minimum port + number, which must not be + greater than the maximum + port number. + type: integer + type: object + type: object + type: object + type: array + name: + description: SecurityList Name. + type: string + type: object + type: + description: Type defines the subnet type (e.g. + public, private). + type: string + required: + - name + - role + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + type: object + vcnPeering: + description: VCNPeering configuration. + properties: + drg: + description: DRG configuration refers to the DRG which + has to be created if required. If management cluster + and workload cluster shares the same DRG, this fields + is not required to be specified. + properties: + id: + description: ID is the OCID for the created DRG. + type: string + manage: + description: Manage defines whether the DRG has + to be managed(including create). If set to false(the + default) the ID has to be specified by the user + to a valid DRG ID to which the VCN has to be + attached. + type: boolean + name: + description: Name is the name of the created DRG. + type: string + vcnAttachmentId: + description: VcnAttachmentId is the ID of the + VCN attachment of the DRG. The workload cluster + VCN can be attached to either the management + cluster VCN if they are sharing the same DRG + or to the workload cluster DRG. + type: string + type: object + peerRouteRules: + description: PeerRouteRules defines the routing rules + which will be added to the private route tables + of the workload cluster VCN. The routes defined + here will be directed to DRG. + items: + description: PeerRouteRule defines a Route Rule + to be routed via a DRG. + properties: + vcnCIDRRange: + description: VCNCIDRRange is the CIDR Range + of peer VCN to which the workload cluster + VCN will be peered. The CIDR range is required + to add the route rule in the workload cluster + VCN, the route rule will forward any traffic + to the CIDR to the DRG. + type: string + type: object + type: array + remotePeeringConnections: + description: RemotePeeringConnections defines the + RPC connections which be established with the workload + cluster DRG. + items: + description: RemotePeeringConnection is used to + peer VCNs residing in different regions(typically). + Remote VCN Peering is explained here - https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/remoteVCNpeering.htm + properties: + managePeerRPC: + description: ManagePeerRPC will define if the + Peer VCN needs to be managed. If set to true + a Remote Peering Connection will be created + in the Peer DRG and the connection will be + created between local and peer RPC. + type: boolean + peerDRGId: + description: PeerDRGId defines the DRG ID of + the peer. + type: string + peerRPCConnectionId: + description: PeerRPCConnectionId defines the + RPC ID of peer. If ManagePeerRPC is set to + true this will be created by Cluster API Provider + for OCI, otherwise this has be defined by + the user. + type: string + peerRegionName: + description: PeerRegionName defined the region + name of Peer VCN. + type: string + rpcConnectionId: + description: RPCConnectionId is the connection + ID of the connection between peer and local + RPC. + type: string + type: object + type: array + type: object + type: object + ociResourceIdentifier: + description: The unique ID which will be used to tag all the + resources created by this Cluster. The tag will be used + to identify resources belonging to this cluster. this will + be auto-generated and should not be set by the user. + type: string + region: + description: Region the cluster operates in. It must be one + of available regions in Region Identifier format. See https://docs.oracle.com/en-us/iaas/Content/General/Concepts/regions.htm + type: string + type: object + required: + - spec + type: object + required: + - template + type: object + type: object + served: true + storage: true diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedcontrolplanes.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedcontrolplanes.yaml index b1a869e4..0f482df3 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedcontrolplanes.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedcontrolplanes.yaml @@ -190,3 +190,178 @@ spec: storage: true subresources: status: {} + - name: v1beta2 + schema: + openAPIV3Schema: + description: OCIManagedControlPlane is the Schema for the ocimanagedcontrolplane + API. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: OCIManagedControlPlaneSpec defines the desired state of OCIManagedControlPlane. + The properties are generated from https://docs.oracle.com/en-us/iaas/api/#/en/containerengine/20180222/datatypes/CreateClusterDetails + properties: + clusterOptions: + description: ClusterOptions defines Optional attributes for the cluster. + properties: + addOnOptions: + description: AddOnOptions defines the properties that define options + for supported add-ons. + properties: + isKubernetesDashboardEnabled: + description: IsKubernetesDashboardEnabled defines whether + or not to enable the Kubernetes Dashboard add-on. + type: boolean + isTillerEnabled: + description: IsKubernetesDashboardEnabled defines whether + or not to enable the Tiller add-on. + type: boolean + type: object + admissionControllerOptions: + description: AdmissionControllerOptions defines the properties + that define supported admission controllers. + properties: + isPodSecurityPolicyEnabled: + description: IsPodSecurityPolicyEnabled defines whether or + not to enable the Pod Security Policy admission controller. + type: boolean + type: object + type: object + clusterPodNetworkOptions: + description: ClusterPodNetworkOptions defines the available CNIs and + network options for existing and new node pools of the cluster + items: + description: ClusterPodNetworkOptions defines the available CNIs + and network options for existing and new node pools of the cluster + properties: + cniType: + description: The CNI to be used are OCI_VCN_IP_NATIVE and FLANNEL_OVERLAY + type: string + type: object + type: array + controlPlaneEndpoint: + description: ControlPlaneEndpoint represents the endpoint used to + communicate with the control plane. + properties: + host: + description: The hostname on which the API server is serving. + type: string + port: + description: The port on which the API server is serving. + format: int32 + type: integer + required: + - host + - port + type: object + id: + description: ID of the OKEcluster. + type: string + imagePolicyConfig: + description: ImagePolicyConfig defines the properties that define + a image verification policy. + properties: + isPolicyEnabled: + description: IsPolicyEnabled defines Whether the image verification + policy is enabled. + type: boolean + keyDetails: + description: KeyDetails defines a list of KMS key details. + items: + description: KeyDetails defines the properties that define the + kms keys used by OKE for Image Signature verification. + properties: + keyDetails: + description: KmsKeyId defines the OCID of the KMS key that + will be used to verify whether the images are signed by + an approved source. + type: string + type: object + type: array + type: object + kmsKeyId: + description: KmsKeyId defines the OCID of the KMS key to be used as + the master encryption key for Kubernetes secret encryption. When + used, + type: string + version: + description: Version represents the version of the Kubernetes Cluster + Control Plane. + type: string + type: object + status: + description: OCIManagedControlPlaneStatus defines the observed state of + OCIManagedControlPlane + properties: + conditions: + description: NetworkSpec encapsulates all things related to OCI network. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + initialized: + description: Initialized denotes whether or not the control plane + has the uploaded kubernetes config-map. + type: boolean + ready: + type: boolean + version: + description: Version represents the current Kubernetes version for + the control plane. + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedcontrolplanetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedcontrolplanetemplates.yaml index 757c6f03..900f1623 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedcontrolplanetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedcontrolplanetemplates.yaml @@ -152,3 +152,138 @@ spec: type: object served: true storage: true + - name: v1beta2 + schema: + openAPIV3Schema: + description: OCIManagedControlPlaneTemplate is the Schema for the OCIManagedControlPlaneTemplates + API. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: OCIManagedControlPlaneTemplateSpec defines the desired state + of OCIManagedControlPlaneTemplate. + properties: + template: + description: OCIManagedControlPlaneSpec describes the data needed + to create an OCIManagedControlPlane from a template. + properties: + spec: + description: OCIManagedControlPlaneSpec defines the desired state + of OCIManagedControlPlane. The properties are generated from + https://docs.oracle.com/en-us/iaas/api/#/en/containerengine/20180222/datatypes/CreateClusterDetails + properties: + clusterOptions: + description: ClusterOptions defines Optional attributes for + the cluster. + properties: + addOnOptions: + description: AddOnOptions defines the properties that + define options for supported add-ons. + properties: + isKubernetesDashboardEnabled: + description: IsKubernetesDashboardEnabled defines + whether or not to enable the Kubernetes Dashboard + add-on. + type: boolean + isTillerEnabled: + description: IsKubernetesDashboardEnabled defines + whether or not to enable the Tiller add-on. + type: boolean + type: object + admissionControllerOptions: + description: AdmissionControllerOptions defines the properties + that define supported admission controllers. + properties: + isPodSecurityPolicyEnabled: + description: IsPodSecurityPolicyEnabled defines whether + or not to enable the Pod Security Policy admission + controller. + type: boolean + type: object + type: object + clusterPodNetworkOptions: + description: ClusterPodNetworkOptions defines the available + CNIs and network options for existing and new node pools + of the cluster + items: + description: ClusterPodNetworkOptions defines the available + CNIs and network options for existing and new node pools + of the cluster + properties: + cniType: + description: The CNI to be used are OCI_VCN_IP_NATIVE + and FLANNEL_OVERLAY + type: string + type: object + type: array + controlPlaneEndpoint: + description: ControlPlaneEndpoint represents the endpoint + used to communicate with the control plane. + properties: + host: + description: The hostname on which the API server is serving. + type: string + port: + description: The port on which the API server is serving. + format: int32 + type: integer + required: + - host + - port + type: object + id: + description: ID of the OKEcluster. + type: string + imagePolicyConfig: + description: ImagePolicyConfig defines the properties that + define a image verification policy. + properties: + isPolicyEnabled: + description: IsPolicyEnabled defines Whether the image + verification policy is enabled. + type: boolean + keyDetails: + description: KeyDetails defines a list of KMS key details. + items: + description: KeyDetails defines the properties that + define the kms keys used by OKE for Image Signature + verification. + properties: + keyDetails: + description: KmsKeyId defines the OCID of the KMS + key that will be used to verify whether the images + are signed by an approved source. + type: string + type: object + type: array + type: object + kmsKeyId: + description: KmsKeyId defines the OCID of the KMS key to be + used as the master encryption key for Kubernetes secret + encryption. When used, + type: string + version: + description: Version represents the version of the Kubernetes + Cluster Control Plane. + type: string + type: object + required: + - spec + type: object + required: + - template + type: object + type: object + served: true + storage: true diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedmachinepools.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedmachinepools.yaml index c7d71579..feb719a1 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedmachinepools.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedmachinepools.yaml @@ -274,6 +274,268 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v1beta2 + schema: + openAPIV3Schema: + description: OCIManagedMachinePool is the Schema for the ocimanagedmachinepool + API. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: OCIManagedMachinePoolSpec defines the desired state of an + OCI managed machine pool. An OCIManagedMachinePool translates to an + OKE NodePool. The properties are generated from https://docs.oracle.com/en-us/iaas/api/#/en/containerengine/20180222/datatypes/CreateNodePoolDetails + properties: + id: + description: ID is the OCID of the associated NodePool + type: string + initialNodeLabels: + description: InitialNodeLabels defines a list of key/value pairs to + add to nodes after they join the Kubernetes cluster. + items: + description: KeyValue The properties that define a key value pair. + properties: + key: + description: The key of the pair. + type: string + value: + description: The value of the pair. + type: string + type: object + type: array + nodeEvictionNodePoolSettings: + description: NodeEvictionNodePoolSettings defines the eviction settings. + properties: + evictionGraceDuration: + description: 'EvictionGraceDuration defines the duration after + which OKE will give up eviction of the pods on the node. PT0M + will indicate you want to delete the node without cordon and + drain. Default PT60M, Min PT0M, Max: PT60M. Format ISO 8601 + e.g PT30M' + type: string + isForceDeleteAfterGraceDuration: + description: IsForceDeleteAfterGraceDuration defines if the underlying + compute instance should be deleted if you cannot evict all the + pods in grace period + type: boolean + type: object + nodeMetadata: + additionalProperties: + type: string + description: NodeMetadata defines a list of key/value pairs to add + to each underlying OCI instance in the node pool on launch. + type: object + nodePoolNodeConfig: + description: NodePoolNodeConfig defines the configuration of nodes + in the node pool. + properties: + isPvEncryptionInTransitEnabled: + description: IsPvEncryptionInTransitEnabled defines whether in + transit encryption should be enabled on the nodes. + type: boolean + kmsKeyId: + description: KmsKeyId defines whether in transit encryption should + be enabled on the nodes. + type: string + nodePoolPodNetworkOptionDetails: + description: NodePoolPodNetworkOptionDetails defines the pod networking + details of the node pool + properties: + cniType: + description: CniType describes the CNI plugin used by this + node pool. Allowed values are OCI_VCN_IP_NATIVE and FLANNEL_OVERLAY. + type: string + vcnIpNativePodNetworkOptions: + description: VcnIpNativePodNetworkOptions describes the network + options specific to using the OCI VCN Native CNI + properties: + maxPodsPerNode: + description: MemoryInGBs defines the max number of pods + per node in the node pool. This value will be limited + by the number of VNICs attachable to the node pool shape + type: integer + nsgNames: + description: NSGNames defines the NSGs associated with + the native pod network. + items: + type: string + type: array + subnetNames: + description: SubnetNames defines the Subnets associated + with the native pod network. + items: + type: string + type: array + type: object + type: object + nsgNames: + description: NsgNames defines the names of NSGs which will be + associated with the nodes. the NSGs are defined in OCIManagedCluster + object. + items: + type: string + type: array + placementConfigs: + description: PlacementConfigs defines the placement configurations + for the node pool. + items: + description: PlacementConfig defines the placement configurations + for the node pool. + properties: + availabilityDomain: + description: AvailabilityDomain defines the availability + domain in which to place nodes. + type: string + capacityReservationId: + description: CapacityReservationId defines the OCID of the + compute capacity reservation in which to place the compute + instance. + type: string + faultDomains: + description: FaultDomains defines the list of fault domains + in which to place nodes. + items: + type: string + type: array + subnetName: + description: SubnetName defines the name of the subnet which + need ot be associated with the Nodepool. The subnets are + defined in the OCiManagedCluster object. + type: string + type: object + type: array + type: object + nodeShape: + description: NodeShape defines the name of the node shape of the nodes + in the node pool. + type: string + nodeShapeConfig: + description: NodeShapeConfig defines the configuration of the shape + to launch nodes in the node pool. + properties: + memoryInGBs: + description: MemoryInGBs defines the total amount of memory available + to each node, in gigabytes. + type: string + ocpus: + description: Ocpus defines the total number of OCPUs available + to each node in the node pool. + type: string + type: object + nodeSourceViaImage: + description: NodeSourceViaImage defines the image configuration of + the nodes in the nodepool. + properties: + bootVolumeSizeInGBs: + description: BootVolumeSizeInGBs defines the size of the boot + volume in GBs. + format: int64 + type: integer + imageId: + description: ImageId defines the OCID of the image used to boot + the node. + type: string + type: object + providerID: + description: ProviderID is the OCID of the associated NodePool in + a provider format + type: string + providerIDList: + description: ProviderIDList are the identification IDs of machine + instances provided by the provider. This field must match the provider + IDs as seen on the node objects corresponding to a machine pool's + machine instances. + items: + type: string + type: array + sshPublicKey: + description: SshPublicKey defines the SSH public key on each node + in the node pool on launch. + type: string + version: + description: Version represents the version of the OKE node pool. + type: string + type: object + status: + description: OCIManagedMachinePoolStatus defines the observed state of + OCIManagedMachinePool + properties: + conditions: + description: NetworkSpec encapsulates all things related to OCI network. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + failureMessages: + items: + type: string + type: array + failureReason: + description: MachineStatusError defines errors states for Machine + objects. + type: string + ready: + type: boolean + replicas: + description: Replicas is the most recently observed number of replicas + format: int32 + type: integer + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedmachinepooltemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedmachinepooltemplates.yaml index 3cfd5f30..54dd1d79 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedmachinepooltemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimanagedmachinepooltemplates.yaml @@ -235,3 +235,221 @@ spec: type: object served: true storage: true + - name: v1beta2 + schema: + openAPIV3Schema: + description: OCIManagedMachinePoolTemplate is the Schema for the OCIManagedMachinePoolTemplates + API. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: OCIManagedMachinePoolTemplateSpec defines the desired state + of OCIManagedMachinePoolTemplate. + properties: + template: + description: OCIManagedMachinePoolSpec describes the data needed to + create an OCIManagedMachinePool from a template. + properties: + spec: + description: OCIManagedMachinePoolSpec defines the desired state + of an OCI managed machine pool. An OCIManagedMachinePool translates + to an OKE NodePool. The properties are generated from https://docs.oracle.com/en-us/iaas/api/#/en/containerengine/20180222/datatypes/CreateNodePoolDetails + properties: + id: + description: ID is the OCID of the associated NodePool + type: string + initialNodeLabels: + description: InitialNodeLabels defines a list of key/value + pairs to add to nodes after they join the Kubernetes cluster. + items: + description: KeyValue The properties that define a key value + pair. + properties: + key: + description: The key of the pair. + type: string + value: + description: The value of the pair. + type: string + type: object + type: array + nodeEvictionNodePoolSettings: + description: NodeEvictionNodePoolSettings defines the eviction + settings. + properties: + evictionGraceDuration: + description: 'EvictionGraceDuration defines the duration + after which OKE will give up eviction of the pods on + the node. PT0M will indicate you want to delete the + node without cordon and drain. Default PT60M, Min PT0M, + Max: PT60M. Format ISO 8601 e.g PT30M' + type: string + isForceDeleteAfterGraceDuration: + description: IsForceDeleteAfterGraceDuration defines if + the underlying compute instance should be deleted if + you cannot evict all the pods in grace period + type: boolean + type: object + nodeMetadata: + additionalProperties: + type: string + description: NodeMetadata defines a list of key/value pairs + to add to each underlying OCI instance in the node pool + on launch. + type: object + nodePoolNodeConfig: + description: NodePoolNodeConfig defines the configuration + of nodes in the node pool. + properties: + isPvEncryptionInTransitEnabled: + description: IsPvEncryptionInTransitEnabled defines whether + in transit encryption should be enabled on the nodes. + type: boolean + kmsKeyId: + description: KmsKeyId defines whether in transit encryption + should be enabled on the nodes. + type: string + nodePoolPodNetworkOptionDetails: + description: NodePoolPodNetworkOptionDetails defines the + pod networking details of the node pool + properties: + cniType: + description: CniType describes the CNI plugin used + by this node pool. Allowed values are OCI_VCN_IP_NATIVE + and FLANNEL_OVERLAY. + type: string + vcnIpNativePodNetworkOptions: + description: VcnIpNativePodNetworkOptions describes + the network options specific to using the OCI VCN + Native CNI + properties: + maxPodsPerNode: + description: MemoryInGBs defines the max number + of pods per node in the node pool. This value + will be limited by the number of VNICs attachable + to the node pool shape + type: integer + nsgNames: + description: NSGNames defines the NSGs associated + with the native pod network. + items: + type: string + type: array + subnetNames: + description: SubnetNames defines the Subnets associated + with the native pod network. + items: + type: string + type: array + type: object + type: object + nsgNames: + description: NsgNames defines the names of NSGs which + will be associated with the nodes. the NSGs are defined + in OCIManagedCluster object. + items: + type: string + type: array + placementConfigs: + description: PlacementConfigs defines the placement configurations + for the node pool. + items: + description: PlacementConfig defines the placement configurations + for the node pool. + properties: + availabilityDomain: + description: AvailabilityDomain defines the availability + domain in which to place nodes. + type: string + capacityReservationId: + description: CapacityReservationId defines the OCID + of the compute capacity reservation in which to + place the compute instance. + type: string + faultDomains: + description: FaultDomains defines the list of fault + domains in which to place nodes. + items: + type: string + type: array + subnetName: + description: SubnetName defines the name of the + subnet which need ot be associated with the Nodepool. + The subnets are defined in the OCiManagedCluster + object. + type: string + type: object + type: array + type: object + nodeShape: + description: NodeShape defines the name of the node shape + of the nodes in the node pool. + type: string + nodeShapeConfig: + description: NodeShapeConfig defines the configuration of + the shape to launch nodes in the node pool. + properties: + memoryInGBs: + description: MemoryInGBs defines the total amount of memory + available to each node, in gigabytes. + type: string + ocpus: + description: Ocpus defines the total number of OCPUs available + to each node in the node pool. + type: string + type: object + nodeSourceViaImage: + description: NodeSourceViaImage defines the image configuration + of the nodes in the nodepool. + properties: + bootVolumeSizeInGBs: + description: BootVolumeSizeInGBs defines the size of the + boot volume in GBs. + format: int64 + type: integer + imageId: + description: ImageId defines the OCID of the image used + to boot the node. + type: string + type: object + providerID: + description: ProviderID is the OCID of the associated NodePool + in a provider format + type: string + providerIDList: + description: ProviderIDList are the identification IDs of + machine instances provided by the provider. This field must + match the provider IDs as seen on the node objects corresponding + to a machine pool's machine instances. + items: + type: string + type: array + sshPublicKey: + description: SshPublicKey defines the SSH public key on each + node in the node pool on launch. + type: string + version: + description: Version represents the version of the OKE node + pool. + type: string + type: object + required: + - spec + type: object + required: + - template + type: object + type: object + served: true + storage: true diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 2e125a0a..6a63a4e9 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -22,12 +22,22 @@ patchesStrategicMerge: # patches here are for enabling the conversion webhook for each CRD - patches/webhook_in_ociclusters.yaml - patches/webhook_in_ocimachines.yaml +- patches/webhook_in_ociclustertemplates.yaml +- patches/webhook_in_ocimachinepools.yaml +- patches/webhook_in_ocimanagedclusters.yaml +- patches/webhook_in_ocimanagedmachinepools.yaml +- patches/webhook_in_ociclusteridentities.yaml # +kubebuilder:scaffold:crdkustomizewebhookpatch # [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix. # patches here are for enabling the CA injection for each CRD - patches/cainjection_in_ociclusters.yaml - patches/cainjection_in_ocimachines.yaml +- patches/cainjection_in_ociclustertemplates.yaml +- patches/cainjection_in_ocimachinepools.yaml +- patches/cainjection_in_ocimanagedclusters.yaml +- patches/cainjection_in_ocimanagedmachinepools.yaml +- patches/cainjection_in_ociclusteridentities.yaml # +kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/config/crd/patches/cainjection_in_ociclusteridentities.yaml b/config/crd/patches/cainjection_in_ociclusteridentities.yaml new file mode 100644 index 00000000..9cbad833 --- /dev/null +++ b/config/crd/patches/cainjection_in_ociclusteridentities.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + name: ociclusteridentities.infrastructure.cluster.x-k8s.io diff --git a/config/crd/patches/cainjection_in_ociclustertemplates.yaml b/config/crd/patches/cainjection_in_ociclustertemplates.yaml new file mode 100644 index 00000000..474c100b --- /dev/null +++ b/config/crd/patches/cainjection_in_ociclustertemplates.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + name: ociclustertemplates.infrastructure.cluster.x-k8s.io diff --git a/config/crd/patches/cainjection_in_ocimanagedclusters.yaml b/config/crd/patches/cainjection_in_ocimanagedclusters.yaml new file mode 100644 index 00000000..00787d0b --- /dev/null +++ b/config/crd/patches/cainjection_in_ocimanagedclusters.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + name: ocimanagedclusters.infrastructure.cluster.x-k8s.io diff --git a/config/crd/patches/cainjection_in_ocimanagedcontrolplanes.yaml b/config/crd/patches/cainjection_in_ocimanagedcontrolplanes.yaml new file mode 100644 index 00000000..53728ad5 --- /dev/null +++ b/config/crd/patches/cainjection_in_ocimanagedcontrolplanes.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + name: ocimanagedcontrolplanes.infrastructure.cluster.x-k8s.io diff --git a/config/crd/patches/cainjection_in_ocimanagedmachinepools.yaml b/config/crd/patches/cainjection_in_ocimanagedmachinepools.yaml new file mode 100644 index 00000000..5ee93f16 --- /dev/null +++ b/config/crd/patches/cainjection_in_ocimanagedmachinepools.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + name: ocimanagedmachinepools.infrastructure.cluster.x-k8s.io diff --git a/config/crd/patches/webhook_in_ociclusteridentities.yaml b/config/crd/patches/webhook_in_ociclusteridentities.yaml new file mode 100644 index 00000000..a3edb435 --- /dev/null +++ b/config/crd/patches/webhook_in_ociclusteridentities.yaml @@ -0,0 +1,17 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: ociclusteridentities.infrastructure.cluster.x-k8s.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: system + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 + - v1beta1 diff --git a/config/crd/patches/webhook_in_ociclustertemplates.yaml b/config/crd/patches/webhook_in_ociclustertemplates.yaml new file mode 100644 index 00000000..2d42e2e0 --- /dev/null +++ b/config/crd/patches/webhook_in_ociclustertemplates.yaml @@ -0,0 +1,17 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: ociclustertemplates.infrastructure.cluster.x-k8s.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: system + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 + - v1beta1 diff --git a/config/crd/patches/webhook_in_ocimachinepools.yaml b/config/crd/patches/webhook_in_ocimachinepools.yaml new file mode 100644 index 00000000..52a63440 --- /dev/null +++ b/config/crd/patches/webhook_in_ocimachinepools.yaml @@ -0,0 +1,17 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: ocimachinepools.infrastructure.cluster.x-k8s.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: system + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 + - v1beta1 diff --git a/config/crd/patches/webhook_in_ocimanagedclusters.yaml b/config/crd/patches/webhook_in_ocimanagedclusters.yaml new file mode 100644 index 00000000..a45dcba5 --- /dev/null +++ b/config/crd/patches/webhook_in_ocimanagedclusters.yaml @@ -0,0 +1,17 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: ocimanagedclusters.infrastructure.cluster.x-k8s.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: system + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 + - v1beta1 diff --git a/config/crd/patches/webhook_in_ocimanagedcontrolplanes.yaml b/config/crd/patches/webhook_in_ocimanagedcontrolplanes.yaml new file mode 100644 index 00000000..45430287 --- /dev/null +++ b/config/crd/patches/webhook_in_ocimanagedcontrolplanes.yaml @@ -0,0 +1,17 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: ocimanagedcontrolplanes.infrastructure.cluster.x-k8s.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: system + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 + - v1beta1 diff --git a/config/crd/patches/webhook_in_ocimanagedmachinepools.yaml b/config/crd/patches/webhook_in_ocimanagedmachinepools.yaml new file mode 100644 index 00000000..99c9d864 --- /dev/null +++ b/config/crd/patches/webhook_in_ocimanagedmachinepools.yaml @@ -0,0 +1,17 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: ocimanagedmachinepools.infrastructure.cluster.x-k8s.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: system + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 + - v1beta1 diff --git a/config/webhook/manifests.yaml b/config/webhook/manifests.yaml index 2cba62de..b0b548cb 100644 --- a/config/webhook/manifests.yaml +++ b/config/webhook/manifests.yaml @@ -6,13 +6,12 @@ metadata: name: mutating-webhook-configuration webhooks: - admissionReviewVersions: - - v1 - v1beta1 clientConfig: service: name: webhook-service namespace: system - path: /mutate-infrastructure-cluster-x-k8s-io-v1beta1-ocicluster + path: /mutate-infrastructure-cluster-x-k8s-io-v1beta2-ocicluster failurePolicy: Fail matchPolicy: Equivalent name: default.ocicluster.infrastructure.cluster.x-k8s.io @@ -20,7 +19,7 @@ webhooks: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1beta1 + - v1beta2 operations: - CREATE - UPDATE @@ -28,13 +27,12 @@ webhooks: - ociclusters sideEffects: None - admissionReviewVersions: - - v1 - v1beta1 clientConfig: service: name: webhook-service namespace: system - path: /mutate-infrastructure-cluster-x-k8s-io-v1beta1-ocimanagedcluster + path: /mutate-infrastructure-cluster-x-k8s-io-v1beta2-ocimanagedcluster failurePolicy: Fail matchPolicy: Equivalent name: default.ocimanagedcluster.infrastructure.cluster.x-k8s.io @@ -42,7 +40,7 @@ webhooks: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1beta1 + - v1beta2 operations: - CREATE - UPDATE @@ -50,13 +48,12 @@ webhooks: - ocimanagedclusters sideEffects: None - admissionReviewVersions: - - v1 - v1beta1 clientConfig: service: name: webhook-service namespace: system - path: /mutate-infrastructure-cluster-x-k8s-io-v1beta1-ocimanagedcontrolplane + path: /mutate-infrastructure-cluster-x-k8s-io-v1beta2-ocimanagedcontrolplane failurePolicy: Fail matchPolicy: Equivalent name: default.ocimanagedcontrolplane.infrastructure.cluster.x-k8s.io @@ -64,7 +61,7 @@ webhooks: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1beta1 + - v1beta2 operations: - CREATE - UPDATE @@ -72,13 +69,12 @@ webhooks: - ocimanagedcontrolplanes sideEffects: None - admissionReviewVersions: - - v1 - v1beta1 clientConfig: service: name: webhook-service namespace: system - path: /mutate-infrastructure-cluster-x-k8s-io-v1beta1-ocimanagedmachinepool + path: /mutate-infrastructure-cluster-x-k8s-io-v1beta2-ocimanagedmachinepool failurePolicy: Fail matchPolicy: Equivalent name: default.ocimanagedmachinepool.infrastructure.cluster.x-k8s.io @@ -86,7 +82,7 @@ webhooks: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1beta1 + - v1beta2 operations: - CREATE - UPDATE @@ -106,7 +102,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-infrastructure-cluster-x-k8s-io-v1beta1-ocicluster + path: /validate-infrastructure-cluster-x-k8s-io-v1beta2-ocicluster failurePolicy: Fail matchPolicy: Equivalent name: validation.ocicluster.infrastructure.cluster.x-k8s.io @@ -114,7 +110,7 @@ webhooks: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1beta1 + - v1beta2 operations: - CREATE - UPDATE @@ -127,7 +123,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-infrastructure-cluster-x-k8s-io-v1beta1-ocimachinetemplate + path: /validate-infrastructure-cluster-x-k8s-io-v1beta2-ocimachinetemplate failurePolicy: Fail matchPolicy: Equivalent name: validation.ocimachinetemplate.infrastructure.cluster.x-k8s.io @@ -135,7 +131,7 @@ webhooks: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1beta1 + - v1beta2 operations: - CREATE - UPDATE @@ -148,7 +144,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-infrastructure-cluster-x-k8s-io-v1beta1-ocimanagedcluster + path: /validate-infrastructure-cluster-x-k8s-io-v1beta2-ocimanagedcluster failurePolicy: Fail matchPolicy: Equivalent name: validation.ocimanagedcluster.infrastructure.cluster.x-k8s.io @@ -156,7 +152,7 @@ webhooks: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1beta1 + - v1beta2 operations: - CREATE - UPDATE @@ -169,7 +165,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-infrastructure-cluster-x-k8s-io-v1beta1-ocimanagedcontrolplane + path: /validate-infrastructure-cluster-x-k8s-io-v1beta2-ocimanagedcontrolplane failurePolicy: Fail matchPolicy: Equivalent name: validation.ocimanagedcontrolplane.infrastructure.cluster.x-k8s.io @@ -177,7 +173,7 @@ webhooks: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1beta1 + - v1beta2 operations: - CREATE - UPDATE @@ -190,7 +186,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-infrastructure-cluster-x-k8s-io-v1beta1-ocimanagedmachinepool + path: /validate-infrastructure-cluster-x-k8s-io-v1beta2-ocimanagedmachinepool failurePolicy: Fail matchPolicy: Equivalent name: validation.ocimanagedmachinepool.infrastructure.cluster.x-k8s.io @@ -198,7 +194,7 @@ webhooks: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1beta1 + - v1beta2 operations: - CREATE - UPDATE diff --git a/controllers/ocicluster_controller.go b/controllers/ocicluster_controller.go index 45153b41..b9719ae6 100644 --- a/controllers/ocicluster_controller.go +++ b/controllers/ocicluster_controller.go @@ -19,11 +19,11 @@ package controllers import ( "context" "fmt" + "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "strings" "github.com/go-logr/logr" - "github.com/oracle/cluster-api-provider-oci/api/v1beta1" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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" "github.com/pkg/errors" @@ -73,7 +73,7 @@ func (r *OCIClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) logger.Info("Inside cluster reconciler") // Fetch the OCICluster instance - ociCluster := &infrastructurev1beta1.OCICluster{} + ociCluster := &infrastructurev1beta2.OCICluster{} err := r.Get(ctx, req.NamespacedName, ociCluster) if err != nil { if apierrors.IsNotFound(err) { @@ -153,7 +153,7 @@ func (r *OCIClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) } -func (r *OCIClusterReconciler) reconcileComponent(ctx context.Context, cluster *v1beta1.OCICluster, +func (r *OCIClusterReconciler) reconcileComponent(ctx context.Context, cluster *v1beta2.OCICluster, reconciler func(context.Context) error, componentName string, failReason string, readyEventtype string) error { @@ -161,7 +161,7 @@ func (r *OCIClusterReconciler) reconcileComponent(ctx context.Context, cluster * if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, fmt.Sprintf("failed to reconcile %s", componentName)).Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, failReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, failReason, clusterv1.ConditionSeverityError, "") return errors.Wrapf(err, "failed to reconcile %s for OCICluster %s/%s", componentName, cluster.Namespace, cluster.Name) } @@ -173,9 +173,9 @@ func (r *OCIClusterReconciler) reconcileComponent(ctx context.Context, cluster * return nil } -func (r *OCIClusterReconciler) reconcile(ctx context.Context, logger logr.Logger, clusterScope scope.ClusterScopeClient, cluster *infrastructurev1beta1.OCICluster) (ctrl.Result, error) { +func (r *OCIClusterReconciler) reconcile(ctx context.Context, logger logr.Logger, clusterScope scope.ClusterScopeClient, cluster *infrastructurev1beta2.OCICluster) (ctrl.Result, error) { // If the OCICluster doesn't have our finalizer, add it. - controllerutil.AddFinalizer(cluster, infrastructurev1beta1.ClusterFinalizer) + controllerutil.AddFinalizer(cluster, infrastructurev1beta2.ClusterFinalizer) // 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 @@ -187,52 +187,52 @@ func (r *OCIClusterReconciler) reconcile(ctx context.Context, logger logr.Logger } if err := r.reconcileComponent(ctx, cluster, clusterScope.ReconcileDRG, "DRG", - infrastructurev1beta1.DrgReconciliationFailedReason, infrastructurev1beta1.DrgEventReady); err != nil { + infrastructurev1beta2.DrgReconciliationFailedReason, infrastructurev1beta2.DrgEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, cluster, clusterScope.ReconcileVCN, "VCN", - infrastructurev1beta1.VcnReconciliationFailedReason, infrastructurev1beta1.VcnEventReady); err != nil { + infrastructurev1beta2.VcnReconciliationFailedReason, infrastructurev1beta2.VcnEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, cluster, clusterScope.ReconcileInternetGateway, "Internet Gateway", - infrastructurev1beta1.InternetGatewayReconciliationFailedReason, infrastructurev1beta1.InternetGatewayEventReady); err != nil { + infrastructurev1beta2.InternetGatewayReconciliationFailedReason, infrastructurev1beta2.InternetGatewayEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, cluster, clusterScope.ReconcileNatGateway, "NAT Gateway", - infrastructurev1beta1.NatGatewayReconciliationFailedReason, infrastructurev1beta1.NatEventReady); err != nil { + infrastructurev1beta2.NatGatewayReconciliationFailedReason, infrastructurev1beta2.NatEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, cluster, clusterScope.ReconcileServiceGateway, "Service Gateway", - infrastructurev1beta1.ServiceGatewayReconciliationFailedReason, infrastructurev1beta1.ServiceGatewayEventReady); err != nil { + infrastructurev1beta2.ServiceGatewayReconciliationFailedReason, infrastructurev1beta2.ServiceGatewayEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, cluster, clusterScope.ReconcileNSG, "Network Security Group", - infrastructurev1beta1.NSGReconciliationFailedReason, infrastructurev1beta1.NetworkSecurityEventReady); err != nil { + infrastructurev1beta2.NSGReconciliationFailedReason, infrastructurev1beta2.NetworkSecurityEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, cluster, clusterScope.ReconcileRouteTable, "Route Table", - infrastructurev1beta1.RouteTableReconciliationFailedReason, infrastructurev1beta1.RouteTableEventReady); err != nil { + infrastructurev1beta2.RouteTableReconciliationFailedReason, infrastructurev1beta2.RouteTableEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, cluster, clusterScope.ReconcileSubnet, "Subnet", - infrastructurev1beta1.SubnetReconciliationFailedReason, infrastructurev1beta1.SubnetEventReady); err != nil { + infrastructurev1beta2.SubnetReconciliationFailedReason, infrastructurev1beta2.SubnetEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, cluster, clusterScope.ReconcileDRGVCNAttachment, "DRGVCNAttachment", - infrastructurev1beta1.DRGVCNAttachmentReconciliationFailedReason, infrastructurev1beta1.DRGVCNAttachmentEventReady); err != nil { + infrastructurev1beta2.DRGVCNAttachmentReconciliationFailedReason, infrastructurev1beta2.DRGVCNAttachmentEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, cluster, clusterScope.ReconcileDRGRPCAttachment, "DRGRPCAttachment", - infrastructurev1beta1.DRGRPCAttachmentReconciliationFailedReason, infrastructurev1beta1.DRGRPCAttachmentEventReady); err != nil { + infrastructurev1beta2.DRGRPCAttachmentReconciliationFailedReason, infrastructurev1beta2.DRGRPCAttachmentEventReady); err != nil { return ctrl.Result{}, err } } else { @@ -240,16 +240,16 @@ func (r *OCIClusterReconciler) reconcile(ctx context.Context, logger logr.Logger } if err := r.reconcileComponent(ctx, cluster, clusterScope.ReconcileFailureDomains, "Failure Domain", - infrastructurev1beta1.FailureDomainFailedReason, infrastructurev1beta1.FailureDomainEventReady); err != nil { + infrastructurev1beta2.FailureDomainFailedReason, infrastructurev1beta2.FailureDomainEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, cluster, clusterScope.ReconcileApiServerLB, "Api Server Loadbalancer", - infrastructurev1beta1.APIServerLoadBalancerFailedReason, infrastructurev1beta1.ApiServerLoadBalancerEventReady); err != nil { + infrastructurev1beta2.APIServerLoadBalancerFailedReason, infrastructurev1beta2.ApiServerLoadBalancerEventReady); err != nil { return ctrl.Result{}, err } - conditions.MarkTrue(cluster, infrastructurev1beta1.ClusterReadyCondition) + conditions.MarkTrue(cluster, infrastructurev1beta2.ClusterReadyCondition) cluster.Status.Ready = true return ctrl.Result{}, nil } @@ -259,7 +259,7 @@ func (r *OCIClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma log := ctrl.LoggerFrom(ctx) c, err := ctrl.NewControllerManagedBy(mgr). WithOptions(options). - For(&infrastructurev1beta1.OCICluster{}). + For(&infrastructurev1beta2.OCICluster{}). WithEventFilter(predicates.ResourceNotPaused(log)). // don't queue reconcile if resource is paused WithEventFilter(predicates.ResourceIsNotExternallyManaged(log)). //the externally managed cluster won't be reconciled Build(r) @@ -300,7 +300,7 @@ func (r *OCIClusterReconciler) clusterToInfrastructureMapFunc(ctx context.Contex return nil } - ociCluster := &infrastructurev1beta1.OCICluster{} + ociCluster := &infrastructurev1beta2.OCICluster{} key := types.NamespacedName{Namespace: c.Spec.InfrastructureRef.Namespace, Name: c.Spec.InfrastructureRef.Name} if err := r.Get(ctx, key, ociCluster); err != nil { @@ -326,11 +326,11 @@ func (r *OCIClusterReconciler) clusterToInfrastructureMapFunc(ctx context.Contex } } -func (r *OCIClusterReconciler) reconcileDelete(ctx context.Context, logger logr.Logger, clusterScope scope.ClusterScopeClient, cluster *infrastructurev1beta1.OCICluster) (ctrl.Result, error) { +func (r *OCIClusterReconciler) reconcileDelete(ctx context.Context, logger logr.Logger, clusterScope scope.ClusterScopeClient, cluster *infrastructurev1beta2.OCICluster) (ctrl.Result, error) { err := clusterScope.DeleteApiServerLB(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete Api Server Loadbalancer").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.APIServerLoadBalancerFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.APIServerLoadBalancerFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete apiserver LB for OCICluster %s/%s", cluster.Namespace, cluster.Name) } @@ -340,84 +340,84 @@ func (r *OCIClusterReconciler) reconcileDelete(ctx context.Context, logger logr. err = clusterScope.DeleteDRGRPCAttachment(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete DRG RPC attachment").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.DRGRPCAttachmentReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.DRGRPCAttachmentReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete DRG RPC Attachment for OCICluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteDRGVCNAttachment(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete DRG VCN attachment").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.DRGVCNAttachmentReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.DRGVCNAttachmentReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete DRG VCN Attachment for OCICluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteNSGs(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete Network Security Group").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.NSGReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.NSGReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete Network Security Groups for OCICluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteSubnets(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete Subnet").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.SubnetReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.SubnetReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete subnet for OCICluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteRouteTables(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete Route Table").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.RouteTableReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.RouteTableReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete RouteTables for OCICluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteSecurityLists(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete Security Lists").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.SecurityListReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.SecurityListReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete SecurityLists for OCICluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteServiceGateway(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete Service Gateway").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.ServiceGatewayReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.ServiceGatewayReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete ServiceGateway for OCICluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteNatGateway(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete NAT Gateway").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.NatGatewayReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.NatGatewayReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete NatGateway for OCICluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteInternetGateway(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete Internet Gateway").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.InternetGatewayReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.InternetGatewayReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete InternetGateway for OCICluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteVCN(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete VCN").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.VcnReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.VcnReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete VCN for OCICluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteDRG(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete DRG").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.DrgReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.DrgReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete DRG for OCICluster %s/%s", cluster.Namespace, cluster.Name) } } else { logger.Info("VCN Reconciliation is skipped, none of the VCN related resources will be deleted") } - controllerutil.RemoveFinalizer(cluster, v1beta1.ClusterFinalizer) + controllerutil.RemoveFinalizer(cluster, v1beta2.ClusterFinalizer) return reconcile.Result{}, nil } diff --git a/controllers/ocicluster_controller_test.go b/controllers/ocicluster_controller_test.go index acbed180..3b86730c 100644 --- a/controllers/ocicluster_controller_test.go +++ b/controllers/ocicluster_controller_test.go @@ -22,7 +22,7 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" mock_scope "github.com/oracle/cluster-api-provider-oci/cloud/scope/mocks" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" @@ -113,18 +113,18 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { r OCIClusterReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociCluster *infrastructurev1beta1.OCICluster + ociCluster *infrastructurev1beta2.OCICluster cs *mock_scope.MockClusterScopeClient ) setup := func(t *testing.T, g *WithT) { mockCtrl = gomock.NewController(t) cs = mock_scope.NewMockClusterScopeClient(mockCtrl) - ociCluster = &infrastructurev1beta1.OCICluster{ + ociCluster = &infrastructurev1beta2.OCICluster{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{}, - Spec: infrastructurev1beta1.OCIClusterSpec{}, - Status: infrastructurev1beta1.OCIClusterStatus{}, + Spec: infrastructurev1beta2.OCIClusterSpec{}, + Status: infrastructurev1beta2.OCIClusterStatus{}, } recorder = record.NewFakeRecorder(20) client := fake.NewClientBuilder().WithObjects(getSecret()).Build() @@ -144,13 +144,13 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { expectedEvent string eventNotExpected string conditionAssertion conditionAssertion - testSpecificSetup func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) + testSpecificSetup func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) }{ { name: "all success", - expectedEvent: infrastructurev1beta1.DRGRPCAttachmentEventReady, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionTrue, "", ""}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + expectedEvent: infrastructurev1beta2.DRGRPCAttachmentEventReady, + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionTrue, "", ""}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -169,10 +169,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "drg reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.DrgEventReady, + eventNotExpected: infrastructurev1beta2.DrgEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.DrgReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DrgReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(errors.New("some error")) }, @@ -180,10 +180,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "vcn reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.VcnEventReady, + eventNotExpected: infrastructurev1beta2.VcnEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.VcnReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.VcnReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(errors.New("some error")) @@ -192,10 +192,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "internet gateway reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.InternetGatewayEventReady, + eventNotExpected: infrastructurev1beta2.InternetGatewayEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.InternetGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.InternetGatewayReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -205,10 +205,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "nat gateway reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.NatEventReady, + eventNotExpected: infrastructurev1beta2.NatEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.NatGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.NatGatewayReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -219,10 +219,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "service gateway reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.ServiceGatewayEventReady, + eventNotExpected: infrastructurev1beta2.ServiceGatewayEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.ServiceGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.ServiceGatewayReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -234,10 +234,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "nsg reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.NetworkSecurityEventReady, + eventNotExpected: infrastructurev1beta2.NetworkSecurityEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.NSGReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.NSGReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -250,10 +250,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "route table reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.RouteTableEventReady, + eventNotExpected: infrastructurev1beta2.RouteTableEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.RouteTableReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.RouteTableReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -267,10 +267,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "subnet reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.SubnetEventReady, + eventNotExpected: infrastructurev1beta2.SubnetEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.SubnetReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.SubnetReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -285,10 +285,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "api server lb reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.ApiServerLoadBalancerEventReady, + eventNotExpected: infrastructurev1beta2.ApiServerLoadBalancerEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.APIServerLoadBalancerFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.APIServerLoadBalancerFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -307,10 +307,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "failure domain reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.FailureDomainEventReady, + eventNotExpected: infrastructurev1beta2.FailureDomainEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.FailureDomainFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.FailureDomainFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -328,10 +328,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "drg vcn attachment reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.DRGVCNAttachmentEventReady, + eventNotExpected: infrastructurev1beta2.DRGVCNAttachmentEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.DRGVCNAttachmentReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DRGVCNAttachmentReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -347,10 +347,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "drg rpc attachment reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.DRGRPCAttachmentEventReady, + eventNotExpected: infrastructurev1beta2.DRGRPCAttachmentEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.DRGRPCAttachmentReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DRGRPCAttachmentReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -366,9 +366,9 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { }, { name: "skip vcn reconciliation", - expectedEvent: infrastructurev1beta1.ApiServerLoadBalancerEventReady, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionTrue, "", ""}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + expectedEvent: infrastructurev1beta2.ApiServerLoadBalancerEventReady, + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionTrue, "", ""}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { ociCluster.Spec.NetworkSpec.SkipNetworkManagement = true cs.EXPECT().ReconcileFailureDomains(context.Background()).Return(nil) cs.EXPECT().ReconcileApiServerLB(context.Background()).Return(nil) @@ -411,18 +411,18 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { r OCIClusterReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociCluster *infrastructurev1beta1.OCICluster + ociCluster *infrastructurev1beta2.OCICluster cs *mock_scope.MockClusterScopeClient ) setup := func(t *testing.T, g *WithT) { mockCtrl = gomock.NewController(t) cs = mock_scope.NewMockClusterScopeClient(mockCtrl) - ociCluster = &infrastructurev1beta1.OCICluster{ + ociCluster = &infrastructurev1beta2.OCICluster{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{}, - Spec: infrastructurev1beta1.OCIClusterSpec{}, - Status: infrastructurev1beta1.OCIClusterStatus{}, + Spec: infrastructurev1beta2.OCIClusterSpec{}, + Status: infrastructurev1beta2.OCIClusterStatus{}, } recorder = record.NewFakeRecorder(10) client := fake.NewClientBuilder().WithObjects(getSecret()).Build() @@ -441,11 +441,11 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { errorExpected bool expectedEvent string conditionAssertion conditionAssertion - testSpecificSetup func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) + testSpecificSetup func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) }{ { name: "all success", - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().DeleteApiServerLB(context.Background()).Return(nil) cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) @@ -464,8 +464,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "drg rpc delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.DRGRPCAttachmentReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DRGRPCAttachmentReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().DeleteApiServerLB(context.Background()).Return(nil) cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(errors.New("some error")) }, @@ -474,8 +474,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "drg vcn attachment delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.DRGVCNAttachmentReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DRGVCNAttachmentReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().DeleteApiServerLB(context.Background()).Return(nil) cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(errors.New("some error")) @@ -485,8 +485,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "api server lb delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.APIServerLoadBalancerFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.APIServerLoadBalancerFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().DeleteApiServerLB(context.Background()).Return(errors.New("some error")) }, }, @@ -494,8 +494,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "api server lb delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.APIServerLoadBalancerFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.APIServerLoadBalancerFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().DeleteApiServerLB(context.Background()).Return(errors.New("some error")) }, }, @@ -503,8 +503,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "nsg delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.NSGReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.NSGReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().DeleteApiServerLB(context.Background()).Return(nil) cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) @@ -515,8 +515,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "subnet delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.SubnetReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.SubnetReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().DeleteApiServerLB(context.Background()).Return(nil) cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) @@ -528,8 +528,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "route table delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.RouteTableReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.RouteTableReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().DeleteApiServerLB(context.Background()).Return(nil) cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) @@ -542,8 +542,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "security list delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.SecurityListReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.SecurityListReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().DeleteApiServerLB(context.Background()).Return(nil) cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) @@ -557,8 +557,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "service gateway delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.ServiceGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.ServiceGatewayReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().DeleteApiServerLB(context.Background()).Return(nil) cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) @@ -573,8 +573,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "nat gateway delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.NatGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.NatGatewayReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().DeleteApiServerLB(context.Background()).Return(nil) cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) @@ -590,8 +590,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "internet gateway delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.InternetGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.InternetGatewayReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().DeleteApiServerLB(context.Background()).Return(nil) cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) @@ -608,8 +608,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "delete vcn failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.VcnReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.VcnReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().DeleteApiServerLB(context.Background()).Return(nil) cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) @@ -627,8 +627,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "delete drg failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.DrgReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DrgReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { cs.EXPECT().DeleteApiServerLB(context.Background()).Return(nil) cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) @@ -645,7 +645,7 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { }, { name: "skip vcn deletion", - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta1.OCICluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrastructurev1beta2.OCICluster) { ociCluster.Spec.NetworkSpec.SkipNetworkManagement = true cs.EXPECT().DeleteApiServerLB(context.Background()).Return(nil) }, @@ -681,13 +681,13 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { } } -func getOciClusterWithNoOwner() *infrastructurev1beta1.OCICluster { - ociCluster := &infrastructurev1beta1.OCICluster{ +func getOciClusterWithNoOwner() *infrastructurev1beta2.OCICluster { + ociCluster := &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test", }, - Spec: infrastructurev1beta1.OCIClusterSpec{ + Spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "test", ControlPlaneEndpoint: clusterv1.APIEndpoint{ Port: 6443, @@ -698,7 +698,7 @@ func getOciClusterWithNoOwner() *infrastructurev1beta1.OCICluster { return ociCluster } -func getOCIClusterWithOwner() *infrastructurev1beta1.OCICluster { +func getOCIClusterWithOwner() *infrastructurev1beta2.OCICluster { ociCluster := getOciClusterWithNoOwner() ociCluster.OwnerReferences = []metav1.OwnerReference{ { diff --git a/controllers/ocimachine_controller.go b/controllers/ocimachine_controller.go index 0e99c323..1b4a3581 100644 --- a/controllers/ocimachine_controller.go +++ b/controllers/ocimachine_controller.go @@ -22,7 +22,7 @@ import ( "time" "github.com/go-logr/logr" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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" @@ -71,7 +71,7 @@ func (r *OCIMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request) logger := log.FromContext(ctx) logger.Info("Got reconciliation event for machine") - ociMachine := &infrastructurev1beta1.OCIMachine{} + ociMachine := &infrastructurev1beta2.OCIMachine{} err := r.Get(ctx, req.NamespacedName, ociMachine) if err != nil { if apierrors.IsNotFound(err) { @@ -105,7 +105,7 @@ func (r *OCIMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request) return ctrl.Result{}, nil } - ociCluster := &infrastructurev1beta1.OCICluster{} + ociCluster := &infrastructurev1beta2.OCICluster{} ociClusterName := client.ObjectKey{ Namespace: cluster.Namespace, Name: cluster.Spec.InfrastructureRef.Name, @@ -159,14 +159,14 @@ func (r *OCIMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request) func (r *OCIMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error { c, err := ctrl.NewControllerManagedBy(mgr). WithOptions(options). - For(&infrastructurev1beta1.OCIMachine{}). + For(&infrastructurev1beta2.OCIMachine{}). Watches( &source.Kind{Type: &clusterv1.Machine{}}, - handler.EnqueueRequestsFromMapFunc(util.MachineToInfrastructureMapFunc(infrastructurev1beta1. + handler.EnqueueRequestsFromMapFunc(util.MachineToInfrastructureMapFunc(infrastructurev1beta2. GroupVersion.WithKind(scope.OCIMachineKind))), ). Watches( - &source.Kind{Type: &infrastructurev1beta1.OCICluster{}}, + &source.Kind{Type: &infrastructurev1beta2.OCICluster{}}, handler.EnqueueRequestsFromMapFunc(r.OCIClusterToOCIMachines(ctx)), ). WithEventFilter(predicates.ResourceNotPaused(ctrl.LoggerFrom(ctx))). // don't queue reconcile if resource is paused @@ -175,7 +175,7 @@ func (r *OCIMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma return errors.Wrapf(err, "error creating controller") } - clusterToObjectFunc, err := util.ClusterToObjectsMapper(r.Client, &infrastructurev1beta1.OCIMachineList{}, mgr.GetScheme()) + clusterToObjectFunc, err := util.ClusterToObjectsMapper(r.Client, &infrastructurev1beta2.OCIMachineList{}, mgr.GetScheme()) if err != nil { return errors.Wrapf(err, "failed to create mapper for Cluster to OCIMachines") } @@ -197,7 +197,7 @@ func (r *OCIMachineReconciler) OCIClusterToOCIMachines(ctx context.Context) hand return func(o client.Object) []ctrl.Request { result := []ctrl.Request{} - c, ok := o.(*infrastructurev1beta1.OCICluster) + c, ok := o.(*infrastructurev1beta2.OCICluster) if !ok { log.Error(errors.Errorf("expected a OCICluster but got a %T", o), "failed to get OCIMachine for OCICluster") return nil @@ -231,12 +231,12 @@ func (r *OCIMachineReconciler) OCIClusterToOCIMachines(ctx context.Context) hand } func (r *OCIMachineReconciler) reconcileNormal(ctx context.Context, logger logr.Logger, machineScope *scope.MachineScope) (ctrl.Result, error) { - controllerutil.AddFinalizer(machineScope.OCIMachine, infrastructurev1beta1.MachineFinalizer) + controllerutil.AddFinalizer(machineScope.OCIMachine, infrastructurev1beta2.MachineFinalizer) machine := machineScope.OCIMachine // Make sure bootstrap data is available and populated. if machineScope.Machine.Spec.Bootstrap.DataSecretName == nil { - r.Recorder.Event(machine, corev1.EventTypeNormal, infrastructurev1beta1.WaitingForBootstrapDataReason, "Bootstrap data secret reference is not yet available") - conditions.MarkFalse(machine, infrastructurev1beta1.InstanceReadyCondition, infrastructurev1beta1.WaitingForBootstrapDataReason, clusterv1.ConditionSeverityInfo, "") + r.Recorder.Event(machine, corev1.EventTypeNormal, infrastructurev1beta2.WaitingForBootstrapDataReason, "Bootstrap data secret reference is not yet available") + conditions.MarkFalse(machine, infrastructurev1beta2.InstanceReadyCondition, infrastructurev1beta2.WaitingForBootstrapDataReason, clusterv1.ConditionSeverityInfo, "") logger.Info("Bootstrap data secret reference is not yet available") return ctrl.Result{}, nil } @@ -244,7 +244,7 @@ func (r *OCIMachineReconciler) reconcileNormal(ctx context.Context, logger logr. instance, err := r.getOrCreate(ctx, machineScope) if err != nil { r.Recorder.Event(machine, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "Failed to reconcile OCIMachine").Error()) - conditions.MarkFalse(machine, infrastructurev1beta1.InstanceReadyCondition, infrastructurev1beta1.InstanceProvisionFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(machine, infrastructurev1beta2.InstanceReadyCondition, infrastructurev1beta2.InstanceProvisionFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to reconcile OCI Machine %s/%s", machineScope.OCIMachine.Namespace, machineScope.OCIMachine.Name) } @@ -256,7 +256,7 @@ func (r *OCIMachineReconciler) reconcileNormal(ctx context.Context, logger logr. switch instance.LifecycleState { case core.InstanceLifecycleStateProvisioning, core.InstanceLifecycleStateStarting: machineScope.Info("Instance is pending") - conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta1.InstanceReadyCondition, infrastructurev1beta1.InstanceNotReadyReason, clusterv1.ConditionSeverityInfo, "") + conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta2.InstanceReadyCondition, infrastructurev1beta2.InstanceNotReadyReason, clusterv1.ConditionSeverityInfo, "") return reconcile.Result{RequeueAfter: 10 * time.Second}, nil case core.InstanceLifecycleStateRunning: machineScope.Info("Instance is active") @@ -265,7 +265,7 @@ func (r *OCIMachineReconciler) reconcileNormal(ctx context.Context, logger logr. ipAddress, err := machineScope.GetInstanceIp(ctx) if err != nil { r.Recorder.Event(machine, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to reconcile OCIMachine").Error()) - conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta1.InstanceReadyCondition, infrastructurev1beta1.InstanceIPAddressNotFound, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta2.InstanceReadyCondition, infrastructurev1beta2.InstanceIPAddressNotFound, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, err } machine.Status.Addresses = []clusterv1.MachineAddress{ @@ -279,7 +279,7 @@ func (r *OCIMachineReconciler) reconcileNormal(ctx context.Context, logger logr. err := machineScope.ReconcileCreateInstanceOnLB(ctx) if err != nil { r.Recorder.Event(machine, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to reconcile OCIMachine").Error()) - conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta1.InstanceReadyCondition, infrastructurev1beta1.InstanceLBBackendAdditionFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta2.InstanceReadyCondition, infrastructurev1beta2.InstanceLBBackendAdditionFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, err } machineScope.Info("Instance is added to the control plane LB") @@ -289,23 +289,23 @@ func (r *OCIMachineReconciler) reconcileNormal(ctx context.Context, logger logr. err := machineScope.ReconcileVnicAttachments(ctx) if err != nil { r.Recorder.Event(machine, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to reconcile OCIMachine").Error()) - conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta1.InstanceReadyCondition, - infrastructurev1beta1.InstanceVnicAttachmentFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta2.InstanceReadyCondition, + infrastructurev1beta2.InstanceVnicAttachmentFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, err } machineScope.Info("Instance vnic attachment success") - r.Recorder.Eventf(machineScope.OCIMachine, corev1.EventTypeNormal, infrastructurev1beta1.InstanceVnicAttachmentReady, + r.Recorder.Eventf(machineScope.OCIMachine, corev1.EventTypeNormal, infrastructurev1beta2.InstanceVnicAttachmentReady, "VNICs have been attached to instance.") } // record the event only when machine goes from not ready to ready state r.Recorder.Eventf(machine, corev1.EventTypeNormal, "InstanceReady", "Instance is in ready state") - conditions.MarkTrue(machineScope.OCIMachine, infrastructurev1beta1.InstanceReadyCondition) + conditions.MarkTrue(machineScope.OCIMachine, infrastructurev1beta2.InstanceReadyCondition) machineScope.SetReady() return reconcile.Result{}, nil default: - conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta1.InstanceReadyCondition, infrastructurev1beta1.InstanceProvisionFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta2.InstanceReadyCondition, infrastructurev1beta2.InstanceProvisionFailedReason, clusterv1.ConditionSeverityError, "") machineScope.SetFailureReason(capierrors.CreateMachineError) machineScope.SetFailureMessage(errors.Errorf("Instance status %q is unexpected", instance.LifecycleState)) r.Recorder.Eventf(machine, corev1.EventTypeWarning, "ReconcileError", @@ -329,9 +329,9 @@ func (r *OCIMachineReconciler) reconcileDelete(ctx context.Context, machineScope if err != nil { return reconcile.Result{}, err } - conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta1.InstanceReadyCondition, infrastructurev1beta1.InstanceNotFoundReason, clusterv1.ConditionSeverityInfo, "") + conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta2.InstanceReadyCondition, infrastructurev1beta2.InstanceNotFoundReason, clusterv1.ConditionSeverityInfo, "") machineScope.Info("Instance is not found, may have been deleted") - controllerutil.RemoveFinalizer(machineScope.OCIMachine, infrastructurev1beta1.MachineFinalizer) + controllerutil.RemoveFinalizer(machineScope.OCIMachine, infrastructurev1beta2.MachineFinalizer) return reconcile.Result{}, nil } else { return reconcile.Result{}, err @@ -339,7 +339,7 @@ func (r *OCIMachineReconciler) reconcileDelete(ctx context.Context, machineScope } if instance == nil { machineScope.Info("Instance is not found, may have been deleted") - controllerutil.RemoveFinalizer(machineScope.OCIMachine, infrastructurev1beta1.MachineFinalizer) + controllerutil.RemoveFinalizer(machineScope.OCIMachine, infrastructurev1beta2.MachineFinalizer) return reconcile.Result{}, nil } @@ -350,8 +350,8 @@ func (r *OCIMachineReconciler) reconcileDelete(ctx context.Context, machineScope machineScope.Info("Instance is terminating") return reconcile.Result{RequeueAfter: 30 * time.Second}, nil case core.InstanceLifecycleStateTerminated: - conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta1.InstanceReadyCondition, infrastructurev1beta1.InstanceTerminatedReason, clusterv1.ConditionSeverityInfo, "") - controllerutil.RemoveFinalizer(machineScope.OCIMachine, infrastructurev1beta1.MachineFinalizer) + conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta2.InstanceReadyCondition, infrastructurev1beta2.InstanceTerminatedReason, clusterv1.ConditionSeverityInfo, "") + controllerutil.RemoveFinalizer(machineScope.OCIMachine, infrastructurev1beta2.MachineFinalizer) machineScope.Info("Instance is deleted") r.Recorder.Eventf(machineScope.OCIMachine, corev1.EventTypeNormal, "InstanceTerminated", "Deleted the instance") @@ -368,7 +368,7 @@ func (r *OCIMachineReconciler) reconcileDelete(ctx context.Context, machineScope machineScope.Error(err, "Error deleting Instance") return ctrl.Result{}, errors.Wrapf(err, "error deleting instance %s", machineScope.Name()) } - conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta1.InstanceReadyCondition, infrastructurev1beta1.InstanceTerminatingReason, clusterv1.ConditionSeverityInfo, "") + conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta2.InstanceReadyCondition, infrastructurev1beta2.InstanceTerminatingReason, clusterv1.ConditionSeverityInfo, "") r.Recorder.Eventf(machineScope.OCIMachine, corev1.EventTypeNormal, "InstanceTerminating", "Terminating the instance") return reconcile.Result{RequeueAfter: 30 * time.Second}, nil diff --git a/controllers/ocimachine_controller_test.go b/controllers/ocimachine_controller_test.go index 79e2d740..660cf3a8 100644 --- a/controllers/ocimachine_controller_test.go +++ b/controllers/ocimachine_controller_test.go @@ -30,7 +30,7 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/cluster-api-provider-oci/cloud/scope" "github.com/oracle/cluster-api-provider-oci/cloud/services/compute/mock_compute" "github.com/oracle/oci-go-sdk/v65/common" @@ -102,7 +102,7 @@ func TestMachineReconciliation(t *testing.T) { name: "bootstrap data not available", errorExpected: false, objects: []client.Object{getSecret(), getOciMachine(), getMachine(), getCluster(), getOCICluster()}, - expectedEvent: infrastructurev1beta1.WaitingForBootstrapDataReason, + expectedEvent: infrastructurev1beta2.WaitingForBootstrapDataReason, }, } @@ -153,7 +153,7 @@ func TestNormalReconciliationFunction(t *testing.T) { r OCIMachineReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociMachine *infrastructurev1beta1.OCIMachine + ociMachine *infrastructurev1beta2.OCIMachine computeClient *mock_compute.MockComputeClient nlbClient *mock_nlb.MockNetworkLoadBalancerClient vcnClient *mock_vcn.MockClient @@ -205,7 +205,7 @@ func TestNormalReconciliationFunction(t *testing.T) { { name: "instance in provisioning state", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrastructurev1beta1.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrastructurev1beta1.InstanceNotReadyReason}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrastructurev1beta2.InstanceNotReadyReason}}, testSpecificSetup: func(machineScope *scope.MachineScope, computeClient *mock_compute.MockComputeClient, vcnClient *mock_vcn.MockClient, nlbclient *mock_nlb.MockNetworkLoadBalancerClient) { computeClient.EXPECT().GetInstance(gomock.Any(), gomock.Eq(core.GetInstanceRequest{ InstanceId: common.String("test"), @@ -221,7 +221,7 @@ func TestNormalReconciliationFunction(t *testing.T) { { name: "instance in running state", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrastructurev1beta1.InstanceReadyCondition, corev1.ConditionTrue, "", ""}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.InstanceReadyCondition, corev1.ConditionTrue, "", ""}}, testSpecificSetup: func(machineScope *scope.MachineScope, computeClient *mock_compute.MockComputeClient, vcnClient *mock_vcn.MockClient, nlbclient *mock_nlb.MockNetworkLoadBalancerClient) { machineScope.OCIMachine.Status.Addresses = []clusterv1.MachineAddress{ { @@ -244,7 +244,7 @@ func TestNormalReconciliationFunction(t *testing.T) { name: "instance in terminated state", errorExpected: true, expectedEvent: "invalid lifecycle state TERMINATED", - conditionAssertion: []conditionAssertion{{infrastructurev1beta1.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.InstanceProvisionFailedReason}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.InstanceProvisionFailedReason}}, testSpecificSetup: func(machineScope *scope.MachineScope, computeClient *mock_compute.MockComputeClient, vcnClient *mock_vcn.MockClient, nlbclient *mock_nlb.MockNetworkLoadBalancerClient) { computeClient.EXPECT().GetInstance(gomock.Any(), gomock.Eq(core.GetInstanceRequest{ InstanceId: common.String("test"), @@ -261,7 +261,7 @@ func TestNormalReconciliationFunction(t *testing.T) { name: "control plane backend vnic attachments call error", errorExpected: true, expectedEvent: "server error", - conditionAssertion: []conditionAssertion{{infrastructurev1beta1.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.InstanceIPAddressNotFound}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.InstanceIPAddressNotFound}}, testSpecificSetup: func(machineScope *scope.MachineScope, computeClient *mock_compute.MockComputeClient, vcnClient *mock_vcn.MockClient, nlbclient *mock_nlb.MockNetworkLoadBalancerClient) { machineScope.Machine.ObjectMeta.Labels = make(map[string]string) machineScope.Machine.ObjectMeta.Labels[clusterv1.MachineControlPlaneLabelName] = "true" @@ -337,7 +337,7 @@ func TestNormalReconciliationFunction(t *testing.T) { }, }, nil) }, - conditionAssertion: []conditionAssertion{{infrastructurev1beta1.InstanceReadyCondition, corev1.ConditionTrue, "", ""}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.InstanceReadyCondition, corev1.ConditionTrue, "", ""}}, }, { name: "backend creation", @@ -412,7 +412,7 @@ func TestNormalReconciliationFunction(t *testing.T) { Status: networkloadbalancer.OperationStatusSucceeded, }}, nil) }, - conditionAssertion: []conditionAssertion{{infrastructurev1beta1.InstanceReadyCondition, corev1.ConditionTrue, "", ""}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.InstanceReadyCondition, corev1.ConditionTrue, "", ""}}, }, { name: "ip address exists", @@ -471,7 +471,7 @@ func TestNormalReconciliationFunction(t *testing.T) { Status: networkloadbalancer.OperationStatusSucceeded, }}, nil) }, - conditionAssertion: []conditionAssertion{{infrastructurev1beta1.InstanceReadyCondition, corev1.ConditionTrue, "", ""}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.InstanceReadyCondition, corev1.ConditionTrue, "", ""}}, }, { name: "backend creation fails", @@ -546,7 +546,7 @@ func TestNormalReconciliationFunction(t *testing.T) { Status: networkloadbalancer.OperationStatusFailed, }}, nil) }, - conditionAssertion: []conditionAssertion{{infrastructurev1beta1.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.InstanceLBBackendAdditionFailedReason}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.InstanceLBBackendAdditionFailedReason}}, }, } @@ -578,7 +578,7 @@ func TestMachineReconciliationDelete(t *testing.T) { r OCIMachineReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociMachine *infrastructurev1beta1.OCIMachine + ociMachine *infrastructurev1beta2.OCIMachine computeClient *mock_compute.MockComputeClient ) @@ -646,7 +646,7 @@ func TestMachineReconciliationDeletionNormal(t *testing.T) { r OCIMachineReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociMachine *infrastructurev1beta1.OCIMachine + ociMachine *infrastructurev1beta2.OCIMachine computeClient *mock_compute.MockComputeClient nlbClient *mock_nlb.MockNetworkLoadBalancerClient vcnClient *mock_vcn.MockClient @@ -705,7 +705,7 @@ func TestMachineReconciliationDeletionNormal(t *testing.T) { errorExpected: false, objects: []client.Object{getSecret()}, expectedEvent: "InstanceTerminated", - conditionAssertion: []conditionAssertion{{infrastructurev1beta1.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrastructurev1beta1.InstanceTerminatedReason}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrastructurev1beta2.InstanceTerminatedReason}}, testSpecificSetup: func(machineScope *scope.MachineScope, computeClient *mock_compute.MockComputeClient, vcnClient *mock_vcn.MockClient, nlbClient *mock_nlb.MockNetworkLoadBalancerClient) { computeClient.EXPECT().GetInstance(gomock.Any(), gomock.Eq(core.GetInstanceRequest{ InstanceId: common.String("test"), @@ -723,7 +723,7 @@ func TestMachineReconciliationDeletionNormal(t *testing.T) { errorExpected: false, objects: []client.Object{getSecret()}, expectedEvent: "InstanceTerminating", - conditionAssertion: []conditionAssertion{{infrastructurev1beta1.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrastructurev1beta1.InstanceTerminatingReason}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrastructurev1beta2.InstanceTerminatingReason}}, testSpecificSetup: func(machineScope *scope.MachineScope, computeClient *mock_compute.MockComputeClient, vcnClient *mock_vcn.MockClient, nlbClient *mock_nlb.MockNetworkLoadBalancerClient) { computeClient.EXPECT().GetInstance(gomock.Any(), gomock.Eq(core.GetInstanceRequest{ InstanceId: common.String("test"), @@ -748,7 +748,7 @@ func TestMachineReconciliationDeletionNormal(t *testing.T) { errorExpected: false, objects: []client.Object{getSecret()}, expectedEvent: "InstanceTerminating", - conditionAssertion: []conditionAssertion{{infrastructurev1beta1.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrastructurev1beta1.InstanceTerminatingReason}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrastructurev1beta2.InstanceTerminatingReason}}, testSpecificSetup: func(machineScope *scope.MachineScope, computeClient *mock_compute.MockComputeClient, vcnClient *mock_vcn.MockClient, nlbClient *mock_nlb.MockNetworkLoadBalancerClient) { machineScope.Machine.ObjectMeta.Labels = make(map[string]string) machineScope.Machine.ObjectMeta.Labels[clusterv1.MachineControlPlaneLabelName] = "true" @@ -811,7 +811,7 @@ func TestMachineReconciliationDeletionNormal(t *testing.T) { errorExpected: false, objects: []client.Object{getSecret()}, expectedEvent: "OCIMachineRemovedFromLB", - conditionAssertion: []conditionAssertion{{infrastructurev1beta1.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrastructurev1beta1.InstanceNotFoundReason}}, + conditionAssertion: []conditionAssertion{{infrastructurev1beta2.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrastructurev1beta2.InstanceNotFoundReason}}, testSpecificSetup: func(machineScope *scope.MachineScope, computeClient *mock_compute.MockComputeClient, vcnClient *mock_vcn.MockClient, nlbClient *mock_nlb.MockNetworkLoadBalancerClient) { machineScope.Machine.ObjectMeta.Labels = make(map[string]string) machineScope.Machine.ObjectMeta.Labels[clusterv1.MachineControlPlaneLabelName] = "true" @@ -887,7 +887,7 @@ type conditionAssertion struct { reason string } -func expectConditions(g *WithT, m *infrastructurev1beta1.OCIMachine, expected []conditionAssertion) { +func expectConditions(g *WithT, m *infrastructurev1beta2.OCIMachine, 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) @@ -911,8 +911,8 @@ func getSecret() *corev1.Secret { } } -func getOciMachine() *infrastructurev1beta1.OCIMachine { - return &infrastructurev1beta1.OCIMachine{ +func getOciMachine() *infrastructurev1beta2.OCIMachine { + return &infrastructurev1beta2.OCIMachine{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "test", @@ -933,13 +933,13 @@ func getOciMachine() *infrastructurev1beta1.OCIMachine { }, }, }, - Spec: infrastructurev1beta1.OCIMachineSpec{ + Spec: infrastructurev1beta2.OCIMachineSpec{ InstanceId: common.String("test"), }, } } -func getOciMachineWithNoOwner() *infrastructurev1beta1.OCIMachine { +func getOciMachineWithNoOwner() *infrastructurev1beta2.OCIMachine { ociMachine := getOciMachine() ociMachine.OwnerReferences = []metav1.OwnerReference{} return ociMachine @@ -976,13 +976,13 @@ func getMachine() *clusterv1.Machine { return machine } -func getOCICluster() *infrastructurev1beta1.OCICluster { - return &infrastructurev1beta1.OCICluster{ +func getOCICluster() *infrastructurev1beta2.OCICluster { + return &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ Name: "oci-cluster", Namespace: "test", }, - Spec: infrastructurev1beta1.OCIClusterSpec{ + Spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "test", ControlPlaneEndpoint: clusterv1.APIEndpoint{ Port: 6443, diff --git a/controllers/suite_test.go b/controllers/suite_test.go index 1ab53e31..f2bb3607 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -20,7 +20,7 @@ import ( "os" "testing" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/client-go/kubernetes/scheme" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" @@ -35,6 +35,6 @@ func TestMain(m *testing.M) { } func setup() { - utilruntime.Must(infrastructurev1beta1.AddToScheme(scheme.Scheme)) + utilruntime.Must(infrastructurev1beta2.AddToScheme(scheme.Scheme)) utilruntime.Must(clusterv1.AddToScheme(scheme.Scheme)) } diff --git a/exp/api/v1beta1/conversion.go b/exp/api/v1beta1/conversion.go new file mode 100644 index 00000000..7c3d1ab0 --- /dev/null +++ b/exp/api/v1beta1/conversion.go @@ -0,0 +1,49 @@ +/* + Copyright (c) 2023 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 + +import ( + infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" + "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" + "k8s.io/apimachinery/pkg/conversion" +) + +// Convert_v1beta1_NetworkSpec_To_v1beta2_NetworkSpec converts v1beta1 NetworkSpec to v1beta2 NetworkSpec +func Convert_v1beta1_NetworkSpec_To_v1beta2_NetworkSpec(in *infrastructurev1beta1.NetworkSpec, out *infrastructurev1beta2.NetworkSpec, s conversion.Scope) error { + 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) +} diff --git a/exp/api/v1beta1/conversion_test.go b/exp/api/v1beta1/conversion_test.go new file mode 100644 index 00000000..cafd3c65 --- /dev/null +++ b/exp/api/v1beta1/conversion_test.go @@ -0,0 +1,104 @@ +/* + Copyright (c) 2023 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 + +import ( + "testing" + + 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" + runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilconversion "sigs.k8s.io/cluster-api/util/conversion" +) + +func fuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} { + return []interface{}{ + OCIMachinePoolFuzzer, + OCIClusterFuzzer, + } +} + +func OCIMachinePoolFuzzer(obj *OCIMachinePool, c fuzz.Continue) { + c.FuzzNoCustom(obj) + // nil fields which have been removed so that tests dont fail + if obj.Spec.InstanceConfiguration.InstanceVnicConfiguration != nil { + obj.Spec.InstanceConfiguration.InstanceVnicConfiguration.NSGId = nil + obj.Spec.InstanceConfiguration.InstanceVnicConfiguration.SubnetId = nil + } +} + +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{}, + Spoke: &OCIMachinePool{}, + FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, + })) + + t.Run("for OCIManagedMachinePool", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ + Scheme: scheme, + Hub: &v1beta2.OCIManagedMachinePool{}, + Spoke: &OCIManagedMachinePool{}, + 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/doc.go b/exp/api/v1beta1/doc.go new file mode 100644 index 00000000..5b0beb53 --- /dev/null +++ b/exp/api/v1beta1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright (c) 2023 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 + + http://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. +*/ + +// +k8s:conversion-gen=github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2 + +package v1beta1 diff --git a/exp/api/v1beta1/groupversion_type.go b/exp/api/v1beta1/groupversion_type.go index 90bce315..6ff1add7 100644 --- a/exp/api/v1beta1/groupversion_type.go +++ b/exp/api/v1beta1/groupversion_type.go @@ -30,4 +30,6 @@ var ( // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme + + localSchemeBuilder = SchemeBuilder.SchemeBuilder ) diff --git a/exp/api/v1beta1/ocimachinepool_conversion.go b/exp/api/v1beta1/ocimachinepool_conversion.go new file mode 100644 index 00000000..83b92a6f --- /dev/null +++ b/exp/api/v1beta1/ocimachinepool_conversion.go @@ -0,0 +1,56 @@ +/* +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 + + http://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 + +import ( + "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" + utilconversion "sigs.k8s.io/cluster-api/util/conversion" + "sigs.k8s.io/controller-runtime/pkg/conversion" +) + +// ConvertTo converts the v1beta1 OCIMachinePool receiver to a v1beta2 OCIMachinePool. +func (src *OCIMachinePool) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1beta2.OCIMachinePool) + + if err := Convert_v1beta1_OCIMachinePool_To_v1beta2_OCIMachinePool(src, dst, nil); err != nil { + return err + } + + // Manually restore data. + restored := &v1beta2.OCIMachinePool{} + if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { + return err + } + + return nil +} + +// ConvertFrom converts receiver to a v1beta2 OCIManagedMachinePool. +func (r *OCIMachinePool) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1beta2.OCIMachinePool) + + if err := Convert_v1beta2_OCIMachinePool_To_v1beta1_OCIMachinePool(src, r, nil); err != nil { + return err + } + + // Preserve Hub data on down-conversion. + if err := utilconversion.MarshalData(src, r); err != nil { + return err + } + + return nil +} diff --git a/exp/api/v1beta1/ocimachinepool_types.go b/exp/api/v1beta1/ocimachinepool_types.go index 5a0003fc..9a3d8326 100644 --- a/exp/api/v1beta1/ocimachinepool_types.go +++ b/exp/api/v1beta1/ocimachinepool_types.go @@ -211,6 +211,7 @@ type OCIMachinePoolStatus struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status +// +kubebuilder:storageversion type OCIMachinePool struct { metav1.TypeMeta `json:",inline"` @@ -221,6 +222,7 @@ type OCIMachinePool struct { } // +kubebuilder:object:root=true +// +kubebuilder:storageversion // OCIMachinePoolList contains a list of OCIMachinePool. type OCIMachinePoolList struct { diff --git a/exp/api/v1beta1/ocimanagedcluster_conversion.go b/exp/api/v1beta1/ocimanagedcluster_conversion.go new file mode 100644 index 00000000..6b3531ea --- /dev/null +++ b/exp/api/v1beta1/ocimanagedcluster_conversion.go @@ -0,0 +1,74 @@ +/* +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 + + http://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 + +import ( + infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" + utilconversion "sigs.k8s.io/cluster-api/util/conversion" + "sigs.k8s.io/controller-runtime/pkg/conversion" +) + +// ConvertTo converts the v1beta1 OCIManagedCluster receiver to a v1beta2 OCIManagedCluster. +func (src *OCIManagedCluster) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1beta2.OCIManagedCluster) + + if err := Convert_v1beta1_OCIManagedCluster_To_v1beta2_OCIManagedCluster(src, dst, nil); err != nil { + return err + } + + ad, err := infrastructurev1beta1.Convertv1beta1AdMapTov1beta2AdMap(src.Status.AvailabilityDomains) + if err != nil { + return err + } + dst.Spec.AvailabilityDomains = ad + + // Manually restore data. + restored := &v1beta2.OCIManagedCluster{} + if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { + return err + } + + dst.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.Skip = restored.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.Skip + dst.Spec.NetworkSpec.Vcn.NATGateway.Skip = restored.Spec.NetworkSpec.Vcn.NATGateway.Skip + dst.Spec.NetworkSpec.Vcn.ServiceGateway.Skip = restored.Spec.NetworkSpec.Vcn.ServiceGateway.Skip + dst.Spec.NetworkSpec.Vcn.InternetGateway.Skip = restored.Spec.NetworkSpec.Vcn.InternetGateway.Skip + dst.Spec.NetworkSpec.Vcn.RouteTable.Skip = restored.Spec.NetworkSpec.Vcn.RouteTable.Skip + return nil +} + +// ConvertFrom converts receiver to a v1beta2 OCICluster. +func (r *OCIManagedCluster) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1beta2.OCIManagedCluster) + + if err := Convert_v1beta2_OCIManagedCluster_To_v1beta1_OCIManagedCluster(src, r, nil); err != nil { + return err + } + + ad, err := infrastructurev1beta1.Convertv1beta2AdMapTov1beta1AdMap(src.Spec.AvailabilityDomains) + if err != nil { + return err + } + r.Status.AvailabilityDomains = ad + + // Preserve Hub data on down-conversion. + if err := utilconversion.MarshalData(src, r); err != nil { + return err + } + + return nil +} diff --git a/exp/api/v1beta1/ocimanagedcontrolplane_conversion.go b/exp/api/v1beta1/ocimanagedcontrolplane_conversion.go new file mode 100644 index 00000000..b733a706 --- /dev/null +++ b/exp/api/v1beta1/ocimanagedcontrolplane_conversion.go @@ -0,0 +1,54 @@ +/* +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 + + http://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 + +import ( + "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" + utilconversion "sigs.k8s.io/cluster-api/util/conversion" + "sigs.k8s.io/controller-runtime/pkg/conversion" +) + +// ConvertTo converts the v1beta1 OCIManagedCluster receiver to a v1beta2 OCIManagedCluster. +func (src *OCIManagedControlPlane) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1beta2.OCIManagedControlPlane) + + if err := Convert_v1beta1_OCIManagedControlPlane_To_v1beta2_OCIManagedControlPlane(src, dst, nil); err != nil { + return err + } + + restored := &v1beta2.OCIManagedControlPlane{} + if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { + return err + } + return nil +} + +// ConvertFrom converts receiver to a v1beta2 OCIManagedControlPlane. +func (r *OCIManagedControlPlane) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1beta2.OCIManagedControlPlane) + + if err := Convert_v1beta2_OCIManagedControlPlane_To_v1beta1_OCIManagedControlPlane(src, r, nil); err != nil { + return err + } + + // Preserve Hub data on down-conversion. + if err := utilconversion.MarshalData(src, r); err != nil { + return err + } + + return nil +} diff --git a/exp/api/v1beta1/ocimanagedcontrolplane_types.go b/exp/api/v1beta1/ocimanagedcontrolplane_types.go index aae3ee89..46283a63 100644 --- a/exp/api/v1beta1/ocimanagedcontrolplane_types.go +++ b/exp/api/v1beta1/ocimanagedcontrolplane_types.go @@ -156,6 +156,7 @@ type OCIManagedControlPlaneStatus struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status +// +kubebuilder:storageversion // OCIManagedControlPlane is the Schema for the ocimanagedcontrolplane API. type OCIManagedControlPlane struct { @@ -167,6 +168,7 @@ type OCIManagedControlPlane struct { } //+kubebuilder:object:root=true +// +kubebuilder:storageversion // OCIManagedControlPlaneList contains a list of OCIManagedControlPlane. type OCIManagedControlPlaneList struct { diff --git a/exp/api/v1beta1/ocimanagedmachinepool_conversion.go b/exp/api/v1beta1/ocimanagedmachinepool_conversion.go new file mode 100644 index 00000000..7a0946ed --- /dev/null +++ b/exp/api/v1beta1/ocimanagedmachinepool_conversion.go @@ -0,0 +1,55 @@ +/* +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 + + http://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 + +import ( + "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" + utilconversion "sigs.k8s.io/cluster-api/util/conversion" + "sigs.k8s.io/controller-runtime/pkg/conversion" +) + +// ConvertTo converts the v1beta1 OCIManagedMachinePool receiver to a v1beta2 OCIManagedMachinePool. +func (src *OCIManagedMachinePool) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1beta2.OCIManagedMachinePool) + + if err := Convert_v1beta1_OCIManagedMachinePool_To_v1beta2_OCIManagedMachinePool(src, dst, nil); err != nil { + return err + } + + restored := &v1beta2.OCIManagedMachinePool{} + if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { + return err + } + + return nil +} + +// ConvertFrom converts receiver to a v1beta2 OCIManagedMachinePool. +func (r *OCIManagedMachinePool) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1beta2.OCIManagedMachinePool) + + if err := Convert_v1beta2_OCIManagedMachinePool_To_v1beta1_OCIManagedMachinePool(src, r, nil); err != nil { + return err + } + + // Preserve Hub data on down-conversion. + if err := utilconversion.MarshalData(src, r); err != nil { + return err + } + + return nil +} diff --git a/exp/api/v1beta1/zz_generated.conversion.go b/exp/api/v1beta1/zz_generated.conversion.go new file mode 100644 index 00000000..398853cc --- /dev/null +++ b/exp/api/v1beta1/zz_generated.conversion.go @@ -0,0 +1,1922 @@ +//go:build !ignore_autogenerated_conversions +// +build !ignore_autogenerated_conversions + +/* +Copyright (c) 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 + + http://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. +*/ + +// Code generated by conversion-gen. DO NOT EDIT. + +package v1beta1 + +import ( + unsafe "unsafe" + + 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" + errors "sigs.k8s.io/cluster-api/errors" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// 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 { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.InstanceConfiguration)(nil), (*InstanceConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_InstanceConfiguration_To_v1beta1_InstanceConfiguration(a.(*v1beta2.InstanceConfiguration), b.(*InstanceConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstanceSourceViaImageConfig)(nil), (*v1beta2.InstanceSourceViaImageConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_InstanceSourceViaImageConfig_To_v1beta2_InstanceSourceViaImageConfig(a.(*InstanceSourceViaImageConfig), b.(*v1beta2.InstanceSourceViaImageConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.InstanceSourceViaImageConfig)(nil), (*InstanceSourceViaImageConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_InstanceSourceViaImageConfig_To_v1beta1_InstanceSourceViaImageConfig(a.(*v1beta2.InstanceSourceViaImageConfig), b.(*InstanceSourceViaImageConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*InstanceVnicConfiguration)(nil), (*v1beta2.InstanceVnicConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_InstanceVnicConfiguration_To_v1beta2_InstanceVnicConfiguration(a.(*InstanceVnicConfiguration), b.(*v1beta2.InstanceVnicConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.InstanceVnicConfiguration)(nil), (*InstanceVnicConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_InstanceVnicConfiguration_To_v1beta1_InstanceVnicConfiguration(a.(*v1beta2.InstanceVnicConfiguration), b.(*InstanceVnicConfiguration), scope) + }); 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 { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.KeyValue)(nil), (*KeyValue)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_KeyValue_To_v1beta1_KeyValue(a.(*v1beta2.KeyValue), b.(*KeyValue), 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((*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 { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.LaunchDetails)(nil), (*LaunchDetails)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_LaunchDetails_To_v1beta1_LaunchDetails(a.(*v1beta2.LaunchDetails), b.(*LaunchDetails), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeEvictionNodePoolSettings)(nil), (*v1beta2.NodeEvictionNodePoolSettings)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NodeEvictionNodePoolSettings_To_v1beta2_NodeEvictionNodePoolSettings(a.(*NodeEvictionNodePoolSettings), b.(*v1beta2.NodeEvictionNodePoolSettings), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.NodeEvictionNodePoolSettings)(nil), (*NodeEvictionNodePoolSettings)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_NodeEvictionNodePoolSettings_To_v1beta1_NodeEvictionNodePoolSettings(a.(*v1beta2.NodeEvictionNodePoolSettings), b.(*NodeEvictionNodePoolSettings), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodePoolNodeConfig)(nil), (*v1beta2.NodePoolNodeConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NodePoolNodeConfig_To_v1beta2_NodePoolNodeConfig(a.(*NodePoolNodeConfig), b.(*v1beta2.NodePoolNodeConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.NodePoolNodeConfig)(nil), (*NodePoolNodeConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_NodePoolNodeConfig_To_v1beta1_NodePoolNodeConfig(a.(*v1beta2.NodePoolNodeConfig), b.(*NodePoolNodeConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodePoolPodNetworkOptionDetails)(nil), (*v1beta2.NodePoolPodNetworkOptionDetails)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NodePoolPodNetworkOptionDetails_To_v1beta2_NodePoolPodNetworkOptionDetails(a.(*NodePoolPodNetworkOptionDetails), b.(*v1beta2.NodePoolPodNetworkOptionDetails), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.NodePoolPodNetworkOptionDetails)(nil), (*NodePoolPodNetworkOptionDetails)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_NodePoolPodNetworkOptionDetails_To_v1beta1_NodePoolPodNetworkOptionDetails(a.(*v1beta2.NodePoolPodNetworkOptionDetails), b.(*NodePoolPodNetworkOptionDetails), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeShapeConfig)(nil), (*v1beta2.NodeShapeConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NodeShapeConfig_To_v1beta2_NodeShapeConfig(a.(*NodeShapeConfig), b.(*v1beta2.NodeShapeConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.NodeShapeConfig)(nil), (*NodeShapeConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_NodeShapeConfig_To_v1beta1_NodeShapeConfig(a.(*v1beta2.NodeShapeConfig), b.(*NodeShapeConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeSourceViaImage)(nil), (*v1beta2.NodeSourceViaImage)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NodeSourceViaImage_To_v1beta2_NodeSourceViaImage(a.(*NodeSourceViaImage), b.(*v1beta2.NodeSourceViaImage), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.NodeSourceViaImage)(nil), (*NodeSourceViaImage)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_NodeSourceViaImage_To_v1beta1_NodeSourceViaImage(a.(*v1beta2.NodeSourceViaImage), b.(*NodeSourceViaImage), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIMachinePool)(nil), (*v1beta2.OCIMachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIMachinePool_To_v1beta2_OCIMachinePool(a.(*OCIMachinePool), b.(*v1beta2.OCIMachinePool), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIMachinePool)(nil), (*OCIMachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIMachinePool_To_v1beta1_OCIMachinePool(a.(*v1beta2.OCIMachinePool), b.(*OCIMachinePool), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIMachinePoolList)(nil), (*v1beta2.OCIMachinePoolList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIMachinePoolList_To_v1beta2_OCIMachinePoolList(a.(*OCIMachinePoolList), b.(*v1beta2.OCIMachinePoolList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIMachinePoolList)(nil), (*OCIMachinePoolList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIMachinePoolList_To_v1beta1_OCIMachinePoolList(a.(*v1beta2.OCIMachinePoolList), b.(*OCIMachinePoolList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIMachinePoolSpec)(nil), (*v1beta2.OCIMachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIMachinePoolSpec_To_v1beta2_OCIMachinePoolSpec(a.(*OCIMachinePoolSpec), b.(*v1beta2.OCIMachinePoolSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIMachinePoolSpec)(nil), (*OCIMachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIMachinePoolSpec_To_v1beta1_OCIMachinePoolSpec(a.(*v1beta2.OCIMachinePoolSpec), b.(*OCIMachinePoolSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIMachinePoolStatus)(nil), (*v1beta2.OCIMachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIMachinePoolStatus_To_v1beta2_OCIMachinePoolStatus(a.(*OCIMachinePoolStatus), b.(*v1beta2.OCIMachinePoolStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIMachinePoolStatus)(nil), (*OCIMachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIMachinePoolStatus_To_v1beta1_OCIMachinePoolStatus(a.(*v1beta2.OCIMachinePoolStatus), b.(*OCIMachinePoolStatus), scope) + }); 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((*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.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((*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.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 { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedMachinePool)(nil), (*OCIManagedMachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedMachinePool_To_v1beta1_OCIManagedMachinePool(a.(*v1beta2.OCIManagedMachinePool), b.(*OCIManagedMachinePool), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedMachinePoolList)(nil), (*v1beta2.OCIManagedMachinePoolList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedMachinePoolList_To_v1beta2_OCIManagedMachinePoolList(a.(*OCIManagedMachinePoolList), b.(*v1beta2.OCIManagedMachinePoolList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedMachinePoolList)(nil), (*OCIManagedMachinePoolList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedMachinePoolList_To_v1beta1_OCIManagedMachinePoolList(a.(*v1beta2.OCIManagedMachinePoolList), b.(*OCIManagedMachinePoolList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedMachinePoolSpec)(nil), (*v1beta2.OCIManagedMachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedMachinePoolSpec_To_v1beta2_OCIManagedMachinePoolSpec(a.(*OCIManagedMachinePoolSpec), b.(*v1beta2.OCIManagedMachinePoolSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*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 { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedMachinePoolStatus)(nil), (*v1beta2.OCIManagedMachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedMachinePoolStatus_To_v1beta2_OCIManagedMachinePoolStatus(a.(*OCIManagedMachinePoolStatus), b.(*v1beta2.OCIManagedMachinePoolStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedMachinePoolStatus)(nil), (*OCIManagedMachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedMachinePoolStatus_To_v1beta1_OCIManagedMachinePoolStatus(a.(*v1beta2.OCIManagedMachinePoolStatus), b.(*OCIManagedMachinePoolStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedMachinePoolTemplate)(nil), (*v1beta2.OCIManagedMachinePoolTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedMachinePoolTemplate_To_v1beta2_OCIManagedMachinePoolTemplate(a.(*OCIManagedMachinePoolTemplate), b.(*v1beta2.OCIManagedMachinePoolTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedMachinePoolTemplate)(nil), (*OCIManagedMachinePoolTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedMachinePoolTemplate_To_v1beta1_OCIManagedMachinePoolTemplate(a.(*v1beta2.OCIManagedMachinePoolTemplate), b.(*OCIManagedMachinePoolTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedMachinePoolTemplateList)(nil), (*v1beta2.OCIManagedMachinePoolTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedMachinePoolTemplateList_To_v1beta2_OCIManagedMachinePoolTemplateList(a.(*OCIManagedMachinePoolTemplateList), b.(*v1beta2.OCIManagedMachinePoolTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedMachinePoolTemplateList)(nil), (*OCIManagedMachinePoolTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedMachinePoolTemplateList_To_v1beta1_OCIManagedMachinePoolTemplateList(a.(*v1beta2.OCIManagedMachinePoolTemplateList), b.(*OCIManagedMachinePoolTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedMachinePoolTemplateResource)(nil), (*v1beta2.OCIManagedMachinePoolTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedMachinePoolTemplateResource_To_v1beta2_OCIManagedMachinePoolTemplateResource(a.(*OCIManagedMachinePoolTemplateResource), b.(*v1beta2.OCIManagedMachinePoolTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedMachinePoolTemplateResource)(nil), (*OCIManagedMachinePoolTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedMachinePoolTemplateResource_To_v1beta1_OCIManagedMachinePoolTemplateResource(a.(*v1beta2.OCIManagedMachinePoolTemplateResource), b.(*OCIManagedMachinePoolTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*OCIManagedMachinePoolTemplateSpec)(nil), (*v1beta2.OCIManagedMachinePoolTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_OCIManagedMachinePoolTemplateSpec_To_v1beta2_OCIManagedMachinePoolTemplateSpec(a.(*OCIManagedMachinePoolTemplateSpec), b.(*v1beta2.OCIManagedMachinePoolTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.OCIManagedMachinePoolTemplateSpec)(nil), (*OCIManagedMachinePoolTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_OCIManagedMachinePoolTemplateSpec_To_v1beta1_OCIManagedMachinePoolTemplateSpec(a.(*v1beta2.OCIManagedMachinePoolTemplateSpec), b.(*OCIManagedMachinePoolTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PlacementConfig)(nil), (*v1beta2.PlacementConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_PlacementConfig_To_v1beta2_PlacementConfig(a.(*PlacementConfig), b.(*v1beta2.PlacementConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.PlacementConfig)(nil), (*PlacementConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_PlacementConfig_To_v1beta1_PlacementConfig(a.(*v1beta2.PlacementConfig), b.(*PlacementConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PlacementDetails)(nil), (*v1beta2.PlacementDetails)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_PlacementDetails_To_v1beta2_PlacementDetails(a.(*PlacementDetails), b.(*v1beta2.PlacementDetails), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.PlacementDetails)(nil), (*PlacementDetails)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_PlacementDetails_To_v1beta1_PlacementDetails(a.(*v1beta2.PlacementDetails), b.(*PlacementDetails), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ShapeConfig)(nil), (*v1beta2.ShapeConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_ShapeConfig_To_v1beta2_ShapeConfig(a.(*ShapeConfig), b.(*v1beta2.ShapeConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.ShapeConfig)(nil), (*ShapeConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_ShapeConfig_To_v1beta1_ShapeConfig(a.(*v1beta2.ShapeConfig), b.(*ShapeConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VcnIpNativePodNetworkOptions)(nil), (*v1beta2.VcnIpNativePodNetworkOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_VcnIpNativePodNetworkOptions_To_v1beta2_VcnIpNativePodNetworkOptions(a.(*VcnIpNativePodNetworkOptions), b.(*v1beta2.VcnIpNativePodNetworkOptions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.VcnIpNativePodNetworkOptions)(nil), (*VcnIpNativePodNetworkOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_VcnIpNativePodNetworkOptions_To_v1beta1_VcnIpNativePodNetworkOptions(a.(*v1beta2.VcnIpNativePodNetworkOptions), b.(*VcnIpNativePodNetworkOptions), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*apiv1beta1.NetworkSpec)(nil), (*apiv1beta2.NetworkSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NetworkSpec_To_v1beta2_NetworkSpec(a.(*apiv1beta1.NetworkSpec), b.(*apiv1beta2.NetworkSpec), scope) + }); 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 { + return err + } + if err := s.AddConversionFunc((*apiv1beta2.NetworkSpec)(nil), (*apiv1beta1.NetworkSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_NetworkSpec_To_v1beta1_NetworkSpec(a.(*apiv1beta2.NetworkSpec), b.(*apiv1beta1.NetworkSpec), scope) + }); 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 + } + 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)) + out.ShapeConfig = (*v1beta2.ShapeConfig)(unsafe.Pointer(in.ShapeConfig)) + if in.InstanceVnicConfiguration != nil { + in, out := &in.InstanceVnicConfiguration, &out.InstanceVnicConfiguration + *out = new(apiv1beta2.NetworkDetails) + if err := apiv1beta1.Convert_v1beta1_NetworkDetails_To_v1beta2_NetworkDetails(*in, *out, s); err != nil { + return err + } + } else { + out.InstanceVnicConfiguration = nil + } + out.PlatformConfig = (*apiv1beta2.PlatformConfig)(unsafe.Pointer(in.PlatformConfig)) + out.AgentConfig = (*apiv1beta2.LaunchInstanceAgentConfig)(unsafe.Pointer(in.AgentConfig)) + out.PreemptibleInstanceConfig = (*apiv1beta2.PreemptibleInstanceConfig)(unsafe.Pointer(in.PreemptibleInstanceConfig)) + out.AvailabilityConfig = (*apiv1beta2.LaunchInstanceAvailabilityConfig)(unsafe.Pointer(in.AvailabilityConfig)) + out.DedicatedVmHostId = (*string)(unsafe.Pointer(in.DedicatedVmHostId)) + out.LaunchOptions = (*apiv1beta2.LaunchOptions)(unsafe.Pointer(in.LaunchOptions)) + out.InstanceOptions = (*apiv1beta2.InstanceOptions)(unsafe.Pointer(in.InstanceOptions)) + out.IsPvEncryptionInTransitEnabled = (*bool)(unsafe.Pointer(in.IsPvEncryptionInTransitEnabled)) + out.InstanceSourceViaImageDetails = (*v1beta2.InstanceSourceViaImageConfig)(unsafe.Pointer(in.InstanceSourceViaImageDetails)) + out.CapacityReservationId = (*string)(unsafe.Pointer(in.CapacityReservationId)) + out.Metadata = *(*map[string]string)(unsafe.Pointer(&in.Metadata)) + return nil +} + +// Convert_v1beta1_InstanceConfiguration_To_v1beta2_InstanceConfiguration is an autogenerated conversion function. +func Convert_v1beta1_InstanceConfiguration_To_v1beta2_InstanceConfiguration(in *InstanceConfiguration, out *v1beta2.InstanceConfiguration, s conversion.Scope) error { + return autoConvert_v1beta1_InstanceConfiguration_To_v1beta2_InstanceConfiguration(in, out, s) +} + +func autoConvert_v1beta2_InstanceConfiguration_To_v1beta1_InstanceConfiguration(in *v1beta2.InstanceConfiguration, out *InstanceConfiguration, s conversion.Scope) error { + out.InstanceConfigurationId = (*string)(unsafe.Pointer(in.InstanceConfigurationId)) + out.Shape = (*string)(unsafe.Pointer(in.Shape)) + out.ShapeConfig = (*ShapeConfig)(unsafe.Pointer(in.ShapeConfig)) + if in.InstanceVnicConfiguration != nil { + in, out := &in.InstanceVnicConfiguration, &out.InstanceVnicConfiguration + *out = new(apiv1beta1.NetworkDetails) + if err := Convert_v1beta2_NetworkDetails_To_v1beta1_NetworkDetails(*in, *out, s); err != nil { + return err + } + } else { + out.InstanceVnicConfiguration = nil + } + out.PlatformConfig = (*apiv1beta1.PlatformConfig)(unsafe.Pointer(in.PlatformConfig)) + out.AgentConfig = (*apiv1beta1.LaunchInstanceAgentConfig)(unsafe.Pointer(in.AgentConfig)) + out.PreemptibleInstanceConfig = (*apiv1beta1.PreemptibleInstanceConfig)(unsafe.Pointer(in.PreemptibleInstanceConfig)) + out.AvailabilityConfig = (*apiv1beta1.LaunchInstanceAvailabilityConfig)(unsafe.Pointer(in.AvailabilityConfig)) + out.DedicatedVmHostId = (*string)(unsafe.Pointer(in.DedicatedVmHostId)) + out.LaunchOptions = (*apiv1beta1.LaunchOptions)(unsafe.Pointer(in.LaunchOptions)) + out.InstanceOptions = (*apiv1beta1.InstanceOptions)(unsafe.Pointer(in.InstanceOptions)) + out.IsPvEncryptionInTransitEnabled = (*bool)(unsafe.Pointer(in.IsPvEncryptionInTransitEnabled)) + out.InstanceSourceViaImageDetails = (*InstanceSourceViaImageConfig)(unsafe.Pointer(in.InstanceSourceViaImageDetails)) + out.CapacityReservationId = (*string)(unsafe.Pointer(in.CapacityReservationId)) + out.Metadata = *(*map[string]string)(unsafe.Pointer(&in.Metadata)) + return nil +} + +// Convert_v1beta2_InstanceConfiguration_To_v1beta1_InstanceConfiguration is an autogenerated conversion function. +func Convert_v1beta2_InstanceConfiguration_To_v1beta1_InstanceConfiguration(in *v1beta2.InstanceConfiguration, out *InstanceConfiguration, s conversion.Scope) error { + return autoConvert_v1beta2_InstanceConfiguration_To_v1beta1_InstanceConfiguration(in, out, s) +} + +func autoConvert_v1beta1_InstanceSourceViaImageConfig_To_v1beta2_InstanceSourceViaImageConfig(in *InstanceSourceViaImageConfig, out *v1beta2.InstanceSourceViaImageConfig, s conversion.Scope) error { + out.ImageId = (*string)(unsafe.Pointer(in.ImageId)) + out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) + out.BootVolumeSizeInGBs = (*int64)(unsafe.Pointer(in.BootVolumeSizeInGBs)) + out.BootVolumeVpusPerGB = (*int64)(unsafe.Pointer(in.BootVolumeVpusPerGB)) + return nil +} + +// Convert_v1beta1_InstanceSourceViaImageConfig_To_v1beta2_InstanceSourceViaImageConfig is an autogenerated conversion function. +func Convert_v1beta1_InstanceSourceViaImageConfig_To_v1beta2_InstanceSourceViaImageConfig(in *InstanceSourceViaImageConfig, out *v1beta2.InstanceSourceViaImageConfig, s conversion.Scope) error { + return autoConvert_v1beta1_InstanceSourceViaImageConfig_To_v1beta2_InstanceSourceViaImageConfig(in, out, s) +} + +func autoConvert_v1beta2_InstanceSourceViaImageConfig_To_v1beta1_InstanceSourceViaImageConfig(in *v1beta2.InstanceSourceViaImageConfig, out *InstanceSourceViaImageConfig, s conversion.Scope) error { + out.ImageId = (*string)(unsafe.Pointer(in.ImageId)) + out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) + out.BootVolumeSizeInGBs = (*int64)(unsafe.Pointer(in.BootVolumeSizeInGBs)) + out.BootVolumeVpusPerGB = (*int64)(unsafe.Pointer(in.BootVolumeVpusPerGB)) + return nil +} + +// Convert_v1beta2_InstanceSourceViaImageConfig_To_v1beta1_InstanceSourceViaImageConfig is an autogenerated conversion function. +func Convert_v1beta2_InstanceSourceViaImageConfig_To_v1beta1_InstanceSourceViaImageConfig(in *v1beta2.InstanceSourceViaImageConfig, out *InstanceSourceViaImageConfig, s conversion.Scope) error { + return autoConvert_v1beta2_InstanceSourceViaImageConfig_To_v1beta1_InstanceSourceViaImageConfig(in, out, s) +} + +func autoConvert_v1beta1_InstanceVnicConfiguration_To_v1beta2_InstanceVnicConfiguration(in *InstanceVnicConfiguration, out *v1beta2.InstanceVnicConfiguration, s conversion.Scope) error { + out.AssignPublicIp = in.AssignPublicIp + out.SubnetName = in.SubnetName + out.NSGId = (*string)(unsafe.Pointer(in.NSGId)) + out.SkipSourceDestCheck = (*bool)(unsafe.Pointer(in.SkipSourceDestCheck)) + out.NsgNames = *(*[]string)(unsafe.Pointer(&in.NsgNames)) + out.HostnameLabel = (*string)(unsafe.Pointer(in.HostnameLabel)) + out.DisplayName = (*string)(unsafe.Pointer(in.DisplayName)) + out.AssignPrivateDnsRecord = (*bool)(unsafe.Pointer(in.AssignPrivateDnsRecord)) + return nil +} + +// Convert_v1beta1_InstanceVnicConfiguration_To_v1beta2_InstanceVnicConfiguration is an autogenerated conversion function. +func Convert_v1beta1_InstanceVnicConfiguration_To_v1beta2_InstanceVnicConfiguration(in *InstanceVnicConfiguration, out *v1beta2.InstanceVnicConfiguration, s conversion.Scope) error { + return autoConvert_v1beta1_InstanceVnicConfiguration_To_v1beta2_InstanceVnicConfiguration(in, out, s) +} + +func autoConvert_v1beta2_InstanceVnicConfiguration_To_v1beta1_InstanceVnicConfiguration(in *v1beta2.InstanceVnicConfiguration, out *InstanceVnicConfiguration, s conversion.Scope) error { + out.AssignPublicIp = in.AssignPublicIp + out.SubnetName = in.SubnetName + out.NSGId = (*string)(unsafe.Pointer(in.NSGId)) + out.SkipSourceDestCheck = (*bool)(unsafe.Pointer(in.SkipSourceDestCheck)) + out.NsgNames = *(*[]string)(unsafe.Pointer(&in.NsgNames)) + out.HostnameLabel = (*string)(unsafe.Pointer(in.HostnameLabel)) + out.DisplayName = (*string)(unsafe.Pointer(in.DisplayName)) + out.AssignPrivateDnsRecord = (*bool)(unsafe.Pointer(in.AssignPrivateDnsRecord)) + return nil +} + +// Convert_v1beta2_InstanceVnicConfiguration_To_v1beta1_InstanceVnicConfiguration is an autogenerated conversion function. +func Convert_v1beta2_InstanceVnicConfiguration_To_v1beta1_InstanceVnicConfiguration(in *v1beta2.InstanceVnicConfiguration, out *InstanceVnicConfiguration, s conversion.Scope) error { + 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)) + return nil +} + +// Convert_v1beta1_KeyValue_To_v1beta2_KeyValue is an autogenerated conversion function. +func Convert_v1beta1_KeyValue_To_v1beta2_KeyValue(in *KeyValue, out *v1beta2.KeyValue, s conversion.Scope) error { + return autoConvert_v1beta1_KeyValue_To_v1beta2_KeyValue(in, out, s) +} + +func autoConvert_v1beta2_KeyValue_To_v1beta1_KeyValue(in *v1beta2.KeyValue, out *KeyValue, s conversion.Scope) error { + out.Key = (*string)(unsafe.Pointer(in.Key)) + out.Value = (*string)(unsafe.Pointer(in.Value)) + return nil +} + +// Convert_v1beta2_KeyValue_To_v1beta1_KeyValue is an autogenerated conversion function. +func Convert_v1beta2_KeyValue_To_v1beta1_KeyValue(in *v1beta2.KeyValue, out *KeyValue, s conversion.Scope) error { + 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 + return nil +} + +// Convert_v1beta1_LaunchDetails_To_v1beta2_LaunchDetails is an autogenerated conversion function. +func Convert_v1beta1_LaunchDetails_To_v1beta2_LaunchDetails(in *LaunchDetails, out *v1beta2.LaunchDetails, s conversion.Scope) error { + return autoConvert_v1beta1_LaunchDetails_To_v1beta2_LaunchDetails(in, out, s) +} + +func autoConvert_v1beta2_LaunchDetails_To_v1beta1_LaunchDetails(in *v1beta2.LaunchDetails, out *LaunchDetails, s conversion.Scope) error { + out.Metadata = *(*map[string]string)(unsafe.Pointer(&in.Metadata)) + out.Shape = in.Shape + return nil +} + +// Convert_v1beta2_LaunchDetails_To_v1beta1_LaunchDetails is an autogenerated conversion function. +func Convert_v1beta2_LaunchDetails_To_v1beta1_LaunchDetails(in *v1beta2.LaunchDetails, out *LaunchDetails, s conversion.Scope) error { + return autoConvert_v1beta2_LaunchDetails_To_v1beta1_LaunchDetails(in, out, s) +} + +func autoConvert_v1beta1_NodeEvictionNodePoolSettings_To_v1beta2_NodeEvictionNodePoolSettings(in *NodeEvictionNodePoolSettings, out *v1beta2.NodeEvictionNodePoolSettings, s conversion.Scope) error { + out.EvictionGraceDuration = (*string)(unsafe.Pointer(in.EvictionGraceDuration)) + out.IsForceDeleteAfterGraceDuration = (*bool)(unsafe.Pointer(in.IsForceDeleteAfterGraceDuration)) + return nil +} + +// Convert_v1beta1_NodeEvictionNodePoolSettings_To_v1beta2_NodeEvictionNodePoolSettings is an autogenerated conversion function. +func Convert_v1beta1_NodeEvictionNodePoolSettings_To_v1beta2_NodeEvictionNodePoolSettings(in *NodeEvictionNodePoolSettings, out *v1beta2.NodeEvictionNodePoolSettings, s conversion.Scope) error { + return autoConvert_v1beta1_NodeEvictionNodePoolSettings_To_v1beta2_NodeEvictionNodePoolSettings(in, out, s) +} + +func autoConvert_v1beta2_NodeEvictionNodePoolSettings_To_v1beta1_NodeEvictionNodePoolSettings(in *v1beta2.NodeEvictionNodePoolSettings, out *NodeEvictionNodePoolSettings, s conversion.Scope) error { + out.EvictionGraceDuration = (*string)(unsafe.Pointer(in.EvictionGraceDuration)) + out.IsForceDeleteAfterGraceDuration = (*bool)(unsafe.Pointer(in.IsForceDeleteAfterGraceDuration)) + return nil +} + +// Convert_v1beta2_NodeEvictionNodePoolSettings_To_v1beta1_NodeEvictionNodePoolSettings is an autogenerated conversion function. +func Convert_v1beta2_NodeEvictionNodePoolSettings_To_v1beta1_NodeEvictionNodePoolSettings(in *v1beta2.NodeEvictionNodePoolSettings, out *NodeEvictionNodePoolSettings, s conversion.Scope) error { + return autoConvert_v1beta2_NodeEvictionNodePoolSettings_To_v1beta1_NodeEvictionNodePoolSettings(in, out, s) +} + +func autoConvert_v1beta1_NodePoolNodeConfig_To_v1beta2_NodePoolNodeConfig(in *NodePoolNodeConfig, out *v1beta2.NodePoolNodeConfig, s conversion.Scope) error { + out.IsPvEncryptionInTransitEnabled = (*bool)(unsafe.Pointer(in.IsPvEncryptionInTransitEnabled)) + out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) + out.PlacementConfigs = *(*[]v1beta2.PlacementConfig)(unsafe.Pointer(&in.PlacementConfigs)) + out.NsgNames = *(*[]string)(unsafe.Pointer(&in.NsgNames)) + out.NodePoolPodNetworkOptionDetails = (*v1beta2.NodePoolPodNetworkOptionDetails)(unsafe.Pointer(in.NodePoolPodNetworkOptionDetails)) + return nil +} + +// Convert_v1beta1_NodePoolNodeConfig_To_v1beta2_NodePoolNodeConfig is an autogenerated conversion function. +func Convert_v1beta1_NodePoolNodeConfig_To_v1beta2_NodePoolNodeConfig(in *NodePoolNodeConfig, out *v1beta2.NodePoolNodeConfig, s conversion.Scope) error { + return autoConvert_v1beta1_NodePoolNodeConfig_To_v1beta2_NodePoolNodeConfig(in, out, s) +} + +func autoConvert_v1beta2_NodePoolNodeConfig_To_v1beta1_NodePoolNodeConfig(in *v1beta2.NodePoolNodeConfig, out *NodePoolNodeConfig, s conversion.Scope) error { + out.IsPvEncryptionInTransitEnabled = (*bool)(unsafe.Pointer(in.IsPvEncryptionInTransitEnabled)) + out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) + out.PlacementConfigs = *(*[]PlacementConfig)(unsafe.Pointer(&in.PlacementConfigs)) + out.NsgNames = *(*[]string)(unsafe.Pointer(&in.NsgNames)) + out.NodePoolPodNetworkOptionDetails = (*NodePoolPodNetworkOptionDetails)(unsafe.Pointer(in.NodePoolPodNetworkOptionDetails)) + return nil +} + +// Convert_v1beta2_NodePoolNodeConfig_To_v1beta1_NodePoolNodeConfig is an autogenerated conversion function. +func Convert_v1beta2_NodePoolNodeConfig_To_v1beta1_NodePoolNodeConfig(in *v1beta2.NodePoolNodeConfig, out *NodePoolNodeConfig, s conversion.Scope) error { + return autoConvert_v1beta2_NodePoolNodeConfig_To_v1beta1_NodePoolNodeConfig(in, out, s) +} + +func autoConvert_v1beta1_NodePoolPodNetworkOptionDetails_To_v1beta2_NodePoolPodNetworkOptionDetails(in *NodePoolPodNetworkOptionDetails, out *v1beta2.NodePoolPodNetworkOptionDetails, s conversion.Scope) error { + out.CniType = v1beta2.CNIOptionEnum(in.CniType) + if err := Convert_v1beta1_VcnIpNativePodNetworkOptions_To_v1beta2_VcnIpNativePodNetworkOptions(&in.VcnIpNativePodNetworkOptions, &out.VcnIpNativePodNetworkOptions, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_NodePoolPodNetworkOptionDetails_To_v1beta2_NodePoolPodNetworkOptionDetails is an autogenerated conversion function. +func Convert_v1beta1_NodePoolPodNetworkOptionDetails_To_v1beta2_NodePoolPodNetworkOptionDetails(in *NodePoolPodNetworkOptionDetails, out *v1beta2.NodePoolPodNetworkOptionDetails, s conversion.Scope) error { + return autoConvert_v1beta1_NodePoolPodNetworkOptionDetails_To_v1beta2_NodePoolPodNetworkOptionDetails(in, out, s) +} + +func autoConvert_v1beta2_NodePoolPodNetworkOptionDetails_To_v1beta1_NodePoolPodNetworkOptionDetails(in *v1beta2.NodePoolPodNetworkOptionDetails, out *NodePoolPodNetworkOptionDetails, s conversion.Scope) error { + out.CniType = CNIOptionEnum(in.CniType) + if err := Convert_v1beta2_VcnIpNativePodNetworkOptions_To_v1beta1_VcnIpNativePodNetworkOptions(&in.VcnIpNativePodNetworkOptions, &out.VcnIpNativePodNetworkOptions, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_NodePoolPodNetworkOptionDetails_To_v1beta1_NodePoolPodNetworkOptionDetails is an autogenerated conversion function. +func Convert_v1beta2_NodePoolPodNetworkOptionDetails_To_v1beta1_NodePoolPodNetworkOptionDetails(in *v1beta2.NodePoolPodNetworkOptionDetails, out *NodePoolPodNetworkOptionDetails, s conversion.Scope) error { + return autoConvert_v1beta2_NodePoolPodNetworkOptionDetails_To_v1beta1_NodePoolPodNetworkOptionDetails(in, out, s) +} + +func autoConvert_v1beta1_NodeShapeConfig_To_v1beta2_NodeShapeConfig(in *NodeShapeConfig, out *v1beta2.NodeShapeConfig, s conversion.Scope) error { + out.MemoryInGBs = (*string)(unsafe.Pointer(in.MemoryInGBs)) + out.Ocpus = (*string)(unsafe.Pointer(in.Ocpus)) + return nil +} + +// Convert_v1beta1_NodeShapeConfig_To_v1beta2_NodeShapeConfig is an autogenerated conversion function. +func Convert_v1beta1_NodeShapeConfig_To_v1beta2_NodeShapeConfig(in *NodeShapeConfig, out *v1beta2.NodeShapeConfig, s conversion.Scope) error { + return autoConvert_v1beta1_NodeShapeConfig_To_v1beta2_NodeShapeConfig(in, out, s) +} + +func autoConvert_v1beta2_NodeShapeConfig_To_v1beta1_NodeShapeConfig(in *v1beta2.NodeShapeConfig, out *NodeShapeConfig, s conversion.Scope) error { + out.MemoryInGBs = (*string)(unsafe.Pointer(in.MemoryInGBs)) + out.Ocpus = (*string)(unsafe.Pointer(in.Ocpus)) + return nil +} + +// Convert_v1beta2_NodeShapeConfig_To_v1beta1_NodeShapeConfig is an autogenerated conversion function. +func Convert_v1beta2_NodeShapeConfig_To_v1beta1_NodeShapeConfig(in *v1beta2.NodeShapeConfig, out *NodeShapeConfig, s conversion.Scope) error { + return autoConvert_v1beta2_NodeShapeConfig_To_v1beta1_NodeShapeConfig(in, out, s) +} + +func autoConvert_v1beta1_NodeSourceViaImage_To_v1beta2_NodeSourceViaImage(in *NodeSourceViaImage, out *v1beta2.NodeSourceViaImage, s conversion.Scope) error { + out.BootVolumeSizeInGBs = (*int64)(unsafe.Pointer(in.BootVolumeSizeInGBs)) + out.ImageId = (*string)(unsafe.Pointer(in.ImageId)) + return nil +} + +// Convert_v1beta1_NodeSourceViaImage_To_v1beta2_NodeSourceViaImage is an autogenerated conversion function. +func Convert_v1beta1_NodeSourceViaImage_To_v1beta2_NodeSourceViaImage(in *NodeSourceViaImage, out *v1beta2.NodeSourceViaImage, s conversion.Scope) error { + return autoConvert_v1beta1_NodeSourceViaImage_To_v1beta2_NodeSourceViaImage(in, out, s) +} + +func autoConvert_v1beta2_NodeSourceViaImage_To_v1beta1_NodeSourceViaImage(in *v1beta2.NodeSourceViaImage, out *NodeSourceViaImage, s conversion.Scope) error { + out.BootVolumeSizeInGBs = (*int64)(unsafe.Pointer(in.BootVolumeSizeInGBs)) + out.ImageId = (*string)(unsafe.Pointer(in.ImageId)) + return nil +} + +// Convert_v1beta2_NodeSourceViaImage_To_v1beta1_NodeSourceViaImage is an autogenerated conversion function. +func Convert_v1beta2_NodeSourceViaImage_To_v1beta1_NodeSourceViaImage(in *v1beta2.NodeSourceViaImage, out *NodeSourceViaImage, s conversion.Scope) error { + return autoConvert_v1beta2_NodeSourceViaImage_To_v1beta1_NodeSourceViaImage(in, out, s) +} + +func autoConvert_v1beta1_OCIMachinePool_To_v1beta2_OCIMachinePool(in *OCIMachinePool, out *v1beta2.OCIMachinePool, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta1_OCIMachinePoolSpec_To_v1beta2_OCIMachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1beta1_OCIMachinePoolStatus_To_v1beta2_OCIMachinePoolStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIMachinePool_To_v1beta2_OCIMachinePool is an autogenerated conversion function. +func Convert_v1beta1_OCIMachinePool_To_v1beta2_OCIMachinePool(in *OCIMachinePool, out *v1beta2.OCIMachinePool, s conversion.Scope) error { + return autoConvert_v1beta1_OCIMachinePool_To_v1beta2_OCIMachinePool(in, out, s) +} + +func autoConvert_v1beta2_OCIMachinePool_To_v1beta1_OCIMachinePool(in *v1beta2.OCIMachinePool, out *OCIMachinePool, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta2_OCIMachinePoolSpec_To_v1beta1_OCIMachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1beta2_OCIMachinePoolStatus_To_v1beta1_OCIMachinePoolStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIMachinePool_To_v1beta1_OCIMachinePool is an autogenerated conversion function. +func Convert_v1beta2_OCIMachinePool_To_v1beta1_OCIMachinePool(in *v1beta2.OCIMachinePool, out *OCIMachinePool, s conversion.Scope) error { + return autoConvert_v1beta2_OCIMachinePool_To_v1beta1_OCIMachinePool(in, out, s) +} + +func autoConvert_v1beta1_OCIMachinePoolList_To_v1beta2_OCIMachinePoolList(in *OCIMachinePoolList, out *v1beta2.OCIMachinePoolList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1beta2.OCIMachinePool, len(*in)) + for i := range *in { + if err := Convert_v1beta1_OCIMachinePool_To_v1beta2_OCIMachinePool(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta1_OCIMachinePoolList_To_v1beta2_OCIMachinePoolList is an autogenerated conversion function. +func Convert_v1beta1_OCIMachinePoolList_To_v1beta2_OCIMachinePoolList(in *OCIMachinePoolList, out *v1beta2.OCIMachinePoolList, s conversion.Scope) error { + return autoConvert_v1beta1_OCIMachinePoolList_To_v1beta2_OCIMachinePoolList(in, out, s) +} + +func autoConvert_v1beta2_OCIMachinePoolList_To_v1beta1_OCIMachinePoolList(in *v1beta2.OCIMachinePoolList, out *OCIMachinePoolList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIMachinePool, len(*in)) + for i := range *in { + if err := Convert_v1beta2_OCIMachinePool_To_v1beta1_OCIMachinePool(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1beta2_OCIMachinePoolList_To_v1beta1_OCIMachinePoolList is an autogenerated conversion function. +func Convert_v1beta2_OCIMachinePoolList_To_v1beta1_OCIMachinePoolList(in *v1beta2.OCIMachinePoolList, out *OCIMachinePoolList, s conversion.Scope) error { + return autoConvert_v1beta2_OCIMachinePoolList_To_v1beta1_OCIMachinePoolList(in, out, s) +} + +func autoConvert_v1beta1_OCIMachinePoolSpec_To_v1beta2_OCIMachinePoolSpec(in *OCIMachinePoolSpec, out *v1beta2.OCIMachinePoolSpec, s conversion.Scope) error { + out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) + out.OCID = (*string)(unsafe.Pointer(in.OCID)) + out.PlacementDetails = *(*[]v1beta2.PlacementDetails)(unsafe.Pointer(&in.PlacementDetails)) + if err := Convert_v1beta1_InstanceConfiguration_To_v1beta2_InstanceConfiguration(&in.InstanceConfiguration, &out.InstanceConfiguration, s); err != nil { + return err + } + out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) + return nil +} + +// Convert_v1beta1_OCIMachinePoolSpec_To_v1beta2_OCIMachinePoolSpec is an autogenerated conversion function. +func Convert_v1beta1_OCIMachinePoolSpec_To_v1beta2_OCIMachinePoolSpec(in *OCIMachinePoolSpec, out *v1beta2.OCIMachinePoolSpec, s conversion.Scope) error { + return autoConvert_v1beta1_OCIMachinePoolSpec_To_v1beta2_OCIMachinePoolSpec(in, out, s) +} + +func autoConvert_v1beta2_OCIMachinePoolSpec_To_v1beta1_OCIMachinePoolSpec(in *v1beta2.OCIMachinePoolSpec, out *OCIMachinePoolSpec, s conversion.Scope) error { + out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) + out.OCID = (*string)(unsafe.Pointer(in.OCID)) + out.PlacementDetails = *(*[]PlacementDetails)(unsafe.Pointer(&in.PlacementDetails)) + if err := Convert_v1beta2_InstanceConfiguration_To_v1beta1_InstanceConfiguration(&in.InstanceConfiguration, &out.InstanceConfiguration, s); err != nil { + return err + } + out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) + return nil +} + +// Convert_v1beta2_OCIMachinePoolSpec_To_v1beta1_OCIMachinePoolSpec is an autogenerated conversion function. +func Convert_v1beta2_OCIMachinePoolSpec_To_v1beta1_OCIMachinePoolSpec(in *v1beta2.OCIMachinePoolSpec, out *OCIMachinePoolSpec, s conversion.Scope) error { + return autoConvert_v1beta2_OCIMachinePoolSpec_To_v1beta1_OCIMachinePoolSpec(in, out, s) +} + +func autoConvert_v1beta1_OCIMachinePoolStatus_To_v1beta2_OCIMachinePoolStatus(in *OCIMachinePoolStatus, out *v1beta2.OCIMachinePoolStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.Replicas = in.Replicas + out.Conditions = *(*clusterapiapiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + return nil +} + +// Convert_v1beta1_OCIMachinePoolStatus_To_v1beta2_OCIMachinePoolStatus is an autogenerated conversion function. +func Convert_v1beta1_OCIMachinePoolStatus_To_v1beta2_OCIMachinePoolStatus(in *OCIMachinePoolStatus, out *v1beta2.OCIMachinePoolStatus, s conversion.Scope) error { + return autoConvert_v1beta1_OCIMachinePoolStatus_To_v1beta2_OCIMachinePoolStatus(in, out, s) +} + +func autoConvert_v1beta2_OCIMachinePoolStatus_To_v1beta1_OCIMachinePoolStatus(in *v1beta2.OCIMachinePoolStatus, out *OCIMachinePoolStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.Replicas = in.Replicas + out.Conditions = *(*clusterapiapiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + return nil +} + +// Convert_v1beta2_OCIMachinePoolStatus_To_v1beta1_OCIMachinePoolStatus is an autogenerated conversion function. +func Convert_v1beta2_OCIMachinePoolStatus_To_v1beta1_OCIMachinePoolStatus(in *v1beta2.OCIMachinePoolStatus, out *OCIMachinePoolStatus, s conversion.Scope) error { + 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 + 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 + out.Items = *(*[]v1beta2.OCIManagedControlPlane)(unsafe.Pointer(&in.Items)) + 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 + out.Items = *(*[]OCIManagedControlPlane)(unsafe.Pointer(&in.Items)) + 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 + } + out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + out.Version = (*string)(unsafe.Pointer(in.Version)) + return nil +} + +// Convert_v1beta2_OCIManagedControlPlaneSpec_To_v1beta1_OCIManagedControlPlaneSpec is an autogenerated conversion function. +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 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)) + out.Initialized = in.Initialized + return nil +} + +// Convert_v1beta2_OCIManagedControlPlaneStatus_To_v1beta1_OCIManagedControlPlaneStatus is an autogenerated conversion function. +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 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 + out.Items = *(*[]v1beta2.OCIManagedControlPlaneTemplate)(unsafe.Pointer(&in.Items)) + 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 + out.Items = *(*[]OCIManagedControlPlaneTemplate)(unsafe.Pointer(&in.Items)) + 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 { + return err + } + if err := Convert_v1beta1_OCIManagedMachinePoolStatus_To_v1beta2_OCIManagedMachinePoolStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIManagedMachinePool_To_v1beta2_OCIManagedMachinePool is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedMachinePool_To_v1beta2_OCIManagedMachinePool(in *OCIManagedMachinePool, out *v1beta2.OCIManagedMachinePool, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedMachinePool_To_v1beta2_OCIManagedMachinePool(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedMachinePool_To_v1beta1_OCIManagedMachinePool(in *v1beta2.OCIManagedMachinePool, out *OCIManagedMachinePool, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta2_OCIManagedMachinePoolSpec_To_v1beta1_OCIManagedMachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1beta2_OCIManagedMachinePoolStatus_To_v1beta1_OCIManagedMachinePoolStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIManagedMachinePool_To_v1beta1_OCIManagedMachinePool is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedMachinePool_To_v1beta1_OCIManagedMachinePool(in *v1beta2.OCIManagedMachinePool, out *OCIManagedMachinePool, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedMachinePool_To_v1beta1_OCIManagedMachinePool(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedMachinePoolList_To_v1beta2_OCIManagedMachinePoolList(in *OCIManagedMachinePoolList, out *v1beta2.OCIManagedMachinePoolList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1beta2.OCIManagedMachinePool)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1beta1_OCIManagedMachinePoolList_To_v1beta2_OCIManagedMachinePoolList is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedMachinePoolList_To_v1beta2_OCIManagedMachinePoolList(in *OCIManagedMachinePoolList, out *v1beta2.OCIManagedMachinePoolList, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedMachinePoolList_To_v1beta2_OCIManagedMachinePoolList(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedMachinePoolList_To_v1beta1_OCIManagedMachinePoolList(in *v1beta2.OCIManagedMachinePoolList, out *OCIManagedMachinePoolList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]OCIManagedMachinePool)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1beta2_OCIManagedMachinePoolList_To_v1beta1_OCIManagedMachinePoolList is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedMachinePoolList_To_v1beta1_OCIManagedMachinePoolList(in *v1beta2.OCIManagedMachinePoolList, out *OCIManagedMachinePoolList, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedMachinePoolList_To_v1beta1_OCIManagedMachinePoolList(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedMachinePoolSpec_To_v1beta2_OCIManagedMachinePoolSpec(in *OCIManagedMachinePoolSpec, out *v1beta2.OCIManagedMachinePoolSpec, s conversion.Scope) error { + out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) + out.Version = (*string)(unsafe.Pointer(in.Version)) + out.ID = (*string)(unsafe.Pointer(in.ID)) + out.NodePoolNodeConfig = (*v1beta2.NodePoolNodeConfig)(unsafe.Pointer(in.NodePoolNodeConfig)) + out.NodeEvictionNodePoolSettings = (*v1beta2.NodeEvictionNodePoolSettings)(unsafe.Pointer(in.NodeEvictionNodePoolSettings)) + out.NodeShape = in.NodeShape + out.NodeShapeConfig = (*v1beta2.NodeShapeConfig)(unsafe.Pointer(in.NodeShapeConfig)) + out.NodeSourceViaImage = (*v1beta2.NodeSourceViaImage)(unsafe.Pointer(in.NodeSourceViaImage)) + out.SshPublicKey = in.SshPublicKey + out.NodeMetadata = *(*map[string]string)(unsafe.Pointer(&in.NodeMetadata)) + out.InitialNodeLabels = *(*[]v1beta2.KeyValue)(unsafe.Pointer(&in.InitialNodeLabels)) + out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) + return nil +} + +// Convert_v1beta1_OCIManagedMachinePoolSpec_To_v1beta2_OCIManagedMachinePoolSpec is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedMachinePoolSpec_To_v1beta2_OCIManagedMachinePoolSpec(in *OCIManagedMachinePoolSpec, out *v1beta2.OCIManagedMachinePoolSpec, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedMachinePoolSpec_To_v1beta2_OCIManagedMachinePoolSpec(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedMachinePoolSpec_To_v1beta1_OCIManagedMachinePoolSpec(in *v1beta2.OCIManagedMachinePoolSpec, out *OCIManagedMachinePoolSpec, s conversion.Scope) error { + out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) + out.Version = (*string)(unsafe.Pointer(in.Version)) + out.ID = (*string)(unsafe.Pointer(in.ID)) + out.NodePoolNodeConfig = (*NodePoolNodeConfig)(unsafe.Pointer(in.NodePoolNodeConfig)) + out.NodeEvictionNodePoolSettings = (*NodeEvictionNodePoolSettings)(unsafe.Pointer(in.NodeEvictionNodePoolSettings)) + out.NodeShape = in.NodeShape + out.NodeShapeConfig = (*NodeShapeConfig)(unsafe.Pointer(in.NodeShapeConfig)) + out.NodeSourceViaImage = (*NodeSourceViaImage)(unsafe.Pointer(in.NodeSourceViaImage)) + out.SshPublicKey = in.SshPublicKey + out.NodeMetadata = *(*map[string]string)(unsafe.Pointer(&in.NodeMetadata)) + out.InitialNodeLabels = *(*[]KeyValue)(unsafe.Pointer(&in.InitialNodeLabels)) + out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) + return nil +} + +// Convert_v1beta2_OCIManagedMachinePoolSpec_To_v1beta1_OCIManagedMachinePoolSpec is an autogenerated conversion function. +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 autoConvert_v1beta1_OCIManagedMachinePoolStatus_To_v1beta2_OCIManagedMachinePoolStatus(in *OCIManagedMachinePoolStatus, out *v1beta2.OCIManagedMachinePoolStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.Conditions = *(*clusterapiapiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + out.Replicas = in.Replicas + out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessages = *(*[]string)(unsafe.Pointer(&in.FailureMessages)) + return nil +} + +// Convert_v1beta1_OCIManagedMachinePoolStatus_To_v1beta2_OCIManagedMachinePoolStatus is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedMachinePoolStatus_To_v1beta2_OCIManagedMachinePoolStatus(in *OCIManagedMachinePoolStatus, out *v1beta2.OCIManagedMachinePoolStatus, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedMachinePoolStatus_To_v1beta2_OCIManagedMachinePoolStatus(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedMachinePoolStatus_To_v1beta1_OCIManagedMachinePoolStatus(in *v1beta2.OCIManagedMachinePoolStatus, out *OCIManagedMachinePoolStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.Conditions = *(*clusterapiapiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + out.Replicas = in.Replicas + out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessages = *(*[]string)(unsafe.Pointer(&in.FailureMessages)) + return nil +} + +// Convert_v1beta2_OCIManagedMachinePoolStatus_To_v1beta1_OCIManagedMachinePoolStatus is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedMachinePoolStatus_To_v1beta1_OCIManagedMachinePoolStatus(in *v1beta2.OCIManagedMachinePoolStatus, out *OCIManagedMachinePoolStatus, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedMachinePoolStatus_To_v1beta1_OCIManagedMachinePoolStatus(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedMachinePoolTemplate_To_v1beta2_OCIManagedMachinePoolTemplate(in *OCIManagedMachinePoolTemplate, out *v1beta2.OCIManagedMachinePoolTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta1_OCIManagedMachinePoolTemplateSpec_To_v1beta2_OCIManagedMachinePoolTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIManagedMachinePoolTemplate_To_v1beta2_OCIManagedMachinePoolTemplate is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedMachinePoolTemplate_To_v1beta2_OCIManagedMachinePoolTemplate(in *OCIManagedMachinePoolTemplate, out *v1beta2.OCIManagedMachinePoolTemplate, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedMachinePoolTemplate_To_v1beta2_OCIManagedMachinePoolTemplate(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedMachinePoolTemplate_To_v1beta1_OCIManagedMachinePoolTemplate(in *v1beta2.OCIManagedMachinePoolTemplate, out *OCIManagedMachinePoolTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1beta2_OCIManagedMachinePoolTemplateSpec_To_v1beta1_OCIManagedMachinePoolTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIManagedMachinePoolTemplate_To_v1beta1_OCIManagedMachinePoolTemplate is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedMachinePoolTemplate_To_v1beta1_OCIManagedMachinePoolTemplate(in *v1beta2.OCIManagedMachinePoolTemplate, out *OCIManagedMachinePoolTemplate, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedMachinePoolTemplate_To_v1beta1_OCIManagedMachinePoolTemplate(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedMachinePoolTemplateList_To_v1beta2_OCIManagedMachinePoolTemplateList(in *OCIManagedMachinePoolTemplateList, out *v1beta2.OCIManagedMachinePoolTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1beta2.OCIManagedMachinePoolTemplate)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1beta1_OCIManagedMachinePoolTemplateList_To_v1beta2_OCIManagedMachinePoolTemplateList is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedMachinePoolTemplateList_To_v1beta2_OCIManagedMachinePoolTemplateList(in *OCIManagedMachinePoolTemplateList, out *v1beta2.OCIManagedMachinePoolTemplateList, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedMachinePoolTemplateList_To_v1beta2_OCIManagedMachinePoolTemplateList(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedMachinePoolTemplateList_To_v1beta1_OCIManagedMachinePoolTemplateList(in *v1beta2.OCIManagedMachinePoolTemplateList, out *OCIManagedMachinePoolTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]OCIManagedMachinePoolTemplate)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1beta2_OCIManagedMachinePoolTemplateList_To_v1beta1_OCIManagedMachinePoolTemplateList is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedMachinePoolTemplateList_To_v1beta1_OCIManagedMachinePoolTemplateList(in *v1beta2.OCIManagedMachinePoolTemplateList, out *OCIManagedMachinePoolTemplateList, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedMachinePoolTemplateList_To_v1beta1_OCIManagedMachinePoolTemplateList(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedMachinePoolTemplateResource_To_v1beta2_OCIManagedMachinePoolTemplateResource(in *OCIManagedMachinePoolTemplateResource, out *v1beta2.OCIManagedMachinePoolTemplateResource, s conversion.Scope) error { + if err := Convert_v1beta1_OCIManagedMachinePoolSpec_To_v1beta2_OCIManagedMachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIManagedMachinePoolTemplateResource_To_v1beta2_OCIManagedMachinePoolTemplateResource is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedMachinePoolTemplateResource_To_v1beta2_OCIManagedMachinePoolTemplateResource(in *OCIManagedMachinePoolTemplateResource, out *v1beta2.OCIManagedMachinePoolTemplateResource, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedMachinePoolTemplateResource_To_v1beta2_OCIManagedMachinePoolTemplateResource(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedMachinePoolTemplateResource_To_v1beta1_OCIManagedMachinePoolTemplateResource(in *v1beta2.OCIManagedMachinePoolTemplateResource, out *OCIManagedMachinePoolTemplateResource, s conversion.Scope) error { + if err := Convert_v1beta2_OCIManagedMachinePoolSpec_To_v1beta1_OCIManagedMachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIManagedMachinePoolTemplateResource_To_v1beta1_OCIManagedMachinePoolTemplateResource is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedMachinePoolTemplateResource_To_v1beta1_OCIManagedMachinePoolTemplateResource(in *v1beta2.OCIManagedMachinePoolTemplateResource, out *OCIManagedMachinePoolTemplateResource, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedMachinePoolTemplateResource_To_v1beta1_OCIManagedMachinePoolTemplateResource(in, out, s) +} + +func autoConvert_v1beta1_OCIManagedMachinePoolTemplateSpec_To_v1beta2_OCIManagedMachinePoolTemplateSpec(in *OCIManagedMachinePoolTemplateSpec, out *v1beta2.OCIManagedMachinePoolTemplateSpec, s conversion.Scope) error { + if err := Convert_v1beta1_OCIManagedMachinePoolTemplateResource_To_v1beta2_OCIManagedMachinePoolTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_OCIManagedMachinePoolTemplateSpec_To_v1beta2_OCIManagedMachinePoolTemplateSpec is an autogenerated conversion function. +func Convert_v1beta1_OCIManagedMachinePoolTemplateSpec_To_v1beta2_OCIManagedMachinePoolTemplateSpec(in *OCIManagedMachinePoolTemplateSpec, out *v1beta2.OCIManagedMachinePoolTemplateSpec, s conversion.Scope) error { + return autoConvert_v1beta1_OCIManagedMachinePoolTemplateSpec_To_v1beta2_OCIManagedMachinePoolTemplateSpec(in, out, s) +} + +func autoConvert_v1beta2_OCIManagedMachinePoolTemplateSpec_To_v1beta1_OCIManagedMachinePoolTemplateSpec(in *v1beta2.OCIManagedMachinePoolTemplateSpec, out *OCIManagedMachinePoolTemplateSpec, s conversion.Scope) error { + if err := Convert_v1beta2_OCIManagedMachinePoolTemplateResource_To_v1beta1_OCIManagedMachinePoolTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_OCIManagedMachinePoolTemplateSpec_To_v1beta1_OCIManagedMachinePoolTemplateSpec is an autogenerated conversion function. +func Convert_v1beta2_OCIManagedMachinePoolTemplateSpec_To_v1beta1_OCIManagedMachinePoolTemplateSpec(in *v1beta2.OCIManagedMachinePoolTemplateSpec, out *OCIManagedMachinePoolTemplateSpec, s conversion.Scope) error { + return autoConvert_v1beta2_OCIManagedMachinePoolTemplateSpec_To_v1beta1_OCIManagedMachinePoolTemplateSpec(in, out, s) +} + +func autoConvert_v1beta1_PlacementConfig_To_v1beta2_PlacementConfig(in *PlacementConfig, out *v1beta2.PlacementConfig, s conversion.Scope) error { + out.AvailabilityDomain = (*string)(unsafe.Pointer(in.AvailabilityDomain)) + out.CapacityReservationId = (*string)(unsafe.Pointer(in.CapacityReservationId)) + out.FaultDomains = *(*[]string)(unsafe.Pointer(&in.FaultDomains)) + out.SubnetName = (*string)(unsafe.Pointer(in.SubnetName)) + return nil +} + +// Convert_v1beta1_PlacementConfig_To_v1beta2_PlacementConfig is an autogenerated conversion function. +func Convert_v1beta1_PlacementConfig_To_v1beta2_PlacementConfig(in *PlacementConfig, out *v1beta2.PlacementConfig, s conversion.Scope) error { + return autoConvert_v1beta1_PlacementConfig_To_v1beta2_PlacementConfig(in, out, s) +} + +func autoConvert_v1beta2_PlacementConfig_To_v1beta1_PlacementConfig(in *v1beta2.PlacementConfig, out *PlacementConfig, s conversion.Scope) error { + out.AvailabilityDomain = (*string)(unsafe.Pointer(in.AvailabilityDomain)) + out.CapacityReservationId = (*string)(unsafe.Pointer(in.CapacityReservationId)) + out.FaultDomains = *(*[]string)(unsafe.Pointer(&in.FaultDomains)) + out.SubnetName = (*string)(unsafe.Pointer(in.SubnetName)) + return nil +} + +// Convert_v1beta2_PlacementConfig_To_v1beta1_PlacementConfig is an autogenerated conversion function. +func Convert_v1beta2_PlacementConfig_To_v1beta1_PlacementConfig(in *v1beta2.PlacementConfig, out *PlacementConfig, s conversion.Scope) error { + return autoConvert_v1beta2_PlacementConfig_To_v1beta1_PlacementConfig(in, out, s) +} + +func autoConvert_v1beta1_PlacementDetails_To_v1beta2_PlacementDetails(in *PlacementDetails, out *v1beta2.PlacementDetails, s conversion.Scope) error { + out.AvailabilityDomain = in.AvailabilityDomain + return nil +} + +// Convert_v1beta1_PlacementDetails_To_v1beta2_PlacementDetails is an autogenerated conversion function. +func Convert_v1beta1_PlacementDetails_To_v1beta2_PlacementDetails(in *PlacementDetails, out *v1beta2.PlacementDetails, s conversion.Scope) error { + return autoConvert_v1beta1_PlacementDetails_To_v1beta2_PlacementDetails(in, out, s) +} + +func autoConvert_v1beta2_PlacementDetails_To_v1beta1_PlacementDetails(in *v1beta2.PlacementDetails, out *PlacementDetails, s conversion.Scope) error { + out.AvailabilityDomain = in.AvailabilityDomain + return nil +} + +// Convert_v1beta2_PlacementDetails_To_v1beta1_PlacementDetails is an autogenerated conversion function. +func Convert_v1beta2_PlacementDetails_To_v1beta1_PlacementDetails(in *v1beta2.PlacementDetails, out *PlacementDetails, s conversion.Scope) error { + return autoConvert_v1beta2_PlacementDetails_To_v1beta1_PlacementDetails(in, out, s) +} + +func autoConvert_v1beta1_ShapeConfig_To_v1beta2_ShapeConfig(in *ShapeConfig, out *v1beta2.ShapeConfig, s conversion.Scope) error { + out.Ocpus = (*string)(unsafe.Pointer(in.Ocpus)) + out.MemoryInGBs = (*string)(unsafe.Pointer(in.MemoryInGBs)) + out.BaselineOcpuUtilization = in.BaselineOcpuUtilization + out.Nvmes = (*int)(unsafe.Pointer(in.Nvmes)) + return nil +} + +// Convert_v1beta1_ShapeConfig_To_v1beta2_ShapeConfig is an autogenerated conversion function. +func Convert_v1beta1_ShapeConfig_To_v1beta2_ShapeConfig(in *ShapeConfig, out *v1beta2.ShapeConfig, s conversion.Scope) error { + return autoConvert_v1beta1_ShapeConfig_To_v1beta2_ShapeConfig(in, out, s) +} + +func autoConvert_v1beta2_ShapeConfig_To_v1beta1_ShapeConfig(in *v1beta2.ShapeConfig, out *ShapeConfig, s conversion.Scope) error { + out.Ocpus = (*string)(unsafe.Pointer(in.Ocpus)) + out.MemoryInGBs = (*string)(unsafe.Pointer(in.MemoryInGBs)) + out.BaselineOcpuUtilization = in.BaselineOcpuUtilization + out.Nvmes = (*int)(unsafe.Pointer(in.Nvmes)) + return nil +} + +// Convert_v1beta2_ShapeConfig_To_v1beta1_ShapeConfig is an autogenerated conversion function. +func Convert_v1beta2_ShapeConfig_To_v1beta1_ShapeConfig(in *v1beta2.ShapeConfig, out *ShapeConfig, s conversion.Scope) error { + return autoConvert_v1beta2_ShapeConfig_To_v1beta1_ShapeConfig(in, out, s) +} + +func autoConvert_v1beta1_VcnIpNativePodNetworkOptions_To_v1beta2_VcnIpNativePodNetworkOptions(in *VcnIpNativePodNetworkOptions, out *v1beta2.VcnIpNativePodNetworkOptions, s conversion.Scope) error { + out.MaxPodsPerNode = (*int)(unsafe.Pointer(in.MaxPodsPerNode)) + out.NSGNames = *(*[]string)(unsafe.Pointer(&in.NSGNames)) + out.SubnetNames = *(*[]string)(unsafe.Pointer(&in.SubnetNames)) + return nil +} + +// Convert_v1beta1_VcnIpNativePodNetworkOptions_To_v1beta2_VcnIpNativePodNetworkOptions is an autogenerated conversion function. +func Convert_v1beta1_VcnIpNativePodNetworkOptions_To_v1beta2_VcnIpNativePodNetworkOptions(in *VcnIpNativePodNetworkOptions, out *v1beta2.VcnIpNativePodNetworkOptions, s conversion.Scope) error { + return autoConvert_v1beta1_VcnIpNativePodNetworkOptions_To_v1beta2_VcnIpNativePodNetworkOptions(in, out, s) +} + +func autoConvert_v1beta2_VcnIpNativePodNetworkOptions_To_v1beta1_VcnIpNativePodNetworkOptions(in *v1beta2.VcnIpNativePodNetworkOptions, out *VcnIpNativePodNetworkOptions, s conversion.Scope) error { + out.MaxPodsPerNode = (*int)(unsafe.Pointer(in.MaxPodsPerNode)) + out.NSGNames = *(*[]string)(unsafe.Pointer(&in.NSGNames)) + out.SubnetNames = *(*[]string)(unsafe.Pointer(&in.SubnetNames)) + return nil +} + +// Convert_v1beta2_VcnIpNativePodNetworkOptions_To_v1beta1_VcnIpNativePodNetworkOptions is an autogenerated conversion function. +func Convert_v1beta2_VcnIpNativePodNetworkOptions_To_v1beta1_VcnIpNativePodNetworkOptions(in *v1beta2.VcnIpNativePodNetworkOptions, out *VcnIpNativePodNetworkOptions, s conversion.Scope) error { + return autoConvert_v1beta2_VcnIpNativePodNetworkOptions_To_v1beta1_VcnIpNativePodNetworkOptions(in, out, s) +} diff --git a/exp/api/v1beta2/conditions_consts.go b/exp/api/v1beta2/conditions_consts.go new file mode 100644 index 00000000..28acf2b9 --- /dev/null +++ b/exp/api/v1beta2/conditions_consts.go @@ -0,0 +1,65 @@ +/* +Copyright (c) 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 + + http://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 v1beta2 + +import clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + +const ( + // InstancePoolReadyCondition reports on current status of the Instance Pool. Ready indicates the group is provisioned. + InstancePoolReadyCondition clusterv1.ConditionType = "InstancePoolReady" + // InstancePoolNotFoundReason used when the Instance Pool couldn't be retrieved. + InstancePoolNotFoundReason = "InstancePoolNotFound" + // InstancePoolProvisionFailedReason used for failures during Instance Pool provisioning. + InstancePoolProvisionFailedReason = "InstancePoolProvisionFailed" + // InstancePoolDeletionInProgress Instance Pool is in a deletion in progress state. + InstancePoolDeletionInProgress = "InstancePoolDeletionInProgress" + // InstancePoolNotReadyReason used when the instance pool is in a pending state. + InstancePoolNotReadyReason = "InstancePoolNotReady" + + // NodePoolReadyCondition reports on current status of the Node Pool. Ready indicates the group is provisioned. + NodePoolReadyCondition clusterv1.ConditionType = "NodePoolReady" + // NodePoolNotFoundReason used when the Node Pool couldn't be retrieved. + NodePoolNotFoundReason = "NodePoolNotFound" + // NodePoolProvisionFailedReason used for failures during Instance Pool provisioning. + NodePoolProvisionFailedReason = "NodePoolProvisionFailed" + // NodePoolDeletionInProgress Node Pool is in a deletion in progress state. + NodePoolDeletionInProgress = "NodePoolDeletionInProgress" + // NodePoolNotReadyReason used when the node pool is in a pending state. + NodePoolNotReadyReason = "NodePoolNotReady" + // NodePoolDeletedReason Node Pool is deleted. + NodePoolDeletedReason = "NodePoolDeleted" + + // LaunchTemplateReadyCondition represents the status of an OCIachinePool's associated Instance Template. + LaunchTemplateReadyCondition clusterv1.ConditionType = "LaunchTemplateReady" + // LaunchTemplateNotFoundReason is used when an associated Launch Template can't be found. + 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/constants.go b/exp/api/v1beta2/constants.go new file mode 100644 index 00000000..32faf37b --- /dev/null +++ b/exp/api/v1beta2/constants.go @@ -0,0 +1,22 @@ +/* + 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 v1beta2 + +const ( + PodDefaultName = "pod" + PodDefaultCIDR = "10.0.128.0/18" +) diff --git a/exp/api/v1beta2/conversion.go b/exp/api/v1beta2/conversion.go new file mode 100644 index 00000000..423da793 --- /dev/null +++ b/exp/api/v1beta2/conversion.go @@ -0,0 +1,44 @@ +/* +Copyright (c) 2023 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 + + http://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 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() {} + +// Hub marks OCIManagedMachinePoolList as a conversion hub. +func (*OCIManagedMachinePoolList) Hub() {} + +// Hub marks OCIMachinePool as a conversion hub. +func (*OCIMachinePool) Hub() {} + +// Hub marks OCIMachinePoolList as a conversion hub. +func (*OCIMachinePoolList) Hub() {} diff --git a/exp/api/v1beta2/groupversion_type.go b/exp/api/v1beta2/groupversion_type.go new file mode 100644 index 00000000..d36ce09e --- /dev/null +++ b/exp/api/v1beta2/groupversion_type.go @@ -0,0 +1,33 @@ +/* +Copyright (c) 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 + + http://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 v1beta2 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "infrastructure.cluster.x-k8s.io", Version: "v1beta2"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/exp/api/v1beta2/ocimachinepool_types.go b/exp/api/v1beta2/ocimachinepool_types.go new file mode 100644 index 00000000..c97c62ed --- /dev/null +++ b/exp/api/v1beta2/ocimachinepool_types.go @@ -0,0 +1,245 @@ +/* +Copyright (c) 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 + + http://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 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" +) + +// +kubebuilder:object:generate=true +// +groupName=infrastructure.cluster.x-k8s.io + +// Constants block. +const ( + // MachinePoolFinalizer is the finalizer for the machine pool. + MachinePoolFinalizer = "ocimachinepool.infrastructure.cluster.x-k8s.io" +) + +// OCIMachinePoolSpec defines the desired state of OCIMachinePool +type OCIMachinePoolSpec struct { + // ProviderID is the OCID of the associated InstancePool in a provider format + // +optional + ProviderID *string `json:"providerID,omitempty"` + + // OCID is the OCID of the associated InstancePool + // +optional + OCID *string `json:"ocid,omitempty"` + + // PlacementDetails defines the placement details of the instance pool. + PlacementDetails []PlacementDetails `json:"placementDetails,omitempty"` + + // InstanceConfiguration defines the configuration of the instance pool instances. + InstanceConfiguration InstanceConfiguration `json:"instanceConfiguration,omitempty"` + + // ProviderIDList are the identification IDs of machine instances provided by the provider. + // This field must match the provider IDs as seen on the node objects corresponding to a machine pool's machine instances. + // +optional + ProviderIDList []string `json:"providerIDList,omitempty"` +} + +type InstanceConfiguration struct { + InstanceConfigurationId *string `json:"instanceConfigurationId,omitempty"` + Shape *string `json:"shape,omitempty"` + // The shape configuration of the instance, applicable for flex instances. + ShapeConfig *ShapeConfig `json:"shapeConfig,omitempty"` + + InstanceVnicConfiguration *infrastructurev1beta2.NetworkDetails `json:"instanceVnicConfiguration,omitempty"` + + // PlatformConfig defines the platform config parameters + PlatformConfig *infrastructurev1beta2.PlatformConfig `json:"platformConfig,omitempty"` + + // AgentConfig defines the options for the Oracle Cloud Agent software running on the instance. + AgentConfig *infrastructurev1beta2.LaunchInstanceAgentConfig `json:"agentConfig,omitempty"` + + // PreemptibleInstanceConfig Configuration options for preemptible instances. + PreemptibleInstanceConfig *infrastructurev1beta2.PreemptibleInstanceConfig `json:"preemptibleInstanceConfig,omitempty"` + + // LaunchInstanceAvailabilityConfig defines the options for VM migration during infrastructure maintenance events and for defining + // the availability of a VM instance after a maintenance event that impacts the underlying hardware. + AvailabilityConfig *infrastructurev1beta2.LaunchInstanceAvailabilityConfig `json:"availabilityConfig,omitempty"` + + // DedicatedVmHostId defines the OCID of the dedicated VM host. + DedicatedVmHostId *string `json:"dedicatedVmHostId,omitempty"` + + // LaunchOptions defines the options for tuning the compatibility and performance of VM shapes + LaunchOptions *infrastructurev1beta2.LaunchOptions `json:"launchOptions,omitempty"` + + // InstanceOptions defines the instance options + InstanceOptions *infrastructurev1beta2.InstanceOptions `json:"instanceOptions,omitempty"` + + // Is in transit encryption of volumes required. + // +kubebuilder:default=true + // +optional + IsPvEncryptionInTransitEnabled *bool `json:"isPvEncryptionInTransitEnabled,omitempty"` + + // InstanceSourceViaImageConfig defines the options for booting up instances via images + InstanceSourceViaImageDetails *InstanceSourceViaImageConfig `json:"instanceSourceViaImageConfig,omitempty"` + + // CapacityReservationId defines the OCID of the compute capacity reservation this instance is launched under. + // You can opt out of all default reservations by specifying an empty string as input for this field. + // For more information, see Capacity Reservations (https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/reserve-capacity.htm#default). + CapacityReservationId *string `json:"capacityReservationId,omitempty"` + + // Custom metadata key/value pairs that you provide, such as the SSH public key + // required to connect to the instance. + Metadata map[string]string `json:"metadata,omitempty"` +} + +type PlacementDetails struct { + // The availability domain to place instances. + AvailabilityDomain int `mandatory:"true" json:"availabilityDomain"` +} + +// LaunchDetails Instance launch details for creating an instance from an instance configuration +// https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/InstanceConfigurationLaunchInstanceDetails +type LaunchDetails struct { + // Custom metadata key/value pairs that you provide, such as the SSH public key + // required to connect to the instance. + Metadata map[string]string `json:"metadata,omitempty"` + + Shape string `json:"shape,omitempty"` +} + +// ShapeConfig defines the configuration options for the compute instance shape +// https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/LaunchInstanceShapeConfigDetails +type ShapeConfig struct { + // The total number of OCPUs available to the instance. + Ocpus *string `json:"ocpus,omitempty"` + + // The total amount of memory available to the instance, in gigabytes. + MemoryInGBs *string `json:"memoryInGBs,omitempty"` + + // The baseline OCPU utilization for a subcore burstable VM instance. Leave this attribute blank for a + // non-burstable instance, or explicitly specify non-burstable with `BASELINE_1_1`. + // The following values are supported: + // - `BASELINE_1_8` - baseline usage is 1/8 of an OCPU. + // - `BASELINE_1_2` - baseline usage is 1/2 of an OCPU. + // - `BASELINE_1_1` - baseline usage is an entire OCPU. This represents a non-burstable instance. + BaselineOcpuUtilization string `json:"baselineOcpuUtilization,omitempty"` + + // Nvmes defines the number of NVMe drives to be used for storage. A single drive has 6.8 TB available. + Nvmes *int `json:"nvmes,omitempty"` +} + +// InstanceVnicConfiguration defines the configuration options for the network +type InstanceVnicConfiguration struct { + + // AssignPublicIp defines whether the instance should have a public IP address + AssignPublicIp bool `json:"assignPublicIp,omitempty"` + + // SubnetName defines the subnet name to use for the VNIC + SubnetName string `json:"subnetName,omitempty"` + + // Deprecated, use NsgNames parameter to define the NSGs + NSGId *string `json:"nsgId,omitempty"` + + // SkipSourceDestCheck defines whether the source/destination check is disabled on the VNIC. + SkipSourceDestCheck *bool `json:"skipSourceDestCheck,omitempty"` + + // NsgNames defines a list of the nsg names of the network security groups (NSGs) to add the VNIC to. + NsgNames []string `json:"nsgNames,omitempty"` + + // HostnameLabel defines the hostname for the VNIC's primary private IP. Used for DNS. + HostnameLabel *string `json:"hostnameLabel,omitempty"` + + // DisplayName defines a user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `json:"displayName,omitempty"` + + // AssignPrivateDnsRecord defines whether the VNIC should be assigned a DNS record. + AssignPrivateDnsRecord *bool `json:"assignPrivateDnsRecord,omitempty"` +} + +// InstanceSourceViaImageConfig The configuration options for booting up instances via images +type InstanceSourceViaImageConfig struct { + // OCID of the image to be used to launch the instance. + ImageId *string `json:"imageId,omitempty"` + + // KmsKeyId defines the OCID of the Key Management key to assign as the master encryption key for the boot volume. + KmsKeyId *string `json:"kmsKeyId,omitempty"` + + // The size of boot volume. Please see https://docs.oracle.com/en-us/iaas/Content/Block/Tasks/extendingbootpartition.htm + // to extend the boot volume size. + BootVolumeSizeInGBs *int64 `json:"bootVolumeSizeInGBs,omitempty"` + + // BootVolumeVpusPerGB defines the number of volume performance units (VPUs) that will be applied to this volume per GB, + // representing the Block Volume service's elastic performance options. + // See Block Volume Performance Levels (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/blockvolumeperformance.htm#perf_levels) for more information. + // Allowed values: + // * `10`: Represents Balanced option. + // * `20`: Represents Higher Performance option. + // * `30`-`120`: Represents the Ultra High Performance option. + // For volumes with the auto-tuned performance feature enabled, this is set to the default (minimum) VPUs/GB. + BootVolumeVpusPerGB *int64 `json:"bootVolumeVpusPerGB,omitempty"` +} + +// OCIMachinePoolStatus defines the observed state of OCIMachinePool +type OCIMachinePoolStatus struct { + // Ready is true when the provider resource is ready. + // +optional + Ready bool `json:"ready"` + + // Replicas is the most recently observed number of replicas + // +optional + Replicas int32 `json:"replicas"` + + // Conditions defines current service state of the OCIMachinePool. + // +optional + Conditions clusterv1.Conditions `json:"conditions,omitempty"` + + FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"` + + FailureMessage *string `json:"failureMessage,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status + +type OCIMachinePool struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec OCIMachinePoolSpec `json:"spec,omitempty"` + Status OCIMachinePoolStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:storageversion + +// OCIMachinePoolList contains a list of OCIMachinePool. +type OCIMachinePoolList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []OCIMachinePool `json:"items"` +} + +// GetConditions returns the list of conditions for an OCIMachine API object. +func (m *OCIMachinePool) GetConditions() clusterv1.Conditions { + return m.Status.Conditions +} + +// SetConditions will set the given conditions on an OCIMachine object. +func (m *OCIMachinePool) SetConditions(conditions clusterv1.Conditions) { + m.Status.Conditions = conditions +} + +func init() { + SchemeBuilder.Register(&OCIMachinePool{}, &OCIMachinePoolList{}) +} diff --git a/exp/api/v1beta2/ocimanagedcluster_types.go b/exp/api/v1beta2/ocimanagedcluster_types.go new file mode 100644 index 00000000..c19a8d0b --- /dev/null +++ b/exp/api/v1beta2/ocimanagedcluster_types.go @@ -0,0 +1,122 @@ +/* +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 + + http://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 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" +) + +const ( + // ManagedClusterFinalizer allows OCIManagedClusterReconciler to clean up OCI resources associated with OCIManagedCluster. + ManagedClusterFinalizer = "ocimanagedcluster.infrastructure.cluster.x-k8s.io" +) + +// OCIManagedClusterSpec defines the desired state of OCI OKE Cluster +type OCIManagedClusterSpec struct { + + // The unique ID which will be used to tag all the resources created by this Cluster. + // The tag will be used to identify resources belonging to this cluster. + // this will be auto-generated and should not be set by the user. + // +optional + OCIResourceIdentifier string `json:"ociResourceIdentifier,omitempty"` + + // IdentityRef is a reference to an identity(principal) to be used when reconciling this cluster + // +optional + IdentityRef *corev1.ObjectReference `json:"identityRef,omitempty"` + + // NetworkSpec encapsulates all things related to OCI network. + // +optional + NetworkSpec infrastructurev1beta2.NetworkSpec `json:"networkSpec,omitempty"` + + // Free-form tags for this resource. + // +optional + FreeformTags map[string]string `json:"freeformTags,omitempty"` + + // Defined tags for this resource. Each key is predefined and scoped to a + // namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Operations": {"CostCenter": "42"}}` + // +optional + DefinedTags map[string]map[string]string `json:"definedTags,omitempty"` + + // Compartment to create the cluster network. + // +optional + CompartmentId string `json:"compartmentId"` + + // Region the cluster operates in. It must be one of available regions in Region Identifier format. + // See https://docs.oracle.com/en-us/iaas/Content/General/Concepts/regions.htm + Region string `json:"region,omitempty"` + + // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. This will not be set by the user, this will be updated by the Cluster Reconciler after OKe cluster has been created and the cluster has an endpoint address + // +optional + ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"` + + // 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"` +} + +// OCIManagedClusterStatus defines the observed state of OCICluster +type OCIManagedClusterStatus struct { + // +optional + FailureDomains clusterv1.FailureDomains `json:"failureDomains,omitempty"` + + // +optional + Ready bool `json:"ready"` + // NetworkSpec encapsulates all things related to OCI network. + // +optional + Conditions clusterv1.Conditions `json:"conditions,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +// +kubebuilder:storageversion + +// OCIManagedCluster is the Schema for the ocimanagedclusters API. +type OCIManagedCluster struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec OCIManagedClusterSpec `json:"spec,omitempty"` + Status OCIManagedClusterStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// OCIManagedClusterList contains a list of OCIManagedCluster. +type OCIManagedClusterList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []OCIManagedCluster `json:"items"` +} + +// GetConditions returns the list of conditions for an OCICluster API object. +func (c *OCIManagedCluster) GetConditions() clusterv1.Conditions { + return c.Status.Conditions +} + +// SetConditions will set the given conditions on an OCICluster object. +func (c *OCIManagedCluster) SetConditions(conditions clusterv1.Conditions) { + c.Status.Conditions = conditions +} + +func init() { + SchemeBuilder.Register(&OCIManagedCluster{}, &OCIManagedClusterList{}) +} diff --git a/exp/api/v1beta1/ocimanagedcluster_webhook.go b/exp/api/v1beta2/ocimanagedcluster_webhook.go similarity index 56% rename from exp/api/v1beta1/ocimanagedcluster_webhook.go rename to exp/api/v1beta2/ocimanagedcluster_webhook.go index f85c5036..1441cd64 100644 --- a/exp/api/v1beta1/ocimanagedcluster_webhook.go +++ b/exp/api/v1beta2/ocimanagedcluster_webhook.go @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1beta1 +package v1beta2 import ( "fmt" "reflect" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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" @@ -37,8 +37,8 @@ var ( _ webhook.Validator = &OCIManagedCluster{} ) -// +kubebuilder:webhook:verbs=create;update,path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-ocimanagedcluster,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ocimanagedclusters,versions=v1beta1,name=validation.ocimanagedcluster.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 -// +kubebuilder:webhook:verbs=create;update,path=/mutate-infrastructure-cluster-x-k8s-io-v1beta1-ocimanagedcluster,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ocimanagedclusters,versions=v1beta1,name=default.ocimanagedcluster.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-infrastructure-cluster-x-k8s-io-v1beta2-ocimanagedcluster,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ocimanagedclusters,versions=v1beta2,name=validation.ocimanagedcluster.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/mutate-infrastructure-cluster-x-k8s-io-v1beta2-ocimanagedcluster,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ocimanagedclusters,versions=v1beta2,name=default.ocimanagedcluster.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 func (c *OCIManagedCluster) Default() { if c.Spec.OCIResourceIdentifier == "" { @@ -46,64 +46,64 @@ func (c *OCIManagedCluster) Default() { } if !c.Spec.NetworkSpec.SkipNetworkManagement { if len(c.Spec.NetworkSpec.Vcn.Subnets) == 0 { - subnets := make([]*infrastructurev1beta1.Subnet, 4) - subnets[0] = &infrastructurev1beta1.Subnet{ - Role: infrastructurev1beta1.ControlPlaneEndpointRole, - Name: infrastructurev1beta1.ControlPlaneEndpointDefaultName, - CIDR: infrastructurev1beta1.ControlPlaneEndpointSubnetDefaultCIDR, - Type: infrastructurev1beta1.Public, + subnets := make([]*infrastructurev1beta2.Subnet, 4) + subnets[0] = &infrastructurev1beta2.Subnet{ + Role: infrastructurev1beta2.ControlPlaneEndpointRole, + Name: infrastructurev1beta2.ControlPlaneEndpointDefaultName, + CIDR: infrastructurev1beta2.ControlPlaneEndpointSubnetDefaultCIDR, + Type: infrastructurev1beta2.Public, } - subnets[1] = &infrastructurev1beta1.Subnet{ - Role: infrastructurev1beta1.ServiceLoadBalancerRole, - Name: infrastructurev1beta1.ServiceLBDefaultName, - CIDR: infrastructurev1beta1.ServiceLoadBalancerDefaultCIDR, - Type: infrastructurev1beta1.Public, + subnets[1] = &infrastructurev1beta2.Subnet{ + Role: infrastructurev1beta2.ServiceLoadBalancerRole, + Name: infrastructurev1beta2.ServiceLBDefaultName, + CIDR: infrastructurev1beta2.ServiceLoadBalancerDefaultCIDR, + Type: infrastructurev1beta2.Public, } - subnets[2] = &infrastructurev1beta1.Subnet{ - Role: infrastructurev1beta1.WorkerRole, - Name: infrastructurev1beta1.WorkerDefaultName, - CIDR: infrastructurev1beta1.WorkerSubnetDefaultCIDR, - Type: infrastructurev1beta1.Private, + subnets[2] = &infrastructurev1beta2.Subnet{ + Role: infrastructurev1beta2.WorkerRole, + Name: infrastructurev1beta2.WorkerDefaultName, + CIDR: infrastructurev1beta2.WorkerSubnetDefaultCIDR, + Type: infrastructurev1beta2.Private, } - subnets[3] = &infrastructurev1beta1.Subnet{ - Role: infrastructurev1beta1.PodRole, + subnets[3] = &infrastructurev1beta2.Subnet{ + Role: infrastructurev1beta2.PodRole, Name: PodDefaultName, CIDR: PodDefaultCIDR, - Type: infrastructurev1beta1.Private, + Type: infrastructurev1beta2.Private, } c.Spec.NetworkSpec.Vcn.Subnets = subnets } - if len(c.Spec.NetworkSpec.Vcn.NetworkSecurityGroups) == 0 { - nsgs := make([]*infrastructurev1beta1.NSG, 4) - nsgs[0] = &infrastructurev1beta1.NSG{ - Role: infrastructurev1beta1.ControlPlaneEndpointRole, - Name: infrastructurev1beta1.ControlPlaneEndpointDefaultName, + 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, IngressRules: c.GetControlPlaneEndpointDefaultIngressRules(), EgressRules: c.GetControlPlaneEndpointDefaultEgressRules(), } - nsgs[1] = &infrastructurev1beta1.NSG{ - Role: infrastructurev1beta1.WorkerRole, - Name: infrastructurev1beta1.WorkerDefaultName, + nsgs[1] = &infrastructurev1beta2.NSG{ + Role: infrastructurev1beta2.WorkerRole, + Name: infrastructurev1beta2.WorkerDefaultName, IngressRules: c.GetWorkerDefaultIngressRules(), EgressRules: c.GetWorkerDefaultEgressRules(), } - nsgs[2] = &infrastructurev1beta1.NSG{ - Role: infrastructurev1beta1.ServiceLoadBalancerRole, - Name: infrastructurev1beta1.ServiceLBDefaultName, + nsgs[2] = &infrastructurev1beta2.NSG{ + Role: infrastructurev1beta2.ServiceLoadBalancerRole, + Name: infrastructurev1beta2.ServiceLBDefaultName, IngressRules: c.GetLBServiceDefaultIngressRules(), EgressRules: c.GetLBServiceDefaultEgressRules(), } - nsgs[3] = &infrastructurev1beta1.NSG{ - Role: infrastructurev1beta1.PodRole, + nsgs[3] = &infrastructurev1beta2.NSG{ + Role: infrastructurev1beta2.PodRole, Name: PodDefaultName, IngressRules: c.GetPodDefaultIngressRules(), EgressRules: c.GetPodDefaultEgressRules(), } - c.Spec.NetworkSpec.Vcn.NetworkSecurityGroups = nsgs + c.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List = nsgs } if c.Spec.NetworkSpec.Vcn.CIDR == "" { - c.Spec.NetworkSpec.Vcn.CIDR = infrastructurev1beta1.VcnDefaultCidr + c.Spec.NetworkSpec.Vcn.CIDR = infrastructurev1beta2.VcnDefaultCidr } } } @@ -171,13 +171,13 @@ func (c *OCIManagedCluster) ValidateUpdate(old runtime.Object) error { func (c *OCIManagedCluster) validate(old *OCIManagedCluster) field.ErrorList { var allErrs field.ErrorList - var oldNetworkSpec infrastructurev1beta1.NetworkSpec + var oldNetworkSpec infrastructurev1beta2.NetworkSpec if old != nil { oldNetworkSpec = old.Spec.NetworkSpec } - allErrs = append(allErrs, infrastructurev1beta1.ValidateNetworkSpec(infrastructurev1beta1.OCIManagedClusterSubnetRoles, c.Spec.NetworkSpec, oldNetworkSpec, field.NewPath("spec").Child("networkSpec"))...) - allErrs = append(allErrs, infrastructurev1beta1.ValidateClusterName(c.Name)...) + allErrs = append(allErrs, infrastructurev1beta2.ValidateNetworkSpec(infrastructurev1beta2.OCIManagedClusterSubnetRoles, c.Spec.NetworkSpec, oldNetworkSpec, field.NewPath("spec").Child("networkSpec"))...) + allErrs = append(allErrs, infrastructurev1beta2.ValidateClusterName(c.Name)...) if len(c.Spec.CompartmentId) <= 0 { allErrs = append( @@ -187,7 +187,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 && !infrastructurev1beta1.ValidOcid(c.Spec.CompartmentId) { + if len(c.Spec.CompartmentId) > 0 && !infrastructurev1beta2.ValidOcid(c.Spec.CompartmentId) { allErrs = append( allErrs, field.Invalid(field.NewPath("spec", "compartmentId"), c.Spec.CompartmentId, "field is invalid")) @@ -199,13 +199,13 @@ func (c *OCIManagedCluster) validate(old *OCIManagedCluster) field.ErrorList { field.Invalid(field.NewPath("spec", "ociResourceIdentifier"), c.Spec.OCIResourceIdentifier, "field is required")) } - if !infrastructurev1beta1.ValidRegion(c.Spec.Region) { + if !infrastructurev1beta2.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, infrastructurev1beta1.LoadBalancer{}) { + if !reflect.DeepEqual(c.Spec.NetworkSpec.APIServerLB, infrastructurev1beta2.LoadBalancer{}) { allErrs = append( allErrs, field.Invalid(field.NewPath("spec", "networkSpec", "apiServerLoadBalancer"), c.Spec.NetworkSpec.APIServerLB, "cannot set loadbalancer in managed cluster")) @@ -218,391 +218,391 @@ func (c *OCIManagedCluster) validate(old *OCIManagedCluster) field.ErrorList { return allErrs } -func (c *OCIManagedCluster) GetControlPlaneEndpointDefaultIngressRules() []infrastructurev1beta1.IngressSecurityRuleForNSG { - return []infrastructurev1beta1.IngressSecurityRuleForNSG{ +func (c *OCIManagedCluster) GetControlPlaneEndpointDefaultIngressRules() []infrastructurev1beta2.IngressSecurityRuleForNSG { + return []infrastructurev1beta2.IngressSecurityRuleForNSG{ { - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ Description: common.String("Kubernetes worker to Kubernetes API endpoint communication."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(6443), Min: common.Int(6443), }, }, - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, - Source: common.String(infrastructurev1beta1.WorkerSubnetDefaultCIDR), + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, + Source: common.String(infrastructurev1beta2.WorkerSubnetDefaultCIDR), }, }, { - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ Description: common.String("Kubernetes worker to Kubernetes API endpoint communication."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(12250), Min: common.Int(12250), }, }, - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, - Source: common.String(infrastructurev1beta1.WorkerSubnetDefaultCIDR), + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, + Source: common.String(infrastructurev1beta2.WorkerSubnetDefaultCIDR), }, }, { - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ Description: common.String("Path Discovery."), Protocol: common.String("1"), - IcmpOptions: &infrastructurev1beta1.IcmpOptions{ + IcmpOptions: &infrastructurev1beta2.IcmpOptions{ Type: common.Int(3), Code: common.Int(4), }, - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, - Source: common.String(infrastructurev1beta1.WorkerSubnetDefaultCIDR), + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, + Source: common.String(infrastructurev1beta2.WorkerSubnetDefaultCIDR), }, }, { - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ Description: common.String("Pod to Kubernetes API endpoint communication (when using VCN-native pod networking)."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(6443), Min: common.Int(6443), }, }, - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, Source: common.String(PodDefaultCIDR), }, }, { - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ Description: common.String("Pod to Kubernetes API endpoint communication (when using VCN-native pod networking)."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(12250), Min: common.Int(12250), }, }, - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, Source: common.String(PodDefaultCIDR), }, }, { - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ Description: common.String("External access to Kubernetes API endpoint."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(6443), Min: common.Int(6443), }, }, - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, Source: common.String("0.0.0.0/0"), }, }, } } -func (c *OCIManagedCluster) GetControlPlaneEndpointDefaultEgressRules() []infrastructurev1beta1.EgressSecurityRuleForNSG { - return []infrastructurev1beta1.EgressSecurityRuleForNSG{ +func (c *OCIManagedCluster) GetControlPlaneEndpointDefaultEgressRules() []infrastructurev1beta2.EgressSecurityRuleForNSG { + return []infrastructurev1beta2.EgressSecurityRuleForNSG{ { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("Allow Kubernetes API endpoint to communicate with OKE."), Protocol: common.String("6"), - DestinationType: infrastructurev1beta1.EgressSecurityRuleSourceTypeServiceCidrBlock, + DestinationType: infrastructurev1beta2.EgressSecurityRuleSourceTypeServiceCidrBlock, }, }, { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("Path Discovery."), Protocol: common.String("1"), - IcmpOptions: &infrastructurev1beta1.IcmpOptions{ + IcmpOptions: &infrastructurev1beta2.IcmpOptions{ Type: common.Int(3), Code: common.Int(4), }, - DestinationType: infrastructurev1beta1.EgressSecurityRuleSourceTypeServiceCidrBlock, + DestinationType: infrastructurev1beta2.EgressSecurityRuleSourceTypeServiceCidrBlock, }, }, { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("Allow Kubernetes API endpoint to communicate with worker nodes."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(10250), Min: common.Int(10250), }, }, - DestinationType: infrastructurev1beta1.EgressSecurityRuleDestinationTypeCidrBlock, - Destination: common.String(infrastructurev1beta1.WorkerSubnetDefaultCIDR), + DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, + Destination: common.String(infrastructurev1beta2.WorkerSubnetDefaultCIDR), }, }, { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("Path Discovery."), Protocol: common.String("1"), - IcmpOptions: &infrastructurev1beta1.IcmpOptions{ + IcmpOptions: &infrastructurev1beta2.IcmpOptions{ Type: common.Int(3), Code: common.Int(4), }, - DestinationType: infrastructurev1beta1.EgressSecurityRuleDestinationTypeCidrBlock, - Destination: common.String(infrastructurev1beta1.WorkerSubnetDefaultCIDR), + DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, + Destination: common.String(infrastructurev1beta2.WorkerSubnetDefaultCIDR), }, }, { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("Allow Kubernetes API endpoint to communicate with pods (when using VCN-native pod networking)."), Protocol: common.String("all"), - DestinationType: infrastructurev1beta1.EgressSecurityRuleDestinationTypeCidrBlock, + DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, Destination: common.String(PodDefaultCIDR), }, }, } } -func (c *OCIManagedCluster) GetWorkerDefaultIngressRules() []infrastructurev1beta1.IngressSecurityRuleForNSG { - return []infrastructurev1beta1.IngressSecurityRuleForNSG{ +func (c *OCIManagedCluster) GetWorkerDefaultIngressRules() []infrastructurev1beta2.IngressSecurityRuleForNSG { + return []infrastructurev1beta2.IngressSecurityRuleForNSG{ { - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ Description: common.String("Allow Kubernetes API endpoint to communicate with worker nodes."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(10250), Min: common.Int(10250), }, }, - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, - Source: common.String(infrastructurev1beta1.ControlPlaneEndpointSubnetDefaultCIDR), + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, + Source: common.String(infrastructurev1beta2.ControlPlaneEndpointSubnetDefaultCIDR), }, }, { - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ Description: common.String("Path Discovery."), Protocol: common.String("1"), - IcmpOptions: &infrastructurev1beta1.IcmpOptions{ + IcmpOptions: &infrastructurev1beta2.IcmpOptions{ Type: common.Int(3), Code: common.Int(4), }, - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, Source: common.String("0.0.0.0/0"), }, }, { - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ Description: common.String("Load Balancer to Worker nodes node ports."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(32767), Min: common.Int(30000), }, }, - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, - Source: common.String(infrastructurev1beta1.ServiceLoadBalancerDefaultCIDR), + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, + Source: common.String(infrastructurev1beta2.ServiceLoadBalancerDefaultCIDR), }, }, } } -func (c *OCIManagedCluster) GetWorkerDefaultEgressRules() []infrastructurev1beta1.EgressSecurityRuleForNSG { - return []infrastructurev1beta1.EgressSecurityRuleForNSG{ +func (c *OCIManagedCluster) GetWorkerDefaultEgressRules() []infrastructurev1beta2.EgressSecurityRuleForNSG { + return []infrastructurev1beta2.EgressSecurityRuleForNSG{ { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("Allow worker nodes to communicate with OKE."), Protocol: common.String("6"), - DestinationType: infrastructurev1beta1.EgressSecurityRuleSourceTypeServiceCidrBlock, + DestinationType: infrastructurev1beta2.EgressSecurityRuleSourceTypeServiceCidrBlock, }, }, { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("Allow worker nodes to access pods."), Protocol: common.String("all"), - DestinationType: infrastructurev1beta1.EgressSecurityRuleDestinationTypeCidrBlock, + DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, Destination: common.String(PodDefaultCIDR), }, }, { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("Path Discovery."), Protocol: common.String("1"), - IcmpOptions: &infrastructurev1beta1.IcmpOptions{ + IcmpOptions: &infrastructurev1beta2.IcmpOptions{ Type: common.Int(3), Code: common.Int(4), }, - DestinationType: infrastructurev1beta1.EgressSecurityRuleDestinationTypeCidrBlock, + DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, Destination: common.String("0.0.0.0/0"), }, }, { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("Kubernetes worker to Kubernetes API endpoint communication."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(6443), Min: common.Int(6443), }, }, - DestinationType: infrastructurev1beta1.EgressSecurityRuleDestinationTypeCidrBlock, - Destination: common.String(infrastructurev1beta1.ControlPlaneEndpointSubnetDefaultCIDR), + DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, + Destination: common.String(infrastructurev1beta2.ControlPlaneEndpointSubnetDefaultCIDR), }, }, { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("Kubernetes worker to Kubernetes API endpoint communication."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(12250), Min: common.Int(12250), }, }, - DestinationType: infrastructurev1beta1.EgressSecurityRuleDestinationTypeCidrBlock, - Destination: common.String(infrastructurev1beta1.ControlPlaneEndpointSubnetDefaultCIDR), + DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, + Destination: common.String(infrastructurev1beta2.ControlPlaneEndpointSubnetDefaultCIDR), }, }, } } -func (c *OCIManagedCluster) GetPodDefaultIngressRules() []infrastructurev1beta1.IngressSecurityRuleForNSG { - return []infrastructurev1beta1.IngressSecurityRuleForNSG{ +func (c *OCIManagedCluster) GetPodDefaultIngressRules() []infrastructurev1beta2.IngressSecurityRuleForNSG { + return []infrastructurev1beta2.IngressSecurityRuleForNSG{ { - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ Description: common.String("Allow worker nodes to access pods."), Protocol: common.String("all"), - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, - Source: common.String(infrastructurev1beta1.WorkerSubnetDefaultCIDR), + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, + Source: common.String(infrastructurev1beta2.WorkerSubnetDefaultCIDR), }, }, { - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ Description: common.String("Allow Kubernetes API endpoint to communicate with pods."), Protocol: common.String("all"), - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, - Source: common.String(infrastructurev1beta1.ControlPlaneEndpointSubnetDefaultCIDR), + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, + Source: common.String(infrastructurev1beta2.ControlPlaneEndpointSubnetDefaultCIDR), }, }, { - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ Description: common.String("Allow pods to communicate with other pods."), Protocol: common.String("all"), - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, Source: common.String(PodDefaultCIDR), }, }, } } -func (c *OCIManagedCluster) GetPodDefaultEgressRules() []infrastructurev1beta1.EgressSecurityRuleForNSG { - return []infrastructurev1beta1.EgressSecurityRuleForNSG{ +func (c *OCIManagedCluster) GetPodDefaultEgressRules() []infrastructurev1beta2.EgressSecurityRuleForNSG { + return []infrastructurev1beta2.EgressSecurityRuleForNSG{ { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("Allow worker nodes to communicate with OCI Services."), Protocol: common.String("6"), - DestinationType: infrastructurev1beta1.EgressSecurityRuleSourceTypeServiceCidrBlock, + DestinationType: infrastructurev1beta2.EgressSecurityRuleSourceTypeServiceCidrBlock, }, }, { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("Path Discovery."), Protocol: common.String("1"), - IcmpOptions: &infrastructurev1beta1.IcmpOptions{ + IcmpOptions: &infrastructurev1beta2.IcmpOptions{ Type: common.Int(3), Code: common.Int(4), }, - DestinationType: infrastructurev1beta1.EgressSecurityRuleSourceTypeServiceCidrBlock, + DestinationType: infrastructurev1beta2.EgressSecurityRuleSourceTypeServiceCidrBlock, }, }, { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("Allow pods to communicate with other pods."), Protocol: common.String("all"), - DestinationType: infrastructurev1beta1.EgressSecurityRuleDestinationTypeCidrBlock, + DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, Destination: common.String(PodDefaultCIDR), }, }, { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("Pod to Kubernetes API endpoint communication (when using VCN-native pod networking)."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(6443), Min: common.Int(6443), }, }, - DestinationType: infrastructurev1beta1.EgressSecurityRuleDestinationTypeCidrBlock, - Destination: common.String(infrastructurev1beta1.ControlPlaneEndpointSubnetDefaultCIDR), + DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, + Destination: common.String(infrastructurev1beta2.ControlPlaneEndpointSubnetDefaultCIDR), }, }, { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("Pod to Kubernetes API endpoint communication (when using VCN-native pod networking)."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(12250), Min: common.Int(12250), }, }, - DestinationType: infrastructurev1beta1.EgressSecurityRuleDestinationTypeCidrBlock, - Destination: common.String(infrastructurev1beta1.ControlPlaneEndpointSubnetDefaultCIDR), + DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, + Destination: common.String(infrastructurev1beta2.ControlPlaneEndpointSubnetDefaultCIDR), }, }, } } -func (c *OCIManagedCluster) GetLBServiceDefaultIngressRules() []infrastructurev1beta1.IngressSecurityRuleForNSG { - return []infrastructurev1beta1.IngressSecurityRuleForNSG{ +func (c *OCIManagedCluster) GetLBServiceDefaultIngressRules() []infrastructurev1beta2.IngressSecurityRuleForNSG { + return []infrastructurev1beta2.IngressSecurityRuleForNSG{ { - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ Description: common.String("Accept http traffic on port 80"), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(80), Min: common.Int(80), }, }, - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, Source: common.String("0.0.0.0/0"), }, }, { - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ Description: common.String("Accept https traffic on port 443"), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(443), Min: common.Int(443), }, }, - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, Source: common.String("0.0.0.0/0"), }, }, } } -func (c *OCIManagedCluster) GetLBServiceDefaultEgressRules() []infrastructurev1beta1.EgressSecurityRuleForNSG { +func (c *OCIManagedCluster) GetLBServiceDefaultEgressRules() []infrastructurev1beta2.EgressSecurityRuleForNSG { // TODO add service gateway rules - return []infrastructurev1beta1.EgressSecurityRuleForNSG{ + return []infrastructurev1beta2.EgressSecurityRuleForNSG{ { - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ Description: common.String("Load Balancer to Worker nodes node ports."), Protocol: common.String("6"), - TcpOptions: &infrastructurev1beta1.TcpOptions{ - DestinationPortRange: &infrastructurev1beta1.PortRange{ + TcpOptions: &infrastructurev1beta2.TcpOptions{ + DestinationPortRange: &infrastructurev1beta2.PortRange{ Max: common.Int(32767), Min: common.Int(30000), }, }, - DestinationType: infrastructurev1beta1.EgressSecurityRuleDestinationTypeCidrBlock, - Destination: common.String(infrastructurev1beta1.WorkerSubnetDefaultCIDR), + DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, + Destination: common.String(infrastructurev1beta2.WorkerSubnetDefaultCIDR), }, }, } diff --git a/exp/api/v1beta1/ocimanagedcluster_webhook_test.go b/exp/api/v1beta2/ocimanagedcluster_webhook_test.go similarity index 67% rename from exp/api/v1beta1/ocimanagedcluster_webhook_test.go rename to exp/api/v1beta2/ocimanagedcluster_webhook_test.go index 48943e9c..4399dab7 100644 --- a/exp/api/v1beta1/ocimanagedcluster_webhook_test.go +++ b/exp/api/v1beta2/ocimanagedcluster_webhook_test.go @@ -17,7 +17,7 @@ * */ -package v1beta1 +package v1beta2 import ( "strings" @@ -25,56 +25,56 @@ import ( "github.com/onsi/gomega" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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 := []*infrastructurev1beta1.Subnet{ - &infrastructurev1beta1.Subnet{ - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + goodSubnets := []*infrastructurev1beta2.Subnet{ + &infrastructurev1beta2.Subnet{ + Role: infrastructurev1beta2.ControlPlaneEndpointRole, Name: "test-subnet", CIDR: "10.0.0.0/16", }, } - badSubnetCidr := []*infrastructurev1beta1.Subnet{ - &infrastructurev1beta1.Subnet{ + badSubnetCidr := []*infrastructurev1beta2.Subnet{ + &infrastructurev1beta2.Subnet{ Name: "test-subnet", CIDR: "10.1.0.0/16", }, } - emptySubnetCidr := []*infrastructurev1beta1.Subnet{ - &infrastructurev1beta1.Subnet{ - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + emptySubnetCidr := []*infrastructurev1beta2.Subnet{ + &infrastructurev1beta2.Subnet{ + Role: infrastructurev1beta2.ControlPlaneEndpointRole, Name: "test-subnet", }, } - badSubnetCidrFormat := []*infrastructurev1beta1.Subnet{ - &infrastructurev1beta1.Subnet{ + badSubnetCidrFormat := []*infrastructurev1beta2.Subnet{ + &infrastructurev1beta2.Subnet{ Name: "test-subnet", CIDR: "no-a-cidr", }, } - dupSubnetNames := []*infrastructurev1beta1.Subnet{ - &infrastructurev1beta1.Subnet{ + dupSubnetNames := []*infrastructurev1beta2.Subnet{ + &infrastructurev1beta2.Subnet{ Name: "dup-name", CIDR: "10.0.0.0/16", }, - &infrastructurev1beta1.Subnet{ + &infrastructurev1beta2.Subnet{ Name: "dup-name", CIDR: "10.0.0.0/16", }, } - emptySubnetName := []*infrastructurev1beta1.Subnet{ - &infrastructurev1beta1.Subnet{ + emptySubnetName := []*infrastructurev1beta2.Subnet{ + &infrastructurev1beta2.Subnet{ Name: "", CIDR: "10.0.0.0/16", - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, }, } - badSubnetRole := []*infrastructurev1beta1.Subnet{ - &infrastructurev1beta1.Subnet{ + badSubnetRole := []*infrastructurev1beta2.Subnet{ + &infrastructurev1beta2.Subnet{ Role: "not-control-plane", }, } @@ -132,8 +132,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ CIDR: "not-a-cidr", }, }, @@ -162,8 +162,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ CIDR: "10.0.0.0/16", Subnets: badSubnetCidr, }, @@ -182,8 +182,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Spec: OCIManagedClusterSpec{ CompartmentId: "ocid", OCIResourceIdentifier: "uuid", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ CIDR: "10.0.0.0/16", Subnets: emptySubnetCidr, }, @@ -199,8 +199,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ CIDR: "10.0.0.0/16", Subnets: badSubnetCidrFormat, }, @@ -217,8 +217,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ CIDR: "10.0.0.0/16", Subnets: dupSubnetNames, }, @@ -235,8 +235,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ CIDR: "10.0.0.0/16", Subnets: badSubnetRole, }, @@ -253,12 +253,12 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ CIDR: "10.0.0.0/16", - Subnets: []*infrastructurev1beta1.Subnet{ - &infrastructurev1beta1.Subnet{ - Role: infrastructurev1beta1.ControlPlaneRole, + Subnets: []*infrastructurev1beta2.Subnet{ + &infrastructurev1beta2.Subnet{ + Role: infrastructurev1beta2.ControlPlaneRole, }, }, }, @@ -277,8 +277,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Spec: OCIManagedClusterSpec{ CompartmentId: "ocid", OCIResourceIdentifier: "uuid", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ CIDR: "10.0.0.0/16", Subnets: emptySubnetName, }, @@ -294,16 +294,18 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{{ - EgressRules: []infrastructurev1beta1.EgressSecurityRuleForNSG{{ - EgressSecurityRule: infrastructurev1beta1.EgressSecurityRule{ - Destination: common.String("bad/15"), - DestinationType: infrastructurev1beta1.EgressSecurityRuleDestinationTypeCidrBlock, - }, + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{{ + EgressRules: []infrastructurev1beta2.EgressSecurityRuleForNSG{{ + EgressSecurityRule: infrastructurev1beta2.EgressSecurityRule{ + Destination: common.String("bad/15"), + DestinationType: infrastructurev1beta2.EgressSecurityRuleDestinationTypeCidrBlock, + }, + }}, }}, - }}, + }, }, }, }, @@ -318,16 +320,18 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{{ - IngressRules: []infrastructurev1beta1.IngressSecurityRuleForNSG{{ - IngressSecurityRule: infrastructurev1beta1.IngressSecurityRule{ - Source: common.String("bad/15"), - SourceType: infrastructurev1beta1.IngressSecurityRuleSourceTypeCidrBlock, - }, + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{{ + IngressRules: []infrastructurev1beta2.IngressSecurityRuleForNSG{{ + IngressSecurityRule: infrastructurev1beta2.IngressSecurityRule{ + Source: common.String("bad/15"), + SourceType: infrastructurev1beta2.IngressSecurityRuleSourceTypeCidrBlock, + }, + }}, }}, - }}, + }, }, }, }, @@ -342,11 +346,13 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{{ - Role: "bad-role", - }}, + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{{ + Role: "bad-role", + }}, + }, }, }, }, @@ -361,11 +367,13 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Name: goodClusterName, }, Spec: OCIManagedClusterSpec{ - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{{ - Role: infrastructurev1beta1.ControlPlaneRole, - }}, + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{{ + Role: infrastructurev1beta2.ControlPlaneRole, + }}, + }, }, }, }, @@ -383,8 +391,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Region: "", CompartmentId: "ocid", OCIResourceIdentifier: "uuid", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ CIDR: "10.0.0.0/16", Subnets: goodSubnets, }, @@ -401,8 +409,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { }, Spec: OCIManagedClusterSpec{ CompartmentId: "ocid", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - APIServerLB: infrastructurev1beta1.LoadBalancer{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + APIServerLB: infrastructurev1beta2.LoadBalancer{ Name: "test", }, }, @@ -421,8 +429,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Region: "us-lexington-1", CompartmentId: "ocid", OCIResourceIdentifier: "uuid", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ CIDR: "10.0.0.0/16", Subnets: goodSubnets, }, @@ -440,8 +448,8 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { Spec: OCIManagedClusterSpec{ CompartmentId: "ocid", OCIResourceIdentifier: "uuid", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ CIDR: "10.0.0.0/16", Subnets: emptySubnetName, }, @@ -468,9 +476,9 @@ func TestOCIManagedCluster_ValidateCreate(t *testing.T) { } func TestOCIManagedCluster_ValidateUpdate(t *testing.T) { - goodSubnets := []*infrastructurev1beta1.Subnet{ - &infrastructurev1beta1.Subnet{ - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + goodSubnets := []*infrastructurev1beta2.Subnet{ + &infrastructurev1beta2.Subnet{ + Role: infrastructurev1beta2.ControlPlaneEndpointRole, Name: "test-subnet", CIDR: "10.0.0.0/16", }, @@ -547,8 +555,8 @@ func TestOCIManagedCluster_ValidateUpdate(t *testing.T) { CompartmentId: "ocid", Region: "old-region", OCIResourceIdentifier: "uuid", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ CIDR: "10.0.0.0/16", Subnets: goodSubnets, }, @@ -563,8 +571,8 @@ func TestOCIManagedCluster_ValidateUpdate(t *testing.T) { Region: "old-region", CompartmentId: "ocid", OCIResourceIdentifier: "uuid", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ CIDR: "10.0.0.0/16", Subnets: goodSubnets, }, @@ -618,31 +626,31 @@ func TestOCIManagedCluster_CreateDefault(t *testing.T) { }, }, expect: func(g *gomega.WithT, c *OCIManagedCluster) { - subnets := make([]*infrastructurev1beta1.Subnet, 0) - subnets = append(subnets, &infrastructurev1beta1.Subnet{ - Role: infrastructurev1beta1.ControlPlaneEndpointRole, - Name: infrastructurev1beta1.ControlPlaneEndpointDefaultName, - CIDR: infrastructurev1beta1.ControlPlaneEndpointSubnetDefaultCIDR, - Type: infrastructurev1beta1.Public, + subnets := make([]*infrastructurev1beta2.Subnet, 0) + subnets = append(subnets, &infrastructurev1beta2.Subnet{ + Role: infrastructurev1beta2.ControlPlaneEndpointRole, + Name: infrastructurev1beta2.ControlPlaneEndpointDefaultName, + CIDR: infrastructurev1beta2.ControlPlaneEndpointSubnetDefaultCIDR, + Type: infrastructurev1beta2.Public, }) - subnets = append(subnets, &infrastructurev1beta1.Subnet{ - Role: infrastructurev1beta1.ServiceLoadBalancerRole, - Name: infrastructurev1beta1.ServiceLBDefaultName, - CIDR: infrastructurev1beta1.ServiceLoadBalancerDefaultCIDR, - Type: infrastructurev1beta1.Public, + subnets = append(subnets, &infrastructurev1beta2.Subnet{ + Role: infrastructurev1beta2.ServiceLoadBalancerRole, + Name: infrastructurev1beta2.ServiceLBDefaultName, + CIDR: infrastructurev1beta2.ServiceLoadBalancerDefaultCIDR, + Type: infrastructurev1beta2.Public, }) - subnets = append(subnets, &infrastructurev1beta1.Subnet{ - Role: infrastructurev1beta1.WorkerRole, - Name: infrastructurev1beta1.WorkerDefaultName, - CIDR: infrastructurev1beta1.WorkerSubnetDefaultCIDR, - Type: infrastructurev1beta1.Private, + subnets = append(subnets, &infrastructurev1beta2.Subnet{ + Role: infrastructurev1beta2.WorkerRole, + Name: infrastructurev1beta2.WorkerDefaultName, + CIDR: infrastructurev1beta2.WorkerSubnetDefaultCIDR, + Type: infrastructurev1beta2.Private, }) - subnets = append(subnets, &infrastructurev1beta1.Subnet{ - Role: infrastructurev1beta1.PodRole, + subnets = append(subnets, &infrastructurev1beta2.Subnet{ + Role: infrastructurev1beta2.PodRole, Name: PodDefaultName, CIDR: PodDefaultCIDR, - Type: infrastructurev1beta1.Private, + Type: infrastructurev1beta2.Private, }) g.Expect(c.Spec.NetworkSpec.Vcn.Subnets).To(Equal(subnets)) }, @@ -656,32 +664,51 @@ func TestOCIManagedCluster_CreateDefault(t *testing.T) { }, }, expect: func(g *gomega.WithT, c *OCIManagedCluster) { - nsgs := make([]*infrastructurev1beta1.NSG, 4) - nsgs[0] = &infrastructurev1beta1.NSG{ - Role: infrastructurev1beta1.ControlPlaneEndpointRole, - Name: infrastructurev1beta1.ControlPlaneEndpointDefaultName, + nsgs := make([]*infrastructurev1beta2.NSG, 4) + nsgs[0] = &infrastructurev1beta2.NSG{ + Role: infrastructurev1beta2.ControlPlaneEndpointRole, + Name: infrastructurev1beta2.ControlPlaneEndpointDefaultName, IngressRules: c.GetControlPlaneEndpointDefaultIngressRules(), EgressRules: c.GetControlPlaneEndpointDefaultEgressRules(), } - nsgs[1] = &infrastructurev1beta1.NSG{ - Role: infrastructurev1beta1.WorkerRole, - Name: infrastructurev1beta1.WorkerDefaultName, + nsgs[1] = &infrastructurev1beta2.NSG{ + Role: infrastructurev1beta2.WorkerRole, + Name: infrastructurev1beta2.WorkerDefaultName, IngressRules: c.GetWorkerDefaultIngressRules(), EgressRules: c.GetWorkerDefaultEgressRules(), } - nsgs[2] = &infrastructurev1beta1.NSG{ - Role: infrastructurev1beta1.ServiceLoadBalancerRole, - Name: infrastructurev1beta1.ServiceLBDefaultName, + nsgs[2] = &infrastructurev1beta2.NSG{ + Role: infrastructurev1beta2.ServiceLoadBalancerRole, + Name: infrastructurev1beta2.ServiceLBDefaultName, IngressRules: c.GetLBServiceDefaultIngressRules(), EgressRules: c.GetLBServiceDefaultEgressRules(), } - nsgs[3] = &infrastructurev1beta1.NSG{ - Role: infrastructurev1beta1.PodRole, + nsgs[3] = &infrastructurev1beta2.NSG{ + Role: infrastructurev1beta2.PodRole, Name: PodDefaultName, IngressRules: c.GetPodDefaultIngressRules(), EgressRules: c.GetPodDefaultEgressRules(), } - g.Expect(c.Spec.NetworkSpec.Vcn.NetworkSecurityGroups).To(Equal(nsgs)) + g.Expect(c.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List).To(Equal(nsgs)) + }, + }, + { + name: "should set default nsg", + c: &OCIManagedCluster{ + ObjectMeta: metav1.ObjectMeta{}, + Spec: OCIManagedClusterSpec{ + CompartmentId: "ocid", + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + Skip: true, + }, + }, + }, + }, + }, + expect: func(g *gomega.WithT, c *OCIManagedCluster) { + g.Expect(len(c.Spec.NetworkSpec.Vcn.NetworkSecurityGroup.List)).To(Equal(0)) }, }, } diff --git a/exp/api/v1beta2/ocimanagedclustertemplate_types.go b/exp/api/v1beta2/ocimanagedclustertemplate_types.go new file mode 100644 index 00000000..33015379 --- /dev/null +++ b/exp/api/v1beta2/ocimanagedclustertemplate_types.go @@ -0,0 +1,58 @@ +/* +Copyright (c) 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 + + http://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 v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// OCIManagedClusterTemplateSpec defines the desired state of OCIManagedClusterTemplate. +type OCIManagedClusterTemplateSpec struct { + Template OCIManagedClusterTemplateResource `json:"template"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=ocimanagedclustertemplates,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion + +// OCIManagedClusterTemplate is the Schema for the ocimanagedclustertemplates API. +type OCIManagedClusterTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec OCIManagedClusterTemplateSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:storageversion + +// OCIManagedClusterTemplateList contains a list of OCIManagedClusterTemplate. +type OCIManagedClusterTemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []OCIManagedClusterTemplate `json:"items"` +} + +func init() { + SchemeBuilder.Register(&OCIManagedClusterTemplate{}, &OCIManagedClusterTemplateList{}) +} + +// OCIManagedClusterSpec describes the data needed to create an OCIManagedCluster from a template. +type OCIManagedClusterTemplateResource struct { + Spec OCIManagedClusterSpec `json:"spec"` +} diff --git a/exp/api/v1beta2/ocimanagedcontrolplane_types.go b/exp/api/v1beta2/ocimanagedcontrolplane_types.go new file mode 100644 index 00000000..b5a134a7 --- /dev/null +++ b/exp/api/v1beta2/ocimanagedcontrolplane_types.go @@ -0,0 +1,191 @@ +/* +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 + + http://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 v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" +) + +const ( + // ControlPlaneFinalizer allows OCIManagedControlPlaneFinalizer to clean up OCI resources associated with control plane + // of OCIManagedControlPlane + ControlPlaneFinalizer = "ocimanagedcontrolplane.infrastructure.cluster.x-k8s.io" +) + +// OCIManagedControlPlaneSpec defines the desired state of OCIManagedControlPlane. +// The properties are generated from https://docs.oracle.com/en-us/iaas/api/#/en/containerengine/20180222/datatypes/CreateClusterDetails +type OCIManagedControlPlaneSpec struct { + // ID of the OKEcluster. + // +optional + ID *string `json:"id,omitempty"` + + // ClusterPodNetworkOptions defines the available CNIs and network options for existing and new node pools of the cluster + // +optional + ClusterPodNetworkOptions []ClusterPodNetworkOptions `json:"clusterPodNetworkOptions,omitempty"` + + // ImagePolicyConfig defines the properties that define a image verification policy. + // +optional + ImagePolicyConfig *ImagePolicyConfig `json:"imagePolicyConfig,omitempty"` + + // ClusterOptions defines Optional attributes for the cluster. + // +optional + ClusterOption ClusterOptions `json:"clusterOptions,omitempty"` + + // KmsKeyId defines the OCID of the KMS key to be used as the master encryption key for Kubernetes secret encryption. When used, + // +optional + KmsKeyId *string `json:"kmsKeyId,omitempty"` + + // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. + // +optional + ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"` + + // Version represents the version of the Kubernetes Cluster Control Plane. + Version *string `json:"version,omitempty"` +} + +// ClusterPodNetworkOptions defines the available CNIs and network options for existing and new node pools of the cluster +type ClusterPodNetworkOptions struct { + + // The CNI to be used are OCI_VCN_IP_NATIVE and FLANNEL_OVERLAY + CniType CNIOptionEnum `json:"cniType,omitempty"` +} + +// EndpointConfig defines the network configuration for access to the Cluster control plane. +type EndpointConfig struct { + // Flag to enable public endpoint address for the OKE cluster. + // If not set, will calculate this using endpoint subnet type. + // +optional + IsPublicIpEnabled bool `json:"isPublicIpEnabled,omitempty"` +} + +// ImagePolicyConfig defines the properties that define a image verification policy. +type ImagePolicyConfig struct { + + // IsPolicyEnabled defines Whether the image verification policy is enabled. + // +optional + IsPolicyEnabled *bool `json:"isPolicyEnabled,omitempty"` + + // KeyDetails defines a list of KMS key details. + // +optional + KeyDetails []KeyDetails `json:"keyDetails,omitempty"` +} + +// KeyDetails defines the properties that define the kms keys used by OKE for Image Signature verification. +type KeyDetails struct { + + // KmsKeyId defines the OCID of the KMS key that will be used to verify whether the images are signed by an approved source. + // +optional + KmsKeyId *string `json:"keyDetails,omitempty"` +} + +// ClusterOptions defines Optional attributes for the cluster. +type ClusterOptions struct { + + // AddOnOptions defines the properties that define options for supported add-ons. + // +optional + AddOnOptions *AddOnOptions `json:"addOnOptions,omitempty"` + + // AdmissionControllerOptions defines the properties that define supported admission controllers. + // +optional + AdmissionControllerOptions *AdmissionControllerOptions `json:"admissionControllerOptions,omitempty"` +} + +// AddOnOptions defines the properties that define options for supported add-ons. +type AddOnOptions struct { + // IsKubernetesDashboardEnabled defines whether or not to enable the Kubernetes Dashboard add-on. + // +optional + IsKubernetesDashboardEnabled *bool `json:"isKubernetesDashboardEnabled,omitempty"` + + // IsKubernetesDashboardEnabled defines whether or not to enable the Tiller add-on. + // +optional + IsTillerEnabled *bool `json:"isTillerEnabled,omitempty"` +} + +// AdmissionControllerOptions defines the properties that define supported admission controllers. +type AdmissionControllerOptions struct { + + // IsPodSecurityPolicyEnabled defines whether or not to enable the Pod Security Policy admission controller. + // +optional + IsPodSecurityPolicyEnabled *bool `json:"isPodSecurityPolicyEnabled,omitempty"` +} + +// KubernetesNetworkConfig defines the properties that define the network configuration for Kubernetes. +type KubernetesNetworkConfig struct { + + // PodsCidr defines the CIDR block for Kubernetes pods. Optional, defaults to 10.244.0.0/16. + // +optional + PodsCidr string `json:"isPodSecurityPolicyEnabled,omitempty"` + + // PodsCidr defines the CIDR block for Kubernetes services. Optional, defaults to 10.96.0.0/16. + // +optional + ServicesCidr string `json:"servicesCidr,omitempty"` +} + +// OCIManagedControlPlaneStatus defines the observed state of OCIManagedControlPlane +type OCIManagedControlPlaneStatus struct { + // +optional + Ready bool `json:"ready"` + // NetworkSpec encapsulates all things related to OCI network. + // +optional + Conditions clusterv1.Conditions `json:"conditions,omitempty"` + + // Version represents the current Kubernetes version for the control plane. + // +optional + Version *string `json:"version,omitempty"` + + // Initialized denotes whether or not the control plane has the + // uploaded kubernetes config-map. + // +optional + Initialized bool `json:"initialized"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status + +// OCIManagedControlPlane is the Schema for the ocimanagedcontrolplane API. +type OCIManagedControlPlane struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec OCIManagedControlPlaneSpec `json:"spec,omitempty"` + Status OCIManagedControlPlaneStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true +// +kubebuilder:storageversion + +// OCIManagedControlPlaneList contains a list of OCIManagedControlPlane. +type OCIManagedControlPlaneList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []OCIManagedControlPlane `json:"items"` +} + +// GetConditions returns the list of conditions for an OCICluster API object. +func (c *OCIManagedControlPlane) GetConditions() clusterv1.Conditions { + return c.Status.Conditions +} + +// SetConditions will set the given conditions on an OCICluster object. +func (c *OCIManagedControlPlane) SetConditions(conditions clusterv1.Conditions) { + c.Status.Conditions = conditions +} + +func init() { + SchemeBuilder.Register(&OCIManagedControlPlane{}, &OCIManagedControlPlaneList{}) +} diff --git a/exp/api/v1beta1/ocimanagedcontrolplane_webhook.go b/exp/api/v1beta2/ocimanagedcontrolplane_webhook.go similarity index 87% rename from exp/api/v1beta1/ocimanagedcontrolplane_webhook.go rename to exp/api/v1beta2/ocimanagedcontrolplane_webhook.go index 2ff326a6..b486fc07 100644 --- a/exp/api/v1beta1/ocimanagedcontrolplane_webhook.go +++ b/exp/api/v1beta2/ocimanagedcontrolplane_webhook.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1beta1 +package v1beta2 import ( apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -31,8 +31,8 @@ var ( _ webhook.Validator = &OCIManagedControlPlane{} ) -// +kubebuilder:webhook:verbs=create;update,path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-ocimanagedcontrolplane,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ocimanagedcontrolplanes,versions=v1beta1,name=validation.ocimanagedcontrolplane.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 -// +kubebuilder:webhook:verbs=create;update,path=/mutate-infrastructure-cluster-x-k8s-io-v1beta1-ocimanagedcontrolplane,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ocimanagedcontrolplanes,versions=v1beta1,name=default.ocimanagedcontrolplane.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-infrastructure-cluster-x-k8s-io-v1beta2-ocimanagedcontrolplane,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ocimanagedcontrolplanes,versions=v1beta2,name=validation.ocimanagedcontrolplane.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/mutate-infrastructure-cluster-x-k8s-io-v1beta2-ocimanagedcontrolplane,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ocimanagedcontrolplanes,versions=v1beta2,name=default.ocimanagedcontrolplane.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 func (c *OCIManagedControlPlane) Default() { if len(c.Spec.ClusterPodNetworkOptions) == 0 { diff --git a/exp/api/v1beta1/ocimanagedcontrolplane_webhook_test.go b/exp/api/v1beta2/ocimanagedcontrolplane_webhook_test.go similarity index 99% rename from exp/api/v1beta1/ocimanagedcontrolplane_webhook_test.go rename to exp/api/v1beta2/ocimanagedcontrolplane_webhook_test.go index 17954ba0..af0ea8a2 100644 --- a/exp/api/v1beta1/ocimanagedcontrolplane_webhook_test.go +++ b/exp/api/v1beta2/ocimanagedcontrolplane_webhook_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1beta1 +package v1beta2 import ( "strings" diff --git a/exp/api/v1beta2/ocimanagedcontrolplanetemplate_types.go b/exp/api/v1beta2/ocimanagedcontrolplanetemplate_types.go new file mode 100644 index 00000000..1d765973 --- /dev/null +++ b/exp/api/v1beta2/ocimanagedcontrolplanetemplate_types.go @@ -0,0 +1,58 @@ +/* +Copyright (c) 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 + + http://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 v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// OCIManagedControlPlaneTemplateSpec defines the desired state of OCIManagedControlPlaneTemplate. +type OCIManagedControlPlaneTemplateSpec struct { + Template OCIManagedControlPlaneTemplateResource `json:"template"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=ocimanagedcontrolplanetemplates,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion + +// OCIManagedControlPlaneTemplate is the Schema for the OCIManagedControlPlaneTemplates API. +type OCIManagedControlPlaneTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec OCIManagedControlPlaneTemplateSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:storageversion + +// OCIManagedControlPlaneTemplateList contains a list of OCIManagedControlPlaneTemplate. +type OCIManagedControlPlaneTemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []OCIManagedControlPlaneTemplate `json:"items"` +} + +func init() { + SchemeBuilder.Register(&OCIManagedControlPlaneTemplate{}, &OCIManagedControlPlaneTemplateList{}) +} + +// OCIManagedControlPlaneSpec describes the data needed to create an OCIManagedControlPlane from a template. +type OCIManagedControlPlaneTemplateResource struct { + Spec OCIManagedControlPlaneSpec `json:"spec"` +} diff --git a/exp/api/v1beta2/ocimanagedmachinepool_types.go b/exp/api/v1beta2/ocimanagedmachinepool_types.go new file mode 100644 index 00000000..44e89be9 --- /dev/null +++ b/exp/api/v1beta2/ocimanagedmachinepool_types.go @@ -0,0 +1,246 @@ +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + "sigs.k8s.io/cluster-api/errors" +) + +// Constants block. +const ( + // ManagedMachinePoolFinalizer is the finalizer for managed machine pool. + ManagedMachinePoolFinalizer = "ocimanagedmachinepool.infrastructure.cluster.x-k8s.io" +) + +// OCIManagedMachinePoolSpec defines the desired state of an OCI managed machine pool. +// An OCIManagedMachinePool translates to an OKE NodePool. +// The properties are generated from https://docs.oracle.com/en-us/iaas/api/#/en/containerengine/20180222/datatypes/CreateNodePoolDetails +type OCIManagedMachinePoolSpec struct { + + // ProviderID is the OCID of the associated NodePool in a provider format + // +optional + ProviderID *string `json:"providerID,omitempty"` + + // Version represents the version of the OKE node pool. + Version *string `json:"version,omitempty"` + + // ID is the OCID of the associated NodePool + // +optional + ID *string `json:"id,omitempty"` + + // NodePoolNodeConfig defines the configuration of nodes in the node pool. + // +optional + NodePoolNodeConfig *NodePoolNodeConfig `json:"nodePoolNodeConfig,omitempty"` + + // NodeEvictionNodePoolSettings defines the eviction settings. + // +optional + NodeEvictionNodePoolSettings *NodeEvictionNodePoolSettings `json:"nodeEvictionNodePoolSettings,omitempty"` + + // NodeShape defines the name of the node shape of the nodes in the node pool. + // +optional + NodeShape string `json:"nodeShape,omitempty"` + + // NodeShapeConfig defines the configuration of the shape to launch nodes in the node pool. + // +optional + NodeShapeConfig *NodeShapeConfig `json:"nodeShapeConfig,omitempty"` + + // NodeSourceViaImage defines the image configuration of the nodes in the nodepool. + // +optional + NodeSourceViaImage *NodeSourceViaImage `json:"nodeSourceViaImage,omitempty"` + + // SshPublicKey defines the SSH public key on each node in the node pool on launch. + // +optional + SshPublicKey string `json:"sshPublicKey,omitempty"` + + // NodeMetadata defines a list of key/value pairs to add to each underlying OCI instance in the node pool on launch. + // +optional + NodeMetadata map[string]string `json:"nodeMetadata,omitempty"` + + // InitialNodeLabels defines a list of key/value pairs to add to nodes after they join the Kubernetes cluster. + // +optional + InitialNodeLabels []KeyValue `json:"initialNodeLabels,omitempty"` + + // ProviderIDList are the identification IDs of machine instances provided by the provider. + // This field must match the provider IDs as seen on the node objects corresponding to a machine pool's machine instances. + // +optional + ProviderIDList []string `json:"providerIDList,omitempty"` +} + +// NodePoolNodeConfig describes the configuration of nodes in the node pool. +type NodePoolNodeConfig struct { + // IsPvEncryptionInTransitEnabled defines whether in transit encryption should be enabled on the nodes. + // +optional + IsPvEncryptionInTransitEnabled *bool `json:"isPvEncryptionInTransitEnabled,omitempty"` + + // KmsKeyId defines whether in transit encryption should be enabled on the nodes. + // +optional + KmsKeyId *string `json:"kmsKeyId,omitempty"` + + // PlacementConfigs defines the placement configurations for the node pool. + // +optional + PlacementConfigs []PlacementConfig `json:"placementConfigs,omitempty"` + + // NsgNames defines the names of NSGs which will be associated with the nodes. the NSGs are defined + // in OCIManagedCluster object. + // +optional + NsgNames []string `json:"nsgNames,omitempty"` + + // NodePoolPodNetworkOptionDetails defines the pod networking details of the node pool + // +optional + 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"` + + // VcnIpNativePodNetworkOptions describes the network options specific to using the OCI VCN Native CNI + // +optional + VcnIpNativePodNetworkOptions VcnIpNativePodNetworkOptions `json:"vcnIpNativePodNetworkOptions,omitempty"` +} + +// VcnIpNativePodNetworkOptions defines the Network options specific to using the OCI VCN Native CNI +type VcnIpNativePodNetworkOptions struct { + + // MemoryInGBs defines the max number of pods per node in the node pool. This value will be limited by the + // number of VNICs attachable to the node pool shape + // +optional + MaxPodsPerNode *int `json:"maxPodsPerNode,omitempty"` + + // NSGNames defines the NSGs associated with the native pod network. + // +optional + NSGNames []string `json:"nsgNames,omitempty"` + + // SubnetNames defines the Subnets associated with the native pod network. + // +optional + SubnetNames []string `json:"subnetNames,omitempty"` +} + +// PlacementConfig defines the placement configurations for the node pool. +type PlacementConfig struct { + // AvailabilityDomain defines the availability domain in which to place nodes. + // +optional + AvailabilityDomain *string `json:"availabilityDomain,omitempty"` + + // CapacityReservationId defines the OCID of the compute capacity reservation in which to place the compute instance. + // +optional + CapacityReservationId *string `json:"capacityReservationId,omitempty"` + + // FaultDomains defines the list of fault domains in which to place nodes. + // +optional + FaultDomains []string `json:"faultDomains,omitempty"` + + // SubnetName defines the name of the subnet which need ot be associated with the Nodepool. + // The subnets are defined in the OCiManagedCluster object. + // +optional + SubnetName *string `json:"subnetName,omitempty"` +} + +// NodeEvictionNodePoolSettings defines the Node Eviction Details configuration. +type NodeEvictionNodePoolSettings struct { + + // EvictionGraceDuration defines the duration after which OKE will give up eviction of the pods on the node. PT0M will indicate you want to delete the node without cordon and drain. Default PT60M, Min PT0M, Max: PT60M. Format ISO 8601 e.g PT30M + // +optional + EvictionGraceDuration *string `json:"evictionGraceDuration,omitempty"` + + // IsForceDeleteAfterGraceDuration defines if the underlying compute instance should be deleted if you cannot evict all the pods in grace period + // +optional + IsForceDeleteAfterGraceDuration *bool `json:"isForceDeleteAfterGraceDuration,omitempty"` +} + +// NodeShapeConfig defines the shape configuration of the nodes. +type NodeShapeConfig struct { + + // MemoryInGBs defines the total amount of memory available to each node, in gigabytes. + // +optional + MemoryInGBs *string `json:"memoryInGBs,omitempty"` + + // Ocpus defines the total number of OCPUs available to each node in the node pool. + // +optional + Ocpus *string `json:"ocpus,omitempty"` +} + +// NodeSourceViaImage defines the Details of the image running on the node. +type NodeSourceViaImage struct { + + // BootVolumeSizeInGBs defines the size of the boot volume in GBs. + // +optional + BootVolumeSizeInGBs *int64 `json:"bootVolumeSizeInGBs,omitempty"` + + // ImageId defines the OCID of the image used to boot the node. + // +optional + ImageId *string `json:"imageId,omitempty"` +} + +// KeyValue The properties that define a key value pair. +type KeyValue struct { + + // The key of the pair. + Key *string `json:"key,omitempty"` + + // The value of the pair. + Value *string `json:"value,omitempty"` +} + +// OCIManagedMachinePoolStatus defines the observed state of OCIManagedMachinePool +type OCIManagedMachinePoolStatus struct { + // +optional + Ready bool `json:"ready"` + // NetworkSpec encapsulates all things related to OCI network. + // +optional + Conditions clusterv1.Conditions `json:"conditions,omitempty"` + + // Replicas is the most recently observed number of replicas + // +optional + Replicas int32 `json:"replicas"` + + FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"` + + FailureMessages []string `json:"failureMessages,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +// +kubebuilder:storageversion + +// OCIManagedMachinePool is the Schema for the ocimanagedmachinepool API. +type OCIManagedMachinePool struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec OCIManagedMachinePoolSpec `json:"spec,omitempty"` + Status OCIManagedMachinePoolStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// OCIManagedMachinePoolList contains a list of OCIManagedMachinePool. +type OCIManagedMachinePoolList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []OCIManagedMachinePool `json:"items"` +} + +// GetConditions returns the list of conditions for an OCIMachine API object. +func (m *OCIManagedMachinePool) GetConditions() clusterv1.Conditions { + return m.Status.Conditions +} + +// SetConditions will set the given conditions on an OCIMachine object. +func (m *OCIManagedMachinePool) SetConditions(conditions clusterv1.Conditions) { + m.Status.Conditions = conditions +} + +func init() { + SchemeBuilder.Register(&OCIManagedMachinePool{}, &OCIManagedMachinePoolList{}) +} diff --git a/exp/api/v1beta1/ocimanagedmachinepool_webhook.go b/exp/api/v1beta2/ocimanagedmachinepool_webhook.go similarity index 90% rename from exp/api/v1beta1/ocimanagedmachinepool_webhook.go rename to exp/api/v1beta2/ocimanagedmachinepool_webhook.go index a143391f..e3fce0e1 100644 --- a/exp/api/v1beta1/ocimanagedmachinepool_webhook.go +++ b/exp/api/v1beta2/ocimanagedmachinepool_webhook.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1beta1 +package v1beta2 import ( apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -32,8 +32,8 @@ var ( _ webhook.Validator = &OCIManagedMachinePool{} ) -// +kubebuilder:webhook:verbs=create;update,path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-ocimanagedmachinepool,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ocimanagedmachinepools,versions=v1beta1,name=validation.ocimanagedmachinepool.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 -// +kubebuilder:webhook:verbs=create;update,path=/mutate-infrastructure-cluster-x-k8s-io-v1beta1-ocimanagedmachinepool,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ocimanagedmachinepools,versions=v1beta1,name=default.ocimanagedmachinepool.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-infrastructure-cluster-x-k8s-io-v1beta2-ocimanagedmachinepool,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ocimanagedmachinepools,versions=v1beta2,name=validation.ocimanagedmachinepool.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/mutate-infrastructure-cluster-x-k8s-io-v1beta2-ocimanagedmachinepool,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=ocimanagedmachinepools,versions=v1beta2,name=default.ocimanagedmachinepool.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 func (m *OCIManagedMachinePool) SetupWebhookWithManager(mgr ctrl.Manager) error { return ctrl.NewWebhookManagedBy(mgr). diff --git a/exp/api/v1beta1/ocimanagedmachinepool_webhook_test.go b/exp/api/v1beta2/ocimanagedmachinepool_webhook_test.go similarity index 99% rename from exp/api/v1beta1/ocimanagedmachinepool_webhook_test.go rename to exp/api/v1beta2/ocimanagedmachinepool_webhook_test.go index 741eb7fc..55c76a06 100644 --- a/exp/api/v1beta1/ocimanagedmachinepool_webhook_test.go +++ b/exp/api/v1beta2/ocimanagedmachinepool_webhook_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1beta1 +package v1beta2 import ( "strings" diff --git a/exp/api/v1beta2/ocimanagedmachinepooltemplate_types.go b/exp/api/v1beta2/ocimanagedmachinepooltemplate_types.go new file mode 100644 index 00000000..52239676 --- /dev/null +++ b/exp/api/v1beta2/ocimanagedmachinepooltemplate_types.go @@ -0,0 +1,58 @@ +/* +Copyright (c) 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 + + http://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 v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// OCIManagedMachinePoolTemplateSpec defines the desired state of OCIManagedMachinePoolTemplate. +type OCIManagedMachinePoolTemplateSpec struct { + Template OCIManagedMachinePoolTemplateResource `json:"template"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=ocimanagedmachinepooltemplates,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion + +// OCIManagedMachinePoolTemplate is the Schema for the OCIManagedMachinePoolTemplates API. +type OCIManagedMachinePoolTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec OCIManagedMachinePoolTemplateSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:storageversion + +// OCIManagedMachinePoolTemplateList contains a list of OCIManagedMachinePoolTemplate. +type OCIManagedMachinePoolTemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []OCIManagedMachinePoolTemplate `json:"items"` +} + +func init() { + SchemeBuilder.Register(&OCIManagedMachinePoolTemplate{}, &OCIManagedMachinePoolTemplateList{}) +} + +// OCIManagedMachinePoolSpec describes the data needed to create an OCIManagedMachinePool from a template. +type OCIManagedMachinePoolTemplateResource struct { + Spec OCIManagedMachinePoolSpec `json:"spec"` +} diff --git a/exp/api/v1beta2/zz_generated.deepcopy.go b/exp/api/v1beta2/zz_generated.deepcopy.go new file mode 100644 index 00000000..e6ec94cd --- /dev/null +++ b/exp/api/v1beta2/zz_generated.deepcopy.go @@ -0,0 +1,1480 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) 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 + + http://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. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +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 *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 + if in.InstanceConfigurationId != nil { + in, out := &in.InstanceConfigurationId, &out.InstanceConfigurationId + *out = new(string) + **out = **in + } + if in.Shape != nil { + in, out := &in.Shape, &out.Shape + *out = new(string) + **out = **in + } + if in.ShapeConfig != nil { + in, out := &in.ShapeConfig, &out.ShapeConfig + *out = new(ShapeConfig) + (*in).DeepCopyInto(*out) + } + if in.InstanceVnicConfiguration != nil { + in, out := &in.InstanceVnicConfiguration, &out.InstanceVnicConfiguration + *out = new(apiv1beta2.NetworkDetails) + (*in).DeepCopyInto(*out) + } + if in.PlatformConfig != nil { + in, out := &in.PlatformConfig, &out.PlatformConfig + *out = new(apiv1beta2.PlatformConfig) + (*in).DeepCopyInto(*out) + } + if in.AgentConfig != nil { + in, out := &in.AgentConfig, &out.AgentConfig + *out = new(apiv1beta2.LaunchInstanceAgentConfig) + (*in).DeepCopyInto(*out) + } + if in.PreemptibleInstanceConfig != nil { + in, out := &in.PreemptibleInstanceConfig, &out.PreemptibleInstanceConfig + *out = new(apiv1beta2.PreemptibleInstanceConfig) + (*in).DeepCopyInto(*out) + } + if in.AvailabilityConfig != nil { + in, out := &in.AvailabilityConfig, &out.AvailabilityConfig + *out = new(apiv1beta2.LaunchInstanceAvailabilityConfig) + (*in).DeepCopyInto(*out) + } + if in.DedicatedVmHostId != nil { + in, out := &in.DedicatedVmHostId, &out.DedicatedVmHostId + *out = new(string) + **out = **in + } + if in.LaunchOptions != nil { + in, out := &in.LaunchOptions, &out.LaunchOptions + *out = new(apiv1beta2.LaunchOptions) + (*in).DeepCopyInto(*out) + } + if in.InstanceOptions != nil { + in, out := &in.InstanceOptions, &out.InstanceOptions + *out = new(apiv1beta2.InstanceOptions) + (*in).DeepCopyInto(*out) + } + if in.IsPvEncryptionInTransitEnabled != nil { + in, out := &in.IsPvEncryptionInTransitEnabled, &out.IsPvEncryptionInTransitEnabled + *out = new(bool) + **out = **in + } + if in.InstanceSourceViaImageDetails != nil { + in, out := &in.InstanceSourceViaImageDetails, &out.InstanceSourceViaImageDetails + *out = new(InstanceSourceViaImageConfig) + (*in).DeepCopyInto(*out) + } + if in.CapacityReservationId != nil { + in, out := &in.CapacityReservationId, &out.CapacityReservationId + *out = new(string) + **out = **in + } + if in.Metadata != nil { + in, out := &in.Metadata, &out.Metadata + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceConfiguration. +func (in *InstanceConfiguration) DeepCopy() *InstanceConfiguration { + if in == nil { + return nil + } + out := new(InstanceConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceSourceViaImageConfig) DeepCopyInto(out *InstanceSourceViaImageConfig) { + *out = *in + if in.ImageId != nil { + in, out := &in.ImageId, &out.ImageId + *out = new(string) + **out = **in + } + if in.KmsKeyId != nil { + in, out := &in.KmsKeyId, &out.KmsKeyId + *out = new(string) + **out = **in + } + if in.BootVolumeSizeInGBs != nil { + in, out := &in.BootVolumeSizeInGBs, &out.BootVolumeSizeInGBs + *out = new(int64) + **out = **in + } + if in.BootVolumeVpusPerGB != nil { + in, out := &in.BootVolumeVpusPerGB, &out.BootVolumeVpusPerGB + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSourceViaImageConfig. +func (in *InstanceSourceViaImageConfig) DeepCopy() *InstanceSourceViaImageConfig { + if in == nil { + return nil + } + out := new(InstanceSourceViaImageConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceVnicConfiguration) DeepCopyInto(out *InstanceVnicConfiguration) { + *out = *in + if in.NSGId != nil { + in, out := &in.NSGId, &out.NSGId + *out = new(string) + **out = **in + } + if in.SkipSourceDestCheck != nil { + in, out := &in.SkipSourceDestCheck, &out.SkipSourceDestCheck + *out = new(bool) + **out = **in + } + if in.NsgNames != nil { + in, out := &in.NsgNames, &out.NsgNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.HostnameLabel != nil { + in, out := &in.HostnameLabel, &out.HostnameLabel + *out = new(string) + **out = **in + } + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } + if in.AssignPrivateDnsRecord != nil { + in, out := &in.AssignPrivateDnsRecord, &out.AssignPrivateDnsRecord + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceVnicConfiguration. +func (in *InstanceVnicConfiguration) DeepCopy() *InstanceVnicConfiguration { + if in == nil { + return nil + } + out := new(InstanceVnicConfiguration) + in.DeepCopyInto(out) + 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 + 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 KeyValue. +func (in *KeyValue) DeepCopy() *KeyValue { + if in == nil { + return nil + } + out := new(KeyValue) + 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 *LaunchDetails) DeepCopyInto(out *LaunchDetails) { + *out = *in + if in.Metadata != nil { + in, out := &in.Metadata, &out.Metadata + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchDetails. +func (in *LaunchDetails) DeepCopy() *LaunchDetails { + if in == nil { + return nil + } + out := new(LaunchDetails) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeEvictionNodePoolSettings) DeepCopyInto(out *NodeEvictionNodePoolSettings) { + *out = *in + if in.EvictionGraceDuration != nil { + in, out := &in.EvictionGraceDuration, &out.EvictionGraceDuration + *out = new(string) + **out = **in + } + if in.IsForceDeleteAfterGraceDuration != nil { + in, out := &in.IsForceDeleteAfterGraceDuration, &out.IsForceDeleteAfterGraceDuration + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeEvictionNodePoolSettings. +func (in *NodeEvictionNodePoolSettings) DeepCopy() *NodeEvictionNodePoolSettings { + if in == nil { + return nil + } + out := new(NodeEvictionNodePoolSettings) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodePoolNodeConfig) DeepCopyInto(out *NodePoolNodeConfig) { + *out = *in + if in.IsPvEncryptionInTransitEnabled != nil { + in, out := &in.IsPvEncryptionInTransitEnabled, &out.IsPvEncryptionInTransitEnabled + *out = new(bool) + **out = **in + } + if in.KmsKeyId != nil { + in, out := &in.KmsKeyId, &out.KmsKeyId + *out = new(string) + **out = **in + } + if in.PlacementConfigs != nil { + in, out := &in.PlacementConfigs, &out.PlacementConfigs + *out = make([]PlacementConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.NsgNames != nil { + in, out := &in.NsgNames, &out.NsgNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.NodePoolPodNetworkOptionDetails != nil { + in, out := &in.NodePoolPodNetworkOptionDetails, &out.NodePoolPodNetworkOptionDetails + *out = new(NodePoolPodNetworkOptionDetails) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePoolNodeConfig. +func (in *NodePoolNodeConfig) DeepCopy() *NodePoolNodeConfig { + if in == nil { + return nil + } + out := new(NodePoolNodeConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodePoolPodNetworkOptionDetails) DeepCopyInto(out *NodePoolPodNetworkOptionDetails) { + *out = *in + in.VcnIpNativePodNetworkOptions.DeepCopyInto(&out.VcnIpNativePodNetworkOptions) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePoolPodNetworkOptionDetails. +func (in *NodePoolPodNetworkOptionDetails) DeepCopy() *NodePoolPodNetworkOptionDetails { + if in == nil { + return nil + } + out := new(NodePoolPodNetworkOptionDetails) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeShapeConfig) DeepCopyInto(out *NodeShapeConfig) { + *out = *in + if in.MemoryInGBs != nil { + in, out := &in.MemoryInGBs, &out.MemoryInGBs + *out = new(string) + **out = **in + } + if in.Ocpus != nil { + in, out := &in.Ocpus, &out.Ocpus + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeShapeConfig. +func (in *NodeShapeConfig) DeepCopy() *NodeShapeConfig { + if in == nil { + return nil + } + out := new(NodeShapeConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeSourceViaImage) DeepCopyInto(out *NodeSourceViaImage) { + *out = *in + if in.BootVolumeSizeInGBs != nil { + in, out := &in.BootVolumeSizeInGBs, &out.BootVolumeSizeInGBs + *out = new(int64) + **out = **in + } + if in.ImageId != nil { + in, out := &in.ImageId, &out.ImageId + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSourceViaImage. +func (in *NodeSourceViaImage) DeepCopy() *NodeSourceViaImage { + if in == nil { + return nil + } + out := new(NodeSourceViaImage) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIMachinePool) DeepCopyInto(out *OCIMachinePool) { + *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 OCIMachinePool. +func (in *OCIMachinePool) DeepCopy() *OCIMachinePool { + if in == nil { + return nil + } + out := new(OCIMachinePool) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIMachinePool) 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 *OCIMachinePoolList) DeepCopyInto(out *OCIMachinePoolList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIMachinePool, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIMachinePoolList. +func (in *OCIMachinePoolList) DeepCopy() *OCIMachinePoolList { + if in == nil { + return nil + } + out := new(OCIMachinePoolList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIMachinePoolList) 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 *OCIMachinePoolSpec) DeepCopyInto(out *OCIMachinePoolSpec) { + *out = *in + if in.ProviderID != nil { + in, out := &in.ProviderID, &out.ProviderID + *out = new(string) + **out = **in + } + if in.OCID != nil { + in, out := &in.OCID, &out.OCID + *out = new(string) + **out = **in + } + if in.PlacementDetails != nil { + in, out := &in.PlacementDetails, &out.PlacementDetails + *out = make([]PlacementDetails, len(*in)) + copy(*out, *in) + } + in.InstanceConfiguration.DeepCopyInto(&out.InstanceConfiguration) + if in.ProviderIDList != nil { + in, out := &in.ProviderIDList, &out.ProviderIDList + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIMachinePoolSpec. +func (in *OCIMachinePoolSpec) DeepCopy() *OCIMachinePoolSpec { + if in == nil { + return nil + } + out := new(OCIMachinePoolSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIMachinePoolStatus) DeepCopyInto(out *OCIMachinePoolStatus) { + *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.FailureReason != nil { + in, out := &in.FailureReason, &out.FailureReason + *out = new(errors.MachineStatusError) + **out = **in + } + if in.FailureMessage != nil { + in, out := &in.FailureMessage, &out.FailureMessage + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIMachinePoolStatus. +func (in *OCIMachinePoolStatus) DeepCopy() *OCIMachinePoolStatus { + if in == nil { + return nil + } + out := new(OCIMachinePoolStatus) + in.DeepCopyInto(out) + 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() + } + } +} + +// 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.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 + } +} + +// 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 + 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 OCIManagedMachinePool. +func (in *OCIManagedMachinePool) DeepCopy() *OCIManagedMachinePool { + if in == nil { + return nil + } + out := new(OCIManagedMachinePool) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedMachinePool) 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 *OCIManagedMachinePoolList) DeepCopyInto(out *OCIManagedMachinePoolList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIManagedMachinePool, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedMachinePoolList. +func (in *OCIManagedMachinePoolList) DeepCopy() *OCIManagedMachinePoolList { + if in == nil { + return nil + } + out := new(OCIManagedMachinePoolList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedMachinePoolList) 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 *OCIManagedMachinePoolSpec) DeepCopyInto(out *OCIManagedMachinePoolSpec) { + *out = *in + if in.ProviderID != nil { + in, out := &in.ProviderID, &out.ProviderID + *out = new(string) + **out = **in + } + if in.Version != nil { + in, out := &in.Version, &out.Version + *out = new(string) + **out = **in + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.NodePoolNodeConfig != nil { + in, out := &in.NodePoolNodeConfig, &out.NodePoolNodeConfig + *out = new(NodePoolNodeConfig) + (*in).DeepCopyInto(*out) + } + if in.NodeEvictionNodePoolSettings != nil { + in, out := &in.NodeEvictionNodePoolSettings, &out.NodeEvictionNodePoolSettings + *out = new(NodeEvictionNodePoolSettings) + (*in).DeepCopyInto(*out) + } + if in.NodeShapeConfig != nil { + in, out := &in.NodeShapeConfig, &out.NodeShapeConfig + *out = new(NodeShapeConfig) + (*in).DeepCopyInto(*out) + } + if in.NodeSourceViaImage != nil { + in, out := &in.NodeSourceViaImage, &out.NodeSourceViaImage + *out = new(NodeSourceViaImage) + (*in).DeepCopyInto(*out) + } + if in.NodeMetadata != nil { + in, out := &in.NodeMetadata, &out.NodeMetadata + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.InitialNodeLabels != nil { + in, out := &in.InitialNodeLabels, &out.InitialNodeLabels + *out = make([]KeyValue, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ProviderIDList != nil { + in, out := &in.ProviderIDList, &out.ProviderIDList + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedMachinePoolSpec. +func (in *OCIManagedMachinePoolSpec) DeepCopy() *OCIManagedMachinePoolSpec { + if in == nil { + return nil + } + out := new(OCIManagedMachinePoolSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedMachinePoolStatus) DeepCopyInto(out *OCIManagedMachinePoolStatus) { + *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.FailureReason != nil { + in, out := &in.FailureReason, &out.FailureReason + *out = new(errors.MachineStatusError) + **out = **in + } + if in.FailureMessages != nil { + in, out := &in.FailureMessages, &out.FailureMessages + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedMachinePoolStatus. +func (in *OCIManagedMachinePoolStatus) DeepCopy() *OCIManagedMachinePoolStatus { + if in == nil { + return nil + } + out := new(OCIManagedMachinePoolStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedMachinePoolTemplate) DeepCopyInto(out *OCIManagedMachinePoolTemplate) { + *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 OCIManagedMachinePoolTemplate. +func (in *OCIManagedMachinePoolTemplate) DeepCopy() *OCIManagedMachinePoolTemplate { + if in == nil { + return nil + } + out := new(OCIManagedMachinePoolTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedMachinePoolTemplate) 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 *OCIManagedMachinePoolTemplateList) DeepCopyInto(out *OCIManagedMachinePoolTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OCIManagedMachinePoolTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedMachinePoolTemplateList. +func (in *OCIManagedMachinePoolTemplateList) DeepCopy() *OCIManagedMachinePoolTemplateList { + if in == nil { + return nil + } + out := new(OCIManagedMachinePoolTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OCIManagedMachinePoolTemplateList) 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 *OCIManagedMachinePoolTemplateResource) DeepCopyInto(out *OCIManagedMachinePoolTemplateResource) { + *out = *in + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedMachinePoolTemplateResource. +func (in *OCIManagedMachinePoolTemplateResource) DeepCopy() *OCIManagedMachinePoolTemplateResource { + if in == nil { + return nil + } + out := new(OCIManagedMachinePoolTemplateResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OCIManagedMachinePoolTemplateSpec) DeepCopyInto(out *OCIManagedMachinePoolTemplateSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIManagedMachinePoolTemplateSpec. +func (in *OCIManagedMachinePoolTemplateSpec) DeepCopy() *OCIManagedMachinePoolTemplateSpec { + if in == nil { + return nil + } + out := new(OCIManagedMachinePoolTemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlacementConfig) DeepCopyInto(out *PlacementConfig) { + *out = *in + if in.AvailabilityDomain != nil { + in, out := &in.AvailabilityDomain, &out.AvailabilityDomain + *out = new(string) + **out = **in + } + if in.CapacityReservationId != nil { + in, out := &in.CapacityReservationId, &out.CapacityReservationId + *out = new(string) + **out = **in + } + if in.FaultDomains != nil { + in, out := &in.FaultDomains, &out.FaultDomains + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.SubnetName != nil { + in, out := &in.SubnetName, &out.SubnetName + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementConfig. +func (in *PlacementConfig) DeepCopy() *PlacementConfig { + if in == nil { + return nil + } + out := new(PlacementConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlacementDetails) DeepCopyInto(out *PlacementDetails) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementDetails. +func (in *PlacementDetails) DeepCopy() *PlacementDetails { + if in == nil { + return nil + } + out := new(PlacementDetails) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ShapeConfig) DeepCopyInto(out *ShapeConfig) { + *out = *in + if in.Ocpus != nil { + in, out := &in.Ocpus, &out.Ocpus + *out = new(string) + **out = **in + } + if in.MemoryInGBs != nil { + in, out := &in.MemoryInGBs, &out.MemoryInGBs + *out = new(string) + **out = **in + } + if in.Nvmes != nil { + in, out := &in.Nvmes, &out.Nvmes + *out = new(int) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShapeConfig. +func (in *ShapeConfig) DeepCopy() *ShapeConfig { + if in == nil { + return nil + } + out := new(ShapeConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VcnIpNativePodNetworkOptions) DeepCopyInto(out *VcnIpNativePodNetworkOptions) { + *out = *in + if in.MaxPodsPerNode != nil { + in, out := &in.MaxPodsPerNode, &out.MaxPodsPerNode + *out = new(int) + **out = **in + } + if in.NSGNames != nil { + in, out := &in.NSGNames, &out.NSGNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.SubnetNames != nil { + in, out := &in.SubnetNames, &out.SubnetNames + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VcnIpNativePodNetworkOptions. +func (in *VcnIpNativePodNetworkOptions) DeepCopy() *VcnIpNativePodNetworkOptions { + if in == nil { + return nil + } + out := new(VcnIpNativePodNetworkOptions) + in.DeepCopyInto(out) + return out +} diff --git a/exp/controllers/ocimachinepool_controller.go b/exp/controllers/ocimachinepool_controller.go index f19df82b..41301e3b 100644 --- a/exp/controllers/ocimachinepool_controller.go +++ b/exp/controllers/ocimachinepool_controller.go @@ -22,11 +22,11 @@ import ( "time" "github.com/go-logr/logr" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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" - 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" "github.com/oracle/oci-go-sdk/v65/core" "github.com/pkg/errors" @@ -77,7 +77,7 @@ func (r *OCIMachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Reque logger.Info("Got reconciliation event for machine pool") // Fetch the OCIMachinePool. - ociMachinePool := &infrav1exp.OCIMachinePool{} + ociMachinePool := &infrav2exp.OCIMachinePool{} err := r.Get(ctx, req.NamespacedName, ociMachinePool) if err != nil { if apierrors.IsNotFound(err) { @@ -113,7 +113,7 @@ func (r *OCIMachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Reque return ctrl.Result{}, nil } - ociCluster := &infrastructurev1beta1.OCICluster{} + ociCluster := &infrastructurev1beta2.OCICluster{} ociClusterName := client.ObjectKey{ Namespace: cluster.Namespace, Name: cluster.Name, @@ -169,10 +169,10 @@ func (r *OCIMachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctr logger := log.FromContext(ctx) return ctrl.NewControllerManagedBy(mgr). WithOptions(options). - For(&infrav1exp.OCIMachinePool{}). + For(&infrav2exp.OCIMachinePool{}). Watches( &source.Kind{Type: &expclusterv1.MachinePool{}}, - handler.EnqueueRequestsFromMapFunc(machinePoolToInfrastructureMapFunc(infrav1exp. + handler.EnqueueRequestsFromMapFunc(machinePoolToInfrastructureMapFunc(infrav2exp. GroupVersion.WithKind(scope.OCIMachinePoolKind), logger)), ). WithEventFilter(predicates.ResourceNotPaused(ctrl.LoggerFrom(ctx))). @@ -243,7 +243,7 @@ func (r *OCIMachinePoolReconciler) reconcileNormal(ctx context.Context, logger l } // If the OCIMachinePool doesn't have our finalizer, add it. - controllerutil.AddFinalizer(machinePoolScope.OCIMachinePool, infrav1exp.MachinePoolFinalizer) + controllerutil.AddFinalizer(machinePoolScope.OCIMachinePool, infrav2exp.MachinePoolFinalizer) // Register the finalizer immediately to avoid orphaning OCI resources on delete if err := machinePoolScope.PatchObject(ctx); err != nil { return reconcile.Result{}, err @@ -256,8 +256,8 @@ func (r *OCIMachinePoolReconciler) reconcileNormal(ctx context.Context, logger l // Make sure bootstrap data is available and populated. if machinePoolScope.MachinePool.Spec.Template.Spec.Bootstrap.DataSecretName == nil { - r.Recorder.Event(machinePoolScope.OCIMachinePool, corev1.EventTypeNormal, infrastructurev1beta1.WaitingForBootstrapDataReason, "Bootstrap data secret reference is not yet available") - conditions.MarkFalse(machinePoolScope.OCIMachinePool, infrav1exp.InstancePoolReadyCondition, infrastructurev1beta1.WaitingForBootstrapDataReason, clusterv1.ConditionSeverityInfo, "") + r.Recorder.Event(machinePoolScope.OCIMachinePool, corev1.EventTypeNormal, infrastructurev1beta2.WaitingForBootstrapDataReason, "Bootstrap data secret reference is not yet available") + conditions.MarkFalse(machinePoolScope.OCIMachinePool, infrav2exp.InstancePoolReadyCondition, infrastructurev1beta2.WaitingForBootstrapDataReason, clusterv1.ConditionSeverityInfo, "") logger.Info("Bootstrap data secret reference is not yet available") return reconcile.Result{}, nil } @@ -271,18 +271,18 @@ func (r *OCIMachinePoolReconciler) reconcileNormal(ctx context.Context, logger l } // set the LaunchTemplateReady condition - conditions.MarkTrue(machinePoolScope.OCIMachinePool, infrav1exp.LaunchTemplateReadyCondition) + conditions.MarkTrue(machinePoolScope.OCIMachinePool, infrav2exp.LaunchTemplateReadyCondition) // Find existing Instance Pool instancePool, err := machinePoolScope.FindInstancePool(ctx) if err != nil { - conditions.MarkUnknown(machinePoolScope.OCIMachinePool, infrav1exp.InstancePoolReadyCondition, infrav1exp.InstancePoolNotFoundReason, err.Error()) + conditions.MarkUnknown(machinePoolScope.OCIMachinePool, infrav2exp.InstancePoolReadyCondition, infrav2exp.InstancePoolNotFoundReason, err.Error()) return ctrl.Result{}, err } if instancePool == nil { if _, err := machinePoolScope.CreateInstancePool(ctx); err != nil { - conditions.MarkFalse(machinePoolScope.OCIMachinePool, infrav1exp.InstancePoolReadyCondition, infrav1exp.InstancePoolProvisionFailedReason, clusterv1.ConditionSeverityError, err.Error()) + 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()) @@ -296,11 +296,11 @@ func (r *OCIMachinePoolReconciler) reconcileNormal(ctx context.Context, logger l switch instancePool.LifecycleState { case core.InstancePoolLifecycleStateProvisioning, core.InstancePoolLifecycleStateStarting: machinePoolScope.Info("Instance Pool is pending") - conditions.MarkFalse(machinePoolScope.OCIMachinePool, infrav1exp.InstancePoolReadyCondition, infrav1exp.InstancePoolNotReadyReason, clusterv1.ConditionSeverityInfo, "") + conditions.MarkFalse(machinePoolScope.OCIMachinePool, infrav2exp.InstancePoolReadyCondition, infrav2exp.InstancePoolNotReadyReason, clusterv1.ConditionSeverityInfo, "") return reconcile.Result{RequeueAfter: 10 * time.Second}, nil case core.InstancePoolLifecycleStateScaling: machinePoolScope.Info("Instance Pool is scaling") - conditions.MarkFalse(machinePoolScope.OCIMachinePool, infrav1exp.InstancePoolReadyCondition, infrav1exp.InstancePoolNotReadyReason, clusterv1.ConditionSeverityInfo, "") + conditions.MarkFalse(machinePoolScope.OCIMachinePool, infrav2exp.InstancePoolReadyCondition, infrav2exp.InstancePoolNotReadyReason, clusterv1.ConditionSeverityInfo, "") return reconcile.Result{RequeueAfter: 10 * time.Second}, nil case core.InstancePoolLifecycleStateRunning: machinePoolScope.Info("Instance pool is active") @@ -308,7 +308,7 @@ func (r *OCIMachinePoolReconciler) reconcileNormal(ctx context.Context, logger l // record the event only when pool goes from not ready to ready state r.Recorder.Eventf(machinePoolScope.OCIMachinePool, corev1.EventTypeNormal, "InstancePoolReady", "Instance pool is in ready state") - conditions.MarkTrue(machinePoolScope.OCIMachinePool, infrav1exp.InstancePoolReadyCondition) + conditions.MarkTrue(machinePoolScope.OCIMachinePool, infrav2exp.InstancePoolReadyCondition) instanceCount, err := machinePoolScope.SetListandSetMachinePoolInstances(ctx) if err != nil { @@ -327,7 +327,7 @@ func (r *OCIMachinePoolReconciler) reconcileNormal(ctx context.Context, logger l machinePoolScope.SetReplicaCount(instanceCount) machinePoolScope.SetReady() default: - conditions.MarkFalse(machinePoolScope.OCIMachinePool, infrav1exp.InstancePoolReadyCondition, infrav1exp.InstancePoolProvisionFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(machinePoolScope.OCIMachinePool, infrav2exp.InstancePoolReadyCondition, infrav2exp.InstancePoolProvisionFailedReason, clusterv1.ConditionSeverityError, "") machinePoolScope.SetFailureReason(capierrors.CreateMachineError) machinePoolScope.SetFailureMessage(errors.Errorf("Instance Pool status %q is unexpected", instancePool.LifecycleState)) r.Recorder.Eventf(machinePoolScope.OCIMachinePool, corev1.EventTypeWarning, "ReconcileError", @@ -351,9 +351,9 @@ func (r *OCIMachinePoolReconciler) reconcileDelete(ctx context.Context, machineP if instancePool == nil { machinePoolScope.OCIMachinePool.Status.Ready = false - conditions.MarkFalse(machinePoolScope.OCIMachinePool, infrav1exp.InstancePoolReadyCondition, infrav1exp.InstancePoolNotFoundReason, clusterv1.ConditionSeverityWarning, "") + conditions.MarkFalse(machinePoolScope.OCIMachinePool, infrav2exp.InstancePoolReadyCondition, infrav2exp.InstancePoolNotFoundReason, clusterv1.ConditionSeverityWarning, "") machinePoolScope.Info("Instance Pool may already be deleted", "displayName", instancePool.DisplayName, "id", instancePool.Id) - r.Recorder.Eventf(machinePoolScope.OCIMachinePool, corev1.EventTypeNormal, infrav1exp.InstancePoolNotFoundReason, "Unable to find matching instance pool") + r.Recorder.Eventf(machinePoolScope.OCIMachinePool, corev1.EventTypeNormal, infrav2exp.InstancePoolNotFoundReason, "Unable to find matching instance pool") } else { switch instancePool.LifecycleState { case core.InstancePoolLifecycleStateTerminating: @@ -363,7 +363,7 @@ func (r *OCIMachinePoolReconciler) reconcileDelete(ctx context.Context, machineP case core.InstancePoolLifecycleStateTerminated: // Instance Pool is already deleted machinePoolScope.OCIMachinePool.Status.Ready = false - conditions.MarkFalse(machinePoolScope.OCIMachinePool, infrav1exp.InstancePoolReadyCondition, infrav1exp.InstancePoolDeletionInProgress, clusterv1.ConditionSeverityWarning, "") + conditions.MarkFalse(machinePoolScope.OCIMachinePool, infrav2exp.InstancePoolReadyCondition, infrav2exp.InstancePoolDeletionInProgress, clusterv1.ConditionSeverityWarning, "") r.Recorder.Eventf(machinePoolScope.OCIMachinePool, corev1.EventTypeWarning, "DeletionInProgress", "Instance Pool deletion in progress: %s - %s", instancePool.DisplayName, instancePool.Id) machinePoolScope.Info("Instance Pool is already deleted", "displayName", instancePool.DisplayName, "id", instancePool.Id) default: @@ -398,6 +398,6 @@ func (r *OCIMachinePoolReconciler) reconcileDelete(ctx context.Context, machineP } machinePoolScope.Info("successfully deleted instance pool and Launch Template") // remove finalizer - controllerutil.RemoveFinalizer(machinePoolScope.OCIMachinePool, infrav1exp.MachinePoolFinalizer) + controllerutil.RemoveFinalizer(machinePoolScope.OCIMachinePool, infrav2exp.MachinePoolFinalizer) return ctrl.Result{}, nil } diff --git a/exp/controllers/ocimachinepool_controller_test.go b/exp/controllers/ocimachinepool_controller_test.go index 703f479b..9d42b191 100644 --- a/exp/controllers/ocimachinepool_controller_test.go +++ b/exp/controllers/ocimachinepool_controller_test.go @@ -22,11 +22,11 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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/computemanagement/mock_computemanagement" - 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" "github.com/oracle/oci-go-sdk/v65/core" corev1 "k8s.io/api/core/v1" @@ -138,14 +138,14 @@ func TestMachinePoolReconciliation(t *testing.T) { } } -func getMachinePoolWithNoOwner() *infrav1exp.OCIMachinePool { +func getMachinePoolWithNoOwner() *infrav2exp.OCIMachinePool { ociMachinePool := getOCIMachinePool() ociMachinePool.OwnerReferences = []metav1.OwnerReference{} return ociMachinePool } -func getOCIMachinePool() *infrav1exp.OCIMachinePool { - return &infrav1exp.OCIMachinePool{ +func getOCIMachinePool() *infrav2exp.OCIMachinePool { + return &infrav2exp.OCIMachinePool{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "test", @@ -166,7 +166,7 @@ func getOCIMachinePool() *infrav1exp.OCIMachinePool { }, }, }, - Spec: infrav1exp.OCIMachinePoolSpec{}, + Spec: infrav2exp.OCIMachinePoolSpec{}, } } @@ -175,7 +175,7 @@ func TestReconciliationFunction(t *testing.T) { r OCIMachinePoolReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociMachinePool *infrav1exp.OCIMachinePool + ociMachinePool *infrav2exp.OCIMachinePool ms *scope.MachinePoolScope computeManagementClient *mock_computemanagement.MockClient ) @@ -241,16 +241,16 @@ func TestReconciliationFunction(t *testing.T) { { name: "bootstrap data not ready", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.InstancePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrastructurev1beta1.WaitingForBootstrapDataReason}}, + conditionAssertion: []conditionAssertion{{infrav2exp.InstancePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrastructurev1beta2.WaitingForBootstrapDataReason}}, testSpecificSetup: func(machinePoolScope *scope.MachinePoolScope, computeManagementClient *mock_computemanagement.MockClient) { }, }, { name: "instance pool create", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.LaunchTemplateReadyCondition, corev1.ConditionTrue, "", ""}}, + conditionAssertion: []conditionAssertion{{infrav2exp.LaunchTemplateReadyCondition, corev1.ConditionTrue, "", ""}}, testSpecificSetup: func(machinePoolScope *scope.MachinePoolScope, computeManagementClient *mock_computemanagement.MockClient) { - ms.OCIMachinePool.Spec.InstanceConfiguration = infrav1exp.InstanceConfiguration{ + ms.OCIMachinePool.Spec.InstanceConfiguration = infrav2exp.InstanceConfiguration{ Shape: common.String("test-shape"), InstanceConfigurationId: common.String("test"), } @@ -293,9 +293,9 @@ func TestReconciliationFunction(t *testing.T) { { name: "instance pool running", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.LaunchTemplateReadyCondition, corev1.ConditionTrue, "", ""}, {infrav1exp.InstancePoolReadyCondition, corev1.ConditionTrue, "", ""}}, + conditionAssertion: []conditionAssertion{{infrav2exp.LaunchTemplateReadyCondition, corev1.ConditionTrue, "", ""}, {infrav2exp.InstancePoolReadyCondition, corev1.ConditionTrue, "", ""}}, testSpecificSetup: func(machinePoolScope *scope.MachinePoolScope, computeManagementClient *mock_computemanagement.MockClient) { - ms.OCIMachinePool.Spec.InstanceConfiguration = infrav1exp.InstanceConfiguration{ + ms.OCIMachinePool.Spec.InstanceConfiguration = infrav2exp.InstanceConfiguration{ Shape: common.String("test-shape"), InstanceConfigurationId: common.String("test"), } @@ -348,9 +348,9 @@ func TestReconciliationFunction(t *testing.T) { { name: "instance pool failed", errorExpected: true, - conditionAssertion: []conditionAssertion{{infrav1exp.LaunchTemplateReadyCondition, corev1.ConditionTrue, "", ""}, {infrav1exp.InstancePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrav1exp.InstancePoolProvisionFailedReason}}, + conditionAssertion: []conditionAssertion{{infrav2exp.LaunchTemplateReadyCondition, corev1.ConditionTrue, "", ""}, {infrav2exp.InstancePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrav2exp.InstancePoolProvisionFailedReason}}, testSpecificSetup: func(machinePoolScope *scope.MachinePoolScope, computeManagementClient *mock_computemanagement.MockClient) { - ms.OCIMachinePool.Spec.InstanceConfiguration = infrav1exp.InstanceConfiguration{ + ms.OCIMachinePool.Spec.InstanceConfiguration = infrav2exp.InstanceConfiguration{ Shape: common.String("test-shape"), InstanceConfigurationId: common.String("test"), } @@ -424,7 +424,7 @@ func TestDeleteeconciliationFunction(t *testing.T) { r OCIMachinePoolReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociMachinePool *infrav1exp.OCIMachinePool + ociMachinePool *infrav2exp.OCIMachinePool ms *scope.MachinePoolScope computeManagementClient *mock_computemanagement.MockClient ) @@ -492,7 +492,7 @@ func TestDeleteeconciliationFunction(t *testing.T) { errorExpected: false, conditionAssertion: []conditionAssertion{}, testSpecificSetup: func(machinePoolScope *scope.MachinePoolScope, computeManagementClient *mock_computemanagement.MockClient) { - ms.OCIMachinePool.Spec.InstanceConfiguration = infrav1exp.InstanceConfiguration{ + ms.OCIMachinePool.Spec.InstanceConfiguration = infrav2exp.InstanceConfiguration{ Shape: common.String("test-shape"), InstanceConfigurationId: common.String("test"), } @@ -513,9 +513,9 @@ func TestDeleteeconciliationFunction(t *testing.T) { { name: "instance pool terminated", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.InstancePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav1exp.InstancePoolDeletionInProgress}}, + conditionAssertion: []conditionAssertion{{infrav2exp.InstancePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav2exp.InstancePoolDeletionInProgress}}, testSpecificSetup: func(machinePoolScope *scope.MachinePoolScope, computeManagementClient *mock_computemanagement.MockClient) { - ms.OCIMachinePool.Spec.InstanceConfiguration = infrav1exp.InstanceConfiguration{ + ms.OCIMachinePool.Spec.InstanceConfiguration = infrav2exp.InstanceConfiguration{ Shape: common.String("test-shape"), InstanceConfigurationId: common.String("test"), } @@ -573,7 +573,7 @@ func TestDeleteeconciliationFunction(t *testing.T) { } } -func getOCIClusterWithOwner() *infrastructurev1beta1.OCICluster { +func getOCIClusterWithOwner() *infrastructurev1beta2.OCICluster { ociCluster := getOCIClusterWithNoOwner() ociCluster.OwnerReferences = []metav1.OwnerReference{ { @@ -585,52 +585,52 @@ func getOCIClusterWithOwner() *infrastructurev1beta1.OCICluster { return ociCluster } -func getOCIClusterWithNoOwner() *infrastructurev1beta1.OCICluster { - ociCluster := &infrastructurev1beta1.OCICluster{ +func getOCIClusterWithNoOwner() *infrastructurev1beta2.OCICluster { + ociCluster := &infrastructurev1beta2.OCICluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test", }, - Spec: infrastructurev1beta1.OCIClusterSpec{ + Spec: infrastructurev1beta2.OCIClusterSpec{ CompartmentId: "test-compartment", ControlPlaneEndpoint: clusterv1.APIEndpoint{ Port: 6443, }, OCIResourceIdentifier: "resource_uid", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn-id"), - Subnets: []*infrastructurev1beta1.Subnet{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, ID: common.String("subnet-id"), - Type: infrastructurev1beta1.Private, + Type: infrastructurev1beta2.Private, Name: "worker-subnet", }, { - Role: infrastructurev1beta1.WorkerRole, + Role: infrastructurev1beta2.WorkerRole, ID: common.String("worker-subnet-id"), - Type: infrastructurev1beta1.Private, + Type: infrastructurev1beta2.Private, Name: "worker-subnet", }, }, - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, - ID: common.String("nsg-id"), - Name: "worker-nsg", - }, - { - Role: infrastructurev1beta1.WorkerRole, - ID: common.String("worker-nsg-id"), - Name: "worker-nsg", + NetworkSecurityGroup: infrastructurev1beta2.NetworkSecurityGroup{ + List: []*infrastructurev1beta2.NSG{ + { + Role: infrastructurev1beta2.ControlPlaneEndpointRole, + ID: common.String("nsg-id"), + Name: "worker-nsg", + }, + { + Role: infrastructurev1beta2.WorkerRole, + ID: common.String("worker-nsg-id"), + Name: "worker-nsg", + }, }, }, }, }, - }, - Status: infrastructurev1beta1.OCIClusterStatus{ - AvailabilityDomains: map[string]infrastructurev1beta1.OCIAvailabilityDomain{ + AvailabilityDomains: map[string]infrastructurev1beta2.OCIAvailabilityDomain{ "ad-1": { Name: "ad-1", FaultDomains: []string{"fd-5", "fd-6"}, @@ -642,7 +642,7 @@ func getOCIClusterWithNoOwner() *infrastructurev1beta1.OCICluster { return ociCluster } -func expectMachinePoolConditions(g *WithT, m *infrav1exp.OCIMachinePool, expected []conditionAssertion) { +func expectMachinePoolConditions(g *WithT, m *infrav2exp.OCIMachinePool, 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/controllers/ocimanaged_machinepool_controller.go b/exp/controllers/ocimanaged_machinepool_controller.go index 89e48bb4..a68392ad 100644 --- a/exp/controllers/ocimanaged_machinepool_controller.go +++ b/exp/controllers/ocimanaged_machinepool_controller.go @@ -22,11 +22,11 @@ import ( "time" "github.com/go-logr/logr" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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" - 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" "github.com/pkg/errors" @@ -77,7 +77,7 @@ func (r *OCIManagedMachinePoolReconciler) Reconcile(ctx context.Context, req ctr logger.Info("Got reconciliation event for managedmachine pool") // Fetch the OCIManagedMachinePool. - ociManagedMachinePool := &infrav1exp.OCIManagedMachinePool{} + ociManagedMachinePool := &infrav2exp.OCIManagedMachinePool{} err := r.Get(ctx, req.NamespacedName, ociManagedMachinePool) if err != nil { if apierrors.IsNotFound(err) { @@ -113,7 +113,7 @@ func (r *OCIManagedMachinePoolReconciler) Reconcile(ctx context.Context, req ctr return ctrl.Result{}, nil } - ociManagedCluster := &infrav1exp.OCIManagedCluster{} + ociManagedCluster := &infrav2exp.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 := &infrav1exp.OCIManagedControlPlane{} + controlPlane := &infrav2exp.OCIManagedControlPlane{} controlPlaneRef := types.NamespacedName{ Name: cluster.Spec.ControlPlaneRef.Name, Namespace: cluster.Namespace, @@ -179,21 +179,21 @@ func (r *OCIManagedMachinePoolReconciler) Reconcile(ctx context.Context, req ctr // SetupWithManager sets up the controller with the Manager. func (r *OCIManagedMachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error { logger := log.FromContext(ctx) - gvk, err := apiutil.GVKForObject(new(infrav1exp.OCIManagedMachinePool), mgr.GetScheme()) + gvk, err := apiutil.GVKForObject(new(infrav2exp.OCIManagedMachinePool), mgr.GetScheme()) if err != nil { return errors.Wrapf(err, "failed to find GVK for OCIManagedMachinePool") } managedControlPlaneToManagedMachinePoolMap := managedClusterToManagedMachinePoolMapFunc(r.Client, gvk, logger) return ctrl.NewControllerManagedBy(mgr). WithOptions(options). - For(&infrav1exp.OCIManagedMachinePool{}). + For(&infrav2exp.OCIManagedMachinePool{}). Watches( &source.Kind{Type: &expclusterv1.MachinePool{}}, - handler.EnqueueRequestsFromMapFunc(machinePoolToInfrastructureMapFunc(infrastructurev1beta1. + handler.EnqueueRequestsFromMapFunc(machinePoolToInfrastructureMapFunc(infrastructurev1beta2. GroupVersion.WithKind(scope.OCIManagedMachinePoolKind), logger)), ). Watches( - &source.Kind{Type: &infrav1exp.OCIManagedCluster{}}, + &source.Kind{Type: &infrav2exp.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.(*infrav1exp.OCIManagedCluster) + ociCluster, ok := o.(*infrav2exp.OCIManagedCluster) if !ok { panic(fmt.Sprintf("Expected a OCIManagedControlPlane but got a %T", o)) } @@ -244,7 +244,7 @@ func managedClusterToManagedMachinePoolMapFunc(c client.Client, gvk schema.Group func (r *OCIManagedMachinePoolReconciler) reconcileNormal(ctx context.Context, logger logr.Logger, machinePoolScope *scope.ManagedMachinePoolScope) (ctrl.Result, error) { machinePoolScope.Info("Handling reconcile OCIMachinePool") // If the OCIMachinePool doesn't have our finalizer, add it. - controllerutil.AddFinalizer(machinePoolScope.OCIManagedMachinePool, infrav1exp.ManagedMachinePoolFinalizer) + controllerutil.AddFinalizer(machinePoolScope.OCIManagedMachinePool, infrav2exp.ManagedMachinePoolFinalizer) if !machinePoolScope.Cluster.Status.InfrastructureReady { logger.Info("Cluster infrastructure is not ready yet") @@ -259,13 +259,13 @@ func (r *OCIManagedMachinePoolReconciler) reconcileNormal(ctx context.Context, l // Find existing Node Pool nodePool, err := machinePoolScope.FindNodePool(ctx) if err != nil { - conditions.MarkUnknown(machinePoolScope.OCIManagedMachinePool, infrav1exp.NodePoolReadyCondition, infrav1exp.NodePoolNotFoundReason, err.Error()) + conditions.MarkUnknown(machinePoolScope.OCIManagedMachinePool, infrav2exp.NodePoolReadyCondition, infrav2exp.NodePoolNotFoundReason, err.Error()) return ctrl.Result{}, err } if nodePool == nil { if nodePool, err = machinePoolScope.CreateNodePool(ctx); err != nil { - conditions.MarkFalse(machinePoolScope.OCIManagedMachinePool, infrav1exp.NodePoolReadyCondition, infrav1exp.NodePoolProvisionFailedReason, clusterv1.ConditionSeverityError, err.Error()) + conditions.MarkFalse(machinePoolScope.OCIManagedMachinePool, infrav2exp.NodePoolReadyCondition, infrav2exp.NodePoolProvisionFailedReason, clusterv1.ConditionSeverityError, err.Error()) return ctrl.Result{}, err } // record the event only when node pool is created @@ -290,7 +290,7 @@ func (r *OCIManagedMachinePoolReconciler) reconcileNormal(ctx context.Context, l switch nodePool.LifecycleState { case oke.NodePoolLifecycleStateCreating: machinePoolScope.Info("Node Pool is creating") - conditions.MarkFalse(machinePoolScope.OCIManagedMachinePool, infrav1exp.NodePoolReadyCondition, infrav1exp.NodePoolNotReadyReason, clusterv1.ConditionSeverityInfo, "") + conditions.MarkFalse(machinePoolScope.OCIManagedMachinePool, infrav2exp.NodePoolReadyCondition, infrav2exp.NodePoolNotReadyReason, clusterv1.ConditionSeverityInfo, "") return reconcile.Result{RequeueAfter: 30 * time.Second}, nil case oke.NodePoolLifecycleStateUpdating: machinePoolScope.Info("Node Pool is updating") @@ -306,7 +306,7 @@ func (r *OCIManagedMachinePoolReconciler) reconcileNormal(ctx context.Context, l // record the event only when pool goes from not ready to ready state r.Recorder.Eventf(machinePoolScope.OCIManagedMachinePool, corev1.EventTypeNormal, "NodePoolReady", "Node pool is in ready state") - conditions.MarkTrue(machinePoolScope.OCIManagedMachinePool, infrav1exp.NodePoolReadyCondition) + conditions.MarkTrue(machinePoolScope.OCIManagedMachinePool, infrav2exp.NodePoolReadyCondition) isUpdated, err := machinePoolScope.UpdateNodePool(ctx, nodePool) if err != nil { return reconcile.Result{}, err @@ -319,7 +319,7 @@ func (r *OCIManagedMachinePoolReconciler) reconcileNormal(ctx context.Context, l default: err := errors.Errorf("Node Pool status %s is unexpected", nodePool.LifecycleState) machinePoolScope.OCIManagedMachinePool.Status.FailureMessages = append(machinePoolScope.OCIManagedMachinePool.Status.FailureMessages, err.Error()) - conditions.MarkFalse(machinePoolScope.OCIManagedMachinePool, infrav1exp.NodePoolReadyCondition, infrav1exp.NodePoolProvisionFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(machinePoolScope.OCIManagedMachinePool, infrav2exp.NodePoolReadyCondition, infrav2exp.NodePoolProvisionFailedReason, clusterv1.ConditionSeverityError, "") r.Recorder.Eventf(machinePoolScope.OCIManagedMachinePool, corev1.EventTypeWarning, "ReconcileError", "Node pool has invalid lifecycle state %s, lifecycle details is %s", nodePool.LifecycleState, nodePool.LifecycleDetails) return reconcile.Result{}, err @@ -333,9 +333,9 @@ func (r *OCIManagedMachinePoolReconciler) reconcileDelete(ctx context.Context, m nodePool, err := machinePoolScope.FindNodePool(ctx) if err != nil { if ociutil.IsNotFound(err) { - controllerutil.RemoveFinalizer(machinePoolScope.OCIManagedMachinePool, infrav1exp.ManagedMachinePoolFinalizer) + controllerutil.RemoveFinalizer(machinePoolScope.OCIManagedMachinePool, infrav2exp.ManagedMachinePoolFinalizer) machinePoolScope.Info("Node pool not found, may have been deleted") - conditions.MarkTrue(machinePoolScope.OCIManagedMachinePool, infrav1exp.NodePoolNotFoundReason) + conditions.MarkTrue(machinePoolScope.OCIManagedMachinePool, infrav2exp.NodePoolNotFoundReason) machinePoolScope.OCIManagedMachinePool.Status.Ready = false return reconcile.Result{}, nil } else { @@ -345,8 +345,8 @@ func (r *OCIManagedMachinePoolReconciler) reconcileDelete(ctx context.Context, m if nodePool == nil { machinePoolScope.Info("Node Pool is not found, may have been deleted") - controllerutil.RemoveFinalizer(machinePoolScope.OCIManagedMachinePool, infrav1exp.ManagedMachinePoolFinalizer) - conditions.MarkFalse(machinePool, infrav1exp.NodePoolReadyCondition, infrav1exp.NodePoolDeletedReason, clusterv1.ConditionSeverityWarning, "") + controllerutil.RemoveFinalizer(machinePoolScope.OCIManagedMachinePool, infrav2exp.ManagedMachinePoolFinalizer) + conditions.MarkFalse(machinePool, infrav2exp.NodePoolReadyCondition, infrav2exp.NodePoolDeletedReason, clusterv1.ConditionSeverityWarning, "") return reconcile.Result{}, nil } @@ -355,13 +355,13 @@ func (r *OCIManagedMachinePoolReconciler) reconcileDelete(ctx context.Context, m case oke.NodePoolLifecycleStateDeleting: // Node Pool is already deleting machinePool.Status.Ready = false - conditions.MarkFalse(machinePool, infrav1exp.NodePoolReadyCondition, infrav1exp.NodePoolDeletionInProgress, clusterv1.ConditionSeverityWarning, "") + conditions.MarkFalse(machinePool, infrav2exp.NodePoolReadyCondition, infrav2exp.NodePoolDeletionInProgress, clusterv1.ConditionSeverityWarning, "") r.Recorder.Eventf(machinePool, corev1.EventTypeWarning, "DeletionInProgress", "Node Pool deletion in progress") machinePoolScope.Info("Node Pool is deleting") return reconcile.Result{RequeueAfter: 30 * time.Second}, nil case oke.NodePoolLifecycleStateDeleted: - controllerutil.RemoveFinalizer(machinePoolScope.OCIManagedMachinePool, infrav1exp.ManagedMachinePoolFinalizer) - conditions.MarkFalse(machinePool, infrav1exp.NodePoolReadyCondition, infrav1exp.NodePoolDeletedReason, clusterv1.ConditionSeverityWarning, "") + controllerutil.RemoveFinalizer(machinePoolScope.OCIManagedMachinePool, infrav2exp.ManagedMachinePoolFinalizer) + conditions.MarkFalse(machinePool, infrav2exp.NodePoolReadyCondition, infrav2exp.NodePoolDeletedReason, clusterv1.ConditionSeverityWarning, "") machinePoolScope.Info("Node Pool is already deleted") return reconcile.Result{}, nil default: @@ -371,7 +371,7 @@ func (r *OCIManagedMachinePoolReconciler) reconcileDelete(ctx context.Context, m return ctrl.Result{}, err } else { machinePoolScope.OCIManagedMachinePool.Status.Ready = false - conditions.MarkFalse(machinePoolScope.OCIManagedMachinePool, infrav1exp.NodePoolReadyCondition, infrav1exp.NodePoolDeletionInProgress, clusterv1.ConditionSeverityWarning, "") + conditions.MarkFalse(machinePoolScope.OCIManagedMachinePool, infrav2exp.NodePoolReadyCondition, infrav2exp.NodePoolDeletionInProgress, clusterv1.ConditionSeverityWarning, "") return reconcile.Result{RequeueAfter: 30 * time.Second}, nil } } diff --git a/exp/controllers/ocimanaged_machinepool_controller_test.go b/exp/controllers/ocimanaged_machinepool_controller_test.go index 3558aaee..d2197efe 100644 --- a/exp/controllers/ocimanaged_machinepool_controller_test.go +++ b/exp/controllers/ocimanaged_machinepool_controller_test.go @@ -25,7 +25,7 @@ import ( "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" - 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" corev1 "k8s.io/api/core/v1" @@ -142,7 +142,7 @@ func TestNormalReconciliationFunction(t *testing.T) { r OCIManagedMachinePoolReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociManagedMachinePool *infrav1exp.OCIManagedMachinePool + ociManagedMachinePool *infrav2exp.OCIManagedMachinePool okeClient *mock_containerengine.MockClient ms *scope.ManagedMachinePoolScope ) @@ -159,11 +159,11 @@ func TestNormalReconciliationFunction(t *testing.T) { machinePool := getMachinePool() ociManagedMachinePool = getOCIManagedMachinePool() ociCluster := getOCIManagedClusterWithOwner() - ociManagedControlPlane := infrav1exp.OCIManagedControlPlane{ - Spec: infrav1exp.OCIManagedControlPlaneSpec{ + ociManagedControlPlane := infrav2exp.OCIManagedControlPlane{ + Spec: infrav2exp.OCIManagedControlPlaneSpec{ ID: common.String("cluster-id"), }, - Status: infrav1exp.OCIManagedControlPlaneStatus{ + Status: infrav2exp.OCIManagedControlPlaneStatus{ Ready: true, }, } @@ -200,7 +200,7 @@ func TestNormalReconciliationFunction(t *testing.T) { { name: "node pool in creating state", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.NodePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrav1exp.NodePoolNotReadyReason}}, + conditionAssertion: []conditionAssertion{{infrav2exp.NodePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrav2exp.NodePoolNotReadyReason}}, testSpecificSetup: func(machinePoolScope *scope.ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetNodePool(gomock.Any(), gomock.Eq(oke.GetNodePoolRequest{ NodePoolId: common.String("test"), @@ -218,7 +218,7 @@ func TestNormalReconciliationFunction(t *testing.T) { name: "node pool create", errorExpected: false, expectedEvent: "Created new Node Pool: test", - conditionAssertion: []conditionAssertion{{infrav1exp.NodePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrav1exp.NodePoolNotReadyReason}}, + conditionAssertion: []conditionAssertion{{infrav2exp.NodePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrav2exp.NodePoolNotReadyReason}}, testSpecificSetup: func(machinePoolScope *scope.ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { ociManagedMachinePool.Spec.ID = nil okeClient.EXPECT().ListNodePools(gomock.Any(), gomock.Any()). @@ -247,7 +247,7 @@ func TestNormalReconciliationFunction(t *testing.T) { { name: "node pool is created, no update", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.NodePoolReadyCondition, corev1.ConditionTrue, "", ""}}, + conditionAssertion: []conditionAssertion{{infrav2exp.NodePoolReadyCondition, corev1.ConditionTrue, "", ""}}, testSpecificSetup: func(machinePoolScope *scope.ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetNodePool(gomock.Any(), gomock.Eq(oke.GetNodePoolRequest{ NodePoolId: common.String("test"), @@ -306,7 +306,7 @@ func TestNormalReconciliationFunction(t *testing.T) { { name: "node pool in created, pdate", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.NodePoolReadyCondition, corev1.ConditionTrue, "", ""}}, + conditionAssertion: []conditionAssertion{{infrav2exp.NodePoolReadyCondition, corev1.ConditionTrue, "", ""}}, testSpecificSetup: func(machinePoolScope *scope.ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetNodePool(gomock.Any(), gomock.Eq(oke.GetNodePoolRequest{ NodePoolId: common.String("test"), @@ -368,7 +368,7 @@ func TestNormalReconciliationFunction(t *testing.T) { name: "node pool in error state", errorExpected: true, expectedFailureMessages: []string{"test error!", "Node Pool status FAILED is unexpected"}, - conditionAssertion: []conditionAssertion{{infrav1exp.NodePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrav1exp.NodePoolProvisionFailedReason}}, + conditionAssertion: []conditionAssertion{{infrav2exp.NodePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrav2exp.NodePoolProvisionFailedReason}}, testSpecificSetup: func(machinePoolScope *scope.ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetNodePool(gomock.Any(), gomock.Eq(oke.GetNodePoolRequest{ NodePoolId: common.String("test"), @@ -438,7 +438,7 @@ func TestDeletionFunction(t *testing.T) { r OCIManagedMachinePoolReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociManagedMachinePool *infrav1exp.OCIManagedMachinePool + ociManagedMachinePool *infrav2exp.OCIManagedMachinePool okeClient *mock_containerengine.MockClient ms *scope.ManagedMachinePoolScope ) @@ -455,11 +455,11 @@ func TestDeletionFunction(t *testing.T) { machinePool := getMachinePool() ociManagedMachinePool = getOCIManagedMachinePool() ociCluster := getOCIManagedClusterWithOwner() - ociManagedControlPlane := infrav1exp.OCIManagedControlPlane{ - Spec: infrav1exp.OCIManagedControlPlaneSpec{ + ociManagedControlPlane := infrav2exp.OCIManagedControlPlane{ + Spec: infrav2exp.OCIManagedControlPlaneSpec{ ID: common.String("cluster-id"), }, - Status: infrav1exp.OCIManagedControlPlaneStatus{ + Status: infrav2exp.OCIManagedControlPlaneStatus{ Ready: true, }, } @@ -496,7 +496,7 @@ func TestDeletionFunction(t *testing.T) { { name: "node pool to be deleted", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.NodePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav1exp.NodePoolDeletionInProgress}}, + conditionAssertion: []conditionAssertion{{infrav2exp.NodePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav2exp.NodePoolDeletionInProgress}}, testSpecificSetup: func(machinePoolScope *scope.ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetNodePool(gomock.Any(), gomock.Eq(oke.GetNodePoolRequest{ NodePoolId: common.String("test"), @@ -517,7 +517,7 @@ func TestDeletionFunction(t *testing.T) { { name: "node pool not found", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.NodePoolNotFoundReason, corev1.ConditionTrue, "", ""}}, + conditionAssertion: []conditionAssertion{{infrav2exp.NodePoolNotFoundReason, corev1.ConditionTrue, "", ""}}, testSpecificSetup: func(machinePoolScope *scope.ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetNodePool(gomock.Any(), gomock.Eq(oke.GetNodePoolRequest{ NodePoolId: common.String("test"), @@ -528,7 +528,7 @@ func TestDeletionFunction(t *testing.T) { { name: "node pool ", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.NodePoolNotFoundReason, corev1.ConditionTrue, "", ""}}, + conditionAssertion: []conditionAssertion{{infrav2exp.NodePoolNotFoundReason, corev1.ConditionTrue, "", ""}}, testSpecificSetup: func(machinePoolScope *scope.ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetNodePool(gomock.Any(), gomock.Eq(oke.GetNodePoolRequest{ NodePoolId: common.String("test"), @@ -539,7 +539,7 @@ func TestDeletionFunction(t *testing.T) { { name: "node pool deleting", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.NodePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav1exp.NodePoolDeletionInProgress}}, + conditionAssertion: []conditionAssertion{{infrav2exp.NodePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav2exp.NodePoolDeletionInProgress}}, testSpecificSetup: func(machinePoolScope *scope.ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetNodePool(gomock.Any(), gomock.Eq(oke.GetNodePoolRequest{ NodePoolId: common.String("test"), @@ -556,7 +556,7 @@ func TestDeletionFunction(t *testing.T) { { name: "node pool deleted", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.NodePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav1exp.NodePoolDeletedReason}}, + conditionAssertion: []conditionAssertion{{infrav2exp.NodePoolReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav2exp.NodePoolDeletedReason}}, testSpecificSetup: func(machinePoolScope *scope.ManagedMachinePoolScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetNodePool(gomock.Any(), gomock.Eq(oke.GetNodePoolRequest{ NodePoolId: common.String("test"), @@ -598,14 +598,14 @@ func TestDeletionFunction(t *testing.T) { } } -func getOCIManagedMachinePoolWithNoOwner() *infrav1exp.OCIManagedMachinePool { +func getOCIManagedMachinePoolWithNoOwner() *infrav2exp.OCIManagedMachinePool { ociMachine := getOCIManagedMachinePool() ociMachine.OwnerReferences = []metav1.OwnerReference{} return ociMachine } -func getOCIManagedMachinePool() *infrav1exp.OCIManagedMachinePool { - return &infrav1exp.OCIManagedMachinePool{ +func getOCIManagedMachinePool() *infrav2exp.OCIManagedMachinePool { + return &infrav2exp.OCIManagedMachinePool{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "test", @@ -626,25 +626,25 @@ func getOCIManagedMachinePool() *infrav1exp.OCIManagedMachinePool { }, }, }, - Spec: infrav1exp.OCIManagedMachinePoolSpec{ + Spec: infrav2exp.OCIManagedMachinePoolSpec{ ID: common.String("test"), NodeMetadata: map[string]string{"key1": "value1"}, - InitialNodeLabels: []infrav1exp.KeyValue{{ + InitialNodeLabels: []infrav2exp.KeyValue{{ Key: common.String("key"), Value: common.String("value"), }}, Version: common.String("v1.24.5"), NodeShape: "test-shape", - NodeShapeConfig: &infrav1exp.NodeShapeConfig{ + NodeShapeConfig: &infrav2exp.NodeShapeConfig{ Ocpus: common.String("2"), MemoryInGBs: common.String("16"), }, - NodeSourceViaImage: &infrav1exp.NodeSourceViaImage{ + NodeSourceViaImage: &infrav2exp.NodeSourceViaImage{ ImageId: common.String("test-image-id"), }, SshPublicKey: "test-ssh-public-key", - NodePoolNodeConfig: &infrav1exp.NodePoolNodeConfig{ - PlacementConfigs: []infrav1exp.PlacementConfig{ + NodePoolNodeConfig: &infrav2exp.NodePoolNodeConfig{ + PlacementConfigs: []infrav2exp.PlacementConfig{ { AvailabilityDomain: common.String("test-ad"), SubnetName: common.String("worker-subnet"), @@ -655,16 +655,16 @@ func getOCIManagedMachinePool() *infrav1exp.OCIManagedMachinePool { NsgNames: []string{"worker-nsg"}, KmsKeyId: common.String("kms-key-id"), IsPvEncryptionInTransitEnabled: common.Bool(true), - NodePoolPodNetworkOptionDetails: &infrav1exp.NodePoolPodNetworkOptionDetails{ - CniType: infrav1exp.VCNNativeCNI, - VcnIpNativePodNetworkOptions: infrav1exp.VcnIpNativePodNetworkOptions{ + NodePoolPodNetworkOptionDetails: &infrav2exp.NodePoolPodNetworkOptionDetails{ + CniType: infrav2exp.VCNNativeCNI, + VcnIpNativePodNetworkOptions: infrav2exp.VcnIpNativePodNetworkOptions{ SubnetNames: []string{"pod-subnet"}, MaxPodsPerNode: common.Int(31), NSGNames: []string{"pod-nsg"}, }, }, }, - NodeEvictionNodePoolSettings: &infrav1exp.NodeEvictionNodePoolSettings{ + NodeEvictionNodePoolSettings: &infrav2exp.NodeEvictionNodePoolSettings{ EvictionGraceDuration: common.String("PT30M"), IsForceDeleteAfterGraceDuration: common.Bool(true), }, @@ -711,7 +711,7 @@ func getPausedCluster() *clusterv1.Cluster { return cluster } -func expectConditions(g *WithT, m *infrav1exp.OCIManagedMachinePool, expected []conditionAssertion) { +func expectConditions(g *WithT, m *infrav2exp.OCIManagedMachinePool, 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/controllers/ocimanagedcluster_controller.go b/exp/controllers/ocimanagedcluster_controller.go index 824c8769..01128e24 100644 --- a/exp/controllers/ocimanagedcluster_controller.go +++ b/exp/controllers/ocimanagedcluster_controller.go @@ -22,10 +22,10 @@ import ( "strings" "github.com/go-logr/logr" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + 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" - infrav1exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1" + 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 +73,7 @@ func (r *OCIManagedClusterReconciler) Reconcile(ctx context.Context, req ctrl.Re logger.Info("Inside cluster reconciler") // Fetch the OCIManagedCluster instance - ociCluster := &infrav1exp.OCIManagedCluster{} + ociCluster := &infrav2exp.OCIManagedCluster{} err := r.Get(ctx, req.NamespacedName, ociCluster) if err != nil { if apierrors.IsNotFound(err) { @@ -163,7 +163,7 @@ func (r *OCIManagedClusterReconciler) Reconcile(ctx context.Context, req ctrl.Re } -func (r *OCIManagedClusterReconciler) reconcileComponent(ctx context.Context, cluster *infrav1exp.OCIManagedCluster, +func (r *OCIManagedClusterReconciler) reconcileComponent(ctx context.Context, cluster *infrav2exp.OCIManagedCluster, reconciler func(context.Context) error, componentName string, failReason string, readyEventtype string) error { @@ -171,7 +171,7 @@ func (r *OCIManagedClusterReconciler) reconcileComponent(ctx context.Context, cl if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, fmt.Sprintf("failed to reconcile %s", componentName)).Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, failReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, failReason, clusterv1.ConditionSeverityError, "") return errors.Wrapf(err, "failed to reconcile %s for OCIManagedCluster %s/%s", componentName, cluster.Namespace, cluster.Name) } @@ -183,11 +183,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 *infrav1exp.OCIManagedCluster, cluster *clusterv1.Cluster) (ctrl.Result, error) { +func (r *OCIManagedClusterReconciler) reconcile(ctx context.Context, logger logr.Logger, clusterScope scope.ClusterScopeClient, ociManagedCluster *infrav2exp.OCIManagedCluster, cluster *clusterv1.Cluster) (ctrl.Result, error) { // If the OCIManagedCluster doesn't have our finalizer, add it. - controllerutil.AddFinalizer(ociManagedCluster, infrav1exp.ManagedClusterFinalizer) + controllerutil.AddFinalizer(ociManagedCluster, infrav2exp.ManagedClusterFinalizer) - controlPlane := &infrav1exp.OCIManagedControlPlane{} + controlPlane := &infrav2exp.OCIManagedControlPlane{} controlPlaneRef := types.NamespacedName{ Name: cluster.Spec.ControlPlaneRef.Name, Namespace: cluster.Namespace, @@ -208,52 +208,52 @@ func (r *OCIManagedClusterReconciler) reconcile(ctx context.Context, logger logr } if err := r.reconcileComponent(ctx, ociManagedCluster, clusterScope.ReconcileDRG, "DRG", - infrastructurev1beta1.DrgReconciliationFailedReason, infrastructurev1beta1.DrgEventReady); err != nil { + infrastructurev1beta2.DrgReconciliationFailedReason, infrastructurev1beta2.DrgEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, ociManagedCluster, clusterScope.ReconcileVCN, "VCN", - infrastructurev1beta1.VcnReconciliationFailedReason, infrastructurev1beta1.VcnEventReady); err != nil { + infrastructurev1beta2.VcnReconciliationFailedReason, infrastructurev1beta2.VcnEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, ociManagedCluster, clusterScope.ReconcileInternetGateway, "Internet Gateway", - infrastructurev1beta1.InternetGatewayReconciliationFailedReason, infrastructurev1beta1.InternetGatewayEventReady); err != nil { + infrastructurev1beta2.InternetGatewayReconciliationFailedReason, infrastructurev1beta2.InternetGatewayEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, ociManagedCluster, clusterScope.ReconcileNatGateway, "NAT Gateway", - infrastructurev1beta1.NatGatewayReconciliationFailedReason, infrastructurev1beta1.NatEventReady); err != nil { + infrastructurev1beta2.NatGatewayReconciliationFailedReason, infrastructurev1beta2.NatEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, ociManagedCluster, clusterScope.ReconcileServiceGateway, "Service Gateway", - infrastructurev1beta1.ServiceGatewayReconciliationFailedReason, infrastructurev1beta1.ServiceGatewayEventReady); err != nil { + infrastructurev1beta2.ServiceGatewayReconciliationFailedReason, infrastructurev1beta2.ServiceGatewayEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, ociManagedCluster, clusterScope.ReconcileNSG, "Network Security Group", - infrastructurev1beta1.NSGReconciliationFailedReason, infrastructurev1beta1.NetworkSecurityEventReady); err != nil { + infrastructurev1beta2.NSGReconciliationFailedReason, infrastructurev1beta2.NetworkSecurityEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, ociManagedCluster, clusterScope.ReconcileRouteTable, "Route Table", - infrastructurev1beta1.RouteTableReconciliationFailedReason, infrastructurev1beta1.RouteTableEventReady); err != nil { + infrastructurev1beta2.RouteTableReconciliationFailedReason, infrastructurev1beta2.RouteTableEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, ociManagedCluster, clusterScope.ReconcileSubnet, "Subnet", - infrastructurev1beta1.SubnetReconciliationFailedReason, infrastructurev1beta1.SubnetEventReady); err != nil { + infrastructurev1beta2.SubnetReconciliationFailedReason, infrastructurev1beta2.SubnetEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, ociManagedCluster, clusterScope.ReconcileDRGVCNAttachment, "DRGVCNAttachment", - infrastructurev1beta1.DRGVCNAttachmentReconciliationFailedReason, infrastructurev1beta1.DRGVCNAttachmentEventReady); err != nil { + infrastructurev1beta2.DRGVCNAttachmentReconciliationFailedReason, infrastructurev1beta2.DRGVCNAttachmentEventReady); err != nil { return ctrl.Result{}, err } if err := r.reconcileComponent(ctx, ociManagedCluster, clusterScope.ReconcileDRGRPCAttachment, "DRGRPCAttachment", - infrastructurev1beta1.DRGRPCAttachmentReconciliationFailedReason, infrastructurev1beta1.DRGRPCAttachmentEventReady); err != nil { + infrastructurev1beta2.DRGRPCAttachmentReconciliationFailedReason, infrastructurev1beta2.DRGRPCAttachmentEventReady); err != nil { return ctrl.Result{}, err } } else { @@ -261,11 +261,11 @@ func (r *OCIManagedClusterReconciler) reconcile(ctx context.Context, logger logr } if err := r.reconcileComponent(ctx, ociManagedCluster, clusterScope.ReconcileFailureDomains, "Failure Domain", - infrastructurev1beta1.FailureDomainFailedReason, infrastructurev1beta1.FailureDomainEventReady); err != nil { + infrastructurev1beta2.FailureDomainFailedReason, infrastructurev1beta2.FailureDomainEventReady); err != nil { return ctrl.Result{}, err } - conditions.MarkTrue(ociManagedCluster, infrastructurev1beta1.ClusterReadyCondition) + conditions.MarkTrue(ociManagedCluster, infrastructurev1beta2.ClusterReadyCondition) ociManagedCluster.Status.Ready = true if controlPlane.Status.Ready { ociManagedCluster.Spec.ControlPlaneEndpoint = controlPlane.Spec.ControlPlaneEndpoint @@ -279,11 +279,11 @@ func (r *OCIManagedClusterReconciler) SetupWithManager(ctx context.Context, mgr ociManagedControlPlaneMapper, err := OCIManagedControlPlaneToOCIManagedClusterMapper(ctx, r.Client, log) c, err := ctrl.NewControllerManagedBy(mgr). WithOptions(options). - For(&infrav1exp.OCIManagedCluster{}). + For(&infrav2exp.OCIManagedCluster{}). WithEventFilter(predicates.ResourceNotPaused(log)). // don't queue reconcile if resource is paused // watch OCIManagedControlPlane resources Watches( - &source.Kind{Type: &infrav1exp.OCIManagedControlPlane{}}, + &source.Kind{Type: &infrav2exp.OCIManagedControlPlane{}}, handler.EnqueueRequestsFromMapFunc(ociManagedControlPlaneMapper), ). Build(r) @@ -324,7 +324,7 @@ func (r *OCIManagedClusterReconciler) clusterToInfrastructureMapFunc(ctx context return nil } - ociCluster := &infrav1exp.OCIManagedCluster{} + ociCluster := &infrav2exp.OCIManagedCluster{} key := types.NamespacedName{Namespace: c.Spec.InfrastructureRef.Namespace, Name: c.Spec.InfrastructureRef.Name} if err := r.Get(ctx, key, ociCluster); err != nil { @@ -350,98 +350,98 @@ func (r *OCIManagedClusterReconciler) clusterToInfrastructureMapFunc(ctx context } } -func (r *OCIManagedClusterReconciler) reconcileDelete(ctx context.Context, logger logr.Logger, clusterScope scope.ClusterScopeClient, cluster *infrav1exp.OCIManagedCluster) (ctrl.Result, error) { +func (r *OCIManagedClusterReconciler) reconcileDelete(ctx context.Context, logger logr.Logger, clusterScope scope.ClusterScopeClient, cluster *infrav2exp.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 { err := clusterScope.DeleteDRGRPCAttachment(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete DRG RPC attachment").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.DRGRPCAttachmentReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.DRGRPCAttachmentReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete DRG RPC Attachment for OCIManagedCluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteDRGVCNAttachment(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete DRG VCN attachment").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.DRGVCNAttachmentReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.DRGVCNAttachmentReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete DRG VCN Attachment for OCIManagedCluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteNSGs(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete Network Security Group").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.NSGReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.NSGReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete Network Security Groups for OCIManagedCluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteSubnets(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete Subnet").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.SubnetReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.SubnetReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete subnet for OCIManagedCluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteRouteTables(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete Route Table").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.RouteTableReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.RouteTableReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete RouteTables for OCIManagedCluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteSecurityLists(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete Security Lists").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.SecurityListReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.SecurityListReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete SecurityLists for OCIManagedCluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteServiceGateway(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete Service Gateway").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.ServiceGatewayReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.ServiceGatewayReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete ServiceGateway for OCIManagedCluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteNatGateway(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete NAT Gateway").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.NatGatewayReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.NatGatewayReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete NatGateway for OCIManagedCluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteInternetGateway(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete Internet Gateway").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.InternetGatewayReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.InternetGatewayReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete InternetGateway for OCIManagedCluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteVCN(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete VCN").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.VcnReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.VcnReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete VCN for OCIManagedCluster %s/%s", cluster.Namespace, cluster.Name) } err = clusterScope.DeleteDRG(ctx) if err != nil { r.Recorder.Event(cluster, corev1.EventTypeWarning, "ReconcileError", errors.Wrapf(err, "failed to delete DRG").Error()) - conditions.MarkFalse(cluster, infrastructurev1beta1.ClusterReadyCondition, infrastructurev1beta1.DrgReconciliationFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(cluster, infrastructurev1beta2.ClusterReadyCondition, infrastructurev1beta2.DrgReconciliationFailedReason, clusterv1.ConditionSeverityError, "") return ctrl.Result{}, errors.Wrapf(err, "failed to delete DRG for OCIManagedCluster %s/%s", cluster.Namespace, cluster.Name) } } else { logger.Info("VCN Reconciliation is skipped, none of the VCN related resources will be deleted") } - controllerutil.RemoveFinalizer(cluster, infrav1exp.ManagedClusterFinalizer) + controllerutil.RemoveFinalizer(cluster, infrav2exp.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.(*infrav1exp.OCIManagedControlPlane) + ociManagedControlPlane, ok := o.(*infrav2exp.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/exp/controllers/ocimanagedcluster_controller_test.go index 50ea8856..b34f2963 100644 --- a/exp/controllers/ocimanagedcluster_controller_test.go +++ b/exp/controllers/ocimanagedcluster_controller_test.go @@ -22,9 +22,9 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/gomega" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" mock_scope "github.com/oracle/cluster-api-provider-oci/cloud/scope/mocks" - 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" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" @@ -115,7 +115,7 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { r OCIManagedClusterReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociCluster *infrav1exp.OCIManagedCluster + ociCluster *infrav2exp.OCIManagedCluster cluster *clusterv1.Cluster cs *mock_scope.MockClusterScopeClient ) @@ -123,11 +123,11 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { setup := func(t *testing.T, g *WithT) { mockCtrl = gomock.NewController(t) cs = mock_scope.NewMockClusterScopeClient(mockCtrl) - ociCluster = &infrav1exp.OCIManagedCluster{ + ociCluster = &infrav2exp.OCIManagedCluster{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{}, - Spec: infrav1exp.OCIManagedClusterSpec{}, - Status: infrav1exp.OCIManagedClusterStatus{}, + Spec: infrav2exp.OCIManagedClusterSpec{}, + Status: infrav2exp.OCIManagedClusterStatus{}, } cluster = &clusterv1.Cluster{ ObjectMeta: metav1.ObjectMeta{ @@ -141,7 +141,7 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { Paused: true, }, } - controlPlane := infrav1exp.OCIManagedControlPlane{ + controlPlane := infrav2exp.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "test", @@ -166,13 +166,13 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { expectedEvent string eventNotExpected string conditionAssertion conditionAssertion - testSpecificSetup func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) + testSpecificSetup func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) }{ { name: "all success", - expectedEvent: infrastructurev1beta1.DRGRPCAttachmentEventReady, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionTrue, "", ""}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + expectedEvent: infrastructurev1beta2.DRGRPCAttachmentEventReady, + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionTrue, "", ""}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -190,10 +190,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "drg reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.DrgEventReady, + eventNotExpected: infrastructurev1beta2.DrgEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.DrgReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DrgReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(errors.New("some error")) }, @@ -201,10 +201,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "vcn reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.VcnEventReady, + eventNotExpected: infrastructurev1beta2.VcnEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.VcnReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.VcnReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.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")) @@ -213,10 +213,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "internet gateway reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.InternetGatewayEventReady, + eventNotExpected: infrastructurev1beta2.InternetGatewayEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.InternetGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.InternetGatewayReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -226,10 +226,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "nat gateway reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.NatEventReady, + eventNotExpected: infrastructurev1beta2.NatEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.NatGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.NatGatewayReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -240,10 +240,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "service gateway reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.ServiceGatewayEventReady, + eventNotExpected: infrastructurev1beta2.ServiceGatewayEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.ServiceGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.ServiceGatewayReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -255,10 +255,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "nsg reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.NetworkSecurityEventReady, + eventNotExpected: infrastructurev1beta2.NetworkSecurityEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.NSGReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.NSGReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -271,10 +271,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "route table reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.RouteTableEventReady, + eventNotExpected: infrastructurev1beta2.RouteTableEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.RouteTableReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.RouteTableReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -288,10 +288,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "subnet reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.SubnetEventReady, + eventNotExpected: infrastructurev1beta2.SubnetEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.SubnetReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.SubnetReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -306,10 +306,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "failure domain reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.FailureDomainEventReady, + eventNotExpected: infrastructurev1beta2.FailureDomainEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.FailureDomainFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.FailureDomainFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -327,10 +327,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "drg vcn attachment reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.DRGVCNAttachmentEventReady, + eventNotExpected: infrastructurev1beta2.DRGVCNAttachmentEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.DRGVCNAttachmentReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DRGVCNAttachmentReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -346,10 +346,10 @@ func TestOCIClusterReconciler_reconcile(t *testing.T) { { name: "drg rpc attachment reconciliation failure", expectedEvent: "ReconcileError", - eventNotExpected: infrastructurev1beta1.DRGRPCAttachmentEventReady, + eventNotExpected: infrastructurev1beta2.DRGRPCAttachmentEventReady, errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.DRGRPCAttachmentReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DRGRPCAttachmentReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().SetRegionCode(context.Background()).Return(nil) cs.EXPECT().ReconcileDRG(context.Background()).Return(nil) cs.EXPECT().ReconcileVCN(context.Background()).Return(nil) @@ -400,18 +400,18 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { r OCIManagedClusterReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociCluster *infrav1exp.OCIManagedCluster + ociCluster *infrav2exp.OCIManagedCluster cs *mock_scope.MockClusterScopeClient ) setup := func(t *testing.T, g *WithT) { mockCtrl = gomock.NewController(t) cs = mock_scope.NewMockClusterScopeClient(mockCtrl) - ociCluster = &infrav1exp.OCIManagedCluster{ + ociCluster = &infrav2exp.OCIManagedCluster{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{}, - Spec: infrav1exp.OCIManagedClusterSpec{}, - Status: infrav1exp.OCIManagedClusterStatus{}, + Spec: infrav2exp.OCIManagedClusterSpec{}, + Status: infrav2exp.OCIManagedClusterStatus{}, } recorder = record.NewFakeRecorder(10) client := fake.NewClientBuilder().WithObjects(getSecret()).Build() @@ -430,11 +430,11 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { errorExpected bool expectedEvent string conditionAssertion conditionAssertion - testSpecificSetup func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) + testSpecificSetup func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) }{ { name: "all success", - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -452,8 +452,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "drg rpc delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.DRGRPCAttachmentReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DRGRPCAttachmentReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(errors.New("some error")) }, }, @@ -461,8 +461,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "drg vcn attachment delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.DRGVCNAttachmentReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DRGVCNAttachmentReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(errors.New("some error")) }, @@ -471,8 +471,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "nsg delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.NSGReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.NSGReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.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")) @@ -482,8 +482,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "subnet delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.SubnetReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.SubnetReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -494,8 +494,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "route table delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.RouteTableReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.RouteTableReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -507,8 +507,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "security list delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.SecurityListReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.SecurityListReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -521,8 +521,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "service gateway delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.ServiceGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.ServiceGatewayReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -536,8 +536,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "nat gateway delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.NatGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.NatGatewayReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -552,8 +552,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "internet gateway delete failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.InternetGatewayReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.InternetGatewayReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -569,8 +569,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "delete vcn failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.VcnReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.VcnReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -587,8 +587,8 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { name: "delete drg failure", expectedEvent: "ReconcileError", errorExpected: true, - conditionAssertion: conditionAssertion{infrastructurev1beta1.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta1.DrgReconciliationFailedReason}, - testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav1exp.OCIManagedCluster) { + conditionAssertion: conditionAssertion{infrastructurev1beta2.ClusterReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrastructurev1beta2.DrgReconciliationFailedReason}, + testSpecificSetup: func(cs *mock_scope.MockClusterScopeClient, ociCluster *infrav2exp.OCIManagedCluster) { cs.EXPECT().DeleteDRGRPCAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteDRGVCNAttachment(context.Background()).Return(nil) cs.EXPECT().DeleteNSGs(context.Background()).Return(nil) @@ -633,52 +633,52 @@ func TestOCIClusterReconciler_reconcileDelete(t *testing.T) { } } -func getOCIManagedClusterWithNoOwner() *infrav1exp.OCIManagedCluster { - ociCluster := &infrav1exp.OCIManagedCluster{ +func getOCIManagedClusterWithNoOwner() *infrav2exp.OCIManagedCluster { + ociCluster := &infrav2exp.OCIManagedCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test", }, - Spec: infrav1exp.OCIManagedClusterSpec{ + Spec: infrav2exp.OCIManagedClusterSpec{ CompartmentId: "test", ControlPlaneEndpoint: clusterv1.APIEndpoint{ Port: 6443, }, OCIResourceIdentifier: "resource_uid", - NetworkSpec: infrastructurev1beta1.NetworkSpec{ - Vcn: infrastructurev1beta1.VCN{ + NetworkSpec: infrastructurev1beta2.NetworkSpec{ + Vcn: infrastructurev1beta2.VCN{ ID: common.String("vcn-id"), - Subnets: []*infrastructurev1beta1.Subnet{ + Subnets: []*infrastructurev1beta2.Subnet{ { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, + Role: infrastructurev1beta2.ControlPlaneEndpointRole, ID: common.String("subnet-id"), - Type: infrastructurev1beta1.Private, + Type: infrastructurev1beta2.Private, Name: "worker-subnet", }, { - Role: infrastructurev1beta1.PodRole, + Role: infrastructurev1beta2.PodRole, ID: common.String("pod-subnet-id"), - Type: infrastructurev1beta1.Private, + Type: infrastructurev1beta2.Private, Name: "pod-subnet", }, }, - NetworkSecurityGroups: []*infrastructurev1beta1.NSG{ - { - Role: infrastructurev1beta1.ControlPlaneEndpointRole, - ID: common.String("nsg-id"), - Name: "worker-nsg", - }, - { - Role: infrastructurev1beta1.PodRole, - ID: common.String("pod-nsg-id"), - Name: "pod-nsg", + 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", + }, }, }, }, }, - }, - Status: infrav1exp.OCIManagedClusterStatus{ - AvailabilityDomains: map[string]infrastructurev1beta1.OCIAvailabilityDomain{ + AvailabilityDomains: map[string]infrastructurev1beta2.OCIAvailabilityDomain{ "ad-1": { Name: "ad-1", FaultDomains: []string{"fd-5", "fd-6"}, @@ -690,7 +690,7 @@ func getOCIManagedClusterWithNoOwner() *infrav1exp.OCIManagedCluster { return ociCluster } -func getOCIManagedClusterWithOwner() *infrav1exp.OCIManagedCluster { +func getOCIManagedClusterWithOwner() *infrav2exp.OCIManagedCluster { ociCluster := getOCIManagedClusterWithNoOwner() ociCluster.OwnerReferences = []metav1.OwnerReference{ { diff --git a/exp/controllers/ocimanagedcluster_controlplane_controller.go b/exp/controllers/ocimanagedcluster_controlplane_controller.go index cb2d76cd..838c334b 100644 --- a/exp/controllers/ocimanagedcluster_controlplane_controller.go +++ b/exp/controllers/ocimanagedcluster_controlplane_controller.go @@ -25,7 +25,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" - 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/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 := &infrav1exp.OCIManagedControlPlane{} + controlPlane := &infrav2exp.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 := &infrav1exp.OCIManagedCluster{} + ociManagedCluster := &infrav2exp.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 *infrav1exp.OCIManagedControlPlane) (ctrl.Result, error) { +func (r *OCIManagedClusterControlPlaneReconciler) reconcile(ctx context.Context, controlPlaneScope *scope.ManagedControlPlaneScope, controlPlane *infrav2exp.OCIManagedControlPlane) (ctrl.Result, error) { // If the OCIManagedControlPlane doesn't have our finalizer, add it. - controllerutil.AddFinalizer(controlPlane, infrav1exp.ControlPlaneFinalizer) + controllerutil.AddFinalizer(controlPlane, infrav2exp.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, infrav1exp.ControlPlaneReadyCondition, infrav1exp.ControlPlaneNotReadyReason, clusterv1.ConditionSeverityInfo, "") + conditions.MarkFalse(controlPlane, infrav2exp.ControlPlaneReadyCondition, infrav2exp.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, infrav1exp.ControlPlaneReadyCondition) + conditions.MarkTrue(controlPlane, infrav2exp.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, infrav1exp.ControlPlaneReadyCondition) + conditions.MarkTrue(controlPlane, infrav2exp.ControlPlaneReadyCondition) controlPlaneScope.OCIManagedControlPlane.Status.Ready = true err := controlPlaneScope.ReconcileKubeconfig(ctx, okeControlPlane) @@ -234,7 +234,7 @@ func (r *OCIManagedClusterControlPlaneReconciler) reconcile(ctx context.Context, } return reconcile.Result{RequeueAfter: 180 * time.Second}, nil default: - conditions.MarkFalse(controlPlane, infrav1exp.ControlPlaneReadyCondition, infrav1exp.ControlPlaneProvisionFailedReason, clusterv1.ConditionSeverityError, "") + conditions.MarkFalse(controlPlane, infrav2exp.ControlPlaneReadyCondition, infrav2exp.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)) @@ -247,9 +247,9 @@ func (r *OCIManagedClusterControlPlaneReconciler) SetupWithManager(ctx context.C ociManagedClusterMapper, err := OCIManagedClusterToOCIManagedControlPlaneMapper(ctx, r.Client, log) c, err := ctrl.NewControllerManagedBy(mgr). WithOptions(options). - For(&infrav1exp.OCIManagedControlPlane{}). + For(&infrav2exp.OCIManagedControlPlane{}). Watches( - &source.Kind{Type: &infrav1exp.OCIManagedCluster{}}, + &source.Kind{Type: &infrav2exp.OCIManagedCluster{}}, handler.EnqueueRequestsFromMapFunc(ociManagedClusterMapper), ). Build(r) @@ -288,7 +288,7 @@ func (r *OCIManagedClusterControlPlaneReconciler) clusterToInfrastructureMapFunc return nil } - ociCluster := &infrav1exp.OCIManagedCluster{} + ociCluster := &infrav2exp.OCIManagedCluster{} key := types.NamespacedName{Namespace: c.Spec.InfrastructureRef.Namespace, Name: c.Spec.InfrastructureRef.Name} if err := r.Get(ctx, key, ociCluster); err != nil { @@ -315,15 +315,15 @@ func (r *OCIManagedClusterControlPlaneReconciler) clusterToInfrastructureMapFunc } func (r *OCIManagedClusterControlPlaneReconciler) reconcileDelete(ctx context.Context, - controlPlaneScope *scope.ManagedControlPlaneScope, controlPlane *infrav1exp.OCIManagedControlPlane) (ctrl.Result, error) { + controlPlaneScope *scope.ManagedControlPlaneScope, controlPlane *infrav2exp.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, infrav1exp.ControlPlaneFinalizer) + controllerutil.RemoveFinalizer(controlPlaneScope.OCIManagedControlPlane, infrav2exp.ControlPlaneFinalizer) controlPlaneScope.Info("Cluster is not found, may have been deleted") - conditions.MarkTrue(controlPlaneScope.OCIManagedControlPlane, infrav1exp.ControlPlaneNotFoundReason) + conditions.MarkTrue(controlPlaneScope.OCIManagedControlPlane, infrav2exp.ControlPlaneNotFoundReason) controlPlaneScope.OCIManagedControlPlane.Status.Ready = false return reconcile.Result{}, nil } else { @@ -335,20 +335,20 @@ func (r *OCIManagedClusterControlPlaneReconciler) reconcileDelete(ctx context.Co } if cluster == nil { controlPlaneScope.Info("Cluster is not found, may have been deleted") - controllerutil.RemoveFinalizer(controlPlane, infrav1exp.ControlPlaneFinalizer) + controllerutil.RemoveFinalizer(controlPlane, infrav2exp.ControlPlaneFinalizer) return reconcile.Result{}, nil } switch cluster.LifecycleState { case containerengine.ClusterLifecycleStateDeleting: controlPlane.Status.Ready = false - conditions.MarkFalse(controlPlane, infrav1exp.ControlPlaneReadyCondition, infrav1exp.ControlPlaneDeletionInProgress, clusterv1.ConditionSeverityWarning, "") + conditions.MarkFalse(controlPlane, infrav2exp.ControlPlaneReadyCondition, infrav2exp.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, infrav1exp.ControlPlaneReadyCondition, infrav1exp.ControlPlaneDeletedReason, clusterv1.ConditionSeverityWarning, "") - controllerutil.RemoveFinalizer(controlPlane, infrav1exp.ControlPlaneFinalizer) + conditions.MarkFalse(controlPlane, infrav2exp.ControlPlaneReadyCondition, infrav2exp.ControlPlaneDeletedReason, clusterv1.ConditionSeverityWarning, "") + controllerutil.RemoveFinalizer(controlPlane, infrav2exp.ControlPlaneFinalizer) controlPlaneScope.Info("Managed control plane is deleted") return reconcile.Result{}, nil default: @@ -356,14 +356,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, infrav1exp.ControlPlaneReadyCondition, infrav1exp.ControlPlaneDeletionInProgress, clusterv1.ConditionSeverityWarning, "") + conditions.MarkFalse(controlPlane, infrav2exp.ControlPlaneReadyCondition, infrav2exp.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.(*infrav1exp.OCIManagedCluster) + ociCluster, ok := o.(*infrav2exp.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/exp/controllers/ocimanagedcluster_controlplane_controller_test.go index 5ecc52b0..874cb444 100644 --- a/exp/controllers/ocimanagedcluster_controlplane_controller_test.go +++ b/exp/controllers/ocimanagedcluster_controlplane_controller_test.go @@ -28,7 +28,7 @@ import ( "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" - 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" 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 := &infrav1exp.OCIManagedCluster{ + notReadyCluster := &infrav2exp.OCIManagedCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "oci-cluster", Namespace: "test", }, - Status: infrav1exp.OCIManagedClusterStatus{ + Status: infrav2exp.OCIManagedClusterStatus{ Ready: false, }, } @@ -160,7 +160,7 @@ func TestControlPlaneReconciliationFunction(t *testing.T) { r OCIManagedClusterControlPlaneReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociManagedControlPlane *infrav1exp.OCIManagedControlPlane + ociManagedControlPlane *infrav2exp.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{{infrav1exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrav1exp.ControlPlaneNotReadyReason}}, + conditionAssertion: []conditionAssertion{{infrav2exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrav2exp.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{{infrav1exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrav1exp.ControlPlaneNotReadyReason}}, + conditionAssertion: []conditionAssertion{{infrav2exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrav2exp.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{{infrav1exp.ControlPlaneReadyCondition, corev1.ConditionTrue, "", ""}}, + conditionAssertion: []conditionAssertion{{infrav2exp.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"), @@ -344,7 +344,7 @@ func TestControlPlaneReconciliationFunction(t *testing.T) { { name: "control plane in created, update", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.ControlPlaneReadyCondition, corev1.ConditionTrue, "", ""}}, + conditionAssertion: []conditionAssertion{{infrav2exp.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"), @@ -415,7 +415,7 @@ func TestControlPlaneReconciliationFunction(t *testing.T) { { name: "control plane in error state", errorExpected: true, - conditionAssertion: []conditionAssertion{{infrav1exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrav1exp.ControlPlaneProvisionFailedReason}}, + conditionAssertion: []conditionAssertion{{infrav2exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityError, infrav2exp.ControlPlaneProvisionFailedReason}}, testSpecificSetup: func(controlPlaneScope *scope.ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetCluster(gomock.Any(), gomock.Eq(oke.GetClusterRequest{ ClusterId: common.String("test"), @@ -475,7 +475,7 @@ func TestControlPlaneDeletionFunction(t *testing.T) { r OCIManagedClusterControlPlaneReconciler mockCtrl *gomock.Controller recorder *record.FakeRecorder - ociManagedControlPlane *infrav1exp.OCIManagedControlPlane + ociManagedControlPlane *infrav2exp.OCIManagedControlPlane okeClient *mock_containerengine.MockClient ms *scope.ManagedControlPlaneScope baseClient *mock_base.MockBaseClient @@ -528,7 +528,7 @@ func TestControlPlaneDeletionFunction(t *testing.T) { { name: "control plane to be deleted", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav1exp.ControlPlaneDeletionInProgress}}, + conditionAssertion: []conditionAssertion{{infrav2exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav2exp.ControlPlaneDeletionInProgress}}, testSpecificSetup: func(controlPlaneScope *scope.ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetCluster(gomock.Any(), gomock.Eq(oke.GetClusterRequest{ ClusterId: common.String("test"), @@ -549,7 +549,7 @@ func TestControlPlaneDeletionFunction(t *testing.T) { { name: "control plane not found", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.ControlPlaneNotFoundReason, corev1.ConditionTrue, "", ""}}, + conditionAssertion: []conditionAssertion{{infrav2exp.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"), @@ -560,7 +560,7 @@ func TestControlPlaneDeletionFunction(t *testing.T) { { name: "control plane deleting", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav1exp.ControlPlaneDeletionInProgress}}, + conditionAssertion: []conditionAssertion{{infrav2exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav2exp.ControlPlaneDeletionInProgress}}, testSpecificSetup: func(controlPlaneScope *scope.ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetCluster(gomock.Any(), gomock.Eq(oke.GetClusterRequest{ ClusterId: common.String("test"), @@ -577,7 +577,7 @@ func TestControlPlaneDeletionFunction(t *testing.T) { { name: "control plane deleted", errorExpected: false, - conditionAssertion: []conditionAssertion{{infrav1exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav1exp.ControlPlaneDeletedReason}}, + conditionAssertion: []conditionAssertion{{infrav2exp.ControlPlaneReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav2exp.ControlPlaneDeletedReason}}, testSpecificSetup: func(controlPlaneScope *scope.ManagedControlPlaneScope, okeClient *mock_containerengine.MockClient) { okeClient.EXPECT().GetCluster(gomock.Any(), gomock.Eq(oke.GetClusterRequest{ ClusterId: common.String("test"), @@ -616,14 +616,14 @@ func TestControlPlaneDeletionFunction(t *testing.T) { } } -func getControlPlanePoolWithNoOwner() *infrav1exp.OCIManagedControlPlane { +func getControlPlanePoolWithNoOwner() *infrav2exp.OCIManagedControlPlane { ociControlplane := getOCIManagedControlPlane() ociControlplane.OwnerReferences = []metav1.OwnerReference{} return ociControlplane } -func getOCIManagedControlPlane() *infrav1exp.OCIManagedControlPlane { - return &infrav1exp.OCIManagedControlPlane{ +func getOCIManagedControlPlane() *infrav2exp.OCIManagedControlPlane { + return &infrav2exp.OCIManagedControlPlane{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "test", @@ -644,24 +644,24 @@ func getOCIManagedControlPlane() *infrav1exp.OCIManagedControlPlane { }, }, }, - Spec: infrav1exp.OCIManagedControlPlaneSpec{ + Spec: infrav2exp.OCIManagedControlPlaneSpec{ ID: common.String("test"), - ClusterPodNetworkOptions: []infrav1exp.ClusterPodNetworkOptions{ + ClusterPodNetworkOptions: []infrav2exp.ClusterPodNetworkOptions{ { - CniType: infrav1exp.FlannelCNI, + CniType: infrav2exp.FlannelCNI, }, }, - ImagePolicyConfig: &infrav1exp.ImagePolicyConfig{ + ImagePolicyConfig: &infrav2exp.ImagePolicyConfig{ IsPolicyEnabled: common.Bool(true), - KeyDetails: []infrav1exp.KeyDetails{{ + KeyDetails: []infrav2exp.KeyDetails{{ KmsKeyId: common.String("kms-key-id"), }}, }, - ClusterOption: infrav1exp.ClusterOptions{ - AdmissionControllerOptions: &infrav1exp.AdmissionControllerOptions{ + ClusterOption: infrav2exp.ClusterOptions{ + AdmissionControllerOptions: &infrav2exp.AdmissionControllerOptions{ IsPodSecurityPolicyEnabled: common.Bool(true), }, - AddOnOptions: &infrav1exp.AddOnOptions{ + AddOnOptions: &infrav2exp.AddOnOptions{ IsKubernetesDashboardEnabled: common.Bool(true), IsTillerEnabled: common.Bool(false), }, @@ -672,7 +672,7 @@ func getOCIManagedControlPlane() *infrav1exp.OCIManagedControlPlane { } } -func expectControlPlaneConditions(g *WithT, m *infrav1exp.OCIManagedControlPlane, expected []conditionAssertion) { +func expectControlPlaneConditions(g *WithT, m *infrav2exp.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/controllers/suite_test.go b/exp/controllers/suite_test.go index 24b8fcf2..3e102559 100644 --- a/exp/controllers/suite_test.go +++ b/exp/controllers/suite_test.go @@ -20,8 +20,8 @@ import ( "os" "testing" - infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" - infrav1exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" + infrav2exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/client-go/kubernetes/scheme" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" @@ -37,8 +37,8 @@ func TestMain(m *testing.M) { } func setup() { - utilruntime.Must(infrastructurev1beta1.AddToScheme(scheme.Scheme)) + utilruntime.Must(infrastructurev1beta2.AddToScheme(scheme.Scheme)) utilruntime.Must(clusterv1.AddToScheme(scheme.Scheme)) - utilruntime.Must(infrav1exp.AddToScheme(scheme.Scheme)) + utilruntime.Must(infrav2exp.AddToScheme(scheme.Scheme)) utilruntime.Must(expclusterv1.AddToScheme(scheme.Scheme)) } diff --git a/main.go b/main.go index d72fd1ce..2d568426 100644 --- a/main.go +++ b/main.go @@ -21,11 +21,12 @@ import ( "os" infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1" + infrastructurev1beta2 "github.com/oracle/cluster-api-provider-oci/api/v1beta2" "github.com/oracle/cluster-api-provider-oci/cloud/config" "github.com/oracle/cluster-api-provider-oci/cloud/scope" "github.com/oracle/cluster-api-provider-oci/controllers" expV1Beta1 "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1" - infrav1exp "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1" + expV1Beta2 "github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2" expcontrollers "github.com/oracle/cluster-api-provider-oci/exp/controllers" "github.com/oracle/cluster-api-provider-oci/feature" "github.com/oracle/cluster-api-provider-oci/version" @@ -66,8 +67,10 @@ const ( func init() { utilruntime.Must(clientgoscheme.AddToScheme(scheme)) utilruntime.Must(infrastructurev1beta1.AddToScheme(scheme)) + utilruntime.Must(infrastructurev1beta2.AddToScheme(scheme)) utilruntime.Must(clusterv1.AddToScheme(scheme)) utilruntime.Must(expV1Beta1.AddToScheme(scheme)) + utilruntime.Must(expV1Beta2.AddToScheme(scheme)) utilruntime.Must(expclusterv1.AddToScheme(scheme)) //+kubebuilder:scaffold:scheme } @@ -257,27 +260,27 @@ func main() { } } - if err = (&infrastructurev1beta1.OCICluster{}).SetupWebhookWithManager(mgr); err != nil { + if err = (&infrastructurev1beta2.OCICluster{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "OCICluster") os.Exit(1) } - if err = (&infrastructurev1beta1.OCIMachineTemplate{}).SetupWebhookWithManager(mgr); err != nil { + if err = (&infrastructurev1beta2.OCIMachineTemplate{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "OCIMachineTemplate") os.Exit(1) } - if err = (&infrav1exp.OCIManagedCluster{}).SetupWebhookWithManager(mgr); err != nil { + if err = (&expV1Beta2.OCIManagedCluster{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "OCIManagedCluster") os.Exit(1) } - if err = (&infrav1exp.OCIManagedControlPlane{}).SetupWebhookWithManager(mgr); err != nil { + if err = (&expV1Beta2.OCIManagedControlPlane{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "OCIManagedControlPlane") os.Exit(1) } - if err = (&infrav1exp.OCIManagedMachinePool{}).SetupWebhookWithManager(mgr); err != nil { + if err = (&expV1Beta2.OCIManagedMachinePool{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "OCIManagedMachinePool") os.Exit(1) }