Merge pull request #10616 from ottosulin/azhints

Add network and router availability zone hints to OpenStack
This commit is contained in:
Kubernetes Prow Robot 2021-01-20 08:56:00 -08:00 committed by GitHub
commit 04e61e4965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 305 additions and 27 deletions

View File

@ -322,9 +322,21 @@ spec:
timeout:
type: string
type: object
network:
description: OpenstackNetwork defines the config for a network
properties:
availabilityZoneHints:
items:
type: string
type: array
type: object
router:
description: OpenstackRouter defines the config for a router
properties:
availabilityZoneHints:
items:
type: string
type: array
dnsServers:
type: string
externalNetwork:

View File

@ -749,9 +749,15 @@ type OpenstackMonitor struct {
// OpenstackRouter defines the config for a router
type OpenstackRouter struct {
ExternalNetwork *string `json:"externalNetwork,omitempty"`
DNSServers *string `json:"dnsServers,omitempty"`
ExternalSubnet *string `json:"externalSubnet,omitempty"`
ExternalNetwork *string `json:"externalNetwork,omitempty"`
DNSServers *string `json:"dnsServers,omitempty"`
ExternalSubnet *string `json:"externalSubnet,omitempty"`
AvailabilityZoneHints []*string `json:"availabilityZoneHints,omitempty"`
}
// OpenstackNetwork defines the config for a network
type OpenstackNetwork struct {
AvailabilityZoneHints []*string `json:"availabilityZoneHints,omitempty"`
}
// OpenstackConfiguration defines cloud config elements for the openstack cloud provider
@ -761,6 +767,7 @@ type OpenstackConfiguration struct {
Router *OpenstackRouter `json:"router,omitempty"`
BlockStorage *OpenstackBlockStorageConfig `json:"blockStorage,omitempty"`
InsecureSkipVerify *bool `json:"insecureSkipVerify,omitempty"`
Network *OpenstackNetwork `json:"network,omitempty"`
}
// AzureConfiguration defines Azure specific cluster configuration.

View File

@ -748,9 +748,15 @@ type OpenstackMonitor struct {
// OpenstackRouter defines the config for a router
type OpenstackRouter struct {
ExternalNetwork *string `json:"externalNetwork,omitempty"`
DNSServers *string `json:"dnsServers,omitempty"`
ExternalSubnet *string `json:"externalSubnet,omitempty"`
ExternalNetwork *string `json:"externalNetwork,omitempty"`
DNSServers *string `json:"dnsServers,omitempty"`
ExternalSubnet *string `json:"externalSubnet,omitempty"`
AvailabilityZoneHints []*string `json:"availabilityZoneHints,omitempty"`
}
// OpenstackNetwork defines the config for a network
type OpenstackNetwork struct {
AvailabilityZoneHints []*string `json:"availabilityZoneHints,omitempty"`
}
// OpenstackConfiguration defines cloud config elements for the openstack cloud provider
@ -760,6 +766,7 @@ type OpenstackConfiguration struct {
Router *OpenstackRouter `json:"router,omitempty"`
BlockStorage *OpenstackBlockStorageConfig `json:"blockStorage,omitempty"`
InsecureSkipVerify *bool `json:"insecureSkipVerify,omitempty"`
Network *OpenstackNetwork `json:"network,omitempty"`
}
// AzureConfiguration defines Azure specific cluster configuration.

View File

@ -863,6 +863,16 @@ func RegisterConversions(s *runtime.Scheme) error {
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*OpenstackNetwork)(nil), (*kops.OpenstackNetwork)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha2_OpenstackNetwork_To_kops_OpenstackNetwork(a.(*OpenstackNetwork), b.(*kops.OpenstackNetwork), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*kops.OpenstackNetwork)(nil), (*OpenstackNetwork)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_kops_OpenstackNetwork_To_v1alpha2_OpenstackNetwork(a.(*kops.OpenstackNetwork), b.(*OpenstackNetwork), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*OpenstackRouter)(nil), (*kops.OpenstackRouter)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha2_OpenstackRouter_To_kops_OpenstackRouter(a.(*OpenstackRouter), b.(*kops.OpenstackRouter), scope)
}); err != nil {
@ -5634,6 +5644,15 @@ func autoConvert_v1alpha2_OpenstackConfiguration_To_kops_OpenstackConfiguration(
out.BlockStorage = nil
}
out.InsecureSkipVerify = in.InsecureSkipVerify
if in.Network != nil {
in, out := &in.Network, &out.Network
*out = new(kops.OpenstackNetwork)
if err := Convert_v1alpha2_OpenstackNetwork_To_kops_OpenstackNetwork(*in, *out, s); err != nil {
return err
}
} else {
out.Network = nil
}
return nil
}
@ -5680,6 +5699,15 @@ func autoConvert_kops_OpenstackConfiguration_To_v1alpha2_OpenstackConfiguration(
out.BlockStorage = nil
}
out.InsecureSkipVerify = in.InsecureSkipVerify
if in.Network != nil {
in, out := &in.Network, &out.Network
*out = new(OpenstackNetwork)
if err := Convert_kops_OpenstackNetwork_To_v1alpha2_OpenstackNetwork(*in, *out, s); err != nil {
return err
}
} else {
out.Network = nil
}
return nil
}
@ -5746,10 +5774,31 @@ func Convert_kops_OpenstackMonitor_To_v1alpha2_OpenstackMonitor(in *kops.Opensta
return autoConvert_kops_OpenstackMonitor_To_v1alpha2_OpenstackMonitor(in, out, s)
}
func autoConvert_v1alpha2_OpenstackNetwork_To_kops_OpenstackNetwork(in *OpenstackNetwork, out *kops.OpenstackNetwork, s conversion.Scope) error {
out.AvailabilityZoneHints = in.AvailabilityZoneHints
return nil
}
// Convert_v1alpha2_OpenstackNetwork_To_kops_OpenstackNetwork is an autogenerated conversion function.
func Convert_v1alpha2_OpenstackNetwork_To_kops_OpenstackNetwork(in *OpenstackNetwork, out *kops.OpenstackNetwork, s conversion.Scope) error {
return autoConvert_v1alpha2_OpenstackNetwork_To_kops_OpenstackNetwork(in, out, s)
}
func autoConvert_kops_OpenstackNetwork_To_v1alpha2_OpenstackNetwork(in *kops.OpenstackNetwork, out *OpenstackNetwork, s conversion.Scope) error {
out.AvailabilityZoneHints = in.AvailabilityZoneHints
return nil
}
// Convert_kops_OpenstackNetwork_To_v1alpha2_OpenstackNetwork is an autogenerated conversion function.
func Convert_kops_OpenstackNetwork_To_v1alpha2_OpenstackNetwork(in *kops.OpenstackNetwork, out *OpenstackNetwork, s conversion.Scope) error {
return autoConvert_kops_OpenstackNetwork_To_v1alpha2_OpenstackNetwork(in, out, s)
}
func autoConvert_v1alpha2_OpenstackRouter_To_kops_OpenstackRouter(in *OpenstackRouter, out *kops.OpenstackRouter, s conversion.Scope) error {
out.ExternalNetwork = in.ExternalNetwork
out.DNSServers = in.DNSServers
out.ExternalSubnet = in.ExternalSubnet
out.AvailabilityZoneHints = in.AvailabilityZoneHints
return nil
}
@ -5762,6 +5811,7 @@ func autoConvert_kops_OpenstackRouter_To_v1alpha2_OpenstackRouter(in *kops.Opens
out.ExternalNetwork = in.ExternalNetwork
out.DNSServers = in.DNSServers
out.ExternalSubnet = in.ExternalSubnet
out.AvailabilityZoneHints = in.AvailabilityZoneHints
return nil
}

