From f714ebdb789da4c3d4028125f9d729663031e8ed Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Thu, 16 Mar 2023 17:37:12 +0000 Subject: [PATCH] fixed up --- k8s/applications/nextcloud/Chart.yaml | 9 ++ k8s/applications/nextcloud/values-dev.yaml | 0 k8s/applications/nextcloud/values-prod.yaml | 0 k8s/applications/nextcloud/values.yaml | 89 +++++++++++++++++++ k8s/argocd/templates/appset-applications.yaml | 37 ++++++++ .../templates/project-applications.yaml | 21 +++++ .../templates/user-generation/rbac.yml | 2 +- 7 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 k8s/applications/nextcloud/Chart.yaml create mode 100644 k8s/applications/nextcloud/values-dev.yaml create mode 100644 k8s/applications/nextcloud/values-prod.yaml create mode 100644 k8s/applications/nextcloud/values.yaml create mode 100644 k8s/argocd/templates/appset-applications.yaml create mode 100644 k8s/argocd/templates/project-applications.yaml diff --git a/k8s/applications/nextcloud/Chart.yaml b/k8s/applications/nextcloud/Chart.yaml new file mode 100644 index 0000000..c4fb70b --- /dev/null +++ b/k8s/applications/nextcloud/Chart.yaml @@ -0,0 +1,9 @@ +apiVersion: v2 +name: nextcloud +description: An applications service for homelab +type: application +version: 0.1.0 +dependencies: + - name: nextcloud + repository: https://nextcloud.github.io/helm/ + version: 3.5.3 diff --git a/k8s/applications/nextcloud/values-dev.yaml b/k8s/applications/nextcloud/values-dev.yaml new file mode 100644 index 0000000..e69de29 diff --git a/k8s/applications/nextcloud/values-prod.yaml b/k8s/applications/nextcloud/values-prod.yaml new file mode 100644 index 0000000..e69de29 diff --git a/k8s/applications/nextcloud/values.yaml b/k8s/applications/nextcloud/values.yaml new file mode 100644 index 0000000..cfae82d --- /dev/null +++ b/k8s/applications/nextcloud/values.yaml @@ -0,0 +1,89 @@ +nextcloud: + image: + repository: nextcloud + tag: "25.0.3-fpm" + pullPolicy: IfNotPresent + flavor: fpm + + replicaCount: 1 + + + nextcloud: + existingSecret: + enabled: true + usernameKey: username + passwordKey: password + update: 0 + defaultConfigs: + .htaccess: true + redis.config.php: true + apache-pretty-urls.config.php: true + apcu.config.php: true + apps.config.php: false + autoconfig.php: true + smtp.config.php: true + proxy.config.php: |- + array( + 0 => '127.0.0.1', + 1 => '10.0.0.0/8', + ), + 'forwarded_for_headers' => array('HTTP_X_FORWARDED_FOR'), + ); + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 1 + maxUnavailable: 0 + + internalDatabase: + enabled: false + + externalDatabase: + enabled: true + type: postgresql + database: nextcloud + host: postgres.${var.namespace}.svc.cluster.local + existingSecret: + enabled: true + usernameKey: username + passwordKey: password + + exernalRedis: + enabled: false + auth: + enabled: true + existingSecretPasswordKey: password + + cronjob: + enabled: true + + persistence: + enabled: true + nextcloudData: + enabled: true + + resources: + requests: + cpu: 100m + memory: 512Mi + limits: + cpu: 2 + memory: 1Gi + + hpa: + enabled: true + cputhreshold: 60 + minPods: 1 + maxPods: 5 + + nginx: + enabled: true + + # service: + # port: 80 + + # phpClientHttpsFix: + # enabled: true + # protocol: https diff --git a/k8s/argocd/templates/appset-applications.yaml b/k8s/argocd/templates/appset-applications.yaml new file mode 100644 index 0000000..9ccffa9 --- /dev/null +++ b/k8s/argocd/templates/appset-applications.yaml @@ -0,0 +1,37 @@ +{{- if .Values.selfapp.enabled -}} +--- +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + name: "applications" +spec: + generators: + - git: + repoURL: "git@github.com:{{ .Values.selfapp.repo }}.git" + revision: "{{ .Values.selfapp.commit }}" + directories: + - path: k8s/applications/* + template: + metadata: + name: '{{ `{{path.basename}}` }}' + spec: + project: "applications" + source: + repoURL: "git@github.com:{{ .Values.selfapp.repo }}.git" + targetRevision: "{{ .Values.selfapp.commit }}" + path: '{{ `{{path}}` }}' + helm: + values: |- + global: + {{- .Values.global | toYaml | nindent 28 }} + valueFiles: + - values.yaml + - values-{{ .Values.global.deployment }}.yaml + destination: + server: https://kubernetes.default.svc + namespace: 'app-{{ `{{path.basename}}` }}' + + syncPolicy: + syncOptions: + - CreateNamespace=true +{{- end -}} diff --git a/k8s/argocd/templates/project-applications.yaml b/k8s/argocd/templates/project-applications.yaml new file mode 100644 index 0000000..ccfed41 --- /dev/null +++ b/k8s/argocd/templates/project-applications.yaml @@ -0,0 +1,21 @@ +{{- if .Values.selfapp.enabled -}} +--- +apiVersion: argoproj.io/v1alpha1 +kind: AppProject +metadata: + name: applications + namespace: "{{ .Release.Namespace }}" + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + description: "homelab applications" + sourceRepos: + - "git@github.com:{{ .Values.selfapp.repo }}.git" + destinations: + - server: "*" + namespace: 'app-*' + name: '*' + clusterResourceWhitelist: + - group: "*" + kind: "*" +{{- end -}} \ No newline at end of file diff --git a/k8s/infra/database/templates/user-generation/rbac.yml b/k8s/infra/database/templates/user-generation/rbac.yml index 7a2f503..6a7dd3a 100644 --- a/k8s/infra/database/templates/user-generation/rbac.yml +++ b/k8s/infra/database/templates/user-generation/rbac.yml @@ -7,7 +7,7 @@ metadata: rules: - apiGroups: [""] resources: ["secrets"] - verbs: ["list"] + verbs: ["list", "create"] - apiGroups: [""] resources: ["secrets"] verbs: ["get", "update", "create", "patch", "delete"]