-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* cyberchef: add initial chart * remove infro * fix typo * add check if exists in main branch * add check if exists in main branch * add helm package * add debug * add debug * add debug * add debug * add debug * replace help with helm * help * help * help * now it should work * now it should work * add helm login * add permissions * add emptydir * add port 80 * add port 80 * add run as user * add run as user * add run privilleged * add image build * add push on branch build * add push on branch build * fix output * fix output * remove deprecated output * remove deprecated output * add echo * fix output steps * use new image * use new image * use correct temp dir for unpriviliged image * update image location
- Loading branch information
1 parent
f2ebc7d
commit aae4123
Showing
11 changed files
with
303 additions
and
3 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
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,100 @@ | ||
name: Build Images | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'images/**' | ||
pull_request: | ||
paths: | ||
- 'images/**' | ||
|
||
jobs: | ||
create-matrix: | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
images: ${{ steps.images.outputs.images }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Create changed images matrix | ||
id: images | ||
run: | | ||
images=$(git diff --merge-base origin/main --name-only | grep ^images/ | cut -d/ -f2 | uniq | sort | jq -R -s -c 'split("\n")[:-1]') | ||
echo "images=${images}" | ||
echo "images=${images}" >> "$GITHUB_OUTPUT" | ||
build-images: | ||
runs-on: ubuntu-latest | ||
needs: create-matrix | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
imageName: ${{ fromJSON(needs.create-matrix.outputs.images) }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Get short SHA | ||
id: sha | ||
run: | | ||
sha=$(echo "${GITHUB_SHA::7}") | ||
echo "SHA=$sha" | ||
echo "SHA=$sha" >> "$GITHUB_OUTPUT" | ||
- name: Get version from Dockerfile | ||
id: version | ||
run: | | ||
version=$(head -n 1 images/${{ matrix.imageName }}/Dockerfile | awk -F: '{print $NF}' | awk '{print $1}') | ||
echo "VERSION=$version" | ||
echo "VERSION=$version" >> "$GITHUB_OUTPUT" | ||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
if: github.ref == 'refs/heads/main' | ||
with: | ||
context: 'images/${{ matrix.imageName }}' | ||
platforms: linux/amd64,linux/arm64 | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/${{ matrix.imageName }}:latest | ||
ghcr.io/${{ github.repository_owner }}/${{ matrix.imageName }}:${{ steps.version.outputs.VERSION }} | ||
push: true | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
if: github.ref != 'refs/heads/main' | ||
with: | ||
context: 'images/${{ matrix.imageName }}' | ||
platforms: linux/amd64,linux/arm64 | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/${{ matrix.imageName }}:${{ steps.version.outputs.VERSION }}-${{ github.head_ref }}.${{ steps.sha.outputs.SHA }} | ||
push: true |
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,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
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,3 @@ | ||
apiVersion: v2 | ||
name: cyberchef | ||
version: 1.0.0 |
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,16 @@ | ||
# Cyberchef | ||
|
||
## How to use | ||
|
||
Add repository by running: | ||
|
||
```bash | ||
helm repo add k8s-at-our-home https://k8s-at-our-homes.github.io/helm-charts/ | ||
helm install cyberchef k8s-at-our-home/cyberchef | ||
``` | ||
|
||
Or get the chart from ghcr.io: | ||
|
||
```bash | ||
helm install cyberchef oci://ghcr.io/k8s-at-our-homes/helm-charts/cyberchef | ||
``` |
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,31 @@ | ||
{{- define "common.name" -}} | ||
{{- .Chart.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{- define "common.fullname" -}} | ||
{{- if contains .Chart.Name .Release.Name -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- define "chartName" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{- define "common.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ template "common.name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/part-of: "cyberchef" | ||
{{- end -}} | ||
|
||
{{- define "common.labels" -}} | ||
app.kubernetes.io/name: {{ template "common.name" . }} | ||
helm.sh/chart: {{ include "chartName" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/version: {{ .Values.image.tag | quote }} | ||
app.kubernetes.io/part-of: "cyberchef" | ||
{{- end -}} |
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,32 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ template "common.fullname" . }} | ||
labels: {{- include "common.labels" . | nindent 4 }} | ||
spec: | ||
revisionHistoryLimit: 0 | ||
replicas: {{ .Values.replicas }} | ||
selector: | ||
matchLabels: {{- include "common.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
labels: {{- include "common.selectorLabels" . | nindent 8 }} | ||
spec: | ||
nodeSelector: {{ .Values.nodeSelector | toYaml | nindent 8 }} | ||
securityContext: {{ toYaml .Values.podSecurityContext | nindent 8 }} | ||
containers: | ||
- name: core | ||
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
ports: | ||
- name: http | ||
containerPort: 8080 | ||
protocol: TCP | ||
resources: {{ toYaml .Values.resources | nindent 12 }} | ||
securityContext: {{ toYaml .Values.securityContext | nindent 12 }} | ||
volumeMounts: | ||
- mountPath: /tmp/ | ||
name: cache | ||
volumes: | ||
- name: cache | ||
emptyDir: {} |
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,28 @@ | ||
{{ if .Values.ingress.enabled }} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ template "common.fullname" . }} | ||
annotations: {{ toYaml .Values.ingress.annotations | nindent 4 }} | ||
labels: | ||
{{- include "common.labels" . | nindent 4 }} | ||
spec: | ||
ingressClassName: {{ .Values.ingress.class }} | ||
rules: | ||
- host: {{ .Values.ingress.domain }} | ||
http: | ||
paths: | ||
- backend: | ||
service: | ||
name: {{ template "common.fullname" . }} | ||
port: | ||
number: 8080 | ||
path: / | ||
pathType: Prefix | ||
{{- if .Values.ingress.tls.enabled }} | ||
tls: | ||
- hosts: | ||
- {{ .Values.ingress.domain }} | ||
secretName: {{ .Values.ingress.tls.secretName }} | ||
{{- end }} | ||
{{ end }} |
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,15 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ template "common.fullname" . }} | ||
labels: | ||
{{- include "common.labels" . | nindent 4 }} | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- name: http | ||
targetPort: 8080 | ||
port: 8080 | ||
protocol: TCP | ||
selector: | ||
{{- include "common.selectorLabels" . | nindent 4 }} |
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,38 @@ | ||
replicas: 1 | ||
|
||
nodeSelector: {} | ||
|
||
resources: {} | ||
# requests: | ||
# memory: 512Mi | ||
# cpu: 100m | ||
# limits: | ||
# memory: 2048Mi | ||
|
||
podSecurityContext: | ||
runAsUser: 1000 | ||
runAsGroup: 1000 | ||
fsGroup: 1000 | ||
runAsNonRoot: true | ||
|
||
securityContext: | ||
capabilities: | ||
drop: [ "ALL" ] | ||
allowPrivilegeEscalation: false | ||
readOnlyRootFilesystem: true | ||
privileged: false | ||
|
||
image: | ||
registry: ghcr.io | ||
repository: k8s-at-our-homes/cyberchef | ||
tag: 10.18.9 | ||
pullPolicy: IfNotPresent | ||
|
||
ingress: | ||
enabled: true | ||
domain: cyberchef.example.com | ||
class: | ||
annotations: {} | ||
tls: | ||
enabled: true | ||
secretName: |
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,4 @@ | ||
FROM ghcr.io/gchq/cyberchef:10.18.9 AS build | ||
FROM nginxinc/nginx-unprivileged:1.27.0-alpine3.19 AS run | ||
|
||
COPY --from=build /usr/share/nginx/html /usr/share/nginx/html |