Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
32a18ff
Fix typo in EMBEDED_CHART_VERSION variable
mallardduck Oct 11, 2024
9b81ed4
Add tests from hpo+hl repo
mallardduck Oct 10, 2024
9cae444
Merge repo readmes
mallardduck Oct 10, 2024
392b7fd
Bring over docker files
mallardduck Oct 10, 2024
3af8c44
Copy in hpo examples
mallardduck Oct 10, 2024
750e9e6
bring in docs
mallardduck Oct 10, 2024
8935f15
Add helm-locker source
mallardduck Oct 10, 2024
8ae1135
Add versoin function doc
mallardduck Oct 10, 2024
6eac673
make sure `helm-locker` pkg doesn't use `helm-project-operator` repo
mallardduck Oct 10, 2024
90916b8
Ensure go generate works with all local package
mallardduck Oct 10, 2024
18bb73a
Add tag for prom-fed cli entry
mallardduck Oct 10, 2024
b46d13d
correct issue with versions being set
mallardduck Oct 10, 2024
3ff084e
Add helm-locker and helm-project-operator chart packages
mallardduck Oct 10, 2024
d2a16e5
Update to use local dependency instead of remote
mallardduck Oct 10, 2024
7fd18f5
Add helm-locker ci workflow
mallardduck Oct 11, 2024
f427e67
enabled make test cmd for helm-locker
mallardduck Oct 11, 2024
9f59c1d
Use env to set bash shebang
mallardduck Oct 11, 2024
fcbd8e1
Enable tests for `helm-locker`
mallardduck Oct 11, 2024
b58581e
remove bash array usage
mallardduck Oct 11, 2024
5c1d356
Correct helm-locker docker file bin path
mallardduck Oct 11, 2024
3ee5104
fix helm-project-operator yq arch and bin path
mallardduck Oct 11, 2024
0604fb0
Update helm-locker chart values
mallardduck Oct 11, 2024
1e4f7ab
Add helm-locker e2e tests
mallardduck Oct 11, 2024
2ef477e
import helm-project-operator codebase
mallardduck Oct 11, 2024
3a77b3f
Update gomod to remove helm-project-operator imports
mallardduck Oct 11, 2024
f116e55
Add hpo example chart
mallardduck Oct 11, 2024
0f0fbdc
Enable hpo generator
mallardduck Oct 11, 2024
c383c30
import existing crds files
mallardduck Oct 11, 2024
c2b455d
run go generate
mallardduck Oct 11, 2024
0a14b2c
Add in HPO ci actions
mallardduck Oct 11, 2024
310f05c
ensure Golang is setup
mallardduck Oct 11, 2024
f544596
limit validate-chart to primary prom-fed package
mallardduck Oct 11, 2024
5f663fe
Move project-operator-example to examples dir
mallardduck Oct 11, 2024
6c225b2
Adjust chart embedding script
mallardduck Oct 11, 2024
23175b4
fix missing util funcs
mallardduck Oct 11, 2024
f093ab1
import the helm-locker example chart
mallardduck Oct 11, 2024
de3a9d3
merge gitignore files
mallardduck Oct 11, 2024
27af1a9
Add dapper back for local-only use
mallardduck Oct 11, 2024
0605b14
Add hpo e2e workflow
mallardduck Oct 11, 2024
b740451
correct HPO e2e paths
mallardduck Oct 11, 2024
dff3025
Correct bci image tag
mallardduck Oct 11, 2024
878decd
Fix arch issue in CI
mallardduck Oct 11, 2024
c86f635
enable arm64 for hpo
mallardduck Oct 11, 2024
9bd26df
golinter fixes
mallardduck Oct 14, 2024
2ffaec1
move helm-locker chart from packages to examples
mallardduck Oct 14, 2024
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
./.dapper
./.cache
./dist
./build
21 changes: 21 additions & 0 deletions .github/workflows/e2e/scripts/hpo-create-project-namespace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -e

source $(dirname $0)/entry

cd $(dirname $0)/../../../..

USE_RANCHER=${USE_RANCHER:-"false"}
if [ "$USE_RANCHER" = "true" ]; then
kubectl apply -f ./examples/helm-project-operator/ci/project.yaml
fi

kubectl apply -f ./examples/helm-project-operator/ci/namespace.yaml

sleep "${DEFAULT_SLEEP_TIMEOUT_SECONDS}"
if ! kubectl get namespace cattle-project-p-example; then
echo "ERROR: Expected cattle-project-p-example namespace to exist after ${DEFAULT_SLEEP_TIMEOUT_SECONDS} seconds, not found"
exit 1
fi

echo "PASS: Project Registration Namespace was created"
31 changes: 31 additions & 0 deletions .github/workflows/e2e/scripts/hpo-create-projecthelmchart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
set -e

source $(dirname $0)/entry

cd $(dirname $0)/../../../..

kubectl apply -f ./examples/helm-project-operator/ci/project-helm-chart.yaml
sleep ${DEFAULT_SLEEP_TIMEOUT_SECONDS};

