From 6bbddf279b1b60e3229a338151659d2644de452b Mon Sep 17 00:00:00 2001 From: Flavio Percoco Date: Thu, 28 Feb 2019 18:15:22 +0100 Subject: [PATCH 1/2] vendor: Update cluster-api-provider-openstack --- Gopkg.lock | 4 +-- .../openstackproviderconfig/v1alpha1/types.go | 26 +++++++++++++- .../v1alpha1/zz_generated.deepcopy.go | 35 ++++++++++++++++++- 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 97db97b4c0d..5ffd267f764 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -883,14 +883,14 @@ [[projects]] branch = "master" - digest = "1:4c282f9a6274e8614446fbbe4faad65ea1588ebff812eaae286355f56fd81236" + digest = "1:55b6b7044d6e27db021b0e645e6c135958815a27bde5e5167e52e85888f8569e" name = "sigs.k8s.io/cluster-api-provider-openstack" packages = [ "pkg/apis", "pkg/apis/openstackproviderconfig/v1alpha1", ] pruneopts = "NUT" - revision = "2b8ee6bc02ae0c13e88e6484b8097adba4e7a894" + revision = "9e913e83ca639e7f6e10fdffa8445f504b101f3c" source = "https://github.com/openshift/cluster-api-provider-openstack.git" [[projects]] diff --git a/vendor/sigs.k8s.io/cluster-api-provider-openstack/pkg/apis/openstackproviderconfig/v1alpha1/types.go b/vendor/sigs.k8s.io/cluster-api-provider-openstack/pkg/apis/openstackproviderconfig/v1alpha1/types.go index 93a895206b5..22774bf45e6 100644 --- a/vendor/sigs.k8s.io/cluster-api-provider-openstack/pkg/apis/openstackproviderconfig/v1alpha1/types.go +++ b/vendor/sigs.k8s.io/cluster-api-provider-openstack/pkg/apis/openstackproviderconfig/v1alpha1/types.go @@ -60,7 +60,7 @@ type OpenstackProviderSpec struct { AvailabilityZone string `json:"availabilityZone,omitempty"` // The names of the security groups to assign to the instance - SecurityGroups []string `json:"securityGroups,omitempty"` + SecurityGroups []SecurityGroupParam `json:"securityGroups,omitempty"` // The name of the secret containing the user data (startup script in most cases) UserDataSecret *corev1.SecretReference `json:"userDataSecret,omitempty"` @@ -71,6 +71,30 @@ type OpenstackProviderSpec struct { RootVolume RootVolume `json:"root_volume,omitempty"` } +type SecurityGroupParam struct { + // Security Group UID + UUID string `json:"uuid,omitempty"` + // Security Group name + Name string `json:"name,omitempty"` + // Filters used to query security groups in openstack + Filter SecurityGroupFilter `json:"filter,omitempty"` +} + +type SecurityGroupFilter struct { + ID string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + TenantID string `json:"tenant_id,omitempty"` + ProjectID string `json:"project_id,omitempty"` + Limit int `json:"limit,omitempty"` + Marker string `json:"marker,omitempty"` + SortKey string `json:"sort_key,omitempty"` + SortDir string `json:"sort_dir,omitempty"` + Tags string `json:"tags,omitempty"` + TagsAny string `json:"tags-any,omitempty"` + NotTags string `json:"not-tags,omitempty"` + NotTagsAny string `json:"not-tags-any,omitempty"` +} + type NetworkParam struct { // The UUID of the network. Required if you omit the port attribute. UUID string `json:"uuid,omitempty"` diff --git a/vendor/sigs.k8s.io/cluster-api-provider-openstack/pkg/apis/openstackproviderconfig/v1alpha1/zz_generated.deepcopy.go b/vendor/sigs.k8s.io/cluster-api-provider-openstack/pkg/apis/openstackproviderconfig/v1alpha1/zz_generated.deepcopy.go index abe7b821c0d..03da0481fc7 100644 --- a/vendor/sigs.k8s.io/cluster-api-provider-openstack/pkg/apis/openstackproviderconfig/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/sigs.k8s.io/cluster-api-provider-openstack/pkg/apis/openstackproviderconfig/v1alpha1/zz_generated.deepcopy.go @@ -202,7 +202,7 @@ func (in *OpenstackProviderSpec) DeepCopyInto(out *OpenstackProviderSpec) { } if in.SecurityGroups != nil { in, out := &in.SecurityGroups, &out.SecurityGroups - *out = make([]string, len(*in)) + *out = make([]SecurityGroupParam, len(*in)) copy(*out, *in) } if in.UserDataSecret != nil { @@ -285,6 +285,39 @@ func (in *SecurityGroup) DeepCopy() *SecurityGroup { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecurityGroupFilter) DeepCopyInto(out *SecurityGroupFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityGroupFilter. +func (in *SecurityGroupFilter) DeepCopy() *SecurityGroupFilter { + if in == nil { + return nil + } + out := new(SecurityGroupFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecurityGroupParam) DeepCopyInto(out *SecurityGroupParam) { + *out = *in + out.Filter = in.Filter + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityGroupParam. +func (in *SecurityGroupParam) DeepCopy() *SecurityGroupParam { + if in == nil { + return nil + } + out := new(SecurityGroupParam) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SecurityGroupRule) DeepCopyInto(out *SecurityGroupRule) { *out = *in From 4be30412fea776a58ec4e49ba92d40fa2811e5cf Mon Sep 17 00:00:00 2001 From: Flavio Percoco Date: Thu, 28 Feb 2019 18:17:21 +0100 Subject: [PATCH 2/2] openstack: Update security group management --- pkg/asset/machines/openstack/machines.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/asset/machines/openstack/machines.go b/pkg/asset/machines/openstack/machines.go index 494a8a55076..2440050953c 100644 --- a/pkg/asset/machines/openstack/machines.go +++ b/pkg/asset/machines/openstack/machines.go @@ -106,7 +106,11 @@ func provider(clusterID string, platform *openstack.Platform, mpool *openstack.M }, }, AvailabilityZone: az, - SecurityGroups: []string{role}, + SecurityGroups: []openstackprovider.SecurityGroupParam{ + { + Name: role, + }, + }, // TODO(flaper87): Trunk support missing. Need to add it back }, nil }