Skip to content

Commit 2c04703

Browse files
Merge pull request #11 from thejasn/rebase-2.4.4
CFE-617: Rebase v2.4.4
2 parents d943007 + d59817b commit 2c04703

File tree

273 files changed

+14586
-8987
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

273 files changed

+14586
-8987
lines changed

.ci-operator.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build_root_image:
2+
name: release
3+
namespace: openshift
4+
tag: rhel-8-release-golang-1.18-openshift-4.12

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# syntax=docker/dockerfile:experimental
22

3-
FROM --platform=${TARGETPLATFORM} public.ecr.aws/docker/library/golang:1.17.8 AS base
3+
FROM --platform=${TARGETPLATFORM} public.ecr.aws/docker/library/golang:1.18.6 AS base
44
WORKDIR /workspace
55
# Copy the Go Modules manifests
66
COPY go.mod go.mod
77
COPY go.sum go.sum
88
# cache deps before building and copying source so that we don't need to re-download as much
99
# and so that source changes don't invalidate our downloaded layer
1010
RUN --mount=type=bind,target=. \
11-
--mount=type=cache,target=/root/.cache/go-build \
1211
GOPROXY=direct go mod download
1312

1413
FROM base AS build
@@ -25,7 +24,7 @@ RUN --mount=type=bind,target=. \
2524
CGO_LDFLAGS="-Wl,-z,relro,-z,now" \
2625
go build -buildmode=pie -tags 'osusergo,netgo,static_build' -ldflags="-s -w -linkmode=external -extldflags '-static-pie' -X ${VERSION_PKG}.GitVersion=${GIT_VERSION} -X ${VERSION_PKG}.GitCommit=${GIT_COMMIT} -X ${VERSION_PKG}.BuildDate=${BUILD_DATE}" -mod=readonly -a -o /out/controller main.go
2726

28-
FROM public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot:2022-03-09-1646784337.2 as bin-unix
27+
FROM public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot:2022-07-27-1658910674.2 as bin-unix
2928

3029
COPY --from=build /out/controller /controller
3130
ENTRYPOINT ["/controller"]

Dockerfile.openshift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM registry.access.redhat.com/ubi8/go-toolset:1.16.12 AS builder
1+
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.18-openshift-4.12 AS builder
22

33
WORKDIR /opt/app-root/src
44

Makefile

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
MAKEFILE_PATH = $(dir $(realpath -s $(firstword $(MAKEFILE_LIST))))
33

44
# Image URL to use all building/pushing image targets
5-
IMG ?= amazon/aws-alb-ingress-controller:v2.4.1
5+
IMG ?= amazon/aws-alb-ingress-controller:v2.4.4
66

77
CRD_OPTIONS ?= "crd:crdVersions=v1"
88

@@ -32,22 +32,26 @@ run: generate fmt vet manifests
3232

3333
# Install CRDs into a cluster
3434
install: manifests
35-
kustomize build config/crd | kubectl apply -f -
35+
$(KUSTOMIZE) build config/crd | kubectl apply -f -
3636

3737
# Uninstall CRDs from a cluster
3838
uninstall: manifests
39-
kustomize build config/crd | kubectl delete -f -
39+
$(KUSTOMIZE) build config/crd | kubectl delete -f -
4040

4141
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
4242
deploy: manifests
43-
cd config/controller && kustomize edit set image controller=${IMG}
44-
kustomize build config/default | kubectl apply -f -
43+
cd config/controller && $(KUSTOMIZE) edit set image controller=${IMG}
44+
$(KUSTOMIZE) build config/default | kubectl apply -f -
4545

4646
# Generate manifests e.g. CRD, RBAC etc.
47-
manifests: controller-gen
47+
manifests: controller-gen kustomize
4848
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=controller-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
4949
yq eval '.metadata.name = "webhook"' -i config/webhook/manifests.yaml
5050

51+
crds: manifests
52+
$(KUSTOMIZE) build config/crd > helm/aws-load-balancer-controller/crds/crds.yaml
53+
54+
5155
# Run go fmt against code
5256
fmt:
5357
go fmt ./...
@@ -95,6 +99,22 @@ else
9599
CONTROLLER_GEN=$(shell which controller-gen)
96100
endif
97101

102+
# install kustomize if not found
103+
kustomize:
104+
ifeq (, $(shell which kustomize))
105+
@{ \
106+
set -e ;\
107+
KUSTOMIZE_TMP_DIR=$$(mktemp -d) ;\
108+
cd $$KUSTOMIZE_TMP_DIR ;\
109+
go mod init tmp ;\
110+
GO111MODULE=on go get sigs.k8s.io/kustomize/kustomize/v3 ;\
111+
rm -rf $$KUSTOMIZE_TMP_DIR ;\
112+
}
113+
KUSTOMIZE=$(GOBIN)/kustomize
114+
else
115+
KUSTOMIZE=$(shell which kustomize)
116+
endif
117+
98118
# preview docs
99119
docs-preview: docs-dependencies
100120
pipenv run mkdocs serve

config/controller/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ kind: Kustomization
99
images:
1010
- name: controller
1111
newName: amazon/aws-alb-ingress-controller
12-
newTag: v2.4.1
12+
newTag: v2.4.4

controllers/ingress/group_controller.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"sigs.k8s.io/aws-load-balancer-controller/controllers/ingress/eventhandlers"
1515
"sigs.k8s.io/aws-load-balancer-controller/pkg/annotations"
1616
"sigs.k8s.io/aws-load-balancer-controller/pkg/aws"
17-
cfg "sigs.k8s.io/aws-load-balancer-controller/pkg/config"
17+
"sigs.k8s.io/aws-load-balancer-controller/pkg/config"
1818
"sigs.k8s.io/aws-load-balancer-controller/pkg/deploy"
1919
elbv2deploy "sigs.k8s.io/aws-load-balancer-controller/pkg/deploy/elbv2"
2020
"sigs.k8s.io/aws-load-balancer-controller/pkg/deploy/tracking"
@@ -44,26 +44,26 @@ const (
4444
func NewGroupReconciler(cloud aws.Cloud, k8sClient client.Client, eventRecorder record.EventRecorder,
4545
finalizerManager k8s.FinalizerManager, networkingSGManager networkingpkg.SecurityGroupManager,
4646
networkingSGReconciler networkingpkg.SecurityGroupReconciler, subnetsResolver networkingpkg.SubnetsResolver,
47-
config cfg.ControllerConfig, backendSGProvider networkingpkg.BackendSGProvider, logger logr.Logger) *groupReconciler {
47+
controllerConfig config.ControllerConfig, backendSGProvider networkingpkg.BackendSGProvider, logger logr.Logger) *groupReconciler {
4848

4949
annotationParser := annotations.NewSuffixAnnotationParser(annotations.AnnotationPrefixIngress)
5050
authConfigBuilder := ingress.NewDefaultAuthConfigBuilder(annotationParser)
5151
enhancedBackendBuilder := ingress.NewDefaultEnhancedBackendBuilder(k8sClient, annotationParser, authConfigBuilder)
5252
referenceIndexer := ingress.NewDefaultReferenceIndexer(enhancedBackendBuilder, authConfigBuilder, logger)
53-
trackingProvider := tracking.NewDefaultProvider(ingressTagPrefix, config.ClusterName)
54-
elbv2TaggingManager := elbv2deploy.NewDefaultTaggingManager(cloud.ELBV2(), cloud.VpcID(), config.FeatureGates, logger)
53+
trackingProvider := tracking.NewDefaultProvider(ingressTagPrefix, controllerConfig.ClusterName)
54+
elbv2TaggingManager := elbv2deploy.NewDefaultTaggingManager(cloud.ELBV2(), cloud.VpcID(), controllerConfig.FeatureGates, logger)
5555
modelBuilder := ingress.NewDefaultModelBuilder(k8sClient, eventRecorder,
5656
cloud.EC2(), cloud.ACM(),
5757
annotationParser, subnetsResolver,
58-
authConfigBuilder, enhancedBackendBuilder, trackingProvider, elbv2TaggingManager,
59-
cloud.VpcID(), config.ClusterName, config.DefaultTags, config.ExternalManagedTags,
60-
config.DefaultSSLPolicy, backendSGProvider, config.EnableBackendSecurityGroup, config.DisableRestrictedSGRules, config.FeatureGates.Enabled(cfg.EnableIPTargetType), logger)
58+
authConfigBuilder, enhancedBackendBuilder, trackingProvider, elbv2TaggingManager, controllerConfig.FeatureGates,
59+
cloud.VpcID(), controllerConfig.ClusterName, controllerConfig.DefaultTags, controllerConfig.ExternalManagedTags,
60+
controllerConfig.DefaultSSLPolicy, backendSGProvider, controllerConfig.EnableBackendSecurityGroup, controllerConfig.DisableRestrictedSGRules, controllerConfig.FeatureGates.Enabled(config.EnableIPTargetType), logger)
6161
stackMarshaller := deploy.NewDefaultStackMarshaller()
6262
stackDeployer := deploy.NewDefaultStackDeployer(cloud, k8sClient, networkingSGManager, networkingSGReconciler,
63-
config, ingressTagPrefix, logger)
63+
controllerConfig, ingressTagPrefix, logger)
6464
classLoader := ingress.NewDefaultClassLoader(k8sClient)
65-
classAnnotationMatcher := ingress.NewDefaultClassAnnotationMatcher(config.IngressConfig.IngressClass)
66-
manageIngressesWithoutIngressClass := config.IngressConfig.IngressClass == ""
65+
classAnnotationMatcher := ingress.NewDefaultClassAnnotationMatcher(controllerConfig.IngressConfig.IngressClass)
66+
manageIngressesWithoutIngressClass := controllerConfig.IngressConfig.IngressClass == ""
6767
groupLoader := ingress.NewDefaultGroupLoader(k8sClient, eventRecorder, annotationParser, classLoader, classAnnotationMatcher, manageIngressesWithoutIngressClass)
6868
groupFinalizerManager := ingress.NewDefaultFinalizerManager(finalizerManager)
6969

