Skip to content

Commit

Permalink
Self managed nodes move oke from exp (#298)
Browse files Browse the repository at this point in the history
* OKE self managed nodes and move OKE out of experimental
  • Loading branch information
shyamradhakrishnan committed Jul 7, 2023
1 parent 8cde3ee commit 3cab342
Show file tree
Hide file tree
Showing 80 changed files with 4,100 additions and 3,139 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ COPY version/ version/
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -ldflags "${LDFLAGS} -extldflags '-static'" -o manager ${package}

FROM ghcr.io/oracle/oraclelinux:8-slim
FROM ghcr.io/oracle/oraclelinux:9-slim
WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ generate-e2e-templates: $(KUSTOMIZE)
$(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta2/cluster-template-cluster-identity --load-restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta2/cluster-template-cluster-identity.yaml
$(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta2/cluster-template-windows-calico --load-restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta2/cluster-template-windows-calico.yaml
$(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta2/cluster-template-managed-virtual --load-restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta2/cluster-template-managed-virtual.yaml
$(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta2/cluster-template-managed-self-managed-nodes --load-restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta2/cluster-template-managed-self-managed-nodes.yaml

.PHONY: test-e2e-run
test-e2e-run: generate-e2e-templates $(GINKGO) $(ENVSUBST) ## Run e2e tests
Expand Down
2 changes: 2 additions & 0 deletions api/v1beta1/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ const (
ControlPlaneDefaultName = "control-plane"
WorkerDefaultName = "worker"
ServiceLBDefaultName = "service-lb"
PodDefaultName = "pod"
PodDefaultCIDR = "10.0.128.0/18"
)
19 changes: 18 additions & 1 deletion api/v1beta1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,24 @@ func Convert_v1beta1_OCIMachineSpec_To_v1beta2_OCIMachineSpec(in *OCIMachineSpec
}

// Convert_v1beta2_LoadBalancer_To_v1beta1_LoadBalancer converts v1beta2 LoadBalancer to v1beta1 LoadBalancer

func Convert_v1beta2_LoadBalancer_To_v1beta1_LoadBalancer(in *v1beta2.LoadBalancer, out *LoadBalancer, s conversion.Scope) error {
return autoConvert_v1beta2_LoadBalancer_To_v1beta1_LoadBalancer(in, out, s)
}

func Convert_v1beta2_OCIManagedControlPlaneStatus_To_v1beta1_OCIManagedControlPlaneStatus(in *v1beta2.OCIManagedControlPlaneStatus, out *OCIManagedControlPlaneStatus, s conversion.Scope) error {
return autoConvert_v1beta2_OCIManagedControlPlaneStatus_To_v1beta1_OCIManagedControlPlaneStatus(in, out, s)
}

func Convert_v1beta2_OCIManagedControlPlaneSpec_To_v1beta1_OCIManagedControlPlaneSpec(in *v1beta2.OCIManagedControlPlaneSpec, out *OCIManagedControlPlaneSpec, s conversion.Scope) error {
return autoConvert_v1beta2_OCIManagedControlPlaneSpec_To_v1beta1_OCIManagedControlPlaneSpec(in, out, s)
}

// Convert_v1beta1_OCIManagedClusterStatus_To_v1beta2_OCIManagedClusterStatus converts v1beta1 OCIManagedClusterStatus to v1beta2 OCIManagedClusterStatus
func Convert_v1beta1_OCIManagedClusterStatus_To_v1beta2_OCIManagedClusterStatus(in *OCIManagedClusterStatus, out *v1beta2.OCIManagedClusterStatus, s conversion.Scope) error {
return autoConvert_v1beta1_OCIManagedClusterStatus_To_v1beta2_OCIManagedClusterStatus(in, out, s)
}

// Convert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec converts v1beta1 OCIManagedClusterSpec to v1beta2 OCIManagedClusterSpec
func Convert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec(in *v1beta2.OCIManagedClusterSpec, out *OCIManagedClusterSpec, s conversion.Scope) error {
return autoConvert_v1beta2_OCIManagedClusterSpec_To_v1beta1_OCIManagedClusterSpec(in, out, s)
}
37 changes: 37 additions & 0 deletions api/v1beta1/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func fuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} {
OCIMachineTemplateFuzzer,
OCIClusterFuzzer,
OCIClusterTemplateFuzzer,
OCIManagedClusterFuzzer,
}
}

Expand Down Expand Up @@ -93,6 +94,28 @@ func OCIMachineTemplateFuzzer(obj *OCIMachineTemplate, c fuzz.Continue) {
obj.Spec.Template.Spec.NSGName = ""
}

func OCIManagedClusterFuzzer(obj *OCIManagedCluster, c fuzz.Continue) {
c.FuzzNoCustom(obj)
// nil fields which have been removed so that tests dont fail
for _, nsg := range obj.Spec.NetworkSpec.Vcn.NetworkSecurityGroups {
if nsg != nil {
ingressRules := make([]IngressSecurityRuleForNSG, len(nsg.IngressRules))
for _, rule := range nsg.IngressRules {
rule.ID = nil
ingressRules = append(ingressRules, rule)
}
nsg.IngressRules = ingressRules

egressRules := make([]EgressSecurityRuleForNSG, len(nsg.EgressRules))
for _, rule := range nsg.EgressRules {
(&rule).ID = nil
egressRules = append(egressRules, rule)
}
nsg.EgressRules = egressRules
}
}
}

func TestFuzzyConversion(t *testing.T) {
g := NewWithT(t)
scheme := runtime.NewScheme()
Expand Down Expand Up @@ -134,4 +157,18 @@ func TestFuzzyConversion(t *testing.T) {
FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs},
}))

t.Run("for OCIManagedControlPlane", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{
Scheme: scheme,
Hub: &v1beta2.OCIManagedControlPlane{},
Spoke: &OCIManagedControlPlane{},
FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs},
}))

t.Run("for OCIManagedCluster", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{
Scheme: scheme,
Hub: &v1beta2.OCIManagedCluster{},
Spoke: &OCIManagedCluster{},
FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs},
}))

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ limitations under the License.
package v1beta1

import (
infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1"
"github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2"
"github.com/oracle/cluster-api-provider-oci/api/v1beta2"
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)
Expand All @@ -31,7 +30,7 @@ func (src *OCIManagedCluster) ConvertTo(dstRaw conversion.Hub) error {
return err
}

ad, err := infrastructurev1beta1.Convertv1beta1AdMapTov1beta2AdMap(src.Status.AvailabilityDomains)
ad, err := Convertv1beta1AdMapTov1beta2AdMap(src.Status.AvailabilityDomains)
if err != nil {
return err
}
Expand Down Expand Up @@ -61,7 +60,7 @@ func (r *OCIManagedCluster) ConvertFrom(srcRaw conversion.Hub) error {
return err
}

ad, err := infrastructurev1beta1.Convertv1beta2AdMapTov1beta1AdMap(src.Spec.AvailabilityDomains)
ad, err := Convertv1beta2AdMapTov1beta1AdMap(src.Spec.AvailabilityDomains)
if err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package v1beta1

import (
infrastructurev1beta1 "github.com/oracle/cluster-api-provider-oci/api/v1beta1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
Expand All @@ -43,7 +42,7 @@ type OCIManagedClusterSpec struct {

// NetworkSpec encapsulates all things related to OCI network.
// +optional
NetworkSpec infrastructurev1beta1.NetworkSpec `json:"networkSpec,omitempty"`
NetworkSpec NetworkSpec `json:"networkSpec,omitempty"`

// Free-form tags for this resource.
// +optional
Expand Down Expand Up @@ -76,7 +75,7 @@ type OCIManagedClusterStatus struct {
// AvailabilityDomains encapsulates the clusters Availability Domain (AD) information in a map
// where the map key is the AD name and the struct is details about the AD.
// +optional
AvailabilityDomains map[string]infrastructurev1beta1.OCIAvailabilityDomain `json:"availabilityDomains,omitempty"`
AvailabilityDomains map[string]OCIAvailabilityDomain `json:"availabilityDomains,omitempty"`

// +optional
Ready bool `json:"ready"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package v1beta1

import (
"github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2"
"github.com/oracle/cluster-api-provider-oci/api/v1beta2"
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)
Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions api/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1025,3 +1025,10 @@ type RemotePeeringConnection struct {
// RPCConnectionId is the connection ID of the connection between peer and local RPC.
RPCConnectionId *string `json:"rpcConnectionId,omitempty"`
}

const (
VCNNativeCNI CNIOptionEnum = "OCI_VCN_IP_NATIVE"
FlannelCNI CNIOptionEnum = "FLANNEL_OVERLAY"
)

type CNIOptionEnum string
Loading

0 comments on commit 3cab342

Please sign in to comment.