Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,13 @@ build-binaries:
upload-binaries-to-github:
${MAKEFILE_PATH}/scripts/upload-binaries-to-github

generate-k8s-yaml:
${MAKEFILE_PATH}/scripts/generate-k8s-yaml

sync-readme-to-dockerhub:
${MAKEFILE_PATH}/scripts/sync-readme-to-dockerhub

release: create-build-dir build-binaries upload-binaries-to-github
release: create-build-dir build-binaries generate-k8s-yaml upload-resources-to-github

docker-build-and-push: docker-build docker-push

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ helm upgrade --install aws-node-termination-handler \
eks/aws-node-termination-handler
```

Basic installation without Helm:
```sh
kubectl apply -f https://github.com/aws/aws-node-termination-handler/releases/download/v1.2.0/all-resources.yaml
```
Comment thread
bwagner5 marked this conversation as resolved.
For a full list of releases and associated artificats see our [releases page](https://github.com/aws/aws-node-termination-handler/releases).

Enabling Features:
```
helm upgrade --install aws-node-termination-handler \
Expand Down
Binary file added aws-node-termination-handler-k8s-resources.tar
Binary file not shown.
61 changes: 61 additions & 0 deletions scripts/generate-k8s-yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash
set -euo pipefail

SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"

PLATFORM=$(uname | tr '[:upper:]' '[:lower:]')
HELM_VERSION="3.0.2"
NAMESPACE="kube-system"

MAKEFILEPATH=$SCRIPTPATH/../Makefile
VERSION=$(make -s -f $MAKEFILEPATH version)
BUILD_DIR=$SCRIPTPATH/../build/k8s-resources/$VERSION
INDV_RESOURCES_DIR=$BUILD_DIR/individual-resources
TAR_RESOURCES_FILE=$BUILD_DIR/individual-resources.tar
AGG_RESOURCES_YAML=$BUILD_DIR/all-resources.yaml
mkdir -p $INDV_RESOURCES_DIR

USAGE=$(cat << 'EOM'
Usage: generate-k8s-yaml [-n <K8s_NAMESPACE>]
Generates the kubernetes yaml resource files from the helm chart
and places them into the build dir.
Example: generate-k8s-yaml -n kube-system
Optional:
-n Kubernetes namespace
EOM
)

# Process our input arguments
while getopts "n:" opt; do
case ${opt} in
n ) # K8s namespace
NAMESPACE=$OPTARG
;;
\? )
echoerr "$USAGE" 1>&2
exit
;;
esac
done

curl -L https://get.helm.sh/helm-v$HELM_VERSION-$PLATFORM-amd64.tar.gz | tar zxf - -C $BUILD_DIR
mv $BUILD_DIR/$PLATFORM-amd64/helm $BUILD_DIR/.
rm -rf $BUILD_DIR/$PLATFORM-amd64
chmod +x $BUILD_DIR/helm

$BUILD_DIR/helm template aws-node-termination-handler \
--namespace kube-system \
Comment thread
bwagner5 marked this conversation as resolved.
$SCRIPTPATH/../config/helm/aws-node-termination-handler/ > $AGG_RESOURCES_YAML


$BUILD_DIR/helm template aws-node-termination-handler \
--namespace $NAMESPACE \
--output-dir $INDV_RESOURCES_DIR/ \
$SCRIPTPATH/../config/helm/aws-node-termination-handler/

cd $INDV_RESOURCES_DIR/aws-node-termination-handler/ && tar cvf $TAR_RESOURCES_FILE templates/*
cd $SCRIPTPATH

echo "Generated aws-node-termination-handler kubernetes yaml resources files in:"
echo " - $AGG_RESOURCES_YAML"
echo " - $TAR_RESOURCES_FILE"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ set -euo pipefail

SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
VERSION=$(make -s -f $SCRIPTPATH/../Makefile version)
BUILD_DIR=$SCRIPTPATH/../build/k8s-resources/$VERSION
INDV_RESOURCES_DIR=$BUILD_DIR/individual-resources
TAR_RESOURCES_FILE=$BUILD_DIR/individual-resources.tar
AGG_RESOURCES_YAML=$BUILD_DIR/all-resources.yaml

RELEASE_ID=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/aws/aws-node-termination-handler/releases | \
jq --arg VERSION "$VERSION" '.[] | select(.tag_name==$VERSION) | .id')
Expand All @@ -14,3 +19,14 @@ for binary in $SCRIPTPATH/../build/bin/*; do
--data-binary @$binary \
"https://uploads.github.com/repos/aws/aws-node-termination-handler/releases/$RELEASE_ID/assets?name=$(basename $binary)"
done


## Upload k8s yaml
resourceFiles=($TAR_RESOURCES_FILE $AGG_RESOURCES_YAML)
for resourceFile in "${resourceFiles[@]}"; do
curl \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: $(file -b --mime-type $resourceFile)" \
--data-binary @$resourceFile \
"https://uploads.github.com/repos/aws/aws-node-termination-handler/releases/$RELEASE_ID/assets?name=$(basename $resourceFile)"
done