From 3b50e5425b2e2ff5c5d889fd0178cdffdd3c159d Mon Sep 17 00:00:00 2001 From: Thomas Way Date: Tue, 24 Sep 2024 00:18:47 +0100 Subject: [PATCH] chore(k8s/amour/backup/legacy): add smb server --- k8s/amour/backup/legacy/BUILD.bazel | 1 + k8s/amour/backup/legacy/deployment_list.cue | 66 +++++++++++++++++++++ k8s/amour/backup/legacy/list.cue | 1 + k8s/amour/backup/legacy/service_list.cue | 11 ++++ 4 files changed, 79 insertions(+) create mode 100644 k8s/amour/backup/legacy/deployment_list.cue diff --git a/k8s/amour/backup/legacy/BUILD.bazel b/k8s/amour/backup/legacy/BUILD.bazel index 6a657980c..420b8f77e 100644 --- a/k8s/amour/backup/legacy/BUILD.bazel +++ b/k8s/amour/backup/legacy/BUILD.bazel @@ -3,6 +3,7 @@ load("@com_github_tnarg_rules_cue//cue:cue.bzl", "cue_library") cue_library( name = "cue_legacy_library", srcs = [ + "deployment_list.cue", "ingress_list.cue", "list.cue", "persistent_volume_claim_list.cue", diff --git a/k8s/amour/backup/legacy/deployment_list.cue b/k8s/amour/backup/legacy/deployment_list.cue new file mode 100644 index 000000000..fcb5157f7 --- /dev/null +++ b/k8s/amour/backup/legacy/deployment_list.cue @@ -0,0 +1,66 @@ +package legacy + +import ( + appsv1 "k8s.io/api/apps/v1" + "k8s.io/api/core/v1" +) + +#DeploymentList: appsv1.#DeploymentList & { + apiVersion: "apps/v1" + kind: "DeploymentList" + items: [...{ + apiVersion: "apps/v1" + kind: "Deployment" + }] +} + +#DeploymentList: items: [{ + metadata: name: "\(#Name)-smb" + spec: { + // replicas: 0 + selector: matchLabels: "app.kubernetes.io/name": "\(#Name)-smb" + template: { + metadata: labels: "app.kubernetes.io/name": "\(#Name)-smb" + spec: { + volumes: [{ + name: "data" + persistentVolumeClaim: { + claimName: #Name + readOnly: true + } + }] + containers: [{ + name: "samba" + image: "ghcr.io/uhthomas/automata/samba:latest" + ports: [{ + name: "smb" + containerPort: 445 + }] + resources: limits: { + (v1.#ResourceCPU): "1" + (v1.#ResourceMemory): "1Gi" + } + volumeMounts: [{ + name: "data" + mountPath: "/data" + }] + imagePullPolicy: v1.#PullIfNotPresent + }, + // securityContext: { + // capabilities: drop: ["ALL"] + // readOnlyRootFilesystem: true + // allowPrivilegeEscalation: false + // } + ] + // securityContext: { + // runAsUser: 1000 + // runAsGroup: 3000 + // runAsNonRoot: true + // fsGroup: 2000 + // fsGroupChangePolicy: v1.#FSGroupChangeOnRootMismatch + // seccompProfile: type: v1.#SeccompProfileTypeRuntimeDefault + // } + } + } + } +}] diff --git a/k8s/amour/backup/legacy/list.cue b/k8s/amour/backup/legacy/list.cue index 3131d539f..5841f6197 100644 --- a/k8s/amour/backup/legacy/list.cue +++ b/k8s/amour/backup/legacy/list.cue @@ -18,6 +18,7 @@ import ( #List: items: list.Concat(_items) _items: [ + #DeploymentList.items, #IngressList.items, #PersistentVolumeClaimList.items, #ServiceList.items, diff --git a/k8s/amour/backup/legacy/service_list.cue b/k8s/amour/backup/legacy/service_list.cue index 76bf4f574..5140c4203 100644 --- a/k8s/amour/backup/legacy/service_list.cue +++ b/k8s/amour/backup/legacy/service_list.cue @@ -36,4 +36,15 @@ import "k8s.io/api/core/v1" selector: "app.kubernetes.io/name": "\(#Name)-syncthing" type: v1.#ServiceTypeLoadBalancer } +}, { + metadata: name: "\(#Name)-smb" + spec: { + ports: [{ + name: "smb" + port: 445 + targetPort: "smb" + }] + selector: "app.kubernetes.io/name": "\(#Name)-smb" + type: v1.#ServiceTypeLoadBalancer + } }]