if ! kubectl get -n cattle-helm-system job/helm-install-project-operator-example-chart-dummy; then
echo "ERROR: Helm Install Job for Example Chart was never created after ${KUBECTL_WAIT_TIMEOUT} seconds"
echo "PROJECT HELM CHARTS:"
kubectl get projecthelmchart -n cattle-project-p-example -o yaml
echo "HELM CHARTS:"
kubectl get helmcharts -n cattle-helm-system -o yaml
echo "HELM RELEASES:"
kubectl get helmreleases -n cattle-helm-system -o yaml
echo "HELM PROJECT OPERATOR:"
kubectl logs deployment/helm-project-operator -n cattle-helm-system
exit 1
fi

if ! kubectl wait --for=condition=complete --timeout="${KUBECTL_WAIT_TIMEOUT}" -n cattle-helm-system job/helm-install-project-operator-example-chart-dummy; then
echo "ERROR: Helm Install Job for Example Chart never completed after ${KUBECTL_WAIT_TIMEOUT} seconds"
kubectl logs job/helm-install-project-operator-example-chart-dummy -n cattle-helm-system
exit 1
fi
kubectl logs job/helm-install-project-operator-example-chart-dummy -n cattle-helm-system

echo "PASS: Adding ProjectHelmChart successfully installed Example Chart"
17 changes: 17 additions & 0 deletions .github/workflows/e2e/scripts/hpo-delete-projecthelmchart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -e

source $(dirname $0)/entry

cd $(dirname $0)/../../../..

kubectl delete -f ./examples/helm-project-operator/ci/project-helm-chart.yaml
if kubectl get -n cattle-helm-system job/helm-delete-project-operator-example-chart-dummy --ignore-not-found; then
if ! kubectl wait --for=condition=complete --timeout="${KUBECTL_WAIT_TIMEOUT}" -n cattle-helm-system job/helm-delete-project-operator-example-chart-dummy; then
echo "ERROR: Helm Uninstall Job for Example Chart never completed after ${KUBECTL_WAIT_TIMEOUT}"
kubectl logs job/helm-delete-project-operator-example-chart-dummy -n cattle-helm-system
exit 1
fi
fi

echo "PASS: Removing ProjectHelmChart successfully uninstalled Example Chart"
69 changes: 69 additions & 0 deletions .github/workflows/e2e/scripts/hpo-install-helm-project-operator.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash
set -e

source $(dirname $0)/entry

cd $(dirname $0)/../../../..

latest_chart=./packages/helm-project-operator/charts

case "${KUBERNETES_DISTRIBUTION_TYPE}" in
"k3s")
cluster_args=""
kubernetes_version=$(kubectl version --short | grep "Server Version" | cut -d ' ' -f3)
case "${kubernetes_version}" in
v1.23.*)
embedded_helm_controller_fixed_version="v1.23.14"
if [[ $(echo ${kubernetes_version} ${embedded_helm_controller_fixed_version} | tr " " "\n" | sort -rV | head -n 1 ) == "${embedded_helm_controller_fixed_version}" ]]; then
cluster_args="--set helmController.enabled=false"
fi
;;
v1.24.*)
embedded_helm_controller_fixed_version="v1.24.8"
if [[ $(echo ${kubernetes_version} ${embedded_helm_controller_fixed_version} | tr " " "\n" | sort -rV | head -n 1 ) == "${embedded_helm_controller_fixed_version}" ]]; then
cluster_args="--set helmController.enabled=false"
fi
;;
*)
embedded_helm_controller_fixed_version="v1.25.4"
if [[ $(echo ${kubernetes_version} ${embedded_helm_controller_fixed_version} | tr " " "\n" | sort -rV | head -n 1 ) == "${embedded_helm_controller_fixed_version}" ]]; then
cluster_args="--set helmController.enabled=false"
fi
;;
esac
;;
"rke")
cluster_args=""
;;
"rke2")
cluster_args=""
kubernetes_version=$(kubectl version --short | grep "Server Version" | cut -d ' ' -f3)
case "${kubernetes_version}" in
v1.23.*)
embedded_helm_controller_fixed_version="v1.23.14"
if [[ $(echo ${kubernetes_version} ${embedded_helm_controller_fixed_version} | tr " " "\n" | sort -rV | head -n 1 ) == "${embedded_helm_controller_fixed_version}" ]]; then
cluster_args="--set helmController.enabled=false"
fi
;;
v1.24.*)
embedded_helm_controller_fixed_version="v1.24.8"
if [[ $(echo ${kubernetes_version} ${embedded_helm_controller_fixed_version} | tr " " "\n" | sort -rV | head -n 1 ) == "${embedded_helm_controller_fixed_version}" ]]; then
cluster_args="--set helmController.enabled=false"
fi
;;
*)
embedded_helm_controller_fixed_version="v1.25.4"
if [[ $(echo ${kubernetes_version} ${embedded_helm_controller_fixed_version} | tr " " "\n" | sort -rV | head -n 1 ) == "${embedded_helm_controller_fixed_version}" ]]; then
cluster_args="--set helmController.enabled=false"
fi
;;
esac
;;
*)
echo "KUBERNETES_DISTRIBUTION_TYPE=${KUBERNETES_DISTRIBUTION_TYPE} is unknown"
exit 1
esac

