From f88146235a06a73dd33f481135c782cd15aa6466 Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Tue, 31 Jan 2023 10:46:18 +0100 Subject: [PATCH] =?UTF-8?q?A=C3=B1ado=20Kanboard.=20Funcionando?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Comunes/creaImagenKanboard.sh | 3 + HelmCharts/helmKanboard.sh | 14 ++++ HelmCharts/kanboard-chart/.helmignore | 23 ++++++ HelmCharts/kanboard-chart/Chart.yaml | 24 ++++++ .../templates/kanboard-deployment.yaml | 82 +++++++++++++++++++ .../templates/kanboard-secrets.yaml | 9 ++ .../templates/mysql-deployment.yaml | 70 ++++++++++++++++ .../templates/php-deployment.yaml | 56 +++++++++++++ .../templates/registry-secrets.yaml | 11 +++ HelmCharts/kanboard-chart/values.yaml | 82 +++++++++++++++++++ HelmCharts/preparaKanboard/kb-namespace.yaml | 4 + .../preparaKanboard/pv-local-kanboard.yaml | 12 +++ .../preparaKanboard/pv-local-mysql-kb.yaml | 11 +++ 13 files changed, 401 insertions(+) create mode 100644 Comunes/creaImagenKanboard.sh create mode 100644 HelmCharts/helmKanboard.sh create mode 100644 HelmCharts/kanboard-chart/.helmignore create mode 100644 HelmCharts/kanboard-chart/Chart.yaml create mode 100755 HelmCharts/kanboard-chart/templates/kanboard-deployment.yaml create mode 100644 HelmCharts/kanboard-chart/templates/kanboard-secrets.yaml create mode 100755 HelmCharts/kanboard-chart/templates/mysql-deployment.yaml create mode 100644 HelmCharts/kanboard-chart/templates/php-deployment.yaml create mode 100644 HelmCharts/kanboard-chart/templates/registry-secrets.yaml create mode 100644 HelmCharts/kanboard-chart/values.yaml create mode 100644 HelmCharts/preparaKanboard/kb-namespace.yaml create mode 100644 HelmCharts/preparaKanboard/pv-local-kanboard.yaml create mode 100644 HelmCharts/preparaKanboard/pv-local-mysql-kb.yaml diff --git a/Comunes/creaImagenKanboard.sh b/Comunes/creaImagenKanboard.sh new file mode 100644 index 00000000..f3a881fc --- /dev/null +++ b/Comunes/creaImagenKanboard.sh @@ -0,0 +1,3 @@ +docker pull kanboard/kanboard:latest +docker tag kanboard/kanboard:latest docker-registry:32000/kanboard:1.0 +docker push docker-registry:32000/kanboard:1.0 diff --git a/HelmCharts/helmKanboard.sh b/HelmCharts/helmKanboard.sh new file mode 100644 index 00000000..911a56f5 --- /dev/null +++ b/HelmCharts/helmKanboard.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +if [ "$1" = "i" ] +then + kubectl apply -f ./preparaKanboard/kb-namespace.yaml + kubectl apply -f ./preparaKanboard/pv-local-mysql-kb.yaml + kubectl apply -f ./preparaKanboard/pv-local-kanboard.yaml + helm install kanboard kanboard-chart/ +else + helm uninstall kanboard + kubectl delete -f ./preparaKanboard/kb-namespace.yaml + kubectl delete -f ./preparaKanboard/pv-local-mysql-kb.yaml + kubectl delete -f ./preparaKanboard/pv-local-kanboard.yaml +fi diff --git a/HelmCharts/kanboard-chart/.helmignore b/HelmCharts/kanboard-chart/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/HelmCharts/kanboard-chart/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/HelmCharts/kanboard-chart/Chart.yaml b/HelmCharts/kanboard-chart/Chart.yaml new file mode 100644 index 00000000..8d032267 --- /dev/null +++ b/HelmCharts/kanboard-chart/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: kanboard-chart +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/HelmCharts/kanboard-chart/templates/kanboard-deployment.yaml b/HelmCharts/kanboard-chart/templates/kanboard-deployment.yaml new file mode 100755 index 00000000..413b1fca --- /dev/null +++ b/HelmCharts/kanboard-chart/templates/kanboard-deployment.yaml @@ -0,0 +1,82 @@ +apiVersion: v1 +kind: Service +metadata: + name: kanboard + namespace: kanboard + labels: + app: kanboard +spec: + type: NodePort + ports: + - port: 80 + nodePort: 30588 + targetPort: kanboard + selector: + app: kanboard + tier: frontend +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: kb-pv-claim + namespace: kanboard + labels: + app: kanboard +spec: + accessModes: + - ReadWriteOnce + storageClassName: "" + resources: + requests: + storage: 10Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kanboard + namespace: kanboard + labels: + app: kanboard +spec: + selector: + matchLabels: + app: kanboard + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: kanboard + tier: frontend + spec: + containers: + - image: docker-registry:32000/kanboard:1.0 + name: kanboard + env: + - name: DB_DRIVER + value: mysql + - name: DB_HOSTNAME + value: kanboard-mysql + - name: DB_USERNAME + valueFrom: + secretKeyRef: + name: mysqlkb-pass + key: db_user + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: mysqlkb-pass + key: db_passwd + ports: + - containerPort: 80 + name: kanboard + volumeMounts: + - name: kanboard-persistent-storage + mountPath: /var/www + imagePullSecrets: + - name: reg-cred-secret + volumes: + - name: kanboard-persistent-storage + persistentVolumeClaim: + claimName: kb-pv-claim diff --git a/HelmCharts/kanboard-chart/templates/kanboard-secrets.yaml b/HelmCharts/kanboard-chart/templates/kanboard-secrets.yaml new file mode 100644 index 00000000..f49d95f0 --- /dev/null +++ b/HelmCharts/kanboard-chart/templates/kanboard-secrets.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Secret +metadata: + name: mysqlkb-pass + namespace: kanboard +data: + password: RHNhLTAyMTM= + db_user: cm9vdA== + db_passwd: RHNhLTAyMTM= diff --git a/HelmCharts/kanboard-chart/templates/mysql-deployment.yaml b/HelmCharts/kanboard-chart/templates/mysql-deployment.yaml new file mode 100755 index 00000000..dd3efa03 --- /dev/null +++ b/HelmCharts/kanboard-chart/templates/mysql-deployment.yaml @@ -0,0 +1,70 @@ +apiVersion: v1 +kind: Service +metadata: + name: kanboard-mysql + namespace: kanboard + labels: + app: kanboard +spec: + ports: + - port: 3306 + selector: + app: kanboard + tier: mysql + clusterIP: None +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: mysql-kb-pv-claim + namespace: kanboard + labels: + app: kanboard +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kanboard-mysql + namespace: kanboard + labels: + app: kanboard +spec: + selector: + matchLabels: + app: kanboard + tier: mysql + strategy: + type: Recreate + template: + metadata: + labels: + app: kanboard + tier: mysql + spec: + containers: + - image: docker-registry:32000/mariadb:1.0 + name: mysql + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: mysqlkb-pass + key: password + ports: + - containerPort: 3306 + name: mysql + volumeMounts: + - name: mysql-persistent-storage + mountPath: /var/lib/mysql + imagePullSecrets: + - name: reg-cred-secret + volumes: + - name: mysql-persistent-storage + persistentVolumeClaim: + claimName: mysql-kb-pv-claim diff --git a/HelmCharts/kanboard-chart/templates/php-deployment.yaml b/HelmCharts/kanboard-chart/templates/php-deployment.yaml new file mode 100644 index 00000000..e17e5bd7 --- /dev/null +++ b/HelmCharts/kanboard-chart/templates/php-deployment.yaml @@ -0,0 +1,56 @@ +apiVersion: v1 +kind: Service +metadata: + name: phpmyadmin-kanboard + namespace: kanboard + labels: + app: kanboard +spec: + selector: + app: kanboard + tier: phpmyadmin + type: NodePort + ports: + - name: phpadmin + port: 80 + nodePort: 30580 + targetPort: phpmyadm +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: phpmyadmin-kanboard + namespace: kanboard + labels: + app: kanboard +spec: + selector: + matchLabels: + app: kanboard + tier: phpmyadmin + strategy: + type: Recreate + template: + metadata: + labels: + app: kanboard + tier: phpmyadmin + spec: + containers: + - name: phpmyadmin + image: docker-registry:32000/phpmyadmin:1.0 + ports: + - containerPort: 80 + name: phpmyadm + env: + - name: PMA_HOST + value: kanboard-mysql + - name: PMA_PORT + value: "3306" + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: mysqlkb-pass + key: password + imagePullSecrets: + - name: reg-cred-secret diff --git a/HelmCharts/kanboard-chart/templates/registry-secrets.yaml b/HelmCharts/kanboard-chart/templates/registry-secrets.yaml new file mode 100644 index 00000000..948dd3ad --- /dev/null +++ b/HelmCharts/kanboard-chart/templates/registry-secrets.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +data: + .dockerconfigjson: eyJhdXRocyI6eyJkb2NrZXItcmVnaXN0cnk6MzIwMDAiOnsidXNlcm5hbWUiOiJjcmV5bG9wZXoiLCJwYXNzd29yZCI6IlJleS0xMTc2IiwiYXV0aCI6IlkzSmxlV3h2Y0dWNk9sSmxlUzB4TVRjMiJ9fX0= +kind: Secret +metadata: + creationTimestamp: "2023-01-29T10:54:14Z" + name: reg-cred-secret + namespace: kanboard + resourceVersion: "19890385" + uid: 66b3b7c5-26c1-4e5a-af4e-dc973aaafe4b +type: kubernetes.io/dockerconfigjson diff --git a/HelmCharts/kanboard-chart/values.yaml b/HelmCharts/kanboard-chart/values.yaml new file mode 100644 index 00000000..5a61b130 --- /dev/null +++ b/HelmCharts/kanboard-chart/values.yaml @@ -0,0 +1,82 @@ +# Default values for kanboard-chart. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: docker-registry:32000 + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [reg-cred-secret] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/HelmCharts/preparaKanboard/kb-namespace.yaml b/HelmCharts/preparaKanboard/kb-namespace.yaml new file mode 100644 index 00000000..e07bfebf --- /dev/null +++ b/HelmCharts/preparaKanboard/kb-namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: kanboard diff --git a/HelmCharts/preparaKanboard/pv-local-kanboard.yaml b/HelmCharts/preparaKanboard/pv-local-kanboard.yaml new file mode 100644 index 00000000..323e4cd9 --- /dev/null +++ b/HelmCharts/preparaKanboard/pv-local-kanboard.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: kb-folder +spec: + capacity: + storage: 10Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/cluster/kanboard/kanboard" + diff --git a/HelmCharts/preparaKanboard/pv-local-mysql-kb.yaml b/HelmCharts/preparaKanboard/pv-local-mysql-kb.yaml new file mode 100644 index 00000000..c388a88f --- /dev/null +++ b/HelmCharts/preparaKanboard/pv-local-mysql-kb.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: kb-data +spec: + capacity: + storage: 20Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/cluster/kanboard/kanboard-db"