@@ -80,7 +80,7 @@ func NewGroupReconciler(cloud aws.Cloud, k8sClient client.Client, eventRecorder
8080
groupFinalizerManager: groupFinalizerManager,
8181
logger: logger,
8282

83-
maxConcurrentReconciles: config.IngressConfig.MaxConcurrentReconciles,
83+
maxConcurrentReconciles: controllerConfig.IngressConfig.MaxConcurrentReconciles,
8484
}
8585
}
8686

controllers/service/service_controller.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"sigs.k8s.io/aws-load-balancer-controller/controllers/service/eventhandlers"
1111
"sigs.k8s.io/aws-load-balancer-controller/pkg/annotations"
1212
"sigs.k8s.io/aws-load-balancer-controller/pkg/aws"
13-
cfg "sigs.k8s.io/aws-load-balancer-controller/pkg/config"
13+
"sigs.k8s.io/aws-load-balancer-controller/pkg/config"
1414
"sigs.k8s.io/aws-load-balancer-controller/pkg/deploy"
1515
"sigs.k8s.io/aws-load-balancer-controller/pkg/deploy/elbv2"
1616
"sigs.k8s.io/aws-load-balancer-controller/pkg/deploy/tracking"
@@ -36,30 +36,30 @@ const (
3636
func NewServiceReconciler(cloud aws.Cloud, k8sClient client.Client, eventRecorder record.EventRecorder,
3737
finalizerManager k8s.FinalizerManager, networkingSGManager networking.SecurityGroupManager,
3838
networkingSGReconciler networking.SecurityGroupReconciler, subnetsResolver networking.SubnetsResolver,
39-
vpcInfoProvider networking.VPCInfoProvider, config cfg.ControllerConfig, logger logr.Logger) *serviceReconciler {
39+
vpcInfoProvider networking.VPCInfoProvider, controllerConfig config.ControllerConfig, logger logr.Logger) *serviceReconciler {
4040

4141
annotationParser := annotations.NewSuffixAnnotationParser(serviceAnnotationPrefix)
42-
trackingProvider := tracking.NewDefaultProvider(serviceTagPrefix, config.ClusterName)
43-
elbv2TaggingManager := elbv2.NewDefaultTaggingManager(cloud.ELBV2(), cloud.VpcID(), config.FeatureGates, logger)
44-
serviceUtils := service.NewServiceUtils(annotationParser, serviceFinalizer, config.ServiceConfig.LoadBalancerClass, config.FeatureGates)
42+
trackingProvider := tracking.NewDefaultProvider(serviceTagPrefix, controllerConfig.ClusterName)
43+
elbv2TaggingManager := elbv2.NewDefaultTaggingManager(cloud.ELBV2(), cloud.VpcID(), controllerConfig.FeatureGates, logger)
44+
serviceUtils := service.NewServiceUtils(annotationParser, serviceFinalizer, controllerConfig.ServiceConfig.LoadBalancerClass, controllerConfig.FeatureGates)
4545
modelBuilder := service.NewDefaultModelBuilder(annotationParser, subnetsResolver, vpcInfoProvider, cloud.VpcID(), trackingProvider,
46-
elbv2TaggingManager, config.ClusterName, config.DefaultTags, config.ExternalManagedTags, config.DefaultSSLPolicy, config.FeatureGates.Enabled(cfg.EnableIPTargetType), serviceUtils)
46+
elbv2TaggingManager, controllerConfig.FeatureGates, controllerConfig.ClusterName, controllerConfig.DefaultTags, controllerConfig.ExternalManagedTags, controllerConfig.DefaultSSLPolicy, controllerConfig.FeatureGates.Enabled(config.EnableIPTargetType), serviceUtils)
4747
stackMarshaller := deploy.NewDefaultStackMarshaller()
48-
stackDeployer := deploy.NewDefaultStackDeployer(cloud, k8sClient, networkingSGManager, networkingSGReconciler, config, serviceTagPrefix, logger)
48+
stackDeployer := deploy.NewDefaultStackDeployer(cloud, k8sClient, networkingSGManager, networkingSGReconciler, controllerConfig, serviceTagPrefix, logger)
4949
return &serviceReconciler{
5050
k8sClient: k8sClient,
5151
eventRecorder: eventRecorder,
5252
finalizerManager: finalizerManager,
5353
annotationParser: annotationParser,
54-
loadBalancerClass: config.ServiceConfig.LoadBalancerClass,
54+
loadBalancerClass: controllerConfig.ServiceConfig.LoadBalancerClass,
5555
serviceUtils: serviceUtils,
5656

5757
modelBuilder: modelBuilder,
5858
stackMarshaller: stackMarshaller,
5959
stackDeployer: stackDeployer,
6060
logger: logger,
6161

62-
maxConcurrentReconciles: config.ServiceMaxConcurrentReconciles,
62+
maxConcurrentReconciles: controllerConfig.ServiceMaxConcurrentReconciles,
6363
}
6464
}
6565

docs/deploy/configurations.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,19 @@ Once disabled:
127127
* you can no longer alter the value of an `alb.ingress.kubernetes.io/group.name` annotation on an existing Ingress.
128128

129129

130-
### Default throttle config
130+
### throttle config
131+
132+
Controller uses the following default throttle config:
133+
134+
```
135+
WAF Regional:^AssociateWebACL|DisassociateWebACL=0.5:1,WAF Regional:^GetWebACLForResource|ListResourcesForWebACL=1:1,WAFV2:^AssociateWebACL|DisassociateWebACL=0.5:1,WAFV2:^GetWebACLForResource|ListResourcesForWebACL=1:1,Elastic Load Balancing v2:^RegisterTargets|^DeregisterTargets=4:20,Elastic Load Balancing v2:.*=10:40
136+
```
137+
Client side throttling enables gradual scaling of the api calls. Additional throttle config can be specified via the `--aws-api-throttle` flag. You can get the ServiceID from the API definition in AWS SDK. For e.g, ELBv2 it is [Elastic Load Balancing v2](https://github.com/aws/aws-sdk-go/blob/main/models/apis/elasticloadbalancingv2/2015-12-01/api-2.json#L9).
138+
139+
Here is an example of throttle config to specify client side throttling of ELBv2 calls.
140+
131141
```
132-
WAF Regional:^AssociateWebACL|DisassociateWebACL=0.5:1,WAF Regional:^GetWebACLForResource|ListResourcesForWebACL=1:1,WAFV2:^AssociateWebACL|DisassociateWebACL=0.5:1,WAFV2:^GetWebACLForResource|ListResourcesForWebACL=1:1
142+
--aws-api-throttle=Elastic Load Balancing v2:RegisterTargets|DeregisterTargets=4:20,Elastic Load Balancing v2:.*=10:40
133143
```
134144
135145
### Instance metadata
@@ -144,5 +154,7 @@ They are a set of kye=value pairs that describe AWS load balance controller feat
144154
| ListenerRulesTagging | string | true | Enable or disable tagging AWS load balancer listeners and rules |
145155
| WeightedTargetGroups | string | true | Enable or disable weighted target groups |
146156
| ServiceTypeLoadBalancerOnly | string | false | If enabled, controller will be limited to reconciling service of type `LoadBalancer`|
157+
| EndpointsFailOpen | string | false | Enable or disable allowing endpoints with `ready:unknown` state in the target groups. |
147158
| EnableServiceController | string | true | Toggles support for `Service` type resources. |
148159
| EnableIPTargetType | string | true | Used to toggle support for target-type `ip` across `Ingress` and `Service` type resources. |
160+
| SubnetsClusterTagCheck | string | true | Enable or disable the check for `kubernetes.io/cluster/${cluster-name}` during subnet auto-discovery |

0 commit comments

Comments
 (0)