-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: different tags for images * fix: image name * fix: dont create custom tags * fix: e2e test workflow copied * fix: chart adjustments * fix: e2e workflow adjustments * fix: metrics issue * fix: metrics * fix: copy metrics from sparrow * fix: more debugging temporarily * fix: change so we get debugging * fix: get error logs * fix: tags * fix: make e2e only manually executable * fix: tags * fix: change trigger event * fix: workflow call * fix: trigger for e2e call * debugging * debuggin2 * fix: cleanup e2e * fix: debugging * more debugging * fix debugging * fix: tags * fix: tags * fix: remove debugging * fix: tags * fix: set tags * fix: tags * fix: tags * trigger rebuild Signed-off-by: Frank Kloeker <[email protected]> --------- Signed-off-by: Frank Kloeker <[email protected]> Co-authored-by: Frank Kloeker <[email protected]>
- Loading branch information
Showing
8 changed files
with
129 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,81 @@ | ||
# Build and push Image | ||
name: Build and push Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set tag | ||
id: set-tag | ||
run: | | ||
SHORT_SHA=$(git rev-parse --short HEAD) | ||
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | ||
echo "::set-output name=tag1::latest" | ||
echo "::set-output name=tag2::commit-$SHORT_SHA" | ||
else | ||
echo "::set-output name=tag1::dev" | ||
echo "::set-output name=tag2::commit-$SHORT_SHA" | ||
fi | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
mtr.devops.telekom.de/caas/kube-downscaler-dtag | ||
mtr.devops.telekom.de/caas/py-kube-downscaler | ||
ghcr.io/caas-team/py-kube-downscaler | ||
tags: | | ||
type=ref,event=tag | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=raw,value=dev | ||
${{ steps.set-tag.outputs.tag1 }} | ||
${{ steps.set-tag.outputs.tag2 }} | ||
- name: Install Cosign | ||
uses: sigstore/cosign-installer@main | ||
with: | ||
cosign-release: 'v2.2.0' | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to MTR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: mtr.devops.telekom.de | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
id: build-push | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: | | ||
mtr.devops.telekom.de/caas/kube-downscaler-dtag:latest | ||
ghcr.io/caas-team/py-kube-downscaler:latest | ||
${{ steps.meta.outputs.tags }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
|
||
- name: Sign Push | ||
run: | | ||
cosign sign --key env://COSIGN_KEY --tlog-upload=false ghcr.io/caas-team/py-kube-downscaler@${{ steps.build-push.outputs.digest }} | ||
cosign sign --key env://COSIGN_KEY --tlog-upload=false mtr.devops.telekom.de/caas/kube-downscaler-dtag@${{ steps.build-push.outputs.digest }} | ||
cosign sign --key env://COSIGN_KEY --tlog-upload=false mtr.devops.telekom.de/caas/py-kube-downscaler@${{ steps.build-push.outputs.digest }} | ||
env: | ||
COSIGN_KEY: ${{secrets.COSIGN_KEY}} | ||
COSIGN_KEY: ${{ secrets.COSIGN_KEY }} | ||
|
||
call-e2e: | ||
needs: build | ||
uses: ./.github/workflows/end2end.yml | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: End-to-End Testing | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
end2end: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up K3S | ||
uses: debianmaster/actions-k3s@master | ||
with: | ||
version: 'v1.26.9-k3s1' | ||
|
||
- name: Check Metricsserver Deployment | ||
run: | | ||
kubectl -n kube-system rollout status deployment/metrics-server --timeout=60s | ||
STATUS=$(kubectl -n kube-system get deployment metrics-server -o jsonpath={.status.readyReplicas}) | ||
if [[ $STATUS -ne 1 ]] | ||
then | ||
echo "Deployment metrics-server not ready" | ||
kubectl -n kube-system get events | ||
exit 1 | ||
else | ||
echo "Deployment metrics-server OK" | ||
fi | ||
- name: Setup Helm | ||
run: | | ||
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash | ||
helm version | ||
- name: Get Image Tag | ||
id: version | ||
run: echo "value=commit-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
|
||
- name: Install py-kube-downscaler | ||
run: | | ||
set +e # Disable exit on error | ||
helm upgrade -i py-kube-downscaler \ | ||
--atomic \ | ||
--timeout 180s \ | ||
--set image.tag=${{ steps.version.outputs.value }} \ | ||
./chart | ||
RESULT=$? | ||
set -e # Re-enable exit on error | ||
if [ $RESULT -ne 0 ]; then | ||
echo "Helm deployment failed, collecting logs and events..." | ||
kubectl describe pods -l app.kubernetes.io/name=py-kube-downscaler | ||
kubectl logs -l app.kubernetes.io/name=py-kube-downscaler --tail=50 | ||
kubectl get events --all-namespaces --sort-by='.lastTimestamp' | ||
exit 1 | ||
fi | ||
- name: Verify Deployment | ||
run: | | ||
kubectl rollout status deployment/py-kube-downscaler --timeout=60s | ||
STATUS=$(kubectl get deployment py-kube-downscaler -o jsonpath='{.status.readyReplicas}') | ||
if [[ "$STATUS" -ne 1 ]]; then | ||
echo "Deployment py-kube-downscaler not ready" | ||
kubectl get events | ||
exit 1 | ||
fi | ||
echo "Deployment py-kube-downscaler OK" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "kube-downscaler.name" . }} | ||
name: {{ include "py-kube-downscaler.name" . }} | ||
data: | ||
# downscale for non-work hours | ||
EXCLUDE_NAMESPACES: "{{- join ", " .Values.excludedNamespaces }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters