Skip to content

Commit 6322c39

Browse files
authored
F2calv/2024 05 update2 (#77)
* add chart * update ci * updates * updates * doc update * tidy * update cargo.lock
1 parent 7d36359 commit 6322c39

File tree

16 files changed

+480
-128
lines changed

16 files changed

+480
-128
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
# - .github
1010
# - .scripts
1111
# - .charts
12-
- kustomize
1312
- LICENSE
1413
- README.md
1514
- build.sh
@@ -33,16 +32,21 @@ jobs:
3332

3433
image:
3534
uses: f2calv/gha-workflows/.github/workflows/container-image-build.yml@v1
35+
permissions:
36+
packages: write #for pushing container image
37+
contents: read #note: for private repos setting packages to write, will reset all other permissions to none (weird?)
3638
needs: [versioning, app]
3739
with:
3840
tag: ${{ needs.versioning.outputs.semVer }}
3941

4042
chart:
41-
uses: f2calv/gha-workflows/.github/workflows/helm-chart-build.yml@v1
43+
uses: f2calv/gha-workflows/.github/workflows/helm-chart-package.yml@v1
44+
permissions:
45+
packages: write #for pushing helm artifact
46+
contents: read #note: for private repos setting packages to write, will reset all other permissions to none (weird?)
4247
needs: [versioning, app, image]
43-
if: github.ref == 'refs/heads/main'
4448
with:
45-
semVer: ${{ needs.versioning.outputs.semVer }}
49+
tag: ${{ needs.versioning.outputs.semVer }}
4650

4751
release:
4852
needs: [versioning, app, image, chart]
@@ -51,5 +55,6 @@ jobs:
5155
permissions:
5256
contents: write
5357
with:
58+
semVer: ${{ needs.versioning.outputs.semVer }}
5459
tag-prefix: ''
5560
move-major-tag: false

Cargo.lock

Lines changed: 38 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ If you find this repository useful then give it a :star: ... :wink:
1515
## Goals
1616

1717
- Construct a Rust multi-architecture container image via a single Dockerfile using the `docker buildx` command.
18-
- Create GitHub Actions workflow to;
18+
- Create a single GitHub Actions workflow [ci.yml](.github/workflows/ci.yml) to handle all tasks and host the reuseable workflows in an external [gha-workflows](https://github.com/f2calv/gha-workflows) repository.
1919

20-
- Push finished multi-architecture container image to GitHub packages.
20+
- Auto-Semantic Versioning
21+
- Build App
22+
- Build Container + Push To GitHub Packages
23+
- Package Helm Chart + Push To GitHub Packages
24+
- GitHub Release
2125

2226
## Run Pre-Built Container Image
2327

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: multi-arch-container-rust
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "1.16.0"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range $host := .Values.ingress.hosts }}
4+
{{- range .paths }}
5+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
6+
{{- end }}
7+
{{- end }}
8+
{{- else if contains "NodePort" .Values.service.type }}
9+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "multi-arch-container-rust.fullname" . }})
10+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11+
echo http://$NODE_IP:$NODE_PORT
12+
{{- else if contains "LoadBalancer" .Values.service.type }}
13+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14+
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "multi-arch-container-rust.fullname" . }}'
15+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "multi-arch-container-rust.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
16+
echo http://$SERVICE_IP:{{ .Values.service.port }}
17+
{{- else if contains "ClusterIP" .Values.service.type }}
18+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "multi-arch-container-rust.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19+
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
20+
echo "Visit http://127.0.0.1:8080 to use your application"
21+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
22+
{{- end }}

0 commit comments

Comments
 (0)