Skip to content

Commit a22f805

Browse files
authored
Merge pull request #1246 from Nordix/sg-by-name
Passing security groups by specifying more options in addition to UUIDs on ports
2 parents c29befe + a14dcd6 commit a22f805

12 files changed

+425
-10
lines changed

api/v1alpha4/conversion_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ func TestFuzzyConversion(t *testing.T) {
264264
v1alpha5PortOpts.Network = nil
265265
}
266266
}
267+
v1alpha5PortOpts.SecurityGroupFilters = nil
267268
},
268269
func(v1alpha5FixedIP *infrav1.FixedIP, c fuzz.Continue) {
269270
c.FuzzNoCustom(v1alpha5FixedIP)

api/v1alpha4/zz_generated.conversion.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha5/types.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,14 @@ type PortOpts struct {
114114
AdminStateUp *bool `json:"adminStateUp,omitempty"`
115115
MACAddress string `json:"macAddress,omitempty"`
116116
// Specify pairs of subnet and/or IP address. These should be subnets of the network with the given NetworkID.
117-
FixedIPs []FixedIP `json:"fixedIPs,omitempty"`
118-
TenantID string `json:"tenantId,omitempty"`
119-
ProjectID string `json:"projectId,omitempty"`
120-
SecurityGroups *[]string `json:"securityGroups,omitempty"`
121-
AllowedAddressPairs []AddressPair `json:"allowedAddressPairs,omitempty"`
117+
FixedIPs []FixedIP `json:"fixedIPs,omitempty"`
118+
TenantID string `json:"tenantId,omitempty"`
119+
ProjectID string `json:"projectId,omitempty"`
120+
// The uuids of the security groups to assign to the instance
121+
SecurityGroups *[]string `json:"securityGroups,omitempty"`
122+
// The names, uuids, filters or any combination these of the security groups to assign to the instance
123+
SecurityGroupFilters []SecurityGroupParam `json:"securityGroupFilters,omitempty"`
124+
AllowedAddressPairs []AddressPair `json:"allowedAddressPairs,omitempty"`
122125
// Enables and disables trunk at port level. If not provided, openStackMachine.Spec.Trunk is inherited.
123126
Trunk *bool `json:"trunk,omitempty"`
124127

api/v1alpha5/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2779,7 +2779,53 @@ spec:
27792779
type: object
27802780
projectId:
27812781
type: string
2782+
securityGroupFilters:
2783+
description: The names, uuids, filters or any combination
2784+
these of the security groups to assign to the instance
2785+
items:
2786+
properties:
2787+
filter:
2788+
description: Filters used to query security groups
2789+
in openstack
2790+
properties:
2791+
description:
2792+
type: string
2793+
id:
2794+
type: string
2795+
limit:
2796+
type: integer
2797+
marker:
2798+
type: string
2799+
name:
2800+
type: string
2801+
notTags:
2802+
type: string
2803+
notTagsAny:
2804+
type: string
2805+
projectId:
2806+
type: string
2807+
sortDir:
2808+
type: string
2809+
sortKey:
2810+
type: string
2811+
tags:
2812+
type: string
2813+
tagsAny:
2814+
type: string
2815+
tenantId:
2816+
type: string
2817+
type: object
2818+
name:
2819+
description: Security Group name
2820+
type: string
2821+
uuid:
2822+
description: Security Group UID
2823+
type: string
2824+
type: object
2825+
type: array
27822826
securityGroups:
2827+
description: The uuids of the security groups to assign
2828+
to the instance
27832829
items:
27842830
type: string
27852831
type: array
@@ -3252,7 +3298,53 @@ spec:
32523298
type: object
32533299
projectId:
32543300
type: string
3301+
securityGroupFilters:
3302+
description: The names, uuids, filters or any combination
3303+
these of the security groups to assign to the instance
3304+
items:
3305+
properties:
3306+
filter:
3307+
description: Filters used to query security groups
3308+
in openstack
3309+
properties:
3310+
description:
3311+
type: string
3312+
id:
3313+
type: string
3314+
limit:
3315+
type: integer
3316+
marker:
3317+
type: string
3318+
name:
3319+
type: string
3320+
notTags:
3321+
type: string
3322+
notTagsAny:
3323+
type: string
3324+
projectId:
3325+
type: string
3326+
sortDir:
3327+
type: string
3328+
sortKey:
3329+
type: string
3330+
tags:
3331+
type: string
3332+
tagsAny:
3333+
type: string
3334+
tenantId:
3335+
type: string
3336+
type: object
3337+
name:
3338+
description: Security Group name
3339+
type: string
3340+
uuid:
3341+
description: Security Group UID
3342+
type: string
3343+
type: object
3344+
type: array
32553345
securityGroups:
3346+
description: The uuids of the security groups to assign
3347+
to the instance
32563348
items:
32573349
type: string
32583350
type: array
@@ -3586,7 +3678,53 @@ spec:
35863678
type: object
35873679
projectId:
35883680
type: string
3681+
securityGroupFilters:
3682+
description: The names, uuids, filters or any combination
3683+
these of the security groups to assign to the instance
3684+
items:
3685+
properties:
3686+
filter:
3687+
description: Filters used to query security groups in
3688+
openstack
3689+
properties:
3690+
description:
3691+
type: string
3692+
id:
3693+
type: string
3694+
limit:
3695+
type: integer
3696+
marker:
3697+
type: string
3698+
name:
3699+
type: string
3700+
notTags:
3701+
type: string
3702+
notTagsAny:
3703+
type: string
3704+
projectId:
3705+
type: string
3706+
sortDir:
3707+
type: string
3708+
sortKey:
3709+
type: string
3710+
tags:
3711+
type: string
3712+
tagsAny:
3713+
type: string
3714+
tenantId:
3715+
type: string
3716+
type: object
3717+
name:
3718+
description: Security Group name
3719+
type: string
3720+
uuid:
3721+
description: Security Group UID
3722+
type: string
3723+
type: object
3724+
type: array
35893725
securityGroups:
3726+
description: The uuids of the security groups to assign to
3727+
the instance
35903728
items:
35913729
type: string
35923730
type: array
@@ -3834,7 +3972,53 @@ spec:
38343972
type: object
38353973
projectId:
38363974
type: string
3975+
securityGroupFilters:
3976+
description: The names, uuids, filters or any combination
3977+
these of the security groups to assign to the instance
3978+
items:
3979+
properties:
3980+
filter:
3981+
description: Filters used to query security groups in
3982+
openstack
3983+
properties:
3984+
description:
3985+
type: string
3986+
id:
3987+
type: string
3988+
limit:
3989+
type: integer
3990+
marker:
3991+
type: string
3992+
name:
3993+
type: string
3994+
notTags:
3995+
type: string
3996+
notTagsAny:
3997+
type: string
3998+
projectId:
3999+
type: string
4000+
sortDir:
4001+
type: string
4002+
sortKey:
4003+
type: string
4004+
tags:
4005+
type: string
4006+
tagsAny:
4007+
type: string
4008+
tenantId:
4009+
type: string
4010+
type: object
4011+
name:
4012+
description: Security Group name
4013+
type: string
4014+
uuid:
4015+
description: Security Group UID
4016+
type: string
4017+
type: object
4018+
type: array
38374019
securityGroups:
4020+
description: The uuids of the security groups to assign to
4021+
the instance
38384022
items:
38394023
type: string
38404024
type: array

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclustertemplates.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,54 @@ spec:
10491049
type: object
10501050
projectId:
10511051
type: string
1052+
securityGroupFilters:
1053+
description: The names, uuids, filters or any
1054+
combination these of the security groups to
1055+
assign to the instance
1056+
items:
1057+
properties:
1058+
filter:
1059+
description: Filters used to query security
1060+
groups in openstack
1061+
properties:
1062+
description:
1063+
type: string
1064+
id:
1065+
type: string
1066+
limit:
1067+
type: integer
1068+
marker:
1069+
type: string
1070+
name:
1071+
type: string
1072+
notTags:
1073+
type: string
1074+
notTagsAny:
1075+
type: string
1076+
projectId:
1077+
type: string
1078+
sortDir:
1079+
type: string
1080+
sortKey:
1081+
type: string
1082+
tags:
1083+
type: string
1084+
tagsAny:
1085+
type: string
1086+
tenantId:
1087+
type: string
1088+
type: object
1089+
name:
1090+
description: Security Group name
1091+
type: string
1092+
uuid:
1093+
description: Security Group UID
1094+
type: string
1095+
type: object
1096+
type: array
10521097
securityGroups:
1098+
description: The uuids of the security groups
1099+
to assign to the instance
10531100
items:
10541101
type: string
10551102
type: array

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,53 @@ spec:
10441044
type: object
10451045
projectId:
10461046
type: string
1047+
securityGroupFilters:
1048+
description: The names, uuids, filters or any combination these
1049+
of the security groups to assign to the instance
1050+
items:
1051+
properties:
1052+
filter:
1053+
description: Filters used to query security groups in
1054+
openstack
1055+
properties:
1056+
description:
1057+
type: string
1058+
id:
1059+
type: string
1060+
limit:
1061+
type: integer
1062+
marker:
1063+
type: string
1064+
name:
1065+
type: string
1066+
notTags:
1067+
type: string
1068+
notTagsAny:
1069+
type: string
1070+
projectId:
1071+
type: string
1072+
sortDir:
1073+
type: string
1074+
sortKey:
1075+
type: string
1076+
tags:
1077+
type: string
1078+
tagsAny:
1079+
type: string
1080+
tenantId:
1081+
type: string
1082+
type: object
1083+
name:
1084+
description: Security Group name
1085+
type: string
1086+
uuid:
1087+
description: Security Group UID
1088+
type: string
1089+
type: object
1090+
type: array
10471091
securityGroups:
1092+
description: The uuids of the security groups to assign to the
1093+
instance
10481094
items:
10491095
type: string
10501096
type: array

0 commit comments

Comments
 (0)