Compare commits

...

4 Commits

Author SHA1 Message Date
83cf48b2a9 feat: Cache docker builds
All checks were successful
Build and deploy / build (push) Successful in 7m51s
2025-12-23 03:38:36 +01:00
fc9f34939b feat: Default access policy one factor if no rules 2025-12-23 03:38:36 +01:00
c80024972c chore: Remove ./ from kustomization for consistency
All checks were successful
Build and deploy / build (push) Successful in 10m13s
2025-12-23 01:38:44 +01:00
eed5b44916 feat: Create namespace and set it explicitly 2025-12-23 01:38:44 +01:00
8 changed files with 55 additions and 11 deletions

View File

@@ -6,9 +6,23 @@ group "default" {
} }
target "docker-metadata-action" {} target "docker-metadata-action" {}
target "cache" {
cache-from = [
{
type = "gha",
}
]
cache-to = [
{
type = "gha",
mode = "max"
}
]
}
target "authelia-controller" { target "authelia-controller" {
inherits = ["docker-metadata-action"] inherits = ["docker-metadata-action", "cache"]
context = "./" context = "./"
dockerfile = "Dockerfile" dockerfile = "Dockerfile"
tags = [for tag in target.docker-metadata-action.tags : "${TAG_BASE}:${tag}"] tags = [for tag in target.docker-metadata-action.tags : "${TAG_BASE}:${tag}"]
@@ -16,6 +30,7 @@ target "authelia-controller" {
} }
target "manifests" { target "manifests" {
inherits = ["cache"]
context = "./" context = "./"
dockerfile = "Dockerfile" dockerfile = "Dockerfile"
target = "manifests" target = "manifests"

View File

@@ -2,9 +2,11 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: authelia-controller name: authelia-controller
namespace: authelia
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: authelia-controller name: authelia-controller
namespace: authelia
roleRef: roleRef:
kind: ClusterRole kind: ClusterRole
name: authelia-controller name: authelia-controller

View File

@@ -2,6 +2,7 @@ kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: authelia-controller name: authelia-controller
namespace: authelia
rules: rules:
- apiGroups: - apiGroups:
- authelia.huizinga.dev - authelia.huizinga.dev

View File

@@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: authelia-controller name: authelia-controller
namespace: authelia
labels: labels:
app: authelia-controller app: authelia-controller
app.kubernetes.io/name: authelia-controller app.kubernetes.io/name: authelia-controller
@@ -18,12 +19,17 @@ spec:
kubectl.kubernetes.io/default-container: authelia-controller kubectl.kubernetes.io/default-container: authelia-controller
spec: spec:
serviceAccountName: authelia-controller serviceAccountName: authelia-controller
securityContext: {} securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
seccompProfile:
type: RuntimeDefault
containers: containers:
- name: authelia-controller - name: authelia-controller
image: '{{ index .images "authelia-controller" }}' image: '{{ index .images "authelia-controller" }}'
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
securityContext: {}
resources: resources:
limits: limits:
cpu: 200m cpu: 200m
@@ -34,3 +40,9 @@ spec:
env: env:
- name: RUST_LOG - name: RUST_LOG
value: info,authelia_controller=debug value: info,authelia_controller=debug
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
capabilities:
drop:
- ALL

View File

@@ -1,9 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
namespace: authelia
resources: resources:
- ./crds.yaml - namespace.yaml
- ./service-account.yaml - crds.yaml
- ./cluster-role.yaml - service-account.yaml
- ./cluster-role-binding.yaml - cluster-role.yaml
- ./deployment.yaml - cluster-role-binding.yaml
- deployment.yaml

4
manifests/namespace.yaml Normal file
View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: authelia

View File

@@ -2,6 +2,7 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: authelia-controller name: authelia-controller
namespace: authelia
labels: labels:
app: authelia-controller app: authelia-controller
app.kubernetes.io/name: authelia-controller app.kubernetes.io/name: authelia-controller

View File

@@ -45,6 +45,7 @@ pub struct AccessControlRuleSpec {
#[derive(Serialize, Deserialize, Clone, Debug, Hash)] #[derive(Serialize, Deserialize, Clone, Debug, Hash)]
struct AccessControl { struct AccessControl {
rules: Vec<AccessControlRuleSpec>, rules: Vec<AccessControlRuleSpec>,
default_policy: AccessPolicy,
} }
#[derive(Serialize, Deserialize, Clone, Debug, Hash)] #[derive(Serialize, Deserialize, Clone, Debug, Hash)]
@@ -60,14 +61,22 @@ impl AccessControlRule {
debug!("Updating acl"); debug!("Updating acl");
rules.sort_by_cached_key(|rule| rule.name_any()); rules.sort_by_cached_key(|rule| rule.name_any());
let rules = rules let rules: Vec<_> = rules
.iter() .iter()
.inspect(|rule| trace!(name = rule.name_any(), "Rule found")) .inspect(|rule| trace!(name = rule.name_any(), "Rule found"))
.map(|rule| rule.spec.clone()) .map(|rule| rule.spec.clone())
.collect(); .collect();
let top = TopLevel { let top = TopLevel {
access_control: AccessControl { rules }, access_control: AccessControl {
// TODO: Make sure configurable?
default_policy: if rules.is_empty() {
AccessPolicy::OneFactor
} else {
AccessPolicy::Deny
},
rules,
},
}; };
let contents = BTreeMap::from([( let contents = BTreeMap::from([(