Skip to content

Commit af2c69b

Browse files
Merge pull request #86 from anveshmuppeda/main
Sync feature
2 parents 14fb1c4 + 533359d commit af2c69b

39 files changed

+15493
-25
lines changed

.github/pull_request_template.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Thank you for contributing to the **Kubernetes Complete Hands-On Guides** open-source project! 🎉
2+
3+
We appreciate your time and effort in improving this repository. Please take a moment to fill out the sections below to help us understand your changes and their impact. Your contribution helps make this project better for the entire community! 💪
4+
5+
---
6+
7+
## Description
8+
Please provide a brief summary of the changes made in this pull request. Include any relevant context or background information that may help reviewers understand the purpose and scope of the changes.
9+
10+
## Related Issues
11+
If this pull request addresses any specific issues or tickets, please list them here. This helps in tracking the changes and their impact on the overall project.
12+
Example:
13+
Fixes #123
14+
Closes #456
15+
16+
## Testing
17+
Please describe how you tested the changes made in this pull request. Include any relevant details about the testing environment, test cases, and results.
18+
19+
## Checklist
20+
- [ ] I have read the [CONTRIBUTING.md](CONTRIBUTING.md) document and followed the guidelines.
21+
- [ ] I have updated the documentation as necessary.
22+
- [ ] I have added tests to cover my changes, if applicable.
23+
- [ ] All new and existing tests passed.
24+
- [ ] I have followed the coding style and conventions used in the project.
25+
- [ ] I have included any necessary version updates in the `README.md` file.
26+
- [ ] I have added any necessary environment variables or configuration changes in the `docker-compose.yml` file.
27+
- [ ] I have validated all Kubernetes manifests (e.g., YAML files) using tools like `kubectl apply --dry-run=client`.
28+
- [ ] I have ensured that all Kubernetes examples follow best practices (e.g., resource limits, labels, annotations).
29+
- [ ] I have tested the changes in a Kubernetes cluster (e.g., Minikube, Kind, or a cloud provider).
30+

.github/workflows/docker-build-push-update.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# .github/workflows/docker-build-push-update.yaml
2-
name: App1 Docker Build, Push & Update Manifests
2+
name: FluxCD Demo | App1 Docker Build, Push & Update Manifests
33

44
on:
55
workflow_dispatch:

.github/workflows/docker-build-push.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# .github/workflows/docker-build-push.yaml
2-
name: App2 Docker Build & Manifest Update
2+
name: FluxCD Demo | App2 Docker Build & Manifest Update
33

44
on:
55
workflow_dispatch:

