diff --git a/infrastructure/nfs-provisioner/README.md b/infrastructure/nfs-provisioner/README.md new file mode 100644 index 0000000..a60c388 --- /dev/null +++ b/infrastructure/nfs-provisioner/README.md @@ -0,0 +1,20 @@ +## How to use +This deployment exposes a `StorageClass` named `nfs-client` that can be used to create `PersistentVolumeClaim` resources: + + +``` +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: test-claim + namespace: test-namespace +spec: + storageClassName: nfs-client + accessModes: + - ReadWriteMany + resources: + requests: + storage: 1Mi +``` + +This will create a new folder in the NFS server under `<base-path>/test-namespace/test-claim` and mount it. diff --git a/infrastructure/nfs-provisioner/kustomization.yaml b/infrastructure/nfs-provisioner/kustomization.yaml new file mode 100644 index 0000000..169f0af --- /dev/null +++ b/infrastructure/nfs-provisioner/kustomization.yaml @@ -0,0 +1,12 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +namespace: nfs-provisioner + +resources: + - github.com/kubernetes-sigs/nfs-subdir-external-provisioner//deploy + - namespace.yaml + +patches: + - path: nfs_values.yaml + - path: storageclass_values.yaml diff --git a/infrastructure/nfs-provisioner/namespace.yaml b/infrastructure/nfs-provisioner/namespace.yaml new file mode 100644 index 0000000..0a074bd --- /dev/null +++ b/infrastructure/nfs-provisioner/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: placeholder diff --git a/infrastructure/nfs-provisioner/nfs_values.yaml b/infrastructure/nfs-provisioner/nfs_values.yaml new file mode 100644 index 0000000..18da401 --- /dev/null +++ b/infrastructure/nfs-provisioner/nfs_values.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: nfs-client-provisioner + name: nfs-client-provisioner +spec: + template: + spec: + containers: + - name: nfs-client-provisioner + env: + - name: NFS_SERVER + value: 192.168.1.157 + - name: NFS_PATH + value: /export/kluster/ + volumes: + - name: nfs-client-root + nfs: + server: 192.168.1.157 + path: /export/kluster/ diff --git a/infrastructure/nfs-provisioner/storageclass_values.yaml b/infrastructure/nfs-provisioner/storageclass_values.yaml new file mode 100644 index 0000000..18502e9 --- /dev/null +++ b/infrastructure/nfs-provisioner/storageclass_values.yaml @@ -0,0 +1,7 @@ +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: nfs-client +parameters: + archiveOnDelete: "true" + pathPattern: "${.PVC.namespace}/${.PVC.name}" diff --git a/kluster-deployments/kustomization.yaml b/kluster-deployments/kustomization.yaml index 94358f6..9aec978 100644 --- a/kluster-deployments/kustomization.yaml +++ b/kluster-deployments/kustomization.yaml @@ -11,6 +11,7 @@ resources: # infrastructure apps - projects.yaml + - nfs-provisioner/ - backup/ - pg-ha/ - gitea/ diff --git a/kluster-deployments/nfs-provisioner/application.yaml b/kluster-deployments/nfs-provisioner/application.yaml new file mode 100644 index 0000000..9cef01d --- /dev/null +++ b/kluster-deployments/nfs-provisioner/application.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: nfs-provisioner-application + namespace: argocd +spec: + project: infrastructure + source: + repoURL: git@github.com:moll-re/bootstrap-k3s-infra.git + targetRevision: main + path: infrastructure/nfs-provisioner/ + destination: + server: https://kubernetes.default.svc + namespace: nfs-provisioner + syncPolicy: + automated: + prune: true + selfHeal: true diff --git a/kluster-deployments/nfs-provisioner/kustomization.yaml b/kluster-deployments/nfs-provisioner/kustomization.yaml new file mode 100644 index 0000000..977dcfe --- /dev/null +++ b/kluster-deployments/nfs-provisioner/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - application.yaml