metadata: clarify networking variables

This commit is contained in:
Leonard Cohnen 2022-10-26 00:27:40 +02:00 committed by 3u13r
parent 0430336fdf
commit b69d19c3d6
3 changed files with 9 additions and 6 deletions

View file

@ -120,7 +120,7 @@ func (k *KubeWrapper) InitCluster(
nodeName = k8sCompliantHostname(instance.Name) nodeName = k8sCompliantHostname(instance.Name)
providerID = instance.ProviderID providerID = instance.ProviderID
nodeIP = instance.VPCIP nodeIP = instance.VPCIP
subnetworkPodCIDR = instance.SubnetworkCIDR subnetworkPodCIDR = instance.SecondaryIPRange
if len(instance.AliasIPRanges) > 0 { if len(instance.AliasIPRanges) > 0 {
nodePodCIDR = instance.AliasIPRanges[0] nodePodCIDR = instance.AliasIPRanges[0]

View file

@ -92,7 +92,7 @@ func (m *Metadata) Self(ctx context.Context) (metadata.InstanceMetadata, error)
if err != nil { if err != nil {
return metadata.InstanceMetadata{}, err return metadata.InstanceMetadata{}, err
} }
instance.SubnetworkCIDR = subnetCIDR instance.SecondaryIPRange = subnetCIDR
return instance, nil return instance, nil
} }

View file

@ -24,14 +24,17 @@ type InstanceMetadata struct {
// VPCIP is the primary IP address of the instance in the VPC. // VPCIP is the primary IP address of the instance in the VPC.
VPCIP string VPCIP string
// PublicIP is the primary public IP of the instance, if available, empty string otherwise. // PublicIP is the primary public IP of the instance, if available, empty string otherwise.
PublicIP string PublicIP string
AliasIPRanges []string
// SSHKeys maps usernames to ssh public keys. // SSHKeys maps usernames to ssh public keys.
SSHKeys map[string][]string SSHKeys map[string][]string
// SubnetworkCIDR is the CIDR of the subnetwork the instance is in. // SecondaryIPRange is the VPC wide CIDR from which subnets are attached to VMs as AliasIPRanges.
// May be empty on certain CSPs. // May be empty on certain CSPs.
SubnetworkCIDR string SecondaryIPRange string
// AliasIPRanges is a list of IP ranges that are attached.
// May be empty on certain CSPs.
AliasIPRanges []string
} }
type InstanceSelfer interface { type InstanceSelfer interface {