mirror of
https://github.com/morten-olsen/homelab-operator.git
synced 2026-02-08 01:36:28 +01:00
Compare commits
7 Commits
8f5e148bb2
...
v0.1.53
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8c7930650 | ||
|
|
eae83bf0dd | ||
|
|
42cc50948d | ||
|
|
ff06613e99 | ||
|
|
9fe279b1b5 | ||
|
|
63e0ef0909 | ||
|
|
a44e3cb2be |
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -55,10 +55,12 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
working-directory: operator
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Run tests
|
||||
working-directory: operator
|
||||
run: pnpm test
|
||||
|
||||
update-release-draft:
|
||||
|
||||
4
.github/workflows/publish-tag.yml
vendored
4
.github/workflows/publish-tag.yml
vendored
@@ -3,7 +3,7 @@ name: Publish tag
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- "main"
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
id: push
|
||||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
|
||||
with:
|
||||
context: .
|
||||
context: ./operator
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
38
.gitignore
vendored
38
.gitignore
vendored
@@ -1,38 +1,2 @@
|
||||
# dependencies (bun install)
|
||||
node_modules
|
||||
|
||||
# output
|
||||
out
|
||||
dist
|
||||
*.tgz
|
||||
|
||||
# code coverage
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# logs
|
||||
logs
|
||||
_.log
|
||||
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# caches
|
||||
.eslintcache
|
||||
.cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# IntelliJ based IDEs
|
||||
.idea
|
||||
|
||||
# Finder (MacOS) folder config
|
||||
.DS_Store
|
||||
|
||||
/secret.*.yaml
|
||||
/data/
|
||||
|
||||
/cloudflare.yaml
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
3.13
|
||||
10
charts/apps/coder/templates/client.yaml
Normal file
10
charts/apps/coder/templates/client.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
apiVersion: homelab.mortenolsen.pro/v1
|
||||
kind: OidcClient
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}'
|
||||
spec:
|
||||
environment: '{{ .Values.globals.environment }}'
|
||||
redirectUris:
|
||||
- path: /api/v2/users/oidc/callback
|
||||
subdomain: '{{ .Values.subdomain }}'
|
||||
matchingMode: strict
|
||||
73
charts/apps/coder/templates/deployment.yaml
Normal file
73
charts/apps/coder/templates/deployment.yaml
Normal file
@@ -0,0 +1,73 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}'
|
||||
spec:
|
||||
strategy:
|
||||
type: Recreate
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: '{{ .Release.Name }}'
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: '{{ .Release.Name }}'
|
||||
spec:
|
||||
serviceAccountName: '{{ .Release.Name }}-serviceaccount'
|
||||
containers:
|
||||
- name: '{{ .Release.Name }}'
|
||||
image: '{{ .Values.image.repository }}:{{ .Values.image.tag }}'
|
||||
imagePullPolicy: '{{ .Values.image.pullPolicy }}'
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 7080
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: http
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: http
|
||||
volumeMounts:
|
||||
- mountPath: /home/coder/.config
|
||||
name: data
|
||||
env:
|
||||
- name: CODER_HTTP_ADDRESS
|
||||
value: '0.0.0.0:7080'
|
||||
- name: CODER_OIDC_ALLOWED_GROUPS
|
||||
value: admin
|
||||
- name: CODER_OIDC_GROUP_FIELD
|
||||
value: groups
|
||||
- name: CODER_ACCESS_URL
|
||||
value: https://coder.olsen.cloud
|
||||
- name: CODER_OIDC_ICON_URL
|
||||
value: https://authentik.olsen.cloud/static/dist/assets/icons/icon.png
|
||||
- name: CODER_DISABLE_PASSWORD_AUTH
|
||||
value: 'true'
|
||||
- name: CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS
|
||||
value: 'false'
|
||||
- name: CODER_OIDC_SIGN_IN_TEXT
|
||||
value: 'Sign in with OIDC'
|
||||
- name: CODER_OIDC_SCOPES
|
||||
value: openid,profile,email,offline_access
|
||||
- name: CODER_OIDC_ISSUER_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: '{{ .Release.Name }}-client'
|
||||
key: configurationIssuer
|
||||
- name: CODER_OIDC_CLIENT_ID
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: '{{ .Release.Name }}-client'
|
||||
key: clientId
|
||||
- name: CODER_OIDC_CLIENT_SECRET
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: '{{ .Release.Name }}-client'
|
||||
key: clientSecret
|
||||
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: '{{ .Release.Name }}-data'
|
||||
11
charts/apps/coder/templates/http-service.yaml
Normal file
11
charts/apps/coder/templates/http-service.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
apiVersion: homelab.mortenolsen.pro/v1
|
||||
kind: HttpService
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}'
|
||||
spec:
|
||||
environment: '{{ .Values.globals.environment }}'
|
||||
subdomain: '{{ .Values.subdomain }}'
|
||||
destination:
|
||||
host: '{{ .Release.Name }}.{{ .Release.Namespace }}.svc.cluster.local'
|
||||
port:
|
||||
number: 80
|
||||
21
charts/apps/coder/templates/role.yaml
Normal file
21
charts/apps/coder/templates/role.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-workspace-creator'
|
||||
rules:
|
||||
- apiGroups: [''] # "" indicates the core API group (for Pods, PVCs, Services)
|
||||
resources: ['pods', 'pods/exec', 'pods/log', 'persistentvolumeclaims', 'services']
|
||||
verbs: ['get', 'list', 'watch', 'create', 'update', 'patch', 'delete']
|
||||
- apiGroups: ['apps'] # For Deployments, StatefulSets
|
||||
resources: ['deployments', 'statefulsets']
|
||||
verbs: ['get', 'list', 'watch', 'create', 'update', 'patch', 'delete']
|
||||
- apiGroups: ['networking.k8s.io'] # For Ingresses
|
||||
resources: ['ingresses']
|
||||
verbs: ['get', 'list', 'watch', 'create', 'update', 'patch', 'delete']
|
||||
- apiGroups: ['events.k8s.io'] # For events related to workspace activity
|
||||
resources: ['events']
|
||||
verbs: ['create', 'patch', 'update'] # Coder might create events for workspace lifecycle
|
||||
# Add any other resources that Coder workspace templates might create (e.g., secrets, configmaps)
|
||||
# - apiGroups: [""]
|
||||
# resources: ["secrets", "configmaps"]
|
||||
# verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
|
||||
13
charts/apps/coder/templates/rolebinding.yaml
Normal file
13
charts/apps/coder/templates/rolebinding.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-workspace-creator-binding'
|
||||
namespace: '{{ .Release.Namespace }}'
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: '{{ .Release.Name }}-serviceaccount'
|
||||
namespace: '{{ .Release.Namespace }}'
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: '{{ .Release.Name }}-workspace-creator'
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
@@ -8,7 +8,7 @@ spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 3000
|
||||
targetPort: 7080
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
5
charts/apps/coder/templates/serviceaccount.yaml
Normal file
5
charts/apps/coder/templates/serviceaccount.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-serviceaccount'
|
||||
namespace: '{{ .Release.Namespace }}'
|
||||
7
charts/apps/coder/values.yaml
Normal file
7
charts/apps/coder/values.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
globals:
|
||||
environment: prod
|
||||
image:
|
||||
repository: ghcr.io/coder/coder
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
subdomain: coder
|
||||
36
charts/apps/gitea/templates/_runner-deployment.yaml
Normal file
36
charts/apps/gitea/templates/_runner-deployment.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-runner'
|
||||
labels:
|
||||
app: '{{ .Release.Name }}-runner'
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: '{{ .Release.Name }}-runner'
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: '{{ .Release.Name }}-runner'
|
||||
spec:
|
||||
containers:
|
||||
- name: '{{ .Release.Name }}-runner'
|
||||
image: docker.io/gitea/act_runner:latest-dind-rootless
|
||||
env:
|
||||
- name: GITEA_INSTANCE_URL
|
||||
value: '{{ .Release.Name }}'
|
||||
- name: GITEA_RUNNER_NAME
|
||||
- name: GITEA_RUNNER_REGISTRATION_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: '{{ .Release.Name }}-runner'
|
||||
key: registration_token
|
||||
- name: DOCKER_HOST
|
||||
value: tcp://localhost:2376
|
||||
- name: DOCKER_CERT_PATH
|
||||
value: /certs/client
|
||||
- name: DOCKER_TLS_VERIFY
|
||||
value: '1'
|
||||
securityContext:
|
||||
privileged: true
|
||||
@@ -22,6 +22,9 @@ spec:
|
||||
- name: http
|
||||
containerPort: 3000
|
||||
protocol: TCP
|
||||
- name: ssh
|
||||
containerPort: 22
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: http
|
||||
@@ -40,8 +43,8 @@ spec:
|
||||
value: '1000'
|
||||
- name: GITEA__service__REQUIRE_EXTERNAL_REGISTRATION_PASSWORD
|
||||
value: 'true'
|
||||
- name: GITEA__service__ENABLE_BASIC_AUTHENTICATION
|
||||
value: 'true'
|
||||
#- name: GITEA__service__ENABLE_BASIC_AUTHENTICATION
|
||||
# value: 'true'
|
||||
- name: GITEA__service__ENABLE_PASSWORD_SIGNIN_FORM
|
||||
value: 'false'
|
||||
- name: GITEA__service__DEFAULT_KEEP_EMAIL_PRIVATE
|
||||
32
charts/apps/gitea/templates/service.yaml
Normal file
32
charts/apps/gitea/templates/service.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}'
|
||||
labels:
|
||||
app: '{{ .Release.Name }}'
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 3000
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
app: '{{ .Release.Name }}'
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-ssh'
|
||||
labels:
|
||||
app: '{{ .Release.Name }}'
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- port: 2202
|
||||
targetPort: 22
|
||||
protocol: TCP
|
||||
name: ssh
|
||||
selector:
|
||||
app: '{{ .Release.Name }}'
|
||||
3
charts/apps/harbor/Chart.yaml
Normal file
3
charts/apps/harbor/Chart.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
apiVersion: v2
|
||||
version: 1.0.0
|
||||
name: monitoring
|
||||
38
charts/apps/harbor/templates/helm.yaml
Normal file
38
charts/apps/harbor/templates/helm.yaml
Normal file
@@ -0,0 +1,38 @@
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: HelmRepository
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}'
|
||||
spec:
|
||||
interval: 1h
|
||||
url: https://helm.goharbor.io
|
||||
|
||||
---
|
||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||
kind: HelmRelease
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}'
|
||||
spec:
|
||||
chart:
|
||||
spec:
|
||||
chart: harbor
|
||||
reconcileStrategy: ChartVersion
|
||||
sourceRef:
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: HelmRepository
|
||||
name: '{{ .Release.Name }}'
|
||||
namespace: '{{ .Release.Namespace }}'
|
||||
interval: 1h
|
||||
values:
|
||||
persistence:
|
||||
persistentVolumeClaim:
|
||||
registry:
|
||||
storageClass: '{{ .Values.globals.environment }}'
|
||||
jobservice:
|
||||
jobLog:
|
||||
storageClass: '{{ .Values.globals.environment }}'
|
||||
database:
|
||||
storageClass: '{{ .Values.globals.environment }}'
|
||||
redis:
|
||||
storageClass: '{{ .Values.globals.environment }}'
|
||||
trivy:
|
||||
storageClass: '{{ .Values.globals.environment }}'
|
||||
11
charts/apps/harbor/templates/http-service.yaml
Normal file
11
charts/apps/harbor/templates/http-service.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
apiVersion: homelab.mortenolsen.pro/v1
|
||||
kind: HttpService
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}'
|
||||
spec:
|
||||
environment: '{{ .Values.globals.environment }}'
|
||||
subdomain: '{{ .Values.subdomain }}'
|
||||
destination:
|
||||
host: '{{ .Release.Name }}.{{ .Release.Namespace }}.svc.cluster.local'
|
||||
port:
|
||||
number: 80
|
||||
3
charts/apps/harbor/values.yaml
Normal file
3
charts/apps/harbor/values.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
globals:
|
||||
environment: prod
|
||||
subdomain: harbor
|
||||
@@ -11,9 +11,22 @@ spec:
|
||||
targetPort: 8080
|
||||
protocol: TCP
|
||||
name: http
|
||||
- name: wireguard-udp # TODO: should this be a LB service?
|
||||
port: 41641
|
||||
targetPort: 41641
|
||||
protocol: UDP
|
||||
selector:
|
||||
app: '{{ .Release.Name }}'
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-headscale'
|
||||
labels:
|
||||
app: '{{ .Release.Name }}'
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- port: 41641
|
||||
targetPort: 41641
|
||||
protocol: UDP
|
||||
name: wireguard-udp
|
||||
selector:
|
||||
app: '{{ .Release.Name }}'
|
||||
@@ -1,3 +1,3 @@
|
||||
apiVersion: v2
|
||||
version: 1.0.0
|
||||
name: root
|
||||
name: openwebui
|
||||
11
charts/apps/openwebui/templates/pvc.yaml
Normal file
11
charts/apps/openwebui/templates/pvc.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: '{{ .Release.Name }}-data'
|
||||
spec:
|
||||
accessModes:
|
||||
- 'ReadWriteOnce'
|
||||
resources:
|
||||
requests:
|
||||
storage: '1Gi'
|
||||
storageClassName: '{{ .Values.globals.environment }}'
|
||||
@@ -1,33 +0,0 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: ApplicationSet
|
||||
metadata:
|
||||
name: homelab-apps
|
||||
namespace: '{{ .Values.env }}-argo'
|
||||
spec:
|
||||
generators:
|
||||
- git:
|
||||
repoURL: '{{ .Values.repo }}'
|
||||
revision: '{{ .Values.ref }}'
|
||||
directories:
|
||||
- path: charts/apps/*
|
||||
include: '.*'
|
||||
exclude: '.*.disabled'
|
||||
template:
|
||||
metadata:
|
||||
name: '{{`{{path.basename}}`}}'
|
||||
spec:
|
||||
project: default
|
||||
source:
|
||||
repoURL: '{{ .Values.repo }}'
|
||||
targetRevision: '{{ .Values.ref }}'
|
||||
path: charts/apps/{{`{{path.basename}}`}}
|
||||
helm:
|
||||
values: |
|
||||
globals: {{ .Values.globals | toYaml | nindent 14 }}
|
||||
destination:
|
||||
server: https://kubernetes.default.svc
|
||||
namespace: '{{ .Values.globals.env }}'
|
||||
syncPolicy:
|
||||
automated:
|
||||
prune: true
|
||||
selfHeal: true
|
||||
@@ -1,21 +0,0 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: homelab-root
|
||||
namespace: '{{ .Values.globals.env }}-argo'
|
||||
spec:
|
||||
project: default
|
||||
source:
|
||||
repoURL: '{{ .Values.repo }}'
|
||||
targetRevision: '{{ .Values.ref }}'
|
||||
path: charts/root
|
||||
helm:
|
||||
valueFiles:
|
||||
- values.yaml
|
||||
destination:
|
||||
server: https://kubernetes.default.svc
|
||||
namespace: '{{ .Values.globals.env }}-argo'
|
||||
syncPolicy:
|
||||
automated:
|
||||
prune: true
|
||||
selfHeal: true
|
||||
@@ -1,4 +0,0 @@
|
||||
globals:
|
||||
env: prod
|
||||
repo: https://github.com/morten-olsen/homelab-operator.git
|
||||
ref: HEAD
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user