Skip to content

feat: allow setting the internal ip address of a GCPMachine #1499

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

Closed
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
4 changes: 4 additions & 0 deletions api/v1beta1/gcpmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,10 @@ type GCPMachineSpec struct {
// RootDiskEncryptionKey defines the KMS key to be used to encrypt the root disk.
// +optional
RootDiskEncryptionKey *CustomerEncryptionKey `json:"rootDiskEncryptionKey,omitempty"`

// IPAddress is the internal ip address to assign to the machine
// +optional
IPAddress *string `json:"ipAddress,omitempty"`
}

// MetadataItem defines a single piece of metadata associated with an instance.
Expand Down
5 changes: 5 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.

3 changes: 3 additions & 0 deletions cloud/scope/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ func (m *MachineScope) InstanceNetworkInterfaceSpec() *compute.NetworkInterface
networkInterface.Subnetwork = path.Join("projects", m.ClusterGetter.NetworkProject(), "regions", m.ClusterGetter.Region(), "subnetworks", *m.GCPMachine.Spec.Subnet)
}

if m.GCPMachine.Spec.IPAddress != nil {
networkInterface.NetworkIP = *m.GCPMachine.Spec.IPAddress
}
return networkInterface
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ spec:
description: 'InstanceType is the type of instance to create. Example:
n1.standard-2'
type: string
ipAddress:
description: IPAddress is the internal ip address to assign to the
machine
type: string
ipForwarding:
default: Enabled
description: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ spec:
description: 'InstanceType is the type of instance to create.
Example: n1.standard-2'
type: string
ipAddress:
description: IPAddress is the internal ip address to assign
to the machine
type: string
ipForwarding:
default: Enabled
description: |-
Expand Down