mirror of
https://github.com/morten-olsen/homelab-operator.git
synced 2026-02-08 01:36:28 +01:00
Compare commits
6 Commits
v0.1.110
...
fix/auth-u
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cad527e644 | ||
|
|
ce2cebf77b | ||
|
|
3ae89e81bd | ||
|
|
bc67429cd2 | ||
|
|
af2aae493e | ||
|
|
2af701b518 |
@@ -1,12 +1,12 @@
|
|||||||
apiVersion: rbac.authorization.k8s.io/v1
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
kind: ClusterRoleBinding
|
kind: ClusterRoleBinding
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "homelab-operator.fullname" . }}
|
name: '{{ include "homelab-operator.fullname" . }}'
|
||||||
subjects:
|
subjects:
|
||||||
- kind: ServiceAccount
|
- kind: ServiceAccount
|
||||||
name: {{ include "homelab-operator.serviceAccountName" . }}
|
name: '{{ include "homelab-operator.serviceAccountName" . }}'
|
||||||
namespace: {{ .Release.Namespace }}
|
namespace: "{{ .Release.Namespace }}"
|
||||||
roleRef:
|
roleRef:
|
||||||
kind: ClusterRole
|
kind: ClusterRole
|
||||||
name: {{ include "homelab-operator.fullname" . }}
|
name: '{{ include "homelab-operator.fullname" . }}'
|
||||||
apiGroup: rbac.authorization.k8s.io
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ apiVersion: apps/v1
|
|||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "homelab-operator.fullname" . }}
|
name: {{ include "homelab-operator.fullname" . }}
|
||||||
|
namespace: "{{ .Release.Namespace }}"
|
||||||
labels:
|
labels:
|
||||||
{{- include "homelab-operator.labels" . | nindent 4 }}
|
{{- include "homelab-operator.labels" . | nindent 4 }}
|
||||||
spec:
|
spec:
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ apiVersion: v1
|
|||||||
kind: ServiceAccount
|
kind: ServiceAccount
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "homelab-operator.serviceAccountName" . }}
|
name: {{ include "homelab-operator.serviceAccountName" . }}
|
||||||
|
namespace: "{{ .Release.Namespace }}"
|
||||||
labels:
|
labels:
|
||||||
{{- include "homelab-operator.labels" . | nindent 4 }}
|
{{- include "homelab-operator.labels" . | nindent 4 }}
|
||||||
{{- with .Values.serviceAccount.annotations }}
|
{{- with .Values.serviceAccount.annotations }}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
FROM node:23-slim@sha256:86191b94d2a163be41f3dc7fe5e5fcaca8ba2f1be7275d98a06343483c17414a
|
FROM node:23-slim@sha256:86191b94d2a163be41f3dc7fe5e5fcaca8ba2f1be7275d98a06343483c17414a
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
|
WORKDIR /app
|
||||||
COPY package.json pnpm-lock.yaml ./
|
COPY package.json pnpm-lock.yaml ./
|
||||||
|
COPY patches ./patches
|
||||||
RUN pnpm install --frozen-lockfile --prod
|
RUN pnpm install --frozen-lockfile --prod
|
||||||
COPY . .
|
COPY . .
|
||||||
CMD ["node", "src/index.ts"]
|
CMD ["node", "src/index.ts"]
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
"sqlite3"
|
"sqlite3"
|
||||||
],
|
],
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
"@kubernetes/client-node": "patches/@kubernetes__client-node.patch"
|
"@kubernetes/client-node": "./patches/@kubernetes__client-node.patch"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import { RepoService } from '#bootstrap/repos/repos.ts';
|
|||||||
import { DestinationRule } from '#resources/istio/destination-rule/destination-rule.ts';
|
import { DestinationRule } from '#resources/istio/destination-rule/destination-rule.ts';
|
||||||
import { NotReadyError } from '#utils/errors.ts';
|
import { NotReadyError } from '#utils/errors.ts';
|
||||||
import { ExternalHttpService } from '../external-http-service.ts/external-http-service.ts';
|
import { ExternalHttpService } from '../external-http-service.ts/external-http-service.ts';
|
||||||
|
import { HttpService } from '../http-service/http-service.ts';
|
||||||
|
|
||||||
const specSchema = z.object({
|
const specSchema = z.object({
|
||||||
environment: z.string(),
|
environment: z.string(),
|
||||||
@@ -44,6 +45,7 @@ class AuthentikServer extends CustomResource<typeof specSchema> {
|
|||||||
#initSecret: Secret<InitSecretData>;
|
#initSecret: Secret<InitSecretData>;
|
||||||
#service: Service;
|
#service: Service;
|
||||||
#helmRelease: HelmRelease;
|
#helmRelease: HelmRelease;
|
||||||
|
#httpService: HttpService;
|
||||||
#externalHttpService: ExternalHttpService;
|
#externalHttpService: ExternalHttpService;
|
||||||
#destinationRule: DestinationRule;
|
#destinationRule: DestinationRule;
|
||||||
|
|
||||||
@@ -72,6 +74,8 @@ class AuthentikServer extends CustomResource<typeof specSchema> {
|
|||||||
this.#destinationRule.on('changed', this.queueReconcile);
|
this.#destinationRule.on('changed', this.queueReconcile);
|
||||||
|
|
||||||
this.#externalHttpService = resourceService.get(ExternalHttpService, this.name, this.namespace);
|
this.#externalHttpService = resourceService.get(ExternalHttpService, this.name, this.namespace);
|
||||||
|
|
||||||
|
this.#httpService = resourceService.get(HttpService, this.name, this.namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
public get service() {
|
public get service() {
|
||||||
@@ -253,6 +257,22 @@ class AuthentikServer extends CustomResource<typeof specSchema> {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await this.#httpService.ensure({
|
||||||
|
metadata: {
|
||||||
|
ownerReferences: [this.ref],
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
environment: this.spec.environment,
|
||||||
|
subdomain: this.spec.subdomain || 'authentik',
|
||||||
|
destination: {
|
||||||
|
host: this.#service.hostname,
|
||||||
|
port: {
|
||||||
|
number: 80,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
await this.#externalHttpService.ensure({
|
await this.#externalHttpService.ensure({
|
||||||
metadata: {
|
metadata: {
|
||||||
ownerReferences: [this.ref],
|
ownerReferences: [this.ref],
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class OIDCClient extends CustomResource<typeof specSchema> {
|
|||||||
clientId: this.name,
|
clientId: this.name,
|
||||||
configuration: new URL(`/application/o/${this.appName}/.well-known/openid-configuration`, url).toString(),
|
configuration: new URL(`/application/o/${this.appName}/.well-known/openid-configuration`, url).toString(),
|
||||||
configurationIssuer: new URL(`/application/o/${this.appName}/`, url).toString(),
|
configurationIssuer: new URL(`/application/o/${this.appName}/`, url).toString(),
|
||||||
authorization: new URL(`/application/o/${this.appName}/authorize/`, url).toString(),
|
authorization: new URL(`/application/o/authorize/`, url).toString(),
|
||||||
token: new URL(`/application/o/${this.appName}/token/`, url).toString(),
|
token: new URL(`/application/o/${this.appName}/token/`, url).toString(),
|
||||||
userinfo: new URL(`/application/o/${this.appName}/userinfo/`, url).toString(),
|
userinfo: new URL(`/application/o/${this.appName}/userinfo/`, url).toString(),
|
||||||
endSession: new URL(`/application/o/${this.appName}/end-session/`, url).toString(),
|
endSession: new URL(`/application/o/${this.appName}/end-session/`, url).toString(),
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class PostgresCluster extends CustomResource<typeof specSchema> {
|
|||||||
containers: [
|
containers: [
|
||||||
{
|
{
|
||||||
name: this.name,
|
name: this.name,
|
||||||
image: 'postgres:17',
|
image: 'pgvector/pgvector:pg17-trixie',
|
||||||
ports: [{ containerPort: 5432, name: 'postgres' }],
|
ports: [{ containerPort: 5432, name: 'postgres' }],
|
||||||
env: [
|
env: [
|
||||||
{ name: 'POSTGRES_PASSWORD', valueFrom: { secretKeyRef: { name: secretName, key: 'password' } } },
|
{ name: 'POSTGRES_PASSWORD', valueFrom: { secretKeyRef: { name: secretName, key: 'password' } } },
|
||||||
|
|||||||
@@ -1,28 +1,35 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
|
||||||
"extends": [
|
extends: [
|
||||||
"config:base"
|
'config:recommended',
|
||||||
],
|
],
|
||||||
"packageRules": [
|
packageRules: [
|
||||||
{
|
{
|
||||||
"groupName": "Docker images",
|
groupName: 'Docker images',
|
||||||
"groupSlug": "dockerimages",
|
groupSlug: 'dockerimages',
|
||||||
"matchDatasources": ["docker"],
|
matchDatasources: [
|
||||||
"pinDigests": true
|
'docker',
|
||||||
}
|
|
||||||
],
|
|
||||||
"helm-values": {
|
|
||||||
"fileMatch": ["^charts/.*/values\\.yaml$"]
|
|
||||||
},
|
|
||||||
"regexManagers": [
|
|
||||||
{
|
|
||||||
"fileMatch": ["^charts/.*/values\\.yaml$"],
|
|
||||||
"matchStrings": [
|
|
||||||
"repository:\s*'(?<depName>.*?)'\n\s*tag:\s*'(?<currentValue>.*?)'",
|
|
||||||
"repository:\s*\"(?<depName>.*?)\"\n\s*tag:\s*\"(?<currentValue>.*?)\"",
|
|
||||||
"repository:\s*(?<depName>.*?)\n\s*tag:\s*(?<currentValue>.*)"
|
|
||||||
],
|
],
|
||||||
"datasourceTemplate": "docker"
|
pinDigests: true,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
|
'helm-values': {
|
||||||
|
managerFilePatterns: [
|
||||||
|
'/^charts/.*/values\\.yaml$/',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
customManagers: [
|
||||||
|
{
|
||||||
|
customType: 'regex',
|
||||||
|
managerFilePatterns: [
|
||||||
|
'/^charts/.*/values\\.yaml$/',
|
||||||
|
],
|
||||||
|
matchStrings: [
|
||||||
|
"repository:s*'(?<depName>.*?)'\ns*tag:s*'(?<currentValue>.*?)'",
|
||||||
|
'repository:s*"(?<depName>.*?)"\ns*tag:s*"(?<currentValue>.*?)"',
|
||||||
|
'repository:s*(?<depName>.*?)\ns*tag:s*(?<currentValue>.*)',
|
||||||
|
],
|
||||||
|
datasourceTemplate: 'docker',
|
||||||
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,9 @@ metadata:
|
|||||||
name: homelab-operator
|
name: homelab-operator
|
||||||
|
|
||||||
build:
|
build:
|
||||||
cluster: {}
|
|
||||||
artifacts:
|
artifacts:
|
||||||
- image: homelaboperator
|
- image: zot.olsen.cloud/homelaboperator
|
||||||
context: .
|
context: ./images/operator
|
||||||
docker:
|
docker:
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
|
||||||
@@ -16,9 +15,10 @@ manifests:
|
|||||||
releases:
|
releases:
|
||||||
- name: homelab-operator
|
- name: homelab-operator
|
||||||
chartPath: charts/operator
|
chartPath: charts/operator
|
||||||
|
namespace: homelab
|
||||||
setValueTemplates:
|
setValueTemplates:
|
||||||
image.repository: '{{.IMAGE_REPO_homelaboperator}}'
|
image.repository: "zot.local/homelaboperator"
|
||||||
image.tag: '{{.IMAGE_TAG_homelaboperator}}'
|
image.tag: "{{.IMAGE_TAG_zot_olsen_cloud_homelaboperator}}"
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
# Use kubectl to apply the manifests.
|
# Use kubectl to apply the manifests.
|
||||||
|
|||||||
Reference in New Issue
Block a user