helm upgrade --install --create-namespace -n cattle-helm-system helm-project-operator --set image.repository=${REPO:-rancher}/helm-project-operator --set image.tag=${TAG:-dev} ${cluster_args} ${RANCHER_HELM_ARGS} ${latest_chart}

echo "PASS: Helm Project Operator has been installed"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e

source $(dirname $0)/entry

cd $(dirname $0)/../../../..

helm uninstall --wait -n cattle-helm-system helm-project-operator

echo "PASS: Helm Project Operator has been uninstalled"
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -e

source $(dirname $0)/entry

cd $(dirname $0)/../../../..

if ! kubectl -n cattle-helm-system rollout status deployment helm-project-operator --timeout="${KUBECTL_WAIT_TIMEOUT}"; then
echo "ERROR: Helm Project Operator did not roll out"
kubectl get pods -n cattle-helm-system -o yaml
exit 1
fi

echo "PASS: Helm Project Operator is up and running"
27 changes: 27 additions & 0 deletions .github/workflows/hl-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "[helm-locker] CI"

on:
workflow_call:
pull_request:
push:
branches:
- main

jobs:
build:
strategy:
matrix:
arch:
- x64
- arm64
runs-on : runs-on,image=ubuntu22-full-${{ matrix.arch }},runner=4cpu-linux-${{ matrix.arch }},run-id=${{ github.run_id }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name : Set up Go
uses : actions/setup-go@v5
with:
go-version: 1.22
- name: Run CI
run: BUILD_TARGET=helm-locker make ci
53 changes: 53 additions & 0 deletions .github/workflows/hl-e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "[helm-locker] CI-e2e"

on:
pull_request:
push:
branches:
- main
paths:
- 'go.mod'
- 'charts/helm-locker*/**'
- 'crds/helm-locker/**'
- 'package/Dockerfile-helm-locker'
- 'cmd/helm-locker/**'
- 'pkg/helm-locker/**'

env:
CLUSTER_NAME : e2e-ci-helm-locker
K3S_VERSION : v1.27.9-k3s1

jobs:
build:
strategy:
matrix:
arch:
- x64
- arm64
runs-on : runs-on,image=ubuntu22-full-${{ matrix.arch }},runner=4cpu-linux-${{ matrix.arch }},run-id=${{ github.run_id }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name : Set up Go
uses : actions/setup-go@v5
with:
go-version: 1.22
- uses: azure/setup-kubectl@v3
- uses: azure/setup-helm@v3
- name: build
run: BUILD_TARGET=helm-locker make build
- name : Install k3d
run : ./.github/workflows/e2e/scripts/install-k3d.sh
- name : Setup k3d cluster
run : K3S_VERSION=${{ env.K3S_VERSION }} ./.github/workflows/e2e/scripts/setup-cluster.sh
# temporary hack to run the helm-locker controller in the k3d cluster
- name : run helm-locker
run : |
kubectl create ns cattle-helm-system
./build/bin/helm-locker &
- name : run e2e tests
run: |
k3d kubeconfig get ${{ env.CLUSTER_NAME }} > kubeconfig.yaml
export KUBECONFIG=$(pwd)/kubeconfig.yaml
cd tests && KUBECONFIG=$KUBECONFIG go test -v -race -timeout 30m ./...
69 changes: 69 additions & 0 deletions .github/workflows/hpo-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: "[helm-project-operator] ci"

env:
CGO_ENABLED: 0
YQ_VERSION: v4.44.3

on:
pull_request:
workflow_call:
inputs:
skip_build:
default: 'false'
required: false
type: string

permissions:
contents: read

jobs:
build:
strategy:
matrix:
arch:
- x64
- arm64
runs-on : runs-on,image=ubuntu22-full-${{ matrix.arch }},runner=4cpu-linux-${{ matrix.arch }},run-id=${{ github.run_id }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name : setup Go
uses : actions/setup-go@v5
with:
go-version: 1.22
- name: Install mikefarah/yq
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_${{ matrix.arch == 'x64' && 'amd64' || matrix.arch }} -O /usr/bin/yq && sudo chmod +x /usr/bin/yq;
- uses: azure/setup-helm@v3
- name: Perform CI
run : BUILD_TARGET=helm-project-operator make ci
build-images:
if: ${{ inputs.skip_build != 'true' }}
strategy:
matrix:
arch:
- x64
- arm64
runs-on : runs-on,image=ubuntu22-full-${{ matrix.arch }},runner=4cpu-linux-${{ matrix.arch }},run-id=${{ github.run_id }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name : Set up Go
uses : actions/setup-go@v5
with:
go-version: 1.22
- name : Export image version
run : |
source ./scripts/version
echo IMAGE=$IMAGE >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Helm Project Operator image
uses: docker/build-push-action@v5
with:
context: .
file: ./package/Dockerfile-helm-project-operator
push: false
tags: ${{ env.IMAGE }}
Loading
Loading