Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
43 changes: 34 additions & 9 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1
with:
fetch-depth: 0
# This prepares directory where github/codeql-action/upload-sarif@v1 looks up report files by default.
Expand All @@ -16,7 +16,7 @@ jobs:
run: mkdir -p ../results

- name: Scan yaml files with kube-linter
uses: stackrox/kube-linter-action@v1.0.7
uses: stackrox/kube-linter-action@87802a2f4e01abebb3ee3c67a3002fea71f6eae5 # 1.0.7
id: kube-linter-action-scan
with:
# Adjust this directory to the location where your kubernetes resources and helm charts are located.
Expand All @@ -28,7 +28,7 @@ jobs:
continue-on-error: true

- name: Upload SARIF report files to GitHub
uses: github/codeql-action/upload-sarif@v4
uses: github/codeql-action/upload-sarif@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 #4.73.3

# Ensure the workflow eventually fails if files did not pass kube-linter checks.
- name: Verify kube-linter-action succeeded
Expand All @@ -40,23 +40,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v4.3.1
uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # 5.0.1
with:
version: v3.17.0

- uses: actions/setup-python@v6.2.0
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # 7.0.0
with:
python-version: "3.x"
check-latest: true

# https://github.com/helm/chart-testing-action
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.8.0
uses: helm/chart-testing-action@6ec842c01de15ebb84c8627d2744a0c2f2755c9f # 2.8.0

- name: Run chart-testing (list-changed)
id: list-changed
Expand All @@ -72,8 +72,33 @@ jobs:

- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/kind-action@v1.12.0
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0

- name: Create Namespace and Env
run: |
kubectl create namespace ct-tests
kubectl create secret generic orthos2 \
--from-literal=NetboxToken='nbt_zs4YYi6Uo6IN.3qoyyTHhBugnUlPtwrMT9XfDgtvFPToyOiuQ9GHN' \
--from-literal=OIDCsecret='C8e10s83w6mWl46im3jX9XhzjwcRQ7DyamWFKPLOvVLeG3crBy86LbFjueqJ269yo7S7MoQP7xmZ33q4!' \
--from-literal=OrthosKey='xx3%7wbay2723)xqfhe+w$f5sj4z9!d&chlx7av%^15da$$w*b!' \
--namespace=ct-tests
kubectl create configmap orthos2-env \
--from-literal=ORTHOS2_NETBOX_AUTH_SCHEME=Bearer \
--from-literal=ORTHOS2_NETBOX_URL=http://netbox.orthos2.test:8081 \
--from-literal=ORTHOS2_SUPERUSER_PASSWORD=QGIzDq5RVYoP \
--from-literal=ORTHOS2_DB_ENGINE=django.db.backends.sqlite3 \
--from-literal=ALLOWED_HOSTS="orthos2 orthos.local localhost" \
--from-literal=CSRF_TRUSTED_ORIGINS=https://orthos2.orthos2.test \
--from-literal=CSRF_ALLOWED_ORIGIN=https://orthos2.orthos2.test \
--from-literal=CROSS_ORIGINS_WHITELIST=https://orthos2.orthos2.test \
--from-literal=OIDC_ENDPOINT=https://authentik.orthos2.test/application/o/orthos \
--from-literal=NETBOX_SUPERUSER_NAME=admin \
--from-literal=NETBOX_SUPERUSER_PASSWORD=K2jPoo7eKfad \
--namespace=ct-tests

- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --target-branch ${{ github.event.repository.default_branch }}
run: |
ct install \
--target-branch ${{ github.event.repository.default_branch }} \
--namespace ct-tests
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1
with:
fetch-depth: 0

Expand All @@ -23,6 +23,6 @@ jobs:

# https://github.com/helm/chart-releaser-action
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.7.0
uses: helm/chart-releaser-action@cae68fefc6b5f367a0275617c9f83181ba54714f # 1.7.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@

#Ignore vscode AI rules
.github/instructions/codacy.instructions.md

#Ignore ENV files
.env

#Ignore files for local actions runner
.actrc
event.json
23 changes: 23 additions & 0 deletions charts/orthos2/.helmignore
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/
10 changes: 10 additions & 0 deletions charts/orthos2/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: orthos2
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "1.13.0"
maintainers:
- name: SchoolGuy
email: matrixfueller@gmail.com
url: https://github.com/SchoolGuy
11 changes: 11 additions & 0 deletions charts/orthos2/configmap/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ORTHOS2_NETBOX_AUTH_SCHEME=
ORTHOS2_NETBOX_URL=
ORTHOS2_SUPERUSER_PASSWORD=
ORTHOS2_DB_ENGINE=
ALLOWED_HOSTS=
CSRF_TRUSTED_ORIGINS=
CSRF_ALLOWED_ORIGIN=
CROSS_ORIGINS_WHITELIST=
OIDC_ENDPOINT=
NETBOX_SUPERUSER_NAME=
NETBOX_SUPERUSER_PASSWORD=
35 changes: 35 additions & 0 deletions charts/orthos2/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
1. Get the application URL by running these commands:
{{- if .Values.httpRoute.enabled }}
{{- if .Values.httpRoute.hostnames }}
export APP_HOSTNAME={{ .Values.httpRoute.hostnames | first }}
{{- else }}
export APP_HOSTNAME=$(kubectl get --namespace {{(first .Values.httpRoute.parentRefs).namespace | default .Release.Namespace }} gateway/{{ (first .Values.httpRoute.parentRefs).name }} -o jsonpath="{.spec.listeners[0].hostname}")
{{- end }}
{{- if and .Values.httpRoute.rules (first .Values.httpRoute.rules).matches (first (first .Values.httpRoute.rules).matches).path.value }}
echo "Visit http://$APP_HOSTNAME{{ (first (first .Values.httpRoute.rules).matches).path.value }} to use your application"

NOTE: Your HTTPRoute depends on the listener configuration of your gateway and your HTTPRoute rules.
The rules can be set for path, method, header and query parameters.
You can check the gateway configuration with 'kubectl get --namespace {{(first .Values.httpRoute.parentRefs).namespace | default .Release.Namespace }} gateway/{{ (first .Values.httpRoute.parentRefs).name }} -o yaml'
{{- end }}
{{- else if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "orthos2.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "orthos2.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "orthos2.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "orthos2.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
62 changes: 62 additions & 0 deletions charts/orthos2/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "orthos2.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "orthos2.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "orthos2.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "orthos2.labels" -}}
helm.sh/chart: {{ include "orthos2.chart" . }}
{{ include "orthos2.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "orthos2.selectorLabels" -}}
app.kubernetes.io/name: {{ include "orthos2.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "orthos2.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "orthos2.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Loading