Skip to content

Commit

Permalink
Fix consistency of version references in documentation, etc. (#2880)
Browse files Browse the repository at this point in the history
* Create hack/set-version

* Update tags for previous release

* Verify version is set consistently throughout repo

* Fix manifest names in installation.md
  • Loading branch information
johngmyers authored Nov 16, 2022
1 parent 53fbd13 commit 8d2ee85
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 12 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,12 @@ jobs:
uses: codecov/codecov-action@v1
with:
file: ./cover.out # optional

verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: make quick-ci
run: |
make quick-ci
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ site
*.swp
*.swo
*~
*.bak
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
MAKEFILE_PATH = $(dir $(realpath -s $(firstword $(MAKEFILE_LIST))))

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

CRD_OPTIONS ?= "crd:crdVersions=v1"

Expand Down Expand Up @@ -130,6 +130,14 @@ docs-dependencies:
lint:
echo "TODO"

.PHONY: quick-ci
quick-ci: verify-versions
echo "Done!"

.PHONY: verify-versions
verify-versions:
hack/verify-versions.sh

unit-test:
./scripts/ci_unit_test.sh

Expand Down
2 changes: 1 addition & 1 deletion config/controller/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ kind: Kustomization
images:
- name: controller
newName: amazon/aws-alb-ingress-controller
newTag: v2.4.4
newTag: v2.4.5
8 changes: 4 additions & 4 deletions docs/deploy/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Example condition for cluster name resource tag:

1. Download IAM policy for the AWS Load Balancer Controller
```
curl -o iam-policy.json https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.4/docs/install/iam_policy.json
curl -o iam-policy.json https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.5/docs/install/iam_policy.json
```

1. Create an IAM policy called AWSLoadBalancerControllerIAMPolicy
Expand All @@ -106,7 +106,7 @@ Example condition for cluster name resource tag:
### Option B: Attach IAM Policies to Nodes
If not setting up IAM for ServiceAccount, apply the IAM policies from the following URL at minimum.
```
curl -o iam-policy.json https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.4/docs/install/iam_policy.json
curl -o iam-policy.json https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.5/docs/install/iam_policy.json
```

*IAM permission subset for those who use *TargetGroupBinding* only and don't plan to use the AWS Load Balancer Controller to manage security group rules:*
Expand Down Expand Up @@ -190,7 +190,7 @@ We recommend using the Helm chart. This supports Fargate and facilitates updatin
### Apply YAML
1. Download spec for load balancer controller.
```
wget https://github.com/kubernetes-sigs/aws-load-balancer-controller/releases/download/v2.4.4/v2_4_4_full.yaml
wget https://github.com/kubernetes-sigs/aws-load-balancer-controller/releases/download/v2.4.5/v2_4_5_full.yaml
```
1. Edit the saved yaml file, go to the Deployment spec, and set the controller --cluster-name arg value to your EKS cluster name
```
Expand Down Expand Up @@ -218,7 +218,7 @@ We recommend using the Helm chart. This supports Fargate and facilitates updatin
```
1. Optionally download the default ingressclass and ingressclass params
```
wget https://github.com/kubernetes-sigs/aws-load-balancer-controller/releases/download/v2.4.4/v2_4_4_ingclass.yaml
wget https://github.com/kubernetes-sigs/aws-load-balancer-controller/releases/download/v2.4.5/v2_4_5_ingclass.yaml
```
1. Apply the ingressclass and params
```
Expand Down
12 changes: 6 additions & 6 deletions docs/examples/echo_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ In this walkthrough, you'll
1. Deploy all the echoserver resources (namespace, service, deployment)

```bash
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.0/docs/examples/echoservice/echoserver-namespace.yaml &&\
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.0/docs/examples/echoservice/echoserver-service.yaml &&\
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.0/docs/examples/echoservice/echoserver-deployment.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.5/docs/examples/echoservice/echoserver-namespace.yaml &&\
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.5/docs/examples/echoservice/echoserver-service.yaml &&\
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.5/docs/examples/echoservice/echoserver-deployment.yaml
```

1. List all the resources to ensure they were created.
Expand All @@ -112,7 +112,7 @@ In this walkthrough, you'll
1. Download the echoserver ingress manifest locally.

```bash
wget https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.0/docs/examples/echoservice/echoserver-ingress.yaml
wget https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.5/docs/examples/echoservice/echoserver-ingress.yaml
```

1. Configure the subnets, either by add annotation to the ingress or add tags to subnets. This step is optional in lieu of auto-discovery.
Expand Down Expand Up @@ -223,7 +223,7 @@ In this walkthrough, you'll
1. Download external-dns to manage Route 53.

```bash
wget https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.0/docs/examples/external-dns.yaml
wget https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.5/docs/examples/external-dns.yaml
```

1. Edit the `--domain-filter` flag to include your hosted zone(s)
Expand Down Expand Up @@ -294,7 +294,7 @@ In this walkthrough, you'll
follow below steps if you want to use kube2iam to provide the AWS credentials

1. configure the proper policy
The policy to be used can be fetched from https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.0/docs/install/iam_policy.json
The policy to be used can be fetched from https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.5/docs/install/iam_policy.json

1. configure the proper role and create the trust relationship
You have to find which role is associated with your K8S nodes. Once you found take note of the full arn:
Expand Down
64 changes: 64 additions & 0 deletions hack/set-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env bash

# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This script helps with updating versions across the repo, updating the
# multiple places where we encode a aws-load-balancer-controller version number.

# Use: hack/set-version <new-release-version>

# new-release-version is the version you are releasing.

#
# Examples:
# 1.20.1
# 1.21.0-alpha.1
# 1.21.0-beta.1

set -e
set -x

NEW_RELEASE_VERSION=$1

if [[ ! "${NEW_RELEASE_VERSION}" =~ ^([0-9]+[.][0-9]+)[.]([0-9]+)(-(alpha|beta)[.]([0-9]+))?$ ]]; then
echo "syntax $0 <new-release-version>"
echo "<new-relese-version> must be 'X.Y.Z', 'X.Y.Z-alpha.N', or 'X.Y.Z-beta.N'"
exit 1
fi

MINOR=${BASH_REMATCH[1]}
PATCH=${BASH_REMATCH[2]}
PRERELEASE=${BASH_REMATCH[4]}
PRERELEASE_SEQUENCE=${BASH_REMATCH[5]}

PREV_RELEASE_VERSION=$(cat version.txt)
PREV_STABLE_VERSION=$(cat version-stable.txt)

echo "$NEW_RELEASE_VERSION" > version.txt

sed -i.bak -e "s@amazon/aws-alb-ingress-controller:v${PREV_RELEASE_VERSION}@amazon/aws-alb-ingress-controller:v${NEW_RELEASE_VERSION}@g" Makefile

if [[ -z "$PRERELEASE" ]]; then
echo "$NEW_RELEASE_VERSION" > version-stable.txt

sed -i.bak -e "s@newTag: v${PREV_STABLE_VERSION}@newTag: v${NEW_RELEASE_VERSION}@g" config/controller/kustomization.yaml
sed -i.bak -e "s@appVersion: v${PREV_STABLE_VERSION}@appVersion: v${NEW_RELEASE_VERSION}@g" helm/aws-load-balancer-controller/Chart.yaml
sed -i.bak -e "s@tag: v${PREV_STABLE_VERSION}@tag: v${NEW_RELEASE_VERSION}@g" helm/aws-load-balancer-controller/test.yaml
sed -i.bak -e "s@tag: v${PREV_STABLE_VERSION}@tag: v${NEW_RELEASE_VERSION}@g" helm/aws-load-balancer-controller/values.yaml
sed -i.bak -e "s@/v${PREV_STABLE_VERSION}/v${PREV_STABLE_VERSION//./_}_@/v${NEW_RELEASE_VERSION}/v${NEW_RELEASE_VERSION//./_}_@g" docs/deploy/installation.md
sed -i.bak -e "s@/v${PREV_STABLE_VERSION}/@/v${NEW_RELEASE_VERSION}/@g" docs/deploy/installation.md
sed -i.bak -e "s@/v${PREV_STABLE_VERSION}/@/v${NEW_RELEASE_VERSION}/@g" docs/examples/echo_server.md

fi
35 changes: 35 additions & 0 deletions hack/verify-versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

# Copyright 2019 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset
set -o pipefail

RELEASE_VERSION=$(cat version.txt)

"$(dirname "${BASH_SOURCE[0]}")/set-version" "${RELEASE_VERSION}"

changed_files=$(git status --porcelain --untracked-files=no || true)
if [ -n "${changed_files}" ]; then
echo "Detected that version generation is needed"
echo "changed files:"
printf "%s" "${changed_files}\n"
echo "git diff:"
git --no-pager diff
echo "To fix: run 'hack/set-version ${RELEASE_VERSION}'"
exit 1
fi

1 change: 1 addition & 0 deletions version-stable.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.4.5
1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.4.5

0 comments on commit 8d2ee85

Please sign in to comment.