Jelajahi Sumber

NAS-123129 / 23.10 / add `pgadmin` to `community` train (#1387)

* add `pgadmin` to `community` train

* add readme's

* metadata

* add  templates and values

* update metadat
Stavros Kois 2 tahun lalu
induk
melakukan
d7a011168f

+ 6 - 0
library/ix-dev/community/pgadmin/Chart.lock

@@ -0,0 +1,6 @@
+dependencies:
+- name: common
+  repository: file://../../../common
+  version: 1.0.12
+digest: sha256:debd30721d09ae8293b1cbdd9d0115981d40b47908be3035fc3cf657c9d5eedb
+generated: "2023-07-20T20:39:44.954109757+03:00"

+ 26 - 0
library/ix-dev/community/pgadmin/Chart.yaml

@@ -0,0 +1,26 @@
+name: pgadmin
+description: pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL
+annotations:
+  title: pgAdmin
+type: application
+version: 1.0.0
+apiVersion: v2
+appVersion: '7.4'
+kubeVersion: '>=1.16.0-0'
+maintainers:
+  - name: truenas
+    url: https://www.truenas.com/
+    email: dev@ixsystems.com
+dependencies:
+  - name: common
+    repository: file://../../../common
+    version: 1.0.12
+home: https://www.pgadmin.org/
+icon: https://avatars.githubusercontent.com/u/113517144
+sources:
+  - https://hub.docker.com/r/dpage/pgadmin4
+  - https://github.com/truenas/charts/tree/master/library/ix-dev/community/pgadmin
+  - https://www.pgadmin.org/
+keywords:
+  - database
+  - management

+ 8 - 0
library/ix-dev/community/pgadmin/README.md

@@ -0,0 +1,8 @@
+# pgAdmin
+
+[pgAdmin](https://github.com/pgadmin-org/pgadmin4) is the most popular and feature rich Open Source administration and development platform for PostgreSQL
+
+> When application is installed, a container will be launched with **root** privileges.
+> This is required in order to apply the correct permissions to the `pgAdmin` directories.
+> Afterward, the `pgAdmin` container will run as a **non**-root user (`5050`).
+> All mounted storage(s) will be `chown`ed only if the parent directory does not match the configured user.

+ 8 - 0
library/ix-dev/community/pgadmin/app-readme.md

@@ -0,0 +1,8 @@
+# pgAdmin
+
+[pgAdmin](https://github.com/pgadmin-org/pgadmin4) is the most popular and feature rich Open Source administration and development platform for PostgreSQL
+
+> When application is installed, a container will be launched with **root** privileges.
+> This is required in order to apply the correct permissions to the `pgAdmin` directories.
+> Afterward, the `pgAdmin` container will run as a **non**-root user (`5050`).
+> All mounted storage(s) will be `chown`ed only if the parent directory does not match the configured user.

TEMPAT SAMPAH
library/ix-dev/community/pgadmin/charts/common-1.0.12.tgz


+ 11 - 0
library/ix-dev/community/pgadmin/ci/basic-values.yaml

@@ -0,0 +1,11 @@
+pgadminNetwork:
+  webPort: 31000
+
+pgadminConfig:
+  adminEmail: some@email.com
+  adminPassword: somepassword
+
+pgadminStorage:
+  config:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/config

+ 18 - 0
library/ix-dev/community/pgadmin/ci/extra-values.yaml

@@ -0,0 +1,18 @@
+pgadminConfig:
+  adminEmail: some@email.com
+  adminPassword: somepassword
+
+pgadminNetwork:
+  webPort: 31000
+
+pgadminStorage:
+  config:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/config
+  additionalStorages:
+  - type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/db1
+    mountPath: /db1
+  - type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/db2
+    mountPath: /db2

+ 12 - 0
library/ix-dev/community/pgadmin/ci/hostnet-values.yaml

@@ -0,0 +1,12 @@
+pgadminNetwork:
+  webPort: 30000
+  hostNetwork: true
+
+pgadminConfig:
+  adminEmail: some@email.com
+  adminPassword: somepassword
+
+pgadminStorage:
+  config:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/config

+ 99 - 0
library/ix-dev/community/pgadmin/ci/https-values.yaml

@@ -0,0 +1,99 @@
+pgadminNetwork:
+  webPort: 30000
+  hostNetwork: true
+  certificateID: "1"
+
+pgadminStorage:
+  config:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/config
+
+pgadminConfig:
+  adminEmail: some@email.com
+  adminPassword: somepassword
+
+ixCertificates:
+  "1":
+    certificate: |
+      -----BEGIN CERTIFICATE-----
+      MIIEdjCCA16gAwIBAgIDYFMYMA0GCSqGSIb3DQEBCwUAMGwxDDAKBgNVBAMMA2Fz
+      ZDELMAkGA1UEBhMCVVMxDTALBgNVBAgMBGFzZGYxCzAJBgNVBAcMAmFmMQ0wCwYD
+      VQQKDARhc2RmMQwwCgYDVQQLDANhc2QxFjAUBgkqhkiG9w0BCQEWB2FAYS5jb20w
+      HhcNMjEwODMwMjMyMzU0WhcNMjMxMjAzMjMyMzU0WjBuMQswCQYDVQQDDAJhZDEL
+      MAkGA1UEBhMCVVMxDTALBgNVBAgMBGFzZGYxDTALBgNVBAcMBGFzZGYxDTALBgNV
+      BAoMBGFkc2YxDTALBgNVBAsMBGFzZGYxFjAUBgkqhkiG9w0BCQEWB2FAYS5jb20w
+      ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC7+1xOHRQyOnQTHFcrdasX
+      Zl0gzutVlA890a1wiQpdD5dOtCLo7+eqVYjqVKo9W8RUIArXWmBu/AbkH7oVFWC1
+      P973W1+ArF5sA70f7BZgqRKJTIisuIFIlRETgfnP2pfQmHRZtGaIJRZI4vQCdYgW
+      2g0KOvvNcZJCVq1OrhKiNiY1bWCp66DGg0ic6OEkZFHTm745zUNQaf2dNgsxKU0H
+      PGjVLJI//yrRFAOSBUqgD4c50krnMF7fU/Fqh+UyOu8t6Y/HsySh3urB+Zie331t
+      AzV6QV39KKxRflNx/yuWrtIEslGTm+xHKoCYJEk/nZ3mX8Y5hG6wWAb7A/FuDVg3
+      AgMBAAGjggEdMIIBGTAnBgNVHREEIDAehwTAqAADhwTAqAAFhwTAqAC2hwTAqACB
+      hwTAqACSMB0GA1UdDgQWBBQ4G2ff4tgZl4vmo4xCfqmJhdqShzAMBgNVHRMBAf8E
+      AjAAMIGYBgNVHSMEgZAwgY2AFLlYf9L99nxJDcpCM/LT3V5hQ/a3oXCkbjBsMQww
+      CgYDVQQDDANhc2QxCzAJBgNVBAYTAlVTMQ0wCwYDVQQIDARhc2RmMQswCQYDVQQH
+      DAJhZjENMAsGA1UECgwEYXNkZjEMMAoGA1UECwwDYXNkMRYwFAYJKoZIhvcNAQkB
+      FgdhQGEuY29tggNgUxcwFgYDVR0lAQH/BAwwCgYIKwYBBQUHAwEwDgYDVR0PAQH/
+      BAQDAgWgMA0GCSqGSIb3DQEBCwUAA4IBAQA6FpOInEHB5iVk3FP67GybJ29vHZTD
+      KQHbQgmg8s4L7qIsA1HQ+DMCbdylpA11x+t/eL/n48BvGw2FNXpN6uykhLHJjbKR
+      h8yITa2KeD3LjLYhScwIigXmTVYSP3km6s8jRL6UKT9zttnIHyXVpBDya6Q4WTMx
+      fmfC6O7t1PjQ5ZyVtzizIUP8ah9n4TKdXU4A3QIM6WsJXpHb+vqp1WDWJ7mKFtgj
+      x5TKv3wcPnktx0zMPfLb5BTSE9rc9djcBG0eIAsPT4FgiatCUChe7VhuMnqskxEz
+      MymJLoq8+mzucRwFkOkR2EIt1x+Irl2mJVMeBow63rVZfUQBD8h++LqB
+      -----END CERTIFICATE-----
+      -----BEGIN CERTIFICATE-----
+      MIIEhDCCA2ygAwIBAgIDYFMXMA0GCSqGSIb3DQEBCwUAMGwxDDAKBgNVBAMMA2Fz
+      ZDELMAkGA1UEBhMCVVMxDTALBgNVBAgMBGFzZGYxCzAJBgNVBAcMAmFmMQ0wCwYD
+      VQQKDARhc2RmMQwwCgYDVQQLDANhc2QxFjAUBgkqhkiG9w0BCQEWB2FAYS5jb20w
+      HhcNMjEwODMwMjMyMDQ1WhcNMzEwODI4MjMyMDQ1WjBsMQwwCgYDVQQDDANhc2Qx
+      CzAJBgNVBAYTAlVTMQ0wCwYDVQQIDARhc2RmMQswCQYDVQQHDAJhZjENMAsGA1UE
+      CgwEYXNkZjEMMAoGA1UECwwDYXNkMRYwFAYJKoZIhvcNAQkBFgdhQGEuY29tMIIB
+      IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq//c0hEEr83CS1pMgsHX50jt
+      2MqIbcf63UUNJTiYpUUvUQSFJFc7m/dr+RTZvu97eDCnD5K2qkHHvTPaPZwY+Djf
+      iy7N641Sz6u/y3Yo3xxs1Aermsfedh48vusJpjbkT2XS44VjbkrpKcWDNVpp3Evd
+      M7oJotXeUsZ+imiyVCfr4YhoY5gbGh/r+KN9Wf9YKoUyfLLZGwdZkhtX2zIbidsL
+      Thqi9YTaUHttGinjiBBum234u/CfvKXsfG3yP2gvBGnlvZnM9ktv+lVffYNqlf7H
+      VmB1bKKk84HtzuW5X76SGAgOG8eHX4x5ZLI1WQUuoQOVRl1I0UCjBtbz8XhwvQID
+      AQABo4IBLTCCASkwLQYDVR0RBCYwJIcEwKgABYcEwKgAA4cEwKgAkocEwKgAtYcE
+      wKgAgYcEwKgAtjAdBgNVHQ4EFgQUuVh/0v32fEkNykIz8tPdXmFD9rcwDwYDVR0T
+      AQH/BAUwAwEB/zCBmAYDVR0jBIGQMIGNgBS5WH/S/fZ8SQ3KQjPy091eYUP2t6Fw
+      pG4wbDEMMAoGA1UEAwwDYXNkMQswCQYDVQQGEwJVUzENMAsGA1UECAwEYXNkZjEL
+      MAkGA1UEBwwCYWYxDTALBgNVBAoMBGFzZGYxDDAKBgNVBAsMA2FzZDEWMBQGCSqG
+      SIb3DQEJARYHYUBhLmNvbYIDYFMXMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEF
+      BQcDAjAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQELBQADggEBAKEocOmVuWlr
+      zegtKYMe8NhHIkFY9oVn5ym6RHNOJpPH4QF8XYC3Z5+iC5yGh4P/jVe/4I4SF6Ql
+      PtofU0jNq5vzapt/y+m008eXqPQFmoUOvu+JavoRVcRx2LIP5AgBA1mF56CSREsX
+      TkuJAA9IUQ8EjnmAoAeKINuPaKxGDuU8BGCMqr/qd564MKNf9XYL+Fb2rlkA0O2d
+      2No34DQLgqSmST/LAvPM7Cbp6knYgnKmGr1nETCXasg1cueHLnWWTvps2HiPp2D/
+      +Fq0uqcZLu4Mdo0CPs4e5sHRyldEnRSKh0DVLprq9zr/GMipmPLJUsT5Jed3sj0w
+      M7Y3vwxshpo=
+      -----END CERTIFICATE-----
+    privatekey: |
+      -----BEGIN PRIVATE KEY-----
+      MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC7+1xOHRQyOnQT
+      HFcrdasXZl0gzutVlA890a1wiQpdD5dOtCLo7+eqVYjqVKo9W8RUIArXWmBu/Abk
+      H7oVFWC1P973W1+ArF5sA70f7BZgqRKJTIisuIFIlRETgfnP2pfQmHRZtGaIJRZI
+      4vQCdYgW2g0KOvvNcZJCVq1OrhKiNiY1bWCp66DGg0ic6OEkZFHTm745zUNQaf2d
+      NgsxKU0HPGjVLJI//yrRFAOSBUqgD4c50krnMF7fU/Fqh+UyOu8t6Y/HsySh3urB
+      +Zie331tAzV6QV39KKxRflNx/yuWrtIEslGTm+xHKoCYJEk/nZ3mX8Y5hG6wWAb7
+      A/FuDVg3AgMBAAECggEAapt30rj9DitGTtxAt13pJMEhyYxvvD3WkvmJwguF/Bbu
+      eW0Ba1c668fMeRCA54FWi1sMqusPS4HUqqUvk+tmyAOsAF4qgD/A4MMSC7uJSVI5
+      N/JWhJWyhCY94/FPakiO1nbPbVw41bcqtzU2qvparpME2CtxSCbDiqm7aaag3Kqe
+      EF0fGSUdZ+TYl9JM05+eIyiX+UY19Fg0OjTHMn8nGpxcNTfDBdQ68TKvdo/dtIKL
+      PLKzJUNNdM8odC4CvQtfGMqaslwZwXkiOl5VJcW21ncj/Y0ngEMKeD/i65ZoqGdR
+      0FKCQYEAGtM2FvJcZQ92Wsw7yj2bK2MSegVUyLK32QKBgQDe8syVCepPzRsfjfxA
+      6TZlWcGuTZLhwIx97Ktw3VcQ1f4rLoEYlv0xC2VWBORpzIsJo4I/OLmgp8a+Ga8z
+      FkVRnq90dV3t4NP9uJlHgcODHnOardC2UUka4olBSCG6zmK4Jxi34lOxhGRkshOo
+      L4IBeOIB5g+ZrEEXkzfYJHESRQKBgQDX2YhFhGIrT8BAnC5BbXbhm8h6Bhjz8DYL
+      d+qhVJjef7L/aJxViU0hX9Ba2O8CLK3FZeREFE3hJPiJ4TZSlN4evxs5p+bbNDcA
+      0mhRI/o3X4ac6IxdRebyYnCOB/Cu94/MzppcZcotlCekKNike7eorCcX4Qavm7Pu
+      MUuQ+ifmSwKBgEnchoqZzlbBzMqXb4rRuIO7SL9GU/MWp3TQg7vQmJerTZlgvsQ2
+      wYsOC3SECmhCq4117iCj2luvOdihCboTFsQDnn0mpQe6BIF6Ns3J38wAuqv0CcFd
+      DKsrge1uyD3rQilgSoAhKzkUc24o0PpXQurZ8YZPgbuXpbj5vPaOnCdBAoGACYc7
+      wb3XS4wos3FxhUfcwJbM4b4VKeeHqzfu7pI6cU/3ydiHVitKcVe2bdw3qMPqI9Wc
+      nvi6e17Tbdq4OCsEJx1OiVwFD9YdO3cOTc6lw/3+hjypvZBRYo+/4jUthbu96E+S
+      dtOzehGZMmDvN0uSzupSi3ZOgkAAUFpyuIKickMCgYAId0PCRjonO2thn/R0rZ7P
+      //L852uyzYhXKw5/fjFGhQ6LbaLgIRFaCZ0L2809u0HFnNvJjHv4AKP6j+vFQYYY
+      qQ+66XnfsA9G/bu4MDS9AX83iahD9IdLXQAy8I19prAbpVumKegPbMnNYNB/TYEc
+      3G15AKCXo7jjOUtHY01DCQ==
+      -----END PRIVATE KEY-----

+ 10 - 0
library/ix-dev/community/pgadmin/item.yaml

@@ -0,0 +1,10 @@
+icon_url: https://avatars.githubusercontent.com/u/113517144
+categories:
+  - productivity
+screenshots:
+  - https://www.pgadmin.org/static/COMPILED/assets/img/screenshots/pgadmin4-dashboard.png
+  - https://www.pgadmin.org/static/COMPILED/assets/img/screenshots/pgadmin4-preferences.png
+  - https://www.pgadmin.org/static/COMPILED/assets/img/screenshots/pgadmin4-welcome-dark.png
+tags:
+  - database
+  - management

+ 10 - 0
library/ix-dev/community/pgadmin/metadata.yaml

@@ -0,0 +1,10 @@
+runAsContext:
+  - userName: pgadmin
+    groupName: pgadmin
+    gid: 5050
+    uid: 5050
+    description: pgAdmin runs as a non-root user.
+capabilities:
+  - name: NET_BIND_SERVICE
+    description: pgAdmin requires this ability to bind to privileged ports.
+hostMounts: []

+ 231 - 0
library/ix-dev/community/pgadmin/questions.yaml

@@ -0,0 +1,231 @@
+groups:
+  - name: pgAdmin Configuration
+    description: Configure pgAdmin
+  - name: Network Configuration
+    description: Configure Network for pgAdmin
+  - name: Storage Configuration
+    description: Configure Storage for pgAdmin
+  - name: Resources Configuration
+    description: Configure Resources for pgAdmin
+
+portals:
+  web_portal:
+    protocols:
+      - "$kubernetes-resource_configmap_portal_protocol"
+    host:
+      - "$kubernetes-resource_configmap_portal_host"
+    ports:
+      - "$kubernetes-resource_configmap_portal_port"
+    path: "$kubernetes-resource_configmap_portal_path"
+
+questions:
+  - variable: pgadminConfig
+    label: ""
+    group: pgAdmin Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: adminEmail
+          label: Admin Email
+          description: The email address for the pgAdmin admin user.
+          schema:
+            type: string
+            required: true
+            default: ""
+        - variable: adminPassword
+          label: Admin Password
+          description: The password for the pgAdmin admin user.
+          schema:
+            type: string
+            required: true
+            private: true
+            default: ""
+        - variable: additionalEnvs
+          label: Additional Environment Variables
+          description: Configure additional environment variables for pgAdmin.
+          schema:
+            type: list
+            default: []
+            items:
+              - variable: env
+                label: Environment Variable
+                schema:
+                  type: dict
+                  attrs:
+                    - variable: name
+                      label: Name
+                      schema:
+                        type: string
+                        required: true
+                    - variable: value
+                      label: Value
+                      schema:
+                        type: string
+                        required: true
+
+  - variable: pgadminNetwork
+    label: ""
+    group: Network Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: webPort
+          label: Web Port
+          description: The port for the pgAdmin Web UI.
+          schema:
+            type: int
+            default: 30056
+            min: 9000
+            max: 65535
+            required: true
+        - variable: hostNetwork
+          label: Host Network
+          description: |
+            Bind to the host network. It's recommended to keep this disabled.</br>
+          schema:
+            type: boolean
+            default: false
+        - variable: certificateID
+          label: Certificate
+          description: The certificate to use for pgAdmin
+          schema:
+            type: int
+            "null": true
+            $ref:
+              - "definitions/certificate"
+
+  - variable: pgadminStorage
+    label: ""
+    group: Storage Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: config
+          label: pgAdmin Config Storage
+          description: The path to store pgAdmin Configuration.
+          schema:
+            type: dict
+            attrs:
+              - variable: type
+                label: Type
+                description: |
+                  ixVolume: Is dataset created automatically by the system.</br>
+                  Host Path: Is a path that already exists on the system.
+                schema:
+                  type: string
+                  required: true
+                  default: "ixVolume"
+                  enum:
+                    - value: "hostPath"
+                      description: Host Path (Path that already exists on the system)
+                    - value: "ixVolume"
+                      description: ixVolume (Dataset created automatically by the system)
+              - variable: datasetName
+                label: Dataset Name
+                schema:
+                  type: string
+                  show_if: [["type", "=", "ixVolume"]]
+                  required: true
+                  hidden: true
+                  immutable: true
+                  default: "config"
+                  $ref:
+                    - "normalize/ixVolume"
+              - variable: hostPath
+                label: Host Path
+                schema:
+                  type: hostpath
+                  show_if: [["type", "=", "hostPath"]]
+                  immutable: true
+                  required: true
+        - variable: additionalStorages
+          label: Additional Storage
+          description: Additional storage for pgAdmin.
+          schema:
+            type: list
+            default: []
+            items:
+              - variable: storageEntry
+                label: Storage Entry
+                schema:
+                  type: dict
+                  attrs:
+                    - variable: type
+                      label: Type
+                      description: |
+                        ixVolume: Is dataset created automatically by the system.</br>
+                        Host Path: Is a path that already exists on the system.
+                      schema:
+                        type: string
+                        required: true
+                        default: "ixVolume"
+                        enum:
+                          - value: "hostPath"
+                            description: Host Path (Path that already exists on the system)
+                          - value: "ixVolume"
+                            description: ixVolume (Dataset created automatically by the system)
+                    - variable: mountPath
+                      label: Mount Path
+                      description: The path inside the container to mount the storage.
+                      schema:
+                        type: path
+                        required: true
+                    - variable: hostPath
+                      label: Host Path
+                      description: The host path to use for storage.
+                      schema:
+                        type: hostpath
+                        show_if: [["type", "=", "hostPath"]]
+                        required: true
+                    - variable: datasetName
+                      label: Dataset Name
+                      description: The name of the dataset to use for storage.
+                      schema:
+                        type: string
+                        show_if: [["type", "=", "ixVolume"]]
+                        required: true
+                        immutable: true
+                        default: "storage_entry"
+                        $ref:
+                          - "normalize/ixVolume"
+
+  - variable: resources
+    group: Resources Configuration
+    label: ""
+    schema:
+      type: dict
+      attrs:
+        - variable: limits
+          label: Limits
+          schema:
+            type: dict
+            attrs:
+              - variable: cpu
+                label: CPU
+                description: CPU limit for pgAdmin.
+                schema:
+                  type: string
+                  max_length: 6
+                  valid_chars: '^(0\.[1-9]|[1-9][0-9]*)(\.[0-9]|m?)$'
+                  valid_chars_error: |
+                    Valid CPU limit formats are</br>
+                    - Plain Integer - eg. 1</br>
+                    - Float - eg. 0.5</br>
+                    - Milicpu - eg. 500m
+                  default: "4000m"
+                  required: true
+              - variable: memory
+                label: Memory
+                description: Memory limit for pgAdmin.
+                schema:
+                  type: string
+                  max_length: 12
+                  valid_chars: '^[1-9][0-9]*([EPTGMK]i?|e[0-9]+)?$'
+                  valid_chars_error: |
+                    Valid Memory limit formats are</br>
+                    - Suffixed with E/P/T/G/M/K - eg. 1G</br>
+                    - Suffixed with Ei/Pi/Ti/Gi/Mi/Ki - eg. 1Gi</br>
+                    - Plain Integer in bytes - eg. 1024</br>
+                    - Exponent - eg. 134e6
+                  default: "8Gi"
+                  required: true

+ 1 - 0
library/ix-dev/community/pgadmin/templates/NOTES.txt

@@ -0,0 +1 @@
+{{ include "ix.v1.common.lib.chart.notes" $ }}

+ 57 - 0
library/ix-dev/community/pgadmin/templates/_persistence.tpl

@@ -0,0 +1,57 @@
+{{- define "pgadmin.persistence" -}}
+persistence:
+  config:
+    enabled: true
+    type: {{ .Values.pgadminStorage.config.type }}
+    datasetName: {{ .Values.pgadminStorage.config.datasetName | default "" }}
+    hostPath: {{ .Values.pgadminStorage.config.hostPath | default "" }}
+    targetSelector:
+      pgadmin:
+        pgadmin:
+          mountPath: /var/lib/pgadmin
+        01-permissions:
+          mountPath: /mnt/directories/pgadmin
+  tmp:
+    enabled: true
+    type: emptyDir
+    targetSelector:
+      pgadmin:
+        pgadmin:
+          mountPath: /tmp
+  {{- range $idx, $storage := .Values.pgadminStorage.additionalStorages }}
+  {{ printf "pgadmin-%v" (int $idx) }}:
+    enabled: true
+    type: {{ $storage.type }}
+    datasetName: {{ $storage.datasetName | default "" }}
+    hostPath: {{ $storage.hostPath | default "" }}
+    targetSelector:
+      pgadmin:
+        pgadmin:
+          mountPath: {{ $storage.mountPath }}
+        01-permissions:
+          mountPath: /mnt/directories{{ $storage.mountPath }}
+  {{- end }}
+
+  {{- if .Values.pgadminNetwork.certificateID }}
+  cert:
+    enabled: true
+    type: secret
+    objectName: pgadmin-cert
+    defaultMode: "0600"
+    items:
+      - key: tls.key
+        path: server.key
+      - key: tls.crt
+        path: server.cert
+    targetSelector:
+      pgadmin:
+        pgadmin:
+          mountPath: /certs
+          readOnly: true
+
+scaleCertificate:
+  pgadmin-cert:
+    enabled: true
+    id: {{ .Values.pgadminNetwork.certificateID }}
+  {{- end }}
+{{- end -}}

+ 64 - 0
library/ix-dev/community/pgadmin/templates/_pgadmin.tpl

@@ -0,0 +1,64 @@
+{{- define "pgadmin.workload" -}}
+workload:
+  pgadmin:
+    enabled: true
+    primary: true
+    type: Deployment
+    podSpec:
+      hostNetwork: {{ .Values.pgadminNetwork.hostNetwork }}
+      securityContext:
+        fsGroup: 5050
+      containers:
+        pgadmin:
+          enabled: true
+          primary: true
+          imageSelector: image
+          securityContext:
+            runAsUser: 5050
+            runAsGroup: 5050
+            readOnlyRootFilesystem: false
+            capabilities:
+              add:
+                - NET_BIND_SERVICE
+          env:
+            PGADMIN_LISTEN_PORT: {{ .Values.pgadminNetwork.webPort }}
+            PGADMIN_DEFAULT_EMAIL: {{ .Values.pgadminConfig.adminEmail }}
+            PGADMIN_DEFAULT_PASSWORD: {{ .Values.pgadminConfig.adminPassword }}
+            PGADMIN_SERVER_JSON_FILE: /var/lib/pgadmin/servers/servers.json
+            {{ if .Values.pgadminNetwork.certificateID }}
+            PGADMIN_ENABLE_TLS: true
+            {{ end }}
+          {{ with .Values.pgadminConfig.additionalEnvs }}
+          envList:
+            {{ range $env := . }}
+            - name: {{ $env.name }}
+              value: {{ $env.value }}
+            {{ end }}
+          {{ end }}
+          probes:
+            {{- $protocol := "http" -}}
+            {{- if .Values.pgadminNetwork.certificateID -}}
+              {{- $protocol = "https" -}}
+            {{- end }}
+            liveness:
+              enabled: true
+              type: {{ $protocol }}
+              port: "{{ .Values.pgadminNetwork.webPort }}"
+              path: /misc/ping
+            readiness:
+              enabled: true
+              type: {{ $protocol }}
+              port: "{{ .Values.pgadminNetwork.webPort }}"
+              path: /misc/ping
+            startup:
+              enabled: true
+              type: {{ $protocol }}
+              port: "{{ .Values.pgadminNetwork.webPort }}"
+              path: /misc/ping
+      initContainers:
+      {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
+                                                        "UID" 5050
+                                                        "GID" 5050
+                                                        "mode" "check"
+                                                        "type" "init") | nindent 8 }}
+{{- end -}}

+ 16 - 0
library/ix-dev/community/pgadmin/templates/_portal.tpl

@@ -0,0 +1,16 @@
+{{- define "pgadmin.portal" -}}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: portal
+data:
+  {{- $protocol := "http" -}}
+  {{- if .Values.pgadminNetwork.certificateID -}}
+    {{- $protocol = "https" -}}
+  {{- end }}
+  path: "/"
+  port: {{ .Values.pgadminNetwork.webPort | quote }}
+  protocol: {{ $protocol }}
+  host: $node_ip
+{{- end -}}

+ 15 - 0
library/ix-dev/community/pgadmin/templates/_service.tpl

@@ -0,0 +1,15 @@
+{{- define "pgadmin.service" -}}
+service:
+  pgadmin:
+    enabled: true
+    primary: true
+    type: NodePort
+    targetSelector: pgadmin
+    ports:
+      webui:
+        enabled: true
+        primary: true
+        port: {{ .Values.pgadminNetwork.webPort }}
+        nodePort: {{ .Values.pgadminNetwork.webPort }}
+        targetSelector: pgadmin
+{{- end -}}

+ 8 - 0
library/ix-dev/community/pgadmin/templates/_validation.tpl

@@ -0,0 +1,8 @@
+{{- define "pgadmin.validation" -}}
+  {{- if not .Values.pgadminConfig.adminEmail -}}
+    {{- fail "pgAdmin - Admin Email is required" -}}
+  {{- end -}}
+  {{- if not .Values.pgadminConfig.adminPassword -}}
+    {{- fail "pgAdmin - Admin Password is required" -}}
+  {{- end -}}
+{{- end -}}

+ 13 - 0
library/ix-dev/community/pgadmin/templates/common.yaml

@@ -0,0 +1,13 @@
+{{- include "ix.v1.common.loader.init" . -}}
+
+{{- include "pgadmin.validation" $ -}}
+
+{{/* Merge the templates with Values */}}
+{{- $_ := mustMergeOverwrite .Values (include "pgadmin.workload" $ | fromYaml) -}}
+{{- $_ := mustMergeOverwrite .Values (include "pgadmin.service" $ | fromYaml) -}}
+{{- $_ := mustMergeOverwrite .Values (include "pgadmin.persistence" $ | fromYaml) -}}
+
+{{/* Create the configmap for portal manually*/}}
+{{- include "pgadmin.portal" $ -}}
+
+{{- include "ix.v1.common.loader.apply" . -}}

+ 1 - 0
library/ix-dev/community/pgadmin/upgrade_info.json

@@ -0,0 +1 @@
+{"filename": "values.yaml", "keys": ["image"]}

+ 31 - 0
library/ix-dev/community/pgadmin/upgrade_strategy

@@ -0,0 +1,31 @@
+#!/usr/bin/python3
+import json
+import re
+import sys
+
+from catalog_update.upgrade_strategy import semantic_versioning
+
+
+RE_STABLE_VERSION = re.compile(r'\d+\.\d+')
+
+
+def newer_mapping(image_tags):
+    key = list(image_tags.keys())[0]
+    tags = {t: t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)}
+    version = semantic_versioning(list(tags))
+    if not version:
+        return {}
+
+    return {
+        'tags': {key: tags[version]},
+        'app_version': version,
+    }
+
+
+if __name__ == '__main__':
+    try:
+        versions_json = json.loads(sys.stdin.read())
+    except ValueError:
+        raise ValueError('Invalid json specified')
+
+    print(json.dumps(newer_mapping(versions_json)))

+ 25 - 0
library/ix-dev/community/pgadmin/values.yaml

@@ -0,0 +1,25 @@
+image:
+  repository: dpage/pgadmin4
+  pullPolicy: IfNotPresent
+  tag: '7.4'
+
+resources:
+  limits:
+    cpu: 4000m
+    memory: 8Gi
+
+pgadminConfig:
+  adminEmail: ''
+  adminPassword: ''
+  additionalEnvs: []
+
+pgadminNetwork:
+  webPort: 30056
+  certificateID: null
+  hostNetwork: false
+
+pgadminStorage:
+  config:
+    type: ixVolume
+    datasetName: config
+  additionalStorages: []