View File

@ -3826,6 +3826,11 @@ func (in *OpenstackConfiguration) DeepCopyInto(out *OpenstackConfiguration) {
*out = new(bool)
**out = **in
}
if in.Network != nil {
in, out := &in.Network, &out.Network
*out = new(OpenstackNetwork)
(*in).DeepCopyInto(*out)
}
return
}
@ -3926,6 +3931,33 @@ func (in *OpenstackMonitor) DeepCopy() *OpenstackMonitor {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *OpenstackNetwork) DeepCopyInto(out *OpenstackNetwork) {
*out = *in
if in.AvailabilityZoneHints != nil {
in, out := &in.AvailabilityZoneHints, &out.AvailabilityZoneHints
*out = make([]*string, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(string)
**out = **in
}
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenstackNetwork.
func (in *OpenstackNetwork) DeepCopy() *OpenstackNetwork {
if in == nil {
return nil
}
out := new(OpenstackNetwork)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *OpenstackRouter) DeepCopyInto(out *OpenstackRouter) {
*out = *in
@ -3944,6 +3976,17 @@ func (in *OpenstackRouter) DeepCopyInto(out *OpenstackRouter) {
*out = new(string)
**out = **in
}
if in.AvailabilityZoneHints != nil {
in, out := &in.AvailabilityZoneHints, &out.AvailabilityZoneHints
*out = make([]*string, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(string)
**out = **in
}
}
}
return
}

View File

@ -4040,6 +4040,11 @@ func (in *OpenstackConfiguration) DeepCopyInto(out *OpenstackConfiguration) {
*out = new(bool)
**out = **in
}
if in.Network != nil {
in, out := &in.Network, &out.Network
*out = new(OpenstackNetwork)
(*in).DeepCopyInto(*out)
}
return
}
@ -4140,6 +4145,33 @@ func (in *OpenstackMonitor) DeepCopy() *OpenstackMonitor {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *OpenstackNetwork) DeepCopyInto(out *OpenstackNetwork) {
*out = *in
if in.AvailabilityZoneHints != nil {
in, out := &in.AvailabilityZoneHints, &out.AvailabilityZoneHints
*out = make([]*string, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(string)
**out = **in
}
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenstackNetwork.
func (in *OpenstackNetwork) DeepCopy() *OpenstackNetwork {
if in == nil {
return nil
}
out := new(OpenstackNetwork)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *OpenstackRouter) DeepCopyInto(out *OpenstackRouter) {
*out = *in
@ -4158,6 +4190,17 @@ func (in *OpenstackRouter) DeepCopyInto(out *OpenstackRouter) {
*out = new(string)
**out = **in
}
if in.AvailabilityZoneHints != nil {
in, out := &in.AvailabilityZoneHints, &out.AvailabilityZoneHints
*out = make([]*string, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(string)
**out = **in
}
}
}
return
}

View File

@ -34,6 +34,8 @@ var _ fi.ModelBuilder = &NetworkModelBuilder{}
func (b *NetworkModelBuilder) Build(c *fi.ModelBuilderContext) error {
clusterName := b.ClusterName()
osSpec := b.Cluster.Spec.CloudConfig.Openstack
netName, err := b.GetNetworkName()
if err != nil {
return err
@ -45,12 +47,12 @@ func (b *NetworkModelBuilder) Build(c *fi.ModelBuilderContext) error {
Tag: s(clusterName),
Lifecycle: b.Lifecycle,
}
if osSpec.Network != nil {
t.AvailabilityZoneHints = osSpec.Network.AvailabilityZoneHints
}
c.AddTask(t)
}
osSpec := b.Cluster.Spec.CloudConfig.Openstack
needRouter := true
//Do not need router if there is no external network
if osSpec.Router == nil || osSpec.Router.ExternalNetwork == nil {
@ -100,6 +102,9 @@ func (b *NetworkModelBuilder) Build(c *fi.ModelBuilderContext) error {
Name: s(routerName),
Lifecycle: b.Lifecycle,
}
if osSpec.Router != nil {
t.AvailabilityZoneHints = osSpec.Router.AvailabilityZoneHints
}
c.AddTask(t)
}

View File

@ -29,6 +29,7 @@ Port:
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -73,6 +74,7 @@ ID: null
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster

View File

@ -29,6 +29,7 @@ Port:
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -71,6 +72,7 @@ ID: null
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster

View File

@ -29,6 +29,7 @@ Port:
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -71,6 +72,7 @@ ID: null
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster

View File

@ -79,6 +79,7 @@ Port:
Lifecycle: Sync
Name: port-master-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -157,6 +158,7 @@ Port:
Lifecycle: Sync
Name: port-master-2-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -235,6 +237,7 @@ Port:
Lifecycle: Sync
Name: port-master-3-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -312,6 +315,7 @@ Port:
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -383,6 +387,7 @@ Port:
Lifecycle: Sync
Name: port-node-2-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -454,6 +459,7 @@ Port:
Lifecycle: Sync
Name: port-node-3-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -496,6 +502,7 @@ ID: null
Lifecycle: Sync
Name: port-master-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -528,6 +535,7 @@ ID: null
Lifecycle: Sync
Name: port-master-2-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -560,6 +568,7 @@ ID: null
Lifecycle: Sync
Name: port-master-3-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -592,6 +601,7 @@ ID: null
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -618,6 +628,7 @@ ID: null
Lifecycle: Sync
Name: port-node-2-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -644,6 +655,7 @@ ID: null
Lifecycle: Sync
Name: port-node-3-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster

View File

@ -80,6 +80,7 @@ Port:
Lifecycle: Sync
Name: port-master-a-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -146,6 +147,7 @@ Port:
Lifecycle: Sync
Name: port-master-b-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -212,6 +214,7 @@ Port:
Lifecycle: Sync
Name: port-master-c-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -283,6 +286,7 @@ Port:
Lifecycle: Sync
Name: port-node-a-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -354,6 +358,7 @@ Port:
Lifecycle: Sync
Name: port-node-b-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -425,6 +430,7 @@ Port:
Lifecycle: Sync
Name: port-node-c-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -621,6 +627,7 @@ ID: null
Lifecycle: Sync
Name: port-master-a-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -647,6 +654,7 @@ ID: null
Lifecycle: Sync
Name: port-master-b-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -673,6 +681,7 @@ ID: null
Lifecycle: Sync
Name: port-master-c-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -699,6 +708,7 @@ ID: null
Lifecycle: Sync
Name: port-node-a-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -725,6 +735,7 @@ ID: null
Lifecycle: Sync
Name: port-node-b-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -751,6 +762,7 @@ ID: null
Lifecycle: Sync
Name: port-node-c-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster

View File

@ -87,6 +87,7 @@ Port:
Lifecycle: Sync
Name: port-master-a-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -165,6 +166,7 @@ Port:
Lifecycle: Sync
Name: port-master-b-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -243,6 +245,7 @@ Port:
Lifecycle: Sync
Name: port-master-c-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -320,6 +323,7 @@ Port:
Lifecycle: Sync
Name: port-node-a-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -391,6 +395,7 @@ Port:
Lifecycle: Sync
Name: port-node-b-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -462,6 +467,7 @@ Port:
Lifecycle: Sync
Name: port-node-c-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -504,6 +510,7 @@ ID: null
Lifecycle: Sync
Name: port-master-a-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -536,6 +543,7 @@ ID: null
Lifecycle: Sync
Name: port-master-b-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -568,6 +576,7 @@ ID: null
Lifecycle: Sync
Name: port-master-c-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -600,6 +609,7 @@ ID: null
Lifecycle: Sync
Name: port-node-a-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -626,6 +636,7 @@ ID: null
Lifecycle: Sync
Name: port-node-b-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -652,6 +663,7 @@ ID: null
Lifecycle: Sync
Name: port-node-c-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster

View File

@ -39,6 +39,7 @@ Port:
Lifecycle: Sync
Name: port-master-a-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -111,6 +112,7 @@ Port:
Lifecycle: Sync
Name: port-master-b-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -183,6 +185,7 @@ Port:
Lifecycle: Sync
Name: port-master-c-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -254,6 +257,7 @@ Port:
Lifecycle: Sync
Name: port-node-a-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -319,6 +323,7 @@ Port:
Lifecycle: Sync
Name: port-node-b-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -384,6 +389,7 @@ Port:
Lifecycle: Sync
Name: port-node-c-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -426,6 +432,7 @@ ID: null
Lifecycle: Sync
Name: port-master-a-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -458,6 +465,7 @@ ID: null
Lifecycle: Sync
Name: port-master-b-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -490,6 +498,7 @@ ID: null
Lifecycle: Sync
Name: port-master-c-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -522,6 +531,7 @@ ID: null
Lifecycle: Sync
Name: port-node-a-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -548,6 +558,7 @@ ID: null
Lifecycle: Sync
Name: port-node-b-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -574,6 +585,7 @@ ID: null
Lifecycle: Sync
Name: port-node-c-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster

View File

@ -31,6 +31,7 @@ Port:
Lifecycle: Sync
Name: port-bastion-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -97,6 +98,7 @@ Port:
Lifecycle: Sync
Name: port-master-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -168,6 +170,7 @@ Port:
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -210,6 +213,7 @@ ID: null
Lifecycle: Sync
Name: port-bastion-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -236,6 +240,7 @@ ID: null
Lifecycle: Sync
Name: port-master-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -268,6 +273,7 @@ ID: null
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster

View File

@ -51,6 +51,7 @@ Port:
Lifecycle: Sync
Name: port-bastion-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -123,6 +124,7 @@ Port:
Lifecycle: Sync
Name: port-master-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -194,6 +196,7 @@ Port:
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -236,6 +239,7 @@ ID: null
Lifecycle: Sync
Name: port-bastion-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -262,6 +266,7 @@ ID: null
Lifecycle: Sync
Name: port-master-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -294,6 +299,7 @@ ID: null
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster

View File

@ -31,6 +31,7 @@ Port:
Lifecycle: Sync
Name: port-master-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -102,6 +103,7 @@ Port:
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -144,6 +146,7 @@ ID: null
Lifecycle: Sync
Name: port-master-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -176,6 +179,7 @@ ID: null
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster

View File

@ -51,6 +51,7 @@ Port:
Lifecycle: Sync
Name: port-master-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -128,6 +129,7 @@ Port:
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -170,6 +172,7 @@ ID: null
Lifecycle: Sync
Name: port-master-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -202,6 +205,7 @@ ID: null
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster

View File

@ -29,6 +29,7 @@ Port:
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -73,6 +74,7 @@ ID: null
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster

View File

@ -29,6 +29,7 @@ Port:
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster
@ -73,6 +74,7 @@ ID: null
Lifecycle: Sync
Name: port-node-1-cluster
Network:
AvailabilityZoneHints: null
ID: null
Lifecycle: null
Name: cluster

View File

@ -27,10 +27,11 @@ import (
// +kops:fitask
type Network struct {
ID *string
Name *string
Lifecycle *fi.Lifecycle
Tag *string
ID *string
Name *string
Lifecycle *fi.Lifecycle
Tag *string
AvailabilityZoneHints []*string
}
var _ fi.CompareWithID = &Network{}
@ -46,10 +47,11 @@ func NewNetworkTaskFromCloud(cloud openstack.OpenstackCloud, lifecycle *fi.Lifec
}
task := &Network{
ID: fi.String(network.ID),
Name: fi.String(network.Name),
Lifecycle: lifecycle,
Tag: fi.String(tag),
ID: fi.String(network.ID),
Name: fi.String(network.Name),
Lifecycle: lifecycle,
Tag: fi.String(tag),
AvailabilityZoneHints: fi.StringSlice(network.AvailabilityZoneHints),
}
return task, nil
}
@ -98,6 +100,9 @@ func (_ *Network) CheckChanges(a, e, changes *Network) error {
if changes.Name != nil {
return fi.CannotChangeField("Name")
}
if changes.AvailabilityZoneHints != nil {
return fi.CannotChangeField("AvailabilityZoneHints")
}
}
return nil
}
@ -114,8 +119,9 @@ func (_ *Network) RenderOpenstack(t *openstack.OpenstackAPITarget, a, e, changes
klog.V(2).Infof("Creating Network with name:%q", fi.StringValue(e.Name))
opt := networks.CreateOpts{
Name: fi.StringValue(e.Name),
AdminStateUp: fi.Bool(true),
Name: fi.StringValue(e.Name),
AdminStateUp: fi.Bool(true),
AvailabilityZoneHints: fi.StringSliceValue(e.AvailabilityZoneHints),
}
v, err := t.Cloud.CreateNetwork(opt)

View File

@ -27,9 +27,10 @@ import (
// +kops:fitask
type Router struct {
ID *string
Name *string
Lifecycle *fi.Lifecycle
ID *string
Name *string
Lifecycle *fi.Lifecycle
AvailabilityZoneHints []*string
}
var _ fi.CompareWithID = &Router{}
@ -38,11 +39,13 @@ func (n *Router) CompareWithID() *string {
return n.ID
}
//NewRouterTaskFromCloud initializes and returns a new Router
func NewRouterTaskFromCloud(cloud openstack.OpenstackCloud, lifecycle *fi.Lifecycle, router *routers.Router, find *Router) (*Router, error) {
actual := &Router{
ID: fi.String(router.ID),
Name: fi.String(router.Name),
Lifecycle: lifecycle,
ID: fi.String(router.ID),
Name: fi.String(router.Name),
Lifecycle: lifecycle,
AvailabilityZoneHints: fi.StringSlice(router.AvailabilityZoneHints),
}
if find != nil {
find.ID = actual.ID
@ -81,6 +84,9 @@ func (_ *Router) CheckChanges(a, e, changes *Router) error {
if changes.Name != nil {
return fi.CannotChangeField("Name")
}
if changes.AvailabilityZoneHints != nil {
return fi.CannotChangeField("AvailabilityZoneHints")
}
}
return nil
}
@ -90,8 +96,9 @@ func (_ *Router) RenderOpenstack(t *openstack.OpenstackAPITarget, a, e, changes
klog.V(2).Infof("Creating Router with name:%q", fi.StringValue(e.Name))
opt := routers.CreateOpts{
Name: fi.StringValue(e.Name),
AdminStateUp: fi.Bool(true),
Name: fi.StringValue(e.Name),
AdminStateUp: fi.Bool(true),
AvailabilityZoneHints: fi.StringSliceValue(e.AvailabilityZoneHints),
}
floatingNet, err := t.Cloud.GetExternalNetwork()
if err != nil {

View File

@ -30,6 +30,17 @@ func StringValue(s *string) string {
return *s
}
//StringSliceValue takes a slice of string pointers and returns a slice of strings
func StringSliceValue(stringSlice []*string) []string {
var newSlice []string
for _, value := range stringSlice {
if value != nil {
newSlice = append(newSlice, *value)
}
}
return newSlice
}
func IsNilOrEmpty(s *string) bool {
if s == nil {
return true
@ -43,6 +54,15 @@ func String(s string) *string {
return &s
}
// StringSlice is a helper that builds a []*string from a slice of strings
func StringSlice(stringSlice []string) []*string {
var newSlice []*string
for i := range stringSlice {
newSlice = append(newSlice, &stringSlice[i])
}
return newSlice
}
// Float32 returns a point to a float32
func Float32(v float32) *float32 {
return &v