kubernetes-ingresskongkong-ingress

How do I add custom entities to when using the Kubernetes Ingress Controller with a postgres database?


Title. I have Kong running with the Kubernetes Ingress Controller. I already have a working custom plugin. I tried to add a migrations folder to my plugin files with the appropriate migrations in it but subdirectories get ignored by kubectl create configmap and the -R flag doesn't work.


Solution

  • Unfortunately this is not supported currently. The way you work around this limitation is by creating a volume in the YAML in order to define the path for the files you have in subfolders like so:

    apiVersion: v1
    kind: ConfigMap
    metadata:
       name: testconfig
    data:
      file1: |
        This is file1
      file2: |
        This is file2 in subdir directory
    ---
    

    And then in the volume part of the YAML you would specify the path to the files with their names

      volumes:
        - name: config-volume
          configMap:
            name: testconfig
            items:
            - key: file2
              path: subdir/file2
            - key: file1
              path: file1
    

    You can do this with initContainers and emptyDir mounts by passing the info from the initContainer to the application as described here