.github/workflows/echo-pod.yaml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# .github/workflows/docker-build-push.yaml
2+
name: Echo-Pod | Docker Build & Push
3+
# This workflow builds and pushes a Docker image for the Echo-Pod application
4+
# and updates the Kubernetes manifests with the new image version.
5+
# It is triggered on workflow dispatch or when changes are made to the specified paths.
6+
# The workflow calculates the new version based on the latest version in Docker Hub
7+
# and the specified bump type (major, minor, or patch).
8+
# The new version is then used to build and push the Docker image,
9+
10+
on:
11+
workflow_dispatch:
12+
inputs:
13+
bump-type:
14+
description: 'Version bump type'
15+
required: true
16+
default: 'minor'
17+
type: choice
18+
options:
19+
- major
20+
- minor
21+
- patch
22+
push:
23+
branches:
24+
- main
25+
- dev
26+
paths:
27+
- 'dockerfiles/echo-pod/**'
28+
- '.github/workflows/echo-pod.yaml'
29+
30+
jobs:
31+
version-calculator:
32+
runs-on: ubuntu-latest
33+
outputs:
34+
new-version: ${{ steps.get-version.outputs.NEW_VERSION }}
35+
steps:
36+
- name: Get latest version from Docker Hub
37+
id: get-version
38+
run: |
39+
# Get auth token if needed (for private repos)
40+
# TOKEN=$(curl -s "https://auth.docker.io/token?service=registry.docker.io&scope=repository:anvesh35/echo-pod-name:pull" | jq -r .token)
41+
42+
# Get all tags
43+
TAGS=$(curl -s "https://hub.docker.com/v2/repositories/anvesh35/echo-pod-name/tags/?page_size=100" | jq -r '.results[].name')
44+
45+
# Filter and sort semantic versions
46+
LATEST=$(echo "$TAGS" | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1)
47+
48+
# Set default if no versions found
49+
if [ -z "$LATEST" ]; then
50+
LATEST="v0.0.0"
51+
fi
52+
53+
# Remove 'v' prefix and split version
54+
VERSION=${LATEST#v}
55+
IFS=. read MAJOR MINOR PATCH <<<"$VERSION"
56+
57+
# Determine bump type
58+
case "${{ inputs.bump-type || 'minor' }}" in
59+
major) MAJOR=$((MAJOR+1)); MINOR=0; PATCH=0 ;;
60+
minor) MINOR=$((MINOR+1)); PATCH=0 ;;
61+
patch) PATCH=$((PATCH+1)) ;;
62+
esac
63+
64+
NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}"
65+
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_OUTPUT
66+
67+
build-push-update:
68+
needs: version-calculator
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Checkout code
72+
uses: actions/checkout@v3
73+
74+
- name: Set up Docker Buildx
75+
uses: docker/setup-buildx-action@v2
76+
77+
- name: Login to Docker Hub
78+
uses: docker/login-action@v2
79+
with:
80+
username: ${{ secrets.DOCKERHUB_USERNAME }}
81+
password: ${{ secrets.DOCKERHUB_TOKEN }}
82+
83+
- name: Build and push Docker image
84+
uses: docker/build-push-action@v4
85+
with:
86+
context: fluxcd/repos/app2/src/
87+
tags: |
88+
anvesh35/echo-pod-name:${{ needs.version-calculator.outputs.new-version }}
89+
anvesh35/echo-pod-name:latest
90+
push: true
91+
platforms: linux/amd64,linux/arm64
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# .github/workflows/docker-build-push.yaml
2+
name: K8s-Tools | All-In-One - Docker Build
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
kubectl-version:
8+
description: 'Version to use for the kubectl client'
9+
required: true
10+
default: '1.29.3'
11+
type: choice
12+
options:
13+
- 1.29.3
14+
- 1.28.3
15+
velero-version:
16+
description: 'Version to use for the Velero client'
17+
required: true
18+
default: '1.12.2'
19+
type: choice
20+
options:
21+
- 1.12.2
22+
- 1.12.1
23+
helm-version:
24+
description: 'Version to use for the Helm client'
25+
required: true
26+
default: '3.14.4'
27+
type: choice
28+
options:
29+
- 3.14.4
30+
- 3.14.3
31+
argocd-version:
32+
description: 'Version to use for the ArgoCD client'
33+
required: true
34+
default: '2.8.3'
35+
type: choice
36+
options:
37+
- 2.8.3
38+
- 2.8.2
39+
flux-version:
40+
description: 'Version to use for the FluxCD client'
41+
required: true
42+
default: '2.1.0'
43+
type: choice
44+
options:
45+
- 2.1.0
46+
- 2.0.0
47+
eksctl-version:
48+
description: 'Version to use for the EKSCTL client'
49+
required: true
50+
default: '0.150.0'
51+
type: choice
52+
options:
53+
- 0.150.0
54+
- 0.149.0
55+
56+
push:
57+
branches:
58+
- main
59+
- dev
60+
paths:
61+
- 'dockerfiles/k8s-tools/allinone/Dockerfile'
62+
63+
jobs:
64+
build-push-update:
65+
runs-on: ubuntu-latest
66+
steps:
67+
- name: Checkout code (with all branches)
68+
uses: actions/checkout@v3
69+
with:
70+
fetch-depth: 0
71+
ref: dev
72+
73+
- name: Prepare version
74+
id: prep
75+
run: |
76+
if [[ $GITHUB_REF == refs/tags/* ]]; then
77+
VERSION=${GITHUB_REF#refs/tags/}
78+
BUILD_IMAGE=true
79+
else
80+
VERSION=${GITHUB_SHA::8}
81+
BUILD_IMAGE=true
82+
fi
83+
BUILD_IMAGE=true
84+
echo "VERSION=$VERSION" >> $GITHUB_ENV
85+
echo "ALLINONEIMAGE=anvesh35/k8s-tools:allinone-$VERSION" >> $GITHUB_ENV
86+
echo "LATESTALLINONEIMAGE=anvesh35/k8s-tools:latest" >> $GITHUB_ENV
87+
echo "BUILD_IMAGE=$BUILD_IMAGE" >> $GITHUB_ENV
88+
89+
- name: Set up Docker Buildx
90+
if: env.BUILD_IMAGE == 'true'
91+
uses: docker/setup-buildx-action@v2
92+
93+
- name: Login to Docker Hub
94+
if: env.BUILD_IMAGE == 'true'
95+
uses: docker/login-action@v2
96+
with:
97+
username: ${{ secrets.DOCKERHUB_USERNAME }}
98+
password: ${{ secrets.DOCKERHUB_TOKEN }}
99+
100+
- name: Build and push All-In-One Docker image
101+
if: env.BUILD_IMAGE == 'true'
102+
uses: docker/build-push-action@v4
103+
with:
104+
context: dockerfiles/k8s-tools/allinone/
105+
file: dockerfiles/k8s-tools/allinone/Dockerfile
106+
push: true
107+
tags: |
108+
${{ env.ALLINONEIMAGE }}
109+
${{ env.LATESTALLINONEIMAGE }}
110+
platforms: linux/amd64,linux/arm64
111+
build-args: |
112+
KUBECTL_VERSION=${{ github.event.inputs.kubectl-version }}
113+
VELERO_VERSION=${{ github.event.inputs.velero-version }}
114+
HELM_VERSION=${{ github.event.inputs.helm-version }}
115+
ARGOCD_VERSION=${{ github.event.inputs.argocd-version }}
116+
FLUX_VERSION=${{ github.event.inputs.flux-version }}
117+
EKSCTL_VERSION=${{ github.event.inputs.eksctl-version }}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# .github/workflows/docker-build-push.yaml
2+
name: K8s-Tools | ArgoCD - Docker Build
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: 'Version to use for the Docker image'
9+
required: true
10+
default: 'v2.8.3'
11+
type: choice
12+
options:
13+
- v2.8.3
14+
- v2.8.2
15+
push:
16+
branches:
17+
- main
18+
- dev
19+
paths:
20+
- 'dockerfiles/k8s-tools/argocd/Dockerfile'
21+
22+
jobs:
23+
build-push-update:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout code (with all branches)
27+
uses: actions/checkout@v3
28+
with:
29+
fetch-depth: 0
30+
ref: dev
31+
32+
- name: Prepare version
33+
id: prep
34+
run: |
35+
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
36+
VERSION=${{ github.event.inputs.version }}
37+
else
38+
VERSION=${GITHUB_SHA::8}
39+
fi
40+
BUILD_IMAGE=true
41+
echo "VERSION=$VERSION" >> $GITHUB_ENV
42+
echo "IMAGE=anvesh35/k8s-tools:argocd-$VERSION" >> $GITHUB_ENV
43+
echo "AERGOCDIMAGE=anvesh35/argocd-cli:$VERSION" >> $GITHUB_ENV
44+
echo "LATESTARGOCDIMAGE=anvesh35/argocd-cli:latest" >> $GITHUB_ENV
45+
echo "BUILD_IMAGE=$BUILD_IMAGE" >> $GITHUB_ENV
46+
47+
- name: Set up Docker Buildx
48+
if: env.BUILD_IMAGE == 'true'
49+
uses: docker/setup-buildx-action@v2
50+
51+
- name: Login to Docker Hub
52+
if: env.BUILD_IMAGE == 'true'
53+
uses: docker/login-action@v2
54+
with:
55+
username: ${{ secrets.DOCKERHUB_USERNAME }}
56+
password: ${{ secrets.DOCKERHUB_TOKEN }}
57+
58+
- name: Build and push k8s-tools Docker image
59+
if: env.BUILD_IMAGE == 'true'
60+
uses: docker/build-push-action@v4
61+
with:
62+
context: dockerfiles/k8s-tools/argocd/
63+
file: dockerfiles/k8s-tools/argocd/Dockerfile
64+
push: true
65+
tags: ${{ env.IMAGE }}
66+
platforms: linux/amd64,linux/arm64
67+
build-args: |
68+
VERSION=${{ env.VERSION }}
69+
70+
- name: Build and push ArgoCD Docker image
71+
if: env.BUILD_IMAGE == 'true'
72+
uses: docker/build-push-action@v4
73+
with:
74+
context: dockerfiles/k8s-tools/argocd/
75+
file: dockerfiles/k8s-tools/argocd/Dockerfile
76+
push: true
77+
tags: |
78+
${{ env.AERGOCDIMAGE }}
79+
${{ env.LATESTARGOCDIMAGE }}
80+
platforms: linux/amd64,linux/arm64
81+
build-args: |
82+
VERSION=${{ env.VERSION }}

0 commit comments

Comments
 (0)