Skip to content

Commit

Permalink
rename PrivateDNSNameOptions -> PrivateDNSName
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxFedotov committed Jan 29, 2024
1 parent af2a59e commit d6b1fc2
Show file tree
Hide file tree
Showing 20 changed files with 68 additions and 74 deletions.
2 changes: 1 addition & 1 deletion api/v1beta1/awscluster_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (src *AWSCluster) ConvertTo(dstRaw conversion.Hub) error {
if restored.Status.Bastion != nil {
dst.Status.Bastion.InstanceMetadataOptions = restored.Status.Bastion.InstanceMetadataOptions
dst.Status.Bastion.PlacementGroupName = restored.Status.Bastion.PlacementGroupName
dst.Status.Bastion.PrivateDNSNameOptions = restored.Status.Bastion.PrivateDNSNameOptions
dst.Status.Bastion.PrivateDNSName = restored.Status.Bastion.PrivateDNSName
}
dst.Spec.Partition = restored.Spec.Partition

Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/awsmachine_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (src *AWSMachine) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.Ignition = restored.Spec.Ignition
dst.Spec.InstanceMetadataOptions = restored.Spec.InstanceMetadataOptions
dst.Spec.PlacementGroupName = restored.Spec.PlacementGroupName
dst.Spec.PrivateDNSNameOptions = restored.Spec.PrivateDNSNameOptions
dst.Spec.PrivateDNSName = restored.Spec.PrivateDNSName

return nil
}
Expand Down Expand Up @@ -86,7 +86,7 @@ func (r *AWSMachineTemplate) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.Template.Spec.Ignition = restored.Spec.Template.Spec.Ignition
dst.Spec.Template.Spec.InstanceMetadataOptions = restored.Spec.Template.Spec.InstanceMetadataOptions
dst.Spec.Template.Spec.PlacementGroupName = restored.Spec.Template.Spec.PlacementGroupName
dst.Spec.Template.Spec.PrivateDNSNameOptions = restored.Spec.Template.Spec.PrivateDNSNameOptions
dst.Spec.Template.Spec.PrivateDNSName = restored.Spec.Template.Spec.PrivateDNSName

return nil
}
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/zz_generated.conversion.go

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

4 changes: 2 additions & 2 deletions api/v1beta2/awsmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ type AWSMachineSpec struct {
// +kubebuilder:validation:Enum:=default;dedicated;host
Tenancy string `json:"tenancy,omitempty"`

// PrivateDNSNameOptions is the options for the instance hostname.
// PrivateDNSName is the options for the instance hostname.
// +optional
PrivateDNSNameOptions *PrivateDNSNameOptions `json:"privateDnsNameOptions,omitempty"`
PrivateDNSName *PrivateDNSName `json:"privateDnsName,omitempty"`
}

// CloudInit defines options related to the bootstrapping systems where
Expand Down
12 changes: 6 additions & 6 deletions api/v1beta2/awsmachine_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ func (r *AWSMachine) ValidateUpdate(old runtime.Object) (admission.Warnings, err
}

// allow changes to enableResourceNameDNSAAAARecord and enableResourceNameDNSARecord
if privateDNSNameOptions, ok := oldAWSMachineSpec["privateDnsNameOptions"].(map[string]interface{}); ok {
delete(privateDNSNameOptions, "enableResourceNameDnsAAAARecord")
delete(privateDNSNameOptions, "enableResourceNameDnsARecord")
if privateDNSName, ok := oldAWSMachineSpec["privateDnsName"].(map[string]interface{}); ok {
delete(privateDNSName, "enableResourceNameDnsAAAARecord")
delete(privateDNSName, "enableResourceNameDnsARecord")
}

if privateDNSNameOptions, ok := newAWSMachineSpec["privateDnsNameOptions"].(map[string]interface{}); ok {
delete(privateDNSNameOptions, "enableResourceNameDnsAAAARecord")
delete(privateDNSNameOptions, "enableResourceNameDnsARecord")
if privateDNSName, ok := newAWSMachineSpec["privateDnsName"].(map[string]interface{}); ok {
delete(privateDNSName, "enableResourceNameDnsAAAARecord")
delete(privateDNSName, "enableResourceNameDnsARecord")
}

if !cmp.Equal(oldAWSMachineSpec, newAWSMachineSpec) {
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta2/awsmachine_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func TestAWSMachineUpdate(t *testing.T) {
ID: pointer.String("ID"),
},
},
PrivateDNSNameOptions: &PrivateDNSNameOptions{
PrivateDNSName: &PrivateDNSName{
EnableResourceNameDNSAAAARecord: aws.Bool(true),
EnableResourceNameDNSARecord: aws.Bool(true),
},
Expand Down
8 changes: 4 additions & 4 deletions api/v1beta2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ type Instance struct {
// +optional
InstanceMetadataOptions *InstanceMetadataOptions `json:"instanceMetadataOptions,omitempty"`

// PrivateDNSNameOptions is the options for the instance hostname.
// PrivateDNSName is the options for the instance hostname.
// +optional
PrivateDNSNameOptions *PrivateDNSNameOptions `json:"privateDnsNameOptions,omitempty"`
PrivateDNSName *PrivateDNSName `json:"privateDnsName,omitempty"`
}

// InstanceMetadataState describes the state of InstanceMetadataOptions.HttpEndpoint and InstanceMetadataOptions.InstanceMetadataTags
Expand Down Expand Up @@ -412,8 +412,8 @@ const (
AmazonLinuxGPU EKSAMILookupType = "AmazonLinuxGPU"
)

// PrivateDNSNameOptions is the options for the instance hostname.
type PrivateDNSNameOptions struct {
// PrivateDNSName is the options for the instance hostname.
type PrivateDNSName struct {
// EnableResourceNameDNSAAAARecord indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records.
// +optional
EnableResourceNameDNSAAAARecord *bool `json:"enableResourceNameDnsAAAARecord,omitempty"`
Expand Down
20 changes: 10 additions & 10 deletions api/v1beta2/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -1108,9 +1108,8 @@ spec:
description: PlacementGroupName specifies the name of the placement
group in which to launch the instance.
type: string
privateDnsNameOptions:
description: PrivateDNSNameOptions is the options for the instance
hostname.
privateDnsName:
description: PrivateDNSName is the options for the instance hostname.
properties:
enableResourceNameDnsAAAARecord:
description: EnableResourceNameDNSAAAARecord indicates whether
Expand Down Expand Up @@ -2751,9 +2750,8 @@ spec:
description: PlacementGroupName specifies the name of the placement
group in which to launch the instance.
type: string
privateDnsNameOptions:
description: PrivateDNSNameOptions is the options for the instance
hostname.
privateDnsName:
description: PrivateDNSName is the options for the instance hostname.
properties:
enableResourceNameDnsAAAARecord:
description: EnableResourceNameDNSAAAARecord indicates whether
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1699,9 +1699,8 @@ spec:
description: PlacementGroupName specifies the name of the placement
group in which to launch the instance.
type: string
privateDnsNameOptions:
description: PrivateDNSNameOptions is the options for the instance
hostname.
privateDnsName:
description: PrivateDNSName is the options for the instance hostname.
properties:
enableResourceNameDnsAAAARecord:
description: EnableResourceNameDNSAAAARecord indicates whether
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,8 @@ spec:
name:
description: The name of the launch template.
type: string
privateDnsNameOptions:
description: PrivateDNSNameOptions is the options for the instance
hostname.
privateDnsName:
description: PrivateDNSName is the options for the instance hostname.
properties:
enableResourceNameDnsAAAARecord:
description: EnableResourceNameDNSAAAARecord indicates whether
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -780,9 +780,8 @@ spec:
description: PlacementGroupName specifies the name of the placement
group in which to launch the instance.
type: string
privateDnsNameOptions:
description: PrivateDNSNameOptions is the options for the instance
hostname.
privateDnsName:
description: PrivateDNSName is the options for the instance hostname.
properties:
enableResourceNameDnsAAAARecord:
description: EnableResourceNameDNSAAAARecord indicates whether
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -734,9 +734,9 @@ spec:
description: PlacementGroupName specifies the name of the
placement group in which to launch the instance.
type: string
privateDnsNameOptions:
description: PrivateDNSNameOptions is the options for the
instance hostname.
privateDnsName:
description: PrivateDNSName is the options for the instance
hostname.
properties:
enableResourceNameDnsAAAARecord:
description: EnableResourceNameDNSAAAARecord indicates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -678,9 +678,8 @@ spec:
name:
description: The name of the launch template.
type: string
privateDnsNameOptions:
description: PrivateDNSNameOptions is the options for the instance
hostname.
privateDnsName:
description: PrivateDNSName is the options for the instance hostname.
properties:
enableResourceNameDnsAAAARecord:
description: EnableResourceNameDNSAAAARecord indicates whether
Expand Down
8 changes: 4 additions & 4 deletions exp/api/v1beta1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func (src *AWSMachinePool) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.AvailabilityZoneSubnetType = restored.Spec.AvailabilityZoneSubnetType
}

if restored.Spec.AWSLaunchTemplate.PrivateDNSNameOptions != nil {
dst.Spec.AWSLaunchTemplate.PrivateDNSNameOptions = restored.Spec.AWSLaunchTemplate.PrivateDNSNameOptions
if restored.Spec.AWSLaunchTemplate.PrivateDNSName != nil {
dst.Spec.AWSLaunchTemplate.PrivateDNSName = restored.Spec.AWSLaunchTemplate.PrivateDNSName
}

return nil
Expand Down Expand Up @@ -100,8 +100,8 @@ func (src *AWSManagedMachinePool) ConvertTo(dstRaw conversion.Hub) error {
}
dst.Spec.AWSLaunchTemplate.InstanceMetadataOptions = restored.Spec.AWSLaunchTemplate.InstanceMetadataOptions

if restored.Spec.AWSLaunchTemplate.PrivateDNSNameOptions != nil {
dst.Spec.AWSLaunchTemplate.PrivateDNSNameOptions = restored.Spec.AWSLaunchTemplate.PrivateDNSNameOptions
if restored.Spec.AWSLaunchTemplate.PrivateDNSName != nil {
dst.Spec.AWSLaunchTemplate.PrivateDNSName = restored.Spec.AWSLaunchTemplate.PrivateDNSName
}
}
if restored.Spec.AvailabilityZoneSubnetType != nil {
Expand Down
2 changes: 1 addition & 1 deletion exp/api/v1beta1/zz_generated.conversion.go

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

4 changes: 2 additions & 2 deletions exp/api/v1beta2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ type AWSLaunchTemplate struct {
// +optional
InstanceMetadataOptions *infrav1.InstanceMetadataOptions `json:"instanceMetadataOptions,omitempty"`

// PrivateDNSNameOptions is the options for the instance hostname.
// PrivateDNSName is the options for the instance hostname.
// +optional
PrivateDNSNameOptions *infrav1.PrivateDNSNameOptions `json:"privateDnsNameOptions,omitempty"`
PrivateDNSName *infrav1.PrivateDNSName `json:"privateDnsName,omitempty"`
}

// Overrides are used to override the instance type specified by the launch template with multiple
Expand Down
6 changes: 3 additions & 3 deletions exp/api/v1beta2/zz_generated.deepcopy.go

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

16 changes: 8 additions & 8 deletions pkg/cloud/services/ec2/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func (s *Service) CreateInstance(scope *scope.MachineScope, userData []byte, use

input.PlacementGroupName = scope.AWSMachine.Spec.PlacementGroupName

input.PrivateDNSNameOptions = scope.AWSMachine.Spec.PrivateDNSNameOptions
input.PrivateDNSName = scope.AWSMachine.Spec.PrivateDNSName

s.scope.Debug("Running instance", "machine-role", scope.Role())
s.scope.Debug("Running instance with instance metadata options", "metadata options", input.InstanceMetadataOptions)
Expand Down Expand Up @@ -597,7 +597,7 @@ func (s *Service) runInstance(role string, i *infrav1.Instance) (*infrav1.Instan

input.InstanceMarketOptions = getInstanceMarketOptionsRequest(i.SpotMarketOptions)
input.MetadataOptions = getInstanceMetadataOptionsRequest(i.InstanceMetadataOptions)
input.PrivateDnsNameOptions = getPrivateDNSNameOptionsRequest(i.PrivateDNSNameOptions)
input.PrivateDnsNameOptions = getPrivateDNSNameOptionsRequest(i.PrivateDNSName)

if i.Tenancy != "" {
input.Placement = &ec2.Placement{
Expand Down Expand Up @@ -869,7 +869,7 @@ func (s *Service) SDKToInstance(v *ec2.Instance) (*infrav1.Instance, error) {
}

if v.PrivateDnsNameOptions != nil {
i.PrivateDNSNameOptions = &infrav1.PrivateDNSNameOptions{
i.PrivateDNSName = &infrav1.PrivateDNSName{
EnableResourceNameDNSAAAARecord: v.PrivateDnsNameOptions.EnableResourceNameDnsAAAARecord,
EnableResourceNameDNSARecord: v.PrivateDnsNameOptions.EnableResourceNameDnsARecord,
HostnameType: v.PrivateDnsNameOptions.HostnameType,
Expand Down Expand Up @@ -1065,14 +1065,14 @@ func getInstanceMetadataOptionsRequest(metadataOptions *infrav1.InstanceMetadata
return request
}

func getPrivateDNSNameOptionsRequest(privateDNSNameOptions *infrav1.PrivateDNSNameOptions) *ec2.PrivateDnsNameOptionsRequest {
if privateDNSNameOptions == nil {
func getPrivateDNSNameOptionsRequest(privateDNSName *infrav1.PrivateDNSName) *ec2.PrivateDnsNameOptionsRequest {
if privateDNSName == nil {
return nil
}

return &ec2.PrivateDnsNameOptionsRequest{
EnableResourceNameDnsAAAARecord: privateDNSNameOptions.EnableResourceNameDNSAAAARecord,
EnableResourceNameDnsARecord: privateDNSNameOptions.EnableResourceNameDNSARecord,
HostnameType: privateDNSNameOptions.HostnameType,
EnableResourceNameDnsAAAARecord: privateDNSName.EnableResourceNameDNSAAAARecord,
EnableResourceNameDnsARecord: privateDNSName.EnableResourceNameDNSARecord,
HostnameType: privateDNSName.HostnameType,
}
}
14 changes: 7 additions & 7 deletions pkg/cloud/services/ec2/launchtemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ func (s *Service) createLaunchTemplateData(scope scope.LaunchTemplateScope, imag
data.ImageId = imageID

data.InstanceMarketOptions = getLaunchTemplateInstanceMarketOptionsRequest(scope.GetLaunchTemplate().SpotMarketOptions)
data.PrivateDnsNameOptions = getLaunchTemplatePrivateDNSNameOptionsRequest(scope.GetLaunchTemplate().PrivateDNSNameOptions)
data.PrivateDnsNameOptions = getLaunchTemplatePrivateDNSNameOptionsRequest(scope.GetLaunchTemplate().PrivateDNSName)

// Set up root volume
if lt.RootVolume != nil {
Expand Down Expand Up @@ -671,7 +671,7 @@ func (s *Service) SDKToLaunchTemplate(d *ec2.LaunchTemplateVersion) (*expinfrav1
}

if v.PrivateDnsNameOptions != nil {
i.PrivateDNSNameOptions = &infrav1.PrivateDNSNameOptions{
i.PrivateDNSName = &infrav1.PrivateDNSName{
EnableResourceNameDNSAAAARecord: v.PrivateDnsNameOptions.EnableResourceNameDnsAAAARecord,
EnableResourceNameDNSARecord: v.PrivateDnsNameOptions.EnableResourceNameDnsARecord,
HostnameType: v.PrivateDnsNameOptions.HostnameType,
Expand Down Expand Up @@ -924,14 +924,14 @@ func getLaunchTemplateInstanceMarketOptionsRequest(spotMarketOptions *infrav1.Sp
return launchTemplateInstanceMarketOptionsRequest
}

func getLaunchTemplatePrivateDNSNameOptionsRequest(privateDNSNameOptions *infrav1.PrivateDNSNameOptions) *ec2.LaunchTemplatePrivateDnsNameOptionsRequest {
if privateDNSNameOptions == nil {
func getLaunchTemplatePrivateDNSNameOptionsRequest(privateDNSName *infrav1.PrivateDNSName) *ec2.LaunchTemplatePrivateDnsNameOptionsRequest {
if privateDNSName == nil {
return nil
}

return &ec2.LaunchTemplatePrivateDnsNameOptionsRequest{
EnableResourceNameDnsAAAARecord: privateDNSNameOptions.EnableResourceNameDNSAAAARecord,
EnableResourceNameDnsARecord: privateDNSNameOptions.EnableResourceNameDNSARecord,
HostnameType: privateDNSNameOptions.HostnameType,
EnableResourceNameDnsAAAARecord: privateDNSName.EnableResourceNameDNSAAAARecord,
EnableResourceNameDnsARecord: privateDNSName.EnableResourceNameDNSARecord,
HostnameType: privateDNSName.HostnameType,
}
}

0 comments on commit d6b1fc2

Please sign in to comment.