Skip to content

Commit 970ea56

Browse files
Merge pull request #23 from alebedev87/rebase-2-8-2
NE-1807: Rebase to v2.8.2
2 parents 105552e + 03a729d commit 970ea56

File tree

5,180 files changed

+733938
-335192
lines changed

Some content is hidden

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

5,180 files changed

+733938
-335192
lines changed

.ci-operator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
build_root_image:
22
name: release
33
namespace: openshift
4-
tag: rhel-8-release-golang-1.18-openshift-4.12
4+
tag: rhel-8-release-golang-1.22-openshift-4.17

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<!--
88
Please explain the changes you made here.
99
10-
Help your reviewers my guiding them through your key changes,
10+
Help your reviewers by guiding them through your key changes,
1111
implementation decisions etc.
1212
You can even include snippets of output or screenshots.
1313

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# See https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#package-ecosystem
2+
version: 2
3+
updates:
4+
- package-ecosystem: "gomod"
5+
directory: "/"
6+
schedule:
7+
interval: "monthly"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Deprecated API detect
2+
on:
3+
push:
4+
branches: [main]
5+
permissions:
6+
contents: read
7+
jobs:
8+
deprecated-apigroups:
9+
name: Detect deprecated apiGroups
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- run: |
14+
version=$(curl -sL https://api.github.com/repos/FairwindsOps/pluto/releases/latest | jq -r ".tag_name")
15+
number=${version:1}
16+
wget https://github.com/FairwindsOps/pluto/releases/download/${version}/pluto_${number}_linux_amd64.tar.gz
17+
sudo tar -C /usr/local -xzf pluto_${number}_linux_amd64.tar.gz
18+
- run: |
19+
rm -rf docs/install
20+
rm -rf config/samples
21+
/usr/local/pluto detect-files -d .

.github/workflows/deps.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Dependency Review"
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- 'release-*'
7+
pull_request:
8+
workflow_dispatch:
9+
inputs:
10+
head_ref:
11+
description: 'HEAD git reference (tag/branch/commit) to analyze'
12+
required: true
13+
default: 'main'
14+
type: string
15+
base_ref:
16+
description: 'Base git reference (tag/branch/commit) to compare against head_ref'
17+
required: true
18+
default: 'main'
19+
type: string
20+
permissions:
21+
contents: read
22+
jobs:
23+
dependency-review:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: "Checkout Repository"
27+
uses: actions/checkout@v4
28+
with:
29+
show-progress: false
30+
- name: "Dependency Review"
31+
uses: actions/dependency-review-action@v4
32+
with:
33+
base-ref: ${{ inputs.base_ref || github.event.pull_request.base.sha || 'main' }}
34+
head-ref: ${{ inputs.head_ref || github.event.pull_request.head.sha || github.ref }}
35+
govulncheck:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: "Checkout Repository"
39+
uses: actions/checkout@v4
40+
with:
41+
show-progress: false
42+
- name: Setup Go Version
43+
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV
44+
- id: govulncheck
45+
uses: golang/govulncheck-action@v1
46+
with:
47+
go-version-input: ${{ env.GO_VERSION }}
48+
go-version-file: go.mod

.github/workflows/tag-release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: tag-release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'release-*'
8+
paths:
9+
- version.txt
10+
11+
jobs:
12+
tag-release:
13+
if: ${{ github.repository == 'kubernetes-sigs/aws-load-balancer-controller' }}
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: write
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
- run: /usr/bin/git config --global user.email [email protected]
24+
- run: /usr/bin/git config --global user.name 'GitHub Actions Release Tagger'
25+
- run: hack/tag-release.sh

.github/workflows/test.yaml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,37 @@
11
name: Unit Test
22
on:
3-
push:
4-
branches: [ main ]
5-
pull_request:
6-
branches: [ main ]
3+
- push
4+
- pull_request
75
jobs:
86
build:
97
name: Build
108
runs-on: ubuntu-latest
119
steps:
10+
- name: Setup Go Version
11+
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV
1212
- name: Set up Go 1.x
1313
uses: actions/setup-go@v2
1414
with:
15-
go-version: ^1.15
16-
15+
go-version: ${{ env.GO_VERSION }}
16+
1717
- name: Check out code into the Go module directory
1818
uses: actions/checkout@v2
1919

2020
- name: Run unit tests
2121
run: |
2222
sudo snap install yq
2323
make test
24-
24+
2525
- name: Codecov
2626
uses: codecov/codecov-action@v1
2727
with:
2828
file: ./cover.out # optional
29+
30+
verify:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v2
34+
35+
- name: make quick-ci
36+
run: |
37+
make quick-ci

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ site
2323
*.swp
2424
*.swo
2525
*~
26+
*.bak

.go-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.22.5

.ko.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
defaultBaseImage: public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot:2024-04-01-1711929684.2
2+
builds:
3+
- env:
4+
- CGO_ENABLED=0
5+
flags:
6+
- -mod=readonly
7+
ldflags:
8+
- -s
9+
- -w
10+
- -X sigs.k8s.io/aws-load-balancer-controller/pkg/version.GitVersion={{.Env.GIT_VERSION}}
11+
- -X sigs.k8s.io/aws-load-balancer-controller/pkg/version.GitCommit={{.Env.GIT_COMMIT}}
12+
- -X sigs.k8s.io/aws-load-balancer-controller/pkg/version.BuildDate={{.Env.BUILD_DATE}}
13+

CONTRIBUTING.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@ _As contributors and maintainers of this project, and in the interest of fosteri
77
## Getting Started
88

99
### Building the project
10-
[Controller developement documentation](/docs/controller-devel.md) has instructions on how to build the project and project specific expectations.
10+
[Controller development documentation](/docs/controller-devel.md) has instructions on how to build the project and project specific expectations.
1111

12+
### Contributing to docs
13+
14+
The [documentation](https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/) is generated using [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/). In order to generate and preview docs locally, use the steps below -
15+
16+
- Install [pipenv](https://pipenv.pypa.io/en/latest/install/#installing-pipenv)
17+
- run `make docs-preview`. This will generate and serve docs locally at http://127.0.0.1:8000
1218

1319
### Contributing
1420
We also have more documentation on how to get started contributing here:
@@ -23,5 +29,5 @@ We also have more documentation on how to get started contributing here:
2329

2430
## Contact Information
2531

26-
- [Slack channel](https://kubernetes.slack.com/messages/sig-aws)
32+
- [Slack channel](https://kubernetes.slack.com/messages/provider-aws)
2733
- [Mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-aws)

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# syntax=docker/dockerfile:experimental
2+
ARG BASE_IMAGE
3+
ARG BUILD_IMAGE
24

3-
FROM --platform=${TARGETPLATFORM} public.ecr.aws/docker/library/golang:1.18.6 AS base
5+
FROM --platform=${TARGETPLATFORM} $BUILD_IMAGE AS base
46
WORKDIR /workspace
57
# Copy the Go Modules manifests
68
COPY go.mod go.mod
@@ -24,7 +26,7 @@ RUN --mount=type=bind,target=. \
2426
CGO_LDFLAGS="-Wl,-z,relro,-z,now" \
2527
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
2628

27-
FROM public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot:2022-07-27-1658910674.2 as bin-unix
29+
FROM $BASE_IMAGE as bin-unix
2830

2931
COPY --from=build /out/controller /controller
3032
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.ci.openshift.org/ocp/builder:rhel-8-golang-1.18-openshift-4.12 AS builder
1+
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.22-openshift-4.17 AS builder
22

33
WORKDIR /opt/app-root/src
44

Makefile

Lines changed: 72 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
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.4
5+
IMG ?= public.ecr.aws/eks/aws-load-balancer-controller:v2.8.2
6+
# Image URL to use for builder stage in Docker build
7+
GOLANG_VERSION ?= $(shell cat .go-version)
8+
BUILD_IMAGE ?= public.ecr.aws/docker/library/golang:$(GOLANG_VERSION)
9+
# Image URL to use for base layer in Docker build
10+
BASE_IMAGE ?= public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot:2024-04-01-1711929684.2
11+
IMG_PLATFORM ?= linux/amd64,linux/arm64
12+
# ECR doesn't appear to support SPDX SBOM
13+
IMG_SBOM ?= none
14+
615

716
CRD_OPTIONS ?= "crd:crdVersions=v1"
817

@@ -16,6 +25,9 @@ else
1625
GOBIN=$(shell go env GOBIN)
1726
endif
1827

28+
export GOSUMDB = sum.golang.org
29+
export GOTOOLCHAIN = go$(GOLANG_VERSION)
30+
1931
all: controller
2032

2133
# Run tests
@@ -64,8 +76,10 @@ helm-lint:
6476
${MAKEFILE_PATH}/test/helm/helm-lint.sh
6577

6678
# Generate code
67-
generate: aws-sdk-model-override controller-gen
79+
.PHONY: generate
80+
generate: aws-sdk-model-override controller-gen mockgen
6881
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
82+
MOCKGEN=$(MOCKGEN) ./scripts/gen_mocks.sh
6983

7084
aws-sdk-model-override:
7185
@if [ "$(AWS_SDK_MODEL_OVERRIDE)" = "y" ] ; then \
@@ -74,13 +88,25 @@ aws-sdk-model-override:
7488
./scripts/aws_sdk_model_override/cleanup.sh ; \
7589
fi
7690

91+
.PHONY: docker-push
92+
docker-push: aws-load-balancer-controller-push
7793

78-
# Push the docker image
79-
docker-push:
94+
.PHONY: aws-load-balancer-controller-push
95+
aws-load-balancer-controller-push: ko
96+
KO_DOCKER_REPO=$(firstword $(subst :, ,${IMG})) \
97+
GIT_VERSION=$(shell git describe --tags --dirty --always) \
98+
GIT_COMMIT=$(shell git rev-parse HEAD) \
99+
BUILD_DATE=$(shell date +%Y-%m-%dT%H:%M:%S%z) \
100+
ko build --tags $(word 2,$(subst :, ,${IMG})) --platform=${IMG_PLATFORM} --bare --sbom ${IMG_SBOM} .
101+
102+
# Push the docker image using docker buildx
103+
docker-push-w-buildx:
80104
docker buildx build . --target bin \
81105
--tag $(IMG) \
82-
--push \
83-
--platform linux/amd64,linux/arm64
106+
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
107+
--build-arg BUILD_IMAGE=$(BUILD_IMAGE) \
108+
--push \
109+
--platform ${IMG_PLATFORM}
84110

85111
# find or download controller-gen
86112
# download controller-gen if necessary
@@ -91,14 +117,32 @@ ifeq (, $(shell which controller-gen))
91117
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
92118
cd $$CONTROLLER_GEN_TMP_DIR ;\
93119
go mod init tmp ;\
94-
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.5.0 ;\
120+
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0 ;\
95121
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
96122
}
97123
CONTROLLER_GEN=$(GOBIN)/controller-gen
98124
else
99125
CONTROLLER_GEN=$(shell which controller-gen)
100126
endif
101127

128+
# find or download mockgen
129+
# download mockgen if necessary
130+
.PHONY: mockgen
131+
mockgen:
132+
ifeq (, $(shell which mockgen))
133+
@{ \
134+
set -e ;\
135+
MOCKGEN_TMP_DIR=$$(mktemp -d) ;\
136+
cd $$MOCKGEN_TMP_DIR ;\
137+
go mod init tmp ;\
138+
go install github.com/golang/mock/[email protected] ;\
139+
rm -rf $$MOCKGEN_TMP_DIR ;\
140+
}
141+
MOCKGEN=$(GOBIN)/mockgen
142+
else
143+
MOCKGEN=$(shell which mockgen)
144+
endif
145+
102146
# install kustomize if not found
103147
kustomize:
104148
ifeq (, $(shell which kustomize))
@@ -115,13 +159,17 @@ else
115159
KUSTOMIZE=$(shell which kustomize)
116160
endif
117161

162+
.PHONY: ko
163+
ko:
164+
hack/install-ko.sh
165+
118166
# preview docs
119167
docs-preview: docs-dependencies
120168
pipenv run mkdocs serve
121169

122170
# publish the versioned docs using mkdocs mike util
123171
docs-publish: docs-dependencies
124-
pipenv run mike deploy v2.4 latest -p --update-aliases
172+
pipenv run mike deploy v2.8 latest -p --update-aliases
125173

126174
# install dependencies needed to preview and publish docs
127175
docs-dependencies:
@@ -130,6 +178,22 @@ docs-dependencies:
130178
lint:
131179
echo "TODO"
132180

181+
.PHONY: quick-ci
182+
quick-ci: verify-versions verify-generate verify-crds
183+
echo "Done!"
184+
185+
.PHONY: verify-generate
186+
verify-generate:
187+
hack/verify-generate.sh
188+
189+
.PHONY: verify-crds
190+
verify-crds:
191+
hack/verify-crds.sh
192+
193+
.PHONY: verify-versions
194+
verify-versions:
195+
hack/verify-versions.sh
196+
133197
unit-test:
134198
./scripts/ci_unit_test.sh
135199

0 commit comments

Comments
 (0)