Skip to content

Commit db6aac1

Browse files
committed
Add github actions to create downloadable manifest on release
Also reorganizes the `manifests` directory to have a different overlay for releases.
1 parent 17a1b4f commit db6aac1

16 files changed

+119
-19
lines changed

.github/workflows/build-container-image.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
platform:
22-
- 'linux/amd64'
23-
- 'linux/arm64'
22+
- 'linux/amd64'
23+
- 'linux/arm64'
2424
steps:
2525
- name: Checkout
2626
uses: actions/checkout@v4
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release assets
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build:
13+
name: build
14+
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
shell: bash
18+
permissions:
19+
contents: write
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
persist-credentials: true
26+
27+
- name: Build manifests
28+
run: hack/release-manifests.sh ${{ github.event.release.tag_name }}
29+
30+
- name: Release manifests
31+
uses: softprops/action-gh-release@v2
32+
with:
33+
files: |
34+
_output/install.yaml

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
*.kubeconfig
33
bin/*
44
cover.out
5+
_output

hack/install-demo.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ cluster_name="${1:-kind}"
3939
kind get kubeconfig --name "${cluster_name}" > "${kubeconfig_file}"
4040

4141
# Deploy capargo
42-
kubectl --kubeconfig "${kubeconfig_file}" apply -k manifests/kustomize
42+
kubectl --kubeconfig "${kubeconfig_file}" apply -k manifests/overlays/local
4343
kubectl --kubeconfig "${kubeconfig_file}" rollout --namespace capargo status deployment capargo
4444

4545
# Install vcluster binary

hack/release-manifests.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
set -eou pipefail
3+
4+
OUTPUT_DIR="${OUTPUT_DIR:-_output}"
5+
IMAGE_VERSION=${1}
6+
7+
mkdir -p "${OUTPUT_DIR}"
8+
9+
10+
SED="sed"
11+
# Requires gsed to be installed via brew if on MacOS
12+
if [[ $(uname -s | tr '[:upper:]' '[:lower:]') == "darwin" ]]; then
13+
SED="gsed"
14+
fi
15+
16+
# Create install manifest
17+
echo "# This is an auto-generated file. DO NOT EDIT." > "${OUTPUT_DIR}"/install.yaml
18+
kubectl kustomize manifests/overlays/default >> "${OUTPUT_DIR}"/install.yaml
19+
"${SED}" -i -e "s|image: superorbital/capargo:latest|image: superorbital/capargo:${IMAGE_VERSION}|g" "${OUTPUT_DIR}"/install.yaml
File renamed without changes.

manifests/base/deployment.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: capargo
5+
spec:
6+
replicas: 1
7+
selector: {}
8+
template:
9+
spec:
10+
containers:
11+
- name: capargo
12+
resources:
13+
limits:
14+
cpu: 500m
15+
memory: 1G
16+
serviceAccount: capargo
17+
securityContext:
18+
runAsUser: 1001

manifests/base/kustomization.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
labels:
4+
- includeSelectors: true
5+
pairs:
6+
app.kubernetes.io/name: capargo
7+
namespace: capargo
8+
resources:
9+
- namespace.yaml
10+
- deployment.yaml
11+
- clusterrole.yaml
12+
- clusterrolebinding.yaml
13+
- serviceaccount.yaml
File renamed without changes.
File renamed without changes.

manifests/kustomize/kustomization.yaml

-10
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: capargo
5+
spec:
6+
selector: {}
7+
template:
8+
spec:
9+
containers:
10+
- name: capargo
11+
args:
12+
- --argo-namespace=argocd
13+
image: superorbital/capargo:latest
14+
resources:
15+
limits:
16+
cpu: 500m
17+
memory: 1G
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- ../../base
5+
patches:
6+
- path: deployment-default.yaml

manifests/kustomize/deployment.yaml manifests/overlays/local/deployment-local.yaml

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ kind: Deployment
33
metadata:
44
name: capargo
55
spec:
6-
replicas: 1
76
selector: {}
87
template:
98
spec:
@@ -17,8 +16,5 @@ spec:
1716
imagePullPolicy: Always
1817
resources:
1918
limits:
20-
cpu: 500m
21-
memory: 1G
22-
serviceAccount: capargo
23-
securityContext:
24-
runAsUser: 1001
19+
cpu: 250m
20+
memory: 500M
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- ../../base
5+
patches:
6+
- path: deployment-local.yaml

0 commit comments

Comments
 (0)