Skip to content

Commit 0a97512

Browse files
authored
handle invalid yaml when generating helm crd (#4365)
* handle invalid yaml when generating helm crd * remove unused vpc parameter
1 parent 21e6c0a commit 0a97512

File tree

8 files changed

+5
-35
lines changed

8 files changed

+5
-35
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ crds: manifests
7070
$(MOVE_GATEWAY_CRDS)
7171
$(KUSTOMIZE) build config/crd > helm/aws-load-balancer-controller/crds/crds.yaml
7272
$(KUSTOMIZE) build config/crd/gateway > config/crd/gateway/gateway-crds.yaml
73+
echo '---' > config/crd/gateway/gateway-crds.yaml
74+
$(KUSTOMIZE) build config/crd/gateway >> config/crd/gateway/gateway-crds.yaml
7375
$(COPY_GATEWAY_CRDS_TO_HELM)
7476

7577
# Run go fmt against code
@@ -215,4 +217,4 @@ gw-api-ref-docs:
215217
--source-path=${PWD}/apis/gateway/ \
216218
--config=crd-ref-docs.yaml \
217219
--renderer=markdown \
218-
--output-path=${PWD}/docs/guide/gateway/spec.md
220+
--output-path=${PWD}/docs/guide/gateway/spec.md

apis/gateway/v1beta1/loadbalancerconfig_types.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,6 @@ type LoadBalancerConfigurationSpec struct {
245245
// +optional
246246
SourceRanges *[]string `json:"sourceRanges,omitempty"`
247247

248-
// vpcId is the ID of the VPC for the load balancer.
249-
// +optional
250-
VpcId *string `json:"vpcId,omitempty"`
251-
252248
// LoadBalancerAttributes defines the attribute of LB
253249
// +optional
254250
LoadBalancerAttributes []LoadBalancerAttribute `json:"loadBalancerAttributes,omitempty"`

apis/gateway/v1beta1/zz_generated.deepcopy.go

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

config/crd/gateway/gateway-crds.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
apiVersion: apiextensions.k8s.io/v1
23
kind: CustomResourceDefinition
34
metadata:
@@ -699,9 +700,6 @@ spec:
699700
type: string
700701
description: Tags the AWS Tags on all related resources to the gateway.
701702
type: object
702-
vpcId:
703-
description: vpcId is the ID of the VPC for the load balancer.
704-
type: string
705703
wafV2:
706704
description: WAFv2 define the AWS WAFv2 settings for a Gateway [Application
707705
Load Balancer]

config/crd/gateway/gateway.k8s.aws_loadbalancerconfigurations.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,6 @@ spec:
301301
type: string
302302
description: Tags the AWS Tags on all related resources to the gateway.
303303
type: object
304-
vpcId:
305-
description: vpcId is the ID of the VPC for the load balancer.
306-
type: string
307304
wafV2:
308305
description: WAFv2 define the AWS WAFv2 settings for a Gateway [Application
309306
Load Balancer]

helm/aws-load-balancer-controller/crds/gateway-crds.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
apiVersion: apiextensions.k8s.io/v1
23
kind: CustomResourceDefinition
34
metadata:
@@ -699,9 +700,6 @@ spec:
699700
type: string
700701
description: Tags the AWS Tags on all related resources to the gateway.
701702
type: object
702-
vpcId:
703-
description: vpcId is the ID of the VPC for the load balancer.
704-
type: string
705703
wafV2:
706704
description: WAFv2 define the AWS WAFv2 settings for a Gateway [Application
707705
Load Balancer]

pkg/gateway/lb_config_merger.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,6 @@ func (merger *loadBalancerConfigMergerImpl) performTakeOneMerges(merged *elbv2gw
154154
merged.SourceRanges = lowPriority.Spec.SourceRanges
155155
}
156156

157-
if highPriority.Spec.VpcId != nil {
158-
merged.VpcId = highPriority.Spec.VpcId
159-
} else {
160-
merged.VpcId = lowPriority.Spec.VpcId
161-
}
162-
163157
if highPriority.Spec.EnableICMP != nil {
164158
merged.EnableICMP = highPriority.Spec.EnableICMP
165159
} else {

pkg/gateway/lb_config_merger_test.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ func Test_Merge(t *testing.T) {
5050
SecurityGroups: &[]string{"sg1", "sg2", "s3"},
5151
SecurityGroupPrefixes: &[]string{"pl1"},
5252
SourceRanges: &[]string{"127.0.0.0/20"},
53-
VpcId: awssdk.String("vpc-1234"),
5453
ListenerConfigurations: &[]elbv2gw.ListenerConfiguration{
5554
{
5655
ProtocolPort: "pp1",
@@ -91,7 +90,6 @@ func Test_Merge(t *testing.T) {
9190
SecurityGroups: &[]string{"sg1", "sg2", "s3"},
9291
SecurityGroupPrefixes: &[]string{"pl1"},
9392
SourceRanges: &[]string{"127.0.0.0/20"},
94-
VpcId: awssdk.String("vpc-1234"),
9593
ListenerConfigurations: &[]elbv2gw.ListenerConfiguration{
9694
{
9795
ProtocolPort: "pp1",
@@ -134,7 +132,6 @@ func Test_Merge(t *testing.T) {
134132
SecurityGroups: &[]string{"sg1", "sg2", "s3"},
135133
SecurityGroupPrefixes: &[]string{"pl1"},
136134
SourceRanges: &[]string{"127.0.0.0/20"},
137-
VpcId: awssdk.String("vpc-1234"),
138135
ListenerConfigurations: &[]elbv2gw.ListenerConfiguration{
139136
{
140137
ProtocolPort: "pp1",
@@ -175,7 +172,6 @@ func Test_Merge(t *testing.T) {
175172
SecurityGroups: &[]string{"sg1", "sg2", "s3"},
176173
SecurityGroupPrefixes: &[]string{"pl1"},
177174
SourceRanges: &[]string{"127.0.0.0/20"},
178-
VpcId: awssdk.String("vpc-1234"),
179175
ListenerConfigurations: &[]elbv2gw.ListenerConfiguration{
180176
{
181177
ProtocolPort: "pp1",
@@ -222,7 +218,6 @@ func Test_Merge(t *testing.T) {
222218
SecurityGroups: &[]string{"sg1"},
223219
SecurityGroupPrefixes: &[]string{"pl1"},
224220
SourceRanges: &[]string{"127.0.0.0/20"},
225-
VpcId: awssdk.String("vpc-gw-class"),
226221
ListenerConfigurations: &[]elbv2gw.ListenerConfiguration{
227222
{
228223
ProtocolPort: "pp1-gwclass",
@@ -270,7 +265,6 @@ func Test_Merge(t *testing.T) {
270265
SecurityGroups: &[]string{"sg1-gw"},
271266
SecurityGroupPrefixes: &[]string{"pl1-gw"},
272267
SourceRanges: &[]string{"127.0.0.10/20"},
273-
VpcId: awssdk.String("vpc-gw"),
274268
ListenerConfigurations: &[]elbv2gw.ListenerConfiguration{
275269
{
276270
ProtocolPort: "pp1-gw",
@@ -321,7 +315,6 @@ func Test_Merge(t *testing.T) {
321315
SecurityGroups: &[]string{"sg1"},
322316
SecurityGroupPrefixes: &[]string{"pl1"},
323317
SourceRanges: &[]string{"127.0.0.0/20"},
324-
VpcId: awssdk.String("vpc-gw-class"),
325318
ListenerConfigurations: &[]elbv2gw.ListenerConfiguration{
326319
{
327320
ProtocolPort: "pp1-common",
@@ -385,7 +378,6 @@ func Test_Merge(t *testing.T) {
385378
SecurityGroups: &[]string{"sg1"},
386379
SecurityGroupPrefixes: &[]string{"pl1"},
387380
SourceRanges: &[]string{"127.0.0.0/20"},
388-
VpcId: awssdk.String("vpc-gw-class"),
389381
ListenerConfigurations: &[]elbv2gw.ListenerConfiguration{
390382
{
391383
ProtocolPort: "pp1-gwclass",
@@ -433,7 +425,6 @@ func Test_Merge(t *testing.T) {
433425
SecurityGroups: &[]string{"sg1-gw"},
434426
SecurityGroupPrefixes: &[]string{"pl1-gw"},
435427
SourceRanges: &[]string{"127.0.0.10/20"},
436-
VpcId: awssdk.String("vpc-gw"),
437428
ListenerConfigurations: &[]elbv2gw.ListenerConfiguration{
438429
{
439430
ProtocolPort: "pp1-gw",
@@ -481,7 +472,6 @@ func Test_Merge(t *testing.T) {
481472
SecurityGroups: &[]string{"sg1-gw"},
482473
SecurityGroupPrefixes: &[]string{"pl1-gw"},
483474
SourceRanges: &[]string{"127.0.0.10/20"},
484-
VpcId: awssdk.String("vpc-gw"),
485475
ListenerConfigurations: &[]elbv2gw.ListenerConfiguration{
486476
{
487477
ProtocolPort: "pp1-common",

0 commit comments

Comments
 (0)