AWS Load Balancer Operator
This operator is used to install, manage and configure an instance of
aws-load-balancer-controller
in a OpenShift cluster.
This document
describes the design and implementation of the operator in more detail.
Table of contents
- Prerequisites
- IAM Role for STS clusters
- VPC and Subnets
- Installation
- STS Clusters
- Tutorial
- Local Development
- Build the operand image
- Running the operator
- Running the end-to-end tests
- Running the end-to-end tests on an STS cluster
- Proxy support
- Versioning
Local Development
Build the operand image
Note: only needed for unmerged changes, all merged changes get published in a public quay.io repository
The operand image must be built first. Clone the OpenShift fork of the operand,
build the image and push it to a registry which is accessible from the test cluster.
git clone https://github.com/openshift/aws-load-balancer-controller.git
cd aws-load-balancer-controller
IMG=quay.io/$USER/aws-load-balancer-controller
podman build -t $IMG -f Dockerfile.openshift
podman push $IMG
Running the operator
- Replace the operand image in the file
config/manager/manager.yaml
in
the environment variable RELATED_IMAGE_CONTROLLER
with the image
created in the previous step.
- Build and push the operator image to an image registry.
export IMG=quay.io/$USER/aws-load-balancer-operator:latest
make image-build image-push
- Create the namespace where the operator will be deployed.
oc create ns aws-load-balancer-operator
- Deploy the operator
make deploy
- The previous step deploys the conversion webhook, which requires TLS verification on the webhook client side. The
manifests deployed through the
make deploy
command do not contain a valid certificate and key. You must provision a valid certificate and key through other tools.
If you run on OpenShift, you can use a convenience script, hack/add-serving-cert.sh
, to enable the service serving certificate feature.
Run the hack/add-serving-cert.sh
script with the following inputs:
hack/add-serving-cert.sh --namespace aws-load-balancer-operator --service aws-load-balancer-operator-webhook-service --secret webhook-server-cert --crd awsloadbalancercontrollers.networking.olm.openshift.io
Note: You may need to wait for the retry of the volume mount in the operator's pod.
Running the end-to-end tests
After the operator has been deployed as described previously you can run the e2e
tests with the following command:
make test-e2e
Running the end-to-end tests on an STS cluster
Prerequisites:
aws wafv2 create-web-acl --name "echoserver-acl" --scope REGIONAL --default-action '{"Block":{}}' --visibility-config '{"MetricName":"echoserver","CloudWatchMetricsEnabled": false,"SampledRequestsEnabled":false}'
aws waf-regional create-web-acl --name "echoserverclassicacl" --metric-name "echoserverclassicacl" --default-action '{"Type":"BLOCK"}' --change-token "$(aws waf-regional get-change-token)"
Note: note the ARN and ID of the created ACLs from the output of the commands
Now you can run the e2e test with the following commands:
export ALBO_E2E_PLATFORM=OCPSTS
export ALBO_E2E_CONTROLLER_ROLE_ARN=<controller-iamrole-arn>
export ALBO_E2E_WAFV2_WEBACL_ARN=<wafv2-webacl-arn>
export ALBO_E2E_WAF_WEBACL_ID=<wafregional-webacl-id>
make test-e2e
Proxy support
Configuring egress proxy for AWS Load Balancer Operator