Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for dns label #322

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions api/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,12 @@ type Subnet struct {
// The security list associated with Subnet.
// +optional
SecurityList *SecurityList `json:"securityList,omitempty"`

// DnsLabel DNS label for the subnet, used in conjunction with the VNIC's hostname and
// VCN's DNS label to form a fully qualified domain name (FQDN) for each VNIC
// within this subnet (for example, `bminstance1.subnet123.vcn1.oraclevcn.com`).
// +optional
DnsLabel *string `json:"dnsLabel,omitempty"`
}

// NSG defines configuration for a Network Security Group.
Expand Down Expand Up @@ -920,6 +926,12 @@ type VCN struct {
// +listType=map
// +listMapKey=name
NetworkSecurityGroups []*NSG `json:"networkSecurityGroups,omitempty"`

// DnsLabel specifies a DNS label for the VCN, used in conjunction with the VNIC's hostname and
// subnet's DNS label to form a fully qualified domain name (FQDN) for each VNIC
// within this subnet (for example, `bminstance1.subnet123.vcn1.oraclevcn.com`).
// +optional
DnsLabel *string `json:"dnsLabel,omitempty"`
shyamradhakrishnan marked this conversation as resolved.
Show resolved Hide resolved
}

// LoadBalancer Configuration
Expand Down
4 changes: 4 additions & 0 deletions api/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions api/v1beta2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,12 @@ type Subnet struct {
// The security list associated with Subnet.
// +optional
SecurityList *SecurityList `json:"securityList,omitempty"`

// DnsLabel DNS label for the subnet, used in conjunction with the VNIC's hostname and
// VCN's DNS label to form a fully qualified domain name (FQDN) for each VNIC
// within this subnet (for example, `bminstance1.subnet123.vcn1.oraclevcn.com`).
// +optional
DnsLabel *string `json:"dnsLabel,omitempty"`
}

// NSG defines configuration for a Network Security Group.
Expand Down Expand Up @@ -913,6 +919,12 @@ type VCN struct {
// Configuration for NSG management.
// +optional
NetworkSecurityGroup NetworkSecurityGroup `json:"networkSecurityGroup,omitempty"`

// DnsLabel specifies a DNS label for the VCN, used in conjunction with the VNIC's hostname and
// subnet's DNS label to form a fully qualified domain name (FQDN) for each VNIC
// within this subnet (for example, `bminstance1.subnet123.vcn1.oraclevcn.com`).
// +optional
DnsLabel *string `json:"dnsLabel,omitempty"`
}

// LoadBalancerType is an enumeration of the supported load balancer types.
Expand Down
10 changes: 10 additions & 0 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cloud/scope/subnet_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func (s *ClusterScope) CreateSubnet(ctx context.Context, spec infrastructurev1be
RouteTableId: routeTable,
FreeformTags: s.GetFreeFormTags(),
DefinedTags: s.GetDefinedTags(),
DnsLabel: spec.DnsLabel,
}
if spec.SecurityList != nil {
createSubnetDetails.SecurityListIds = []string{*spec.SecurityList.ID}
Expand Down
2 changes: 2 additions & 0 deletions cloud/scope/subnet_reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func TestClusterScope_ReconcileSubnet(t *testing.T) {
EgressRules: customEgress,
IngressRules: customIngress,
},
DnsLabel: common.String("label"),
},
{
Role: infrastructurev1beta2.ServiceLoadBalancerRole,
Expand Down Expand Up @@ -235,6 +236,7 @@ func TestClusterScope_ReconcileSubnet(t *testing.T) {
ProhibitPublicIpOnVnic: common.Bool(true),
RouteTableId: common.String("private"),
SecurityListIds: []string{"sec_list_id"},
DnsLabel: common.String("label"),
},
})).Return(
core.CreateSubnetResponse{
Expand Down
1 change: 1 addition & 0 deletions cloud/scope/vcn_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func (s *ClusterScope) CreateVCN(ctx context.Context, spec infrastructurev1beta2
CidrBlocks: []string{spec.CIDR},
FreeformTags: s.GetFreeFormTags(),
DefinedTags: s.GetDefinedTags(),
DnsLabel: spec.DnsLabel,
}
vcnResponse, err := s.VCNClient.CreateVcn(ctx, core.CreateVcnRequest{
CreateVcnDetails: vcnDetails,
Expand Down
18 changes: 11 additions & 7 deletions cloud/scope/vcn_reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ func TestClusterScope_CreateVCN(t *testing.T) {
vcnClient := mock_vcn.NewMockClient(mockCtrl)

vcnClient.EXPECT().CreateVcn(gomock.Any(), Eq(func(request interface{}) error {
return createVcnDisplayNameMatcher(request, "normal")
return vcnMatcher(request, "normal", common.String("label"))
})).
Return(core.CreateVcnResponse{
Vcn: core.Vcn{
Id: common.String("normal_id"),
},
}, nil)
vcnClient.EXPECT().CreateVcn(gomock.Any(), Eq(func(request interface{}) error {
return createVcnDisplayNameMatcher(request, "error")
return vcnMatcher(request, "error", nil)
})).
Return(core.CreateVcnResponse{}, errors.New("some error"))

Expand All @@ -63,7 +63,8 @@ func TestClusterScope_CreateVCN(t *testing.T) {
spec: infrastructurev1beta2.OCIClusterSpec{
NetworkSpec: infrastructurev1beta2.NetworkSpec{
Vcn: infrastructurev1beta2.VCN{
Name: "normal",
Name: "normal",
DnsLabel: common.String("label"),
},
},
},
Expand Down Expand Up @@ -602,7 +603,7 @@ func TestClusterScope_ReconcileVCN(t *testing.T) {
}}, nil)

vcnClient.EXPECT().CreateVcn(gomock.Any(), Eq(func(request interface{}) error {
return createVcnDisplayNameMatcher(request, "not_found")
return vcnMatcher(request, "not_found", nil)
})).
Return(core.CreateVcnResponse{
Vcn: core.Vcn{
Expand Down Expand Up @@ -705,13 +706,16 @@ func TestClusterScope_ReconcileVCN(t *testing.T) {
}
}

func createVcnDisplayNameMatcher(request interface{}, matchStr string) error {
func vcnMatcher(request interface{}, displayName string, dnsLabel *string) error {
r, ok := request.(core.CreateVcnRequest)
if !ok {
return errors.New("expecting CreateVcnRequest type")
}
if *r.CreateVcnDetails.DisplayName != matchStr {
return errors.New(fmt.Sprintf("expecting DisplayName as %s", matchStr))
if *r.CreateVcnDetails.DisplayName != displayName {
return errors.New(fmt.Sprintf("expecting DisplayName as %s", displayName))
}
if !reflect.DeepEqual(r.CreateVcnDetails.DnsLabel, dnsLabel) {
return errors.New(fmt.Sprintf("expecting DnsLabel as %v", dnsLabel))
}
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.13.0
name: ociclusteridentities.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down
27 changes: 25 additions & 2 deletions config/crd/bases/infrastructure.cluster.x-k8s.io_ociclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.13.0
name: ociclusters.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down Expand Up @@ -130,6 +129,12 @@ spec:
cidr:
description: VCN CIDR.
type: string
dnsLabel:
description: DnsLabel specifies a DNS label for the VCN, used
in conjunction with the VNIC's hostname and subnet's DNS
label to form a fully qualified domain name (FQDN) for each
VNIC within this subnet (for example, `bminstance1.subnet123.vcn1.oraclevcn.com`).
type: string
id:
description: VCN OCID.
type: string
Expand Down Expand Up @@ -535,6 +540,12 @@ spec:
cidr:
description: Subnet CIDR.
type: string
dnsLabel:
description: DnsLabel DNS label for the subnet, used
in conjunction with the VNIC's hostname and VCN's
DNS label to form a fully qualified domain name (FQDN)
for each VNIC within this subnet (for example, `bminstance1.subnet123.vcn1.oraclevcn.com`).
type: string
id:
description: Subnet OCID.
type: string
Expand Down Expand Up @@ -1279,6 +1290,12 @@ spec:
cidr:
description: VCN CIDR.
type: string
dnsLabel:
description: DnsLabel specifies a DNS label for the VCN, used
in conjunction with the VNIC's hostname and subnet's DNS
label to form a fully qualified domain name (FQDN) for each
VNIC within this subnet (for example, `bminstance1.subnet123.vcn1.oraclevcn.com`).
type: string
id:
description: VCN OCID.
type: string
Expand Down Expand Up @@ -1737,6 +1754,12 @@ spec:
cidr:
description: Subnet CIDR.
type: string
dnsLabel:
description: DnsLabel DNS label for the subnet, used
in conjunction with the VNIC's hostname and VCN's
DNS label to form a fully qualified domain name (FQDN)
for each VNIC within this subnet (for example, `bminstance1.subnet123.vcn1.oraclevcn.com`).
type: string
id:
description: Subnet OCID.
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.13.0
name: ociclustertemplates.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down Expand Up @@ -143,6 +142,13 @@ spec:
cidr:
description: VCN CIDR.
type: string
dnsLabel:
description: DnsLabel specifies a DNS label for the
VCN, used in conjunction with the VNIC's hostname
and subnet's DNS label to form a fully qualified
domain name (FQDN) for each VNIC within this subnet
(for example, `bminstance1.subnet123.vcn1.oraclevcn.com`).
type: string
id:
description: VCN OCID.
type: string
Expand Down Expand Up @@ -602,6 +608,13 @@ spec:
cidr:
description: Subnet CIDR.
type: string
dnsLabel:
description: DnsLabel DNS label for the subnet,
used in conjunction with the VNIC's hostname
and VCN's DNS label to form a fully qualified
domain name (FQDN) for each VNIC within this
subnet (for example, `bminstance1.subnet123.vcn1.oraclevcn.com`).
type: string
id:
description: Subnet OCID.
type: string
Expand Down Expand Up @@ -1336,6 +1349,13 @@ spec:
cidr:
description: VCN CIDR.
type: string
dnsLabel:
description: DnsLabel specifies a DNS label for the
VCN, used in conjunction with the VNIC's hostname
and subnet's DNS label to form a fully qualified
domain name (FQDN) for each VNIC within this subnet
(for example, `bminstance1.subnet123.vcn1.oraclevcn.com`).
type: string
id:
description: VCN OCID.
type: string
Expand Down Expand Up @@ -1852,6 +1872,13 @@ spec:
cidr:
description: Subnet CIDR.
type: string
dnsLabel:
description: DnsLabel DNS label for the subnet,
used in conjunction with the VNIC's hostname
and VCN's DNS label to form a fully qualified
domain name (FQDN) for each VNIC within this
subnet (for example, `bminstance1.subnet123.vcn1.oraclevcn.com`).
type: string
id:
description: Subnet OCID.
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.13.0
name: ocimachinepoolmachines.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.13.0
name: ocimachinepools.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.13.0
name: ocimachines.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.13.0
name: ocimachinetemplates.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down
Loading