Skip to content

Instantly share code, notes, and snippets.

@diefans
Forked from bgarcial/kongwithingress.yaml
Created January 10, 2024 10:36
Show Gist options
  • Select an option

  • Save diefans/3ee6477cbe8623ddd9a3bb5a2f40a3b0 to your computer and use it in GitHub Desktop.

Select an option

Save diefans/3ee6477cbe8623ddd9a3bb5a2f40a3b0 to your computer and use it in GitHub Desktop.

Revisions

  1. @bgarcial bgarcial revised this gist Apr 10, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions kongwithingress.yaml
    Original file line number Diff line number Diff line change
    @@ -12,8 +12,8 @@ metadata:
    namespace: kong
    type: Opaque
    data:
    username: emNybTM2NV9kYl9hZG1pbkB6Y3JtMzY1LXBvc3RncmVzcWwx
    password: NypPMW5PRDRydjNBOCpaSlUh
    username: my-username
    password: my-password-database

    ---

  2. @bgarcial bgarcial revised this gist Apr 10, 2019. 1 changed file with 28 additions and 0 deletions.
    28 changes: 28 additions & 0 deletions kongwithingress.yaml
    Original file line number Diff line number Diff line change
    @@ -488,6 +488,12 @@ spec:
    value: "5432"
    - name: KONG_DATABASE
    value: postgres

    # Here new
    - name: KONG_PG_DATABASE
    value: kong_zcrm365_dev_sandbox


    containers:
    - name: admin-api
    image: kong:1.0.0
    @@ -509,6 +515,12 @@ spec:
    value: "5432"
    - name: KONG_DATABASE
    value: postgres

    # Here new
    - name: KONG_PG_DATABASE
    value: kong_zcrm365_dev_sandbox


    - name: KONG_ADMIN_ACCESS_LOG
    value: /dev/stdout
    - name: KONG_ADMIN_ERROR_LOG
    @@ -586,6 +598,7 @@ spec:
    image: ollystephens/acme-kong-kube-helper:0.0.1
    imagePullPolicy: IfNotPresent


    ---

    apiVersion: v1
    @@ -658,6 +671,11 @@ spec:
    value: "5432"
    - name: KONG_DATABASE
    value: postgres

    # Here new
    - name: KONG_PG_DATABASE
    value: kong_zcrm365_dev_sandbox

    containers:
    - name: kong-proxy
    image: kong:1.0.0
    @@ -678,6 +696,12 @@ spec:
    value: "5432"
    - name: KONG_DATABASE
    value: postgres

    # Here new
    - name: KONG_PG_DATABASE
    value: kong_zcrm365_dev_sandbox


    - name: KONG_PROXY_ACCESS_LOG
    value: "/dev/stdout"
    - name: KONG_PROXY_ERROR_LOG
    @@ -722,6 +746,8 @@ spec:
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_DATABASE
    value: postgres
    - name: KONG_PG_DATABASE
    value: kong_zcrm365_dev_sandbox
    - name: KONG_PG_PORT
    value: "5432"
    command: [ "/bin/sh", "-c", "until nc -zv $KONG_PG_HOST $KONG_PG_PORT -w1; do echo 'waiting for db'; sleep 1; done" ]
    @@ -744,6 +770,8 @@ spec:
    # I don't had the database
    - name: KONG_DATABASE
    value: postgres
    - name: KONG_PG_DATABASE
    value: kong_zcrm365_dev_sandbox
    - name: KONG_PG_PORT
    value: "5432"
    command: [ "/bin/sh", "-c", "kong migrations bootstrap --vv" ]
  3. @bgarcial bgarcial revised this gist Mar 22, 2019. 1 changed file with 23 additions and 19 deletions.
    42 changes: 23 additions & 19 deletions kongwithingress.yaml
    Original file line number Diff line number Diff line change
    @@ -12,8 +12,8 @@ metadata:
    namespace: kong
    type: Opaque
    data:
    username: my-username
    password: my-password
    username: emNybTM2NV9kYl9hZG1pbkB6Y3JtMzY1LXBvc3RncmVzcWwx
    password: NypPMW5PRDRydjNBOCpaSlUh

    ---

    @@ -471,7 +471,7 @@ spec:
    value: "/dev/stderr"
    - name: KONG_ADMIN_ERROR_LOG
    value: "/dev/stderr"
    # ##### some differences fixed
    # ##### some differences fixed
    - name: KONG_PG_PASSWORD
    valueFrom:
    secretKeyRef:
    @@ -483,11 +483,11 @@ spec:
    name: az-pg-db-user-pass
    key: username
    - name: KONG_PG_HOST
    value: my-pg-host
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_PORT
    value: "5432"
    - name: KONG_DATABASE
    value: postgres
    value: postgres
    containers:
    - name: admin-api
    image: kong:1.0.0
    @@ -503,8 +503,8 @@ spec:
    name: az-pg-db-user-pass
    key: username
    - name: KONG_PG_HOST
    value: my-pg-host
    # I dont had the port nnd database
    value: zcrm365-postgresql1.postgres.database.azure.com
    # I dont had the port nnd database
    - name: KONG_PG_PORT
    value: "5432"
    - name: KONG_DATABASE
    @@ -543,7 +543,7 @@ spec:
    args:
    - /kong-ingress-controller
    # the kong URL points to the kong admin api server
    - --kong-url=https://localhost:8444
    - --kong-url=http://localhost:8001 #--kong-url=https://localhost:8444
    - --admin-tls-skip-verify
    # the default service is the kong proxy service
    - --default-backend-service=kong/kong-proxy
    @@ -581,6 +581,10 @@ spec:
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 1
    # Adding acme-kong-kube-helper to solve the acme http01 challenge [preserve_host]
    - name: acme-kong-kube-helper
    image: ollystephens/acme-kong-kube-helper:0.0.1
    imagePullPolicy: IfNotPresent

    ---

    @@ -641,19 +645,19 @@ spec:
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: password
    key: password
    - name: KONG_PG_USER
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: username
    key: username
    - name: KONG_PG_HOST
    value: my-pg-host
    value: zcrm365-postgresql1.postgres.database.azure.com
    # I don't had the port and database
    - name: KONG_PG_PORT
    value: "5432"
    - name: KONG_DATABASE
    value: postgres
    value: postgres
    containers:
    - name: kong-proxy
    image: kong:1.0.0
    @@ -667,9 +671,9 @@ spec:
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: username
    key: username
    - name: KONG_PG_HOST
    value: my-pg-host
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_PORT
    value: "5432"
    - name: KONG_DATABASE
    @@ -708,14 +712,14 @@ spec:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: password
    # User created previously or user to be created?
    # User created previously or user to be created?
    - name: KONG_PG_USER
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: username
    key: username
    - name: KONG_PG_HOST
    value: my-pg-host
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_DATABASE
    value: postgres
    - name: KONG_PG_PORT
    @@ -734,9 +738,9 @@ spec:
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: username
    key: username
    - name: KONG_PG_HOST
    value: my-pg-host
    value: zcrm365-postgresql1.postgres.database.azure.com
    # I don't had the database
    - name: KONG_DATABASE
    value: postgres
  4. @bgarcial bgarcial revised this gist Mar 4, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion kongwithingress.yaml
    Original file line number Diff line number Diff line change
    @@ -715,7 +715,7 @@ spec:
    name: az-pg-db-user-pass
    key: username
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    value: my-pg-host
    - name: KONG_DATABASE
    value: postgres
    - name: KONG_PG_PORT
  5. @bgarcial bgarcial revised this gist Mar 4, 2019. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions kongwithingress.yaml
    Original file line number Diff line number Diff line change
    @@ -503,7 +503,7 @@ spec:
    name: az-pg-db-user-pass
    key: username
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    value: my-pg-host
    # I dont had the port nnd database
    - name: KONG_PG_PORT
    value: "5432"
    @@ -648,7 +648,7 @@ spec:
    name: az-pg-db-user-pass
    key: username
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    value: my-pg-host
    # I don't had the port and database
    - name: KONG_PG_PORT
    value: "5432"
    @@ -669,7 +669,7 @@ spec:
    name: az-pg-db-user-pass
    key: username
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    value: my-pg-host
    - name: KONG_PG_PORT
    value: "5432"
    - name: KONG_DATABASE
    @@ -736,7 +736,7 @@ spec:
    name: az-pg-db-user-pass
    key: username
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    value: my-pg-host
    # I don't had the database
    - name: KONG_DATABASE
    value: postgres
  6. @bgarcial bgarcial revised this gist Mar 4, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion kongwithingress.yaml
    Original file line number Diff line number Diff line change
    @@ -483,7 +483,7 @@ spec:
    name: az-pg-db-user-pass
    key: username
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    value: my-pg-host
    - name: KONG_PG_PORT
    value: "5432"
    - name: KONG_DATABASE
  7. @bgarcial bgarcial revised this gist Mar 4, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions kongwithingress.yaml
    Original file line number Diff line number Diff line change
    @@ -12,8 +12,8 @@ metadata:
    namespace: kong
    type: Opaque
    data:
    username: emNybTM2NV9kYl9hZG1pbkB6Y3JtMzY1LXBvc3RncmVzcWwx
    password: NypPMW5PRDRydjNBOCpaSlUh
    username: my-username
    password: my-password

    ---

  8. @bgarcial bgarcial revised this gist Mar 4, 2019. 1 changed file with 59 additions and 46 deletions.
    105 changes: 59 additions & 46 deletions kongwithingress.yaml
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,7 @@ metadata:
    name: kong

    ---

    apiVersion: v1
    kind: Secret
    metadata:
    @@ -262,8 +263,6 @@ spec:
    healthy: *healthy
    unhealthy: *unhealthy



    ---

    apiVersion: v1
    @@ -472,37 +471,44 @@ spec:
    value: "/dev/stderr"
    - name: KONG_ADMIN_ERROR_LOG
    value: "/dev/stderr"
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_USER
    # ##### some differences fixed
    - name: KONG_PG_PASSWORD
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: username
    #- name: KONG_PG_PASSWORD
    - name: KONG_PG_PASSWORD
    #value: kong
    key: password
    - name: KONG_PG_USER
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: password
    key: username
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_PORT
    value: "5432"
    - name: KONG_DATABASE
    value: postgres
    containers:
    - name: admin-api
    image: kong:1.0.0
    env:
    - name: KONG_PG_USER
    - name: KONG_PG_PASSWORD
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: username
    - name: KONG_PG_PASSWORD
    # value: kong
    key: password
    - name: KONG_PG_USER
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: password
    key: username
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    # I dont had the port nnd database
    - name: KONG_PG_PORT
    value: "5432"
    - name: KONG_DATABASE
    value: postgres
    - name: KONG_ADMIN_ACCESS_LOG
    value: /dev/stdout
    - name: KONG_ADMIN_ERROR_LOG
    @@ -631,38 +637,43 @@ spec:
    value: "/dev/stderr"
    - name: KONG_ADMIN_ERROR_LOG
    value: "/dev/stderr"
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_USER
    - name: KONG_PG_PASSWORD
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: username
    #- name: KONG_PG_PASSWORD
    - name: KONG_PG_PASSWORD
    #value: kong
    key: password
    - name: KONG_PG_USER
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: password
    key: username
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    # I don't had the port and database
    - name: KONG_PG_PORT
    value: "5432"
    - name: KONG_DATABASE
    value: postgres
    containers:
    - name: kong-proxy
    image: kong:1.0.0
    env:
    - name: KONG_PG_USER
    - name: KONG_PG_PASSWORD
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: username
    #- name: KONG_PG_PASSWORD
    - name: KONG_PG_PASSWORD
    #value: kong
    key: password
    - name: KONG_PG_USER
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: password
    key: username
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_PORT
    value: "5432"
    - name: KONG_DATABASE
    value: postgres
    - name: KONG_PROXY_ACCESS_LOG
    value: "/dev/stdout"
    - name: KONG_PROXY_ERROR_LOG
    @@ -692,42 +703,44 @@ spec:
    - name: wait-for-postgres
    image: busybox
    env:
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_PORT
    value: "5432"
    - name: KONG_PG_USER
    - name: KONG_PG_PASSWORD
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: username
    #- name: KONG_PG_PASSWORD
    - name: KONG_PG_PASSWORD
    #value: kong
    key: password
    # User created previously or user to be created?
    - name: KONG_PG_USER
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: password
    key: username
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_DATABASE
    value: postgres
    - name: KONG_PG_PORT
    value: "5432"
    command: [ "/bin/sh", "-c", "until nc -zv $KONG_PG_HOST $KONG_PG_PORT -w1; do echo 'waiting for db'; sleep 1; done" ]
    containers:
    - name: kong-migrations
    image: kong:1.0.0-centos
    env:
    - name: KONG_PG_USER
    - name: KONG_PG_PASSWORD
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: username
    #- name: KONG_PG_PASSWORD
    - name: KONG_PG_PASSWORD
    #value: kong
    key: password
    - name: KONG_PG_USER
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: password
    key: username
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    # I don't had the database
    - name: KONG_DATABASE
    value: postgres
    - name: KONG_PG_PORT
    value: "5432"
    command: [ "/bin/sh", "-c", "kong migrations bootstrap" ]
    command: [ "/bin/sh", "-c", "kong migrations bootstrap --vv" ]
    restartPolicy: OnFailure
  9. @bgarcial bgarcial revised this gist Mar 1, 2019. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions kongwithingress.yaml
    Original file line number Diff line number Diff line change
    @@ -474,7 +474,7 @@ spec:
    value: "/dev/stderr"
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_USERNAME
    - name: KONG_PG_USER
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    @@ -490,7 +490,7 @@ spec:
    - name: admin-api
    image: kong:1.0.0
    env:
    - name: KONG_PG_USERNAME
    - name: KONG_PG_USER
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    @@ -633,7 +633,7 @@ spec:
    value: "/dev/stderr"
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_USERNAME
    - name: KONG_PG_USER
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    @@ -649,7 +649,7 @@ spec:
    - name: kong-proxy
    image: kong:1.0.0
    env:
    - name: KONG_PG_USERNAME
    - name: KONG_PG_USER
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    @@ -696,7 +696,7 @@ spec:
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_PORT
    value: "5432"
    - name: KONG_PG_USERNAME
    - name: KONG_PG_USER
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    @@ -713,7 +713,7 @@ spec:
    - name: kong-migrations
    image: kong:1.0.0-centos
    env:
    - name: KONG_PG_USERNAME
    - name: KONG_PG_USER
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
  10. @bgarcial bgarcial revised this gist Mar 1, 2019. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions kongwithingress.yaml
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,17 @@ kind: Namespace
    metadata:
    name: kong

    ---
    apiVersion: v1
    kind: Secret
    metadata:
    name: az-pg-db-user-pass
    namespace: kong
    type: Opaque
    data:
    username: emNybTM2NV9kYl9hZG1pbkB6Y3JtMzY1LXBvc3RncmVzcWwx
    password: NypPMW5PRDRydjNBOCpaSlUh

    ---

    apiVersion: apiextensions.k8s.io/v1beta1
  11. @bgarcial bgarcial revised this gist Feb 26, 2019. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions kongwithingress.yaml
    Original file line number Diff line number Diff line change
    @@ -685,6 +685,18 @@ spec:
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_PORT
    value: "5432"
    - name: KONG_PG_USERNAME
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: username
    #- name: KONG_PG_PASSWORD
    - name: KONG_PG_PASSWORD
    #value: kong
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: password
    command: [ "/bin/sh", "-c", "until nc -zv $KONG_PG_HOST $KONG_PG_PORT -w1; do echo 'waiting for db'; sleep 1; done" ]
    containers:
    - name: kong-migrations
  12. @bgarcial bgarcial revised this gist Feb 26, 2019. 1 changed file with 15 additions and 0 deletions.
    15 changes: 15 additions & 0 deletions kongwithingress.yaml
    Original file line number Diff line number Diff line change
    @@ -622,6 +622,11 @@ spec:
    value: "/dev/stderr"
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_USERNAME
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: username
    #- name: KONG_PG_PASSWORD
    - name: KONG_PG_PASSWORD
    #value: kong
    @@ -633,6 +638,11 @@ spec:
    - name: kong-proxy
    image: kong:1.0.0
    env:
    - name: KONG_PG_USERNAME
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: username
    #- name: KONG_PG_PASSWORD
    - name: KONG_PG_PASSWORD
    #value: kong
    @@ -680,6 +690,11 @@ spec:
    - name: kong-migrations
    image: kong:1.0.0-centos
    env:
    - name: KONG_PG_USERNAME
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: username
    #- name: KONG_PG_PASSWORD
    - name: KONG_PG_PASSWORD
    #value: kong
  13. @bgarcial bgarcial revised this gist Feb 26, 2019. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions kongwithingress.yaml
    Original file line number Diff line number Diff line change
    @@ -463,6 +463,11 @@ spec:
    value: "/dev/stderr"
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_USERNAME
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: username
    #- name: KONG_PG_PASSWORD
    - name: KONG_PG_PASSWORD
    #value: kong
  14. @bgarcial bgarcial revised this gist Feb 26, 2019. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions kongwithingress.yaml
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    apiVersion: v1
    kind: Namespace
    metadata:
    @@ -475,7 +474,7 @@ spec:
    - name: admin-api
    image: kong:1.0.0
    env:
    - name: PG_DB_USERNAME
    - name: KONG_PG_USERNAME
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
  15. @bgarcial bgarcial renamed this gist Feb 26, 2019. 1 changed file with 34 additions and 5 deletions.
    39 changes: 34 additions & 5 deletions kong-with-ingress.yaml → kongwithingress.yaml
    Original file line number Diff line number Diff line change
    @@ -464,14 +464,28 @@ spec:
    value: "/dev/stderr"
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    #- name: KONG_PG_PASSWORD
    - name: KONG_PG_PASSWORD
    value: kong
    #value: kong
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: password
    containers:
    - name: admin-api
    image: kong:1.0.0
    env:
    - name: PG_DB_USERNAME
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: username
    - name: KONG_PG_PASSWORD
    value: kong
    # value: kong
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: password
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_ADMIN_ACCESS_LOG
    @@ -604,14 +618,24 @@ spec:
    value: "/dev/stderr"
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    #- name: KONG_PG_PASSWORD
    - name: KONG_PG_PASSWORD
    value: kong
    #value: kong
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: password
    containers:
    - name: kong-proxy
    image: kong:1.0.0
    env:
    #- name: KONG_PG_PASSWORD
    - name: KONG_PG_PASSWORD
    value: kong
    #value: kong
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: password
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PROXY_ACCESS_LOG
    @@ -652,8 +676,13 @@ spec:
    - name: kong-migrations
    image: kong:1.0.0-centos
    env:
    #- name: KONG_PG_PASSWORD
    - name: KONG_PG_PASSWORD
    value: kong
    #value: kong
    valueFrom:
    secretKeyRef:
    name: az-pg-db-user-pass
    key: password
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_PORT
  16. @bgarcial bgarcial created this gist Feb 25, 2019.
    662 changes: 662 additions & 0 deletions kong-with-ingress.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,662 @@

    apiVersion: v1
    kind: Namespace
    metadata:
    name: kong

    ---

    apiVersion: apiextensions.k8s.io/v1beta1
    kind: CustomResourceDefinition
    metadata:
    name: kongplugins.configuration.konghq.com
    spec:
    group: configuration.konghq.com
    version: v1
    scope: Namespaced
    names:
    kind: KongPlugin
    plural: kongplugins
    shortNames:
    - kp
    additionalPrinterColumns:
    - name: Plugin-Type
    type: string
    description: Name of the plugin
    JSONPath: .plugin
    - name: Age
    type: date
    description: Age
    JSONPath: .metadata.creationTimestamp
    - name: Disabled
    type: boolean
    description: Indicates if the plugin is disabled
    JSONPath: .disabled
    priority: 1
    - name: Config
    type: string
    description: Configuration of the plugin
    JSONPath: .config
    priority: 1
    validation:
    openAPIV3Schema:
    required:
    - plugin
    properties:
    plugin:
    type: string
    disabled:
    type: boolean
    config:
    type: object

    ---

    apiVersion: apiextensions.k8s.io/v1beta1
    kind: CustomResourceDefinition
    metadata:
    name: kongconsumers.configuration.konghq.com
    spec:
    group: configuration.konghq.com
    version: v1
    scope: Namespaced
    names:
    kind: KongConsumer
    plural: kongconsumers
    shortNames:
    - kc
    additionalPrinterColumns:
    - name: Username
    type: string
    description: Username of a Kong Consumer
    JSONPath: .username
    - name: Age
    type: date
    description: Age
    JSONPath: .metadata.creationTimestamp
    validation:
    openAPIV3Schema:
    properties:
    username:
    type: string
    custom_id:
    type: string

    ---

    apiVersion: apiextensions.k8s.io/v1beta1
    kind: CustomResourceDefinition
    metadata:
    name: kongcredentials.configuration.konghq.com
    spec:
    group: configuration.konghq.com
    version: v1
    scope: Namespaced
    names:
    kind: KongCredential
    plural: kongcredentials
    additionalPrinterColumns:
    - name: Credential-type
    type: string
    description: Type of credential
    JSONPath: .type
    - name: Age
    type: date
    description: Age
    JSONPath: .metadata.creationTimestamp
    - name: Consumer-Ref
    type: string
    description: Owner of the credential
    JSONPath: .consumerRef
    validation:
    openAPIV3Schema:
    required:
    - consumerRef
    - type
    properties:
    consumerRef:
    type: string
    type:
    type: string

    ---

    apiVersion: apiextensions.k8s.io/v1beta1
    kind: CustomResourceDefinition
    metadata:
    name: kongingresses.configuration.konghq.com
    spec:
    group: configuration.konghq.com
    version: v1
    scope: Namespaced
    names:
    kind: KongIngress
    plural: kongingresses
    shortNames:
    - ki
    validation:
    openAPIV3Schema:
    properties:
    upstream:
    type: object
    route:
    properties:
    methods:
    type: array
    items:
    type: string
    regex_priority:
    type: integer
    strip_path:
    type: boolean
    preserve_host:
    type: boolean
    protocols:
    type: array
    items:
    type: string
    enum:
    - http
    - https
    proxy:
    type: object
    properties:
    protocol:
    type: string
    enum:
    - http
    - https
    path:
    type: string
    pattern: ^/.*$
    retries:
    type: integer
    minimum: 0
    connect_timeout:
    type: integer
    minimum: 0
    read_timeout:
    type: integer
    minimum: 0
    write_timeout:
    type: integer
    minimum: 0
    upstream:
    type: object
    properties:
    hash_on:
    type: string
    hash_on_cookie:
    type: string
    hash_on_cookie_path:
    type: string
    hash_on_header:
    type: string
    hash_fallback_header:
    type: string
    hash_fallback:
    type: string
    slots:
    type: integer
    minimum: 10
    healthchecks:
    type: object
    properties:
    active:
    type: object
    properties:
    concurrency:
    type: integer
    minimum: 1
    timeout:
    type: integer
    minimum: 0
    http_path:
    type: string
    pattern: ^/.*$
    healthy: &healthy
    type: object
    properties:
    http_statuses:
    type: array
    items:
    type: integer
    interval:
    type: integer
    minimum: 0
    successes:
    type: integer
    minimum: 0
    unhealthy: &unhealthy
    type: object
    properties:
    http_failures:
    type: integer
    minimum: 0
    http_statuses:
    type: array
    items:
    type: integer
    interval:
    type: integer
    minimum: 0
    tcp_failures:
    type: integer
    minimum: 0
    timeout:
    type: integer
    minimum: 0
    passive:
    type: object
    properties:
    healthy: *healthy
    unhealthy: *unhealthy



    ---

    apiVersion: v1
    kind: ServiceAccount
    metadata:
    name: kong-serviceaccount
    namespace: kong

    ---

    apiVersion: rbac.authorization.k8s.io/v1beta1
    kind: ClusterRole
    metadata:
    name: kong-ingress-clusterrole
    rules:
    - apiGroups:
    - ""
    resources:
    - endpoints
    - nodes
    - pods
    - secrets
    verbs:
    - list
    - watch
    - apiGroups:
    - ""
    resources:
    - nodes
    verbs:
    - get
    - apiGroups:
    - ""
    resources:
    - services
    verbs:
    - get
    - list
    - watch
    - apiGroups:
    - "extensions"
    resources:
    - ingresses
    verbs:
    - get
    - list
    - watch
    - apiGroups:
    - ""
    resources:
    - events
    verbs:
    - create
    - patch
    - apiGroups:
    - "extensions"
    resources:
    - ingresses/status
    verbs:
    - update
    - apiGroups:
    - "configuration.konghq.com"
    resources:
    - kongplugins
    - kongcredentials
    - kongconsumers
    - kongingresses
    verbs:
    - get
    - list
    - watch

    ---

    apiVersion: rbac.authorization.k8s.io/v1beta1
    kind: Role
    metadata:
    name: kong-ingress-role
    namespace: kong
    rules:
    - apiGroups:
    - ""
    resources:
    - configmaps
    - pods
    - secrets
    - namespaces
    verbs:
    - get
    - apiGroups:
    - ""
    resources:
    - configmaps
    resourceNames:
    # Defaults to "<election-id>-<ingress-class>"
    # Here: "<ingress-controller-leader>-<kong>"
    # This has to be adapted if you change either parameter
    # when launching the kong-ingress-controller.
    - "ingress-controller-leader-kong"
    verbs:
    - get
    - update
    - apiGroups:
    - ""
    resources:
    - configmaps
    verbs:
    - create
    - apiGroups:
    - ""
    resources:
    - endpoints
    verbs:
    - get

    ---

    apiVersion: rbac.authorization.k8s.io/v1beta1
    kind: RoleBinding
    metadata:
    name: kong-ingress-role-nisa-binding
    namespace: kong
    roleRef:
    apiGroup: rbac.authorization.k8s.io
    kind: Role
    name: kong-ingress-role
    subjects:
    - kind: ServiceAccount
    name: kong-serviceaccount
    namespace: kong

    ---

    apiVersion: rbac.authorization.k8s.io/v1beta1
    kind: ClusterRoleBinding
    metadata:
    name: kong-ingress-clusterrole-nisa-binding
    roleRef:
    apiGroup: rbac.authorization.k8s.io
    kind: ClusterRole
    name: kong-ingress-clusterrole
    subjects:
    - kind: ServiceAccount
    name: kong-serviceaccount
    namespace: kong

    ---

    apiVersion: v1
    kind: Service
    metadata:
    name: kong-ingress-controller
    namespace: kong
    spec:
    type: NodePort
    ports:
    - name: kong-admin
    port: 8001
    targetPort: 8001
    protocol: TCP
    selector:
    app: ingress-kong

    ---

    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
    labels:
    app: ingress-kong
    name: kong-ingress-controller
    namespace: kong
    spec:
    selector:
    matchLabels:
    app: ingress-kong
    strategy:
    rollingUpdate:
    maxSurge: 1
    maxUnavailable: 0
    type: RollingUpdate
    template:
    metadata:
    annotations:
    # the returned metrics are related to the kong ingress controller not kong itself
    prometheus.io/port: "10254"
    prometheus.io/scrape: "true"
    labels:
    app: ingress-kong
    spec:
    serviceAccountName: kong-serviceaccount
    initContainers:
    - name: wait-for-migrations
    image: kong:1.0.0
    command: [ "/bin/sh", "-c", "kong migrations list" ]
    env:
    - name: KONG_ADMIN_LISTEN
    value: 'off'
    - name: KONG_PROXY_LISTEN
    value: 'off'
    - name: KONG_PROXY_ACCESS_LOG
    value: "/dev/stdout"
    - name: KONG_ADMIN_ACCESS_LOG
    value: "/dev/stdout"
    - name: KONG_PROXY_ERROR_LOG
    value: "/dev/stderr"
    - name: KONG_ADMIN_ERROR_LOG
    value: "/dev/stderr"
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_PASSWORD
    value: kong
    containers:
    - name: admin-api
    image: kong:1.0.0
    env:
    - name: KONG_PG_PASSWORD
    value: kong
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_ADMIN_ACCESS_LOG
    value: /dev/stdout
    - name: KONG_ADMIN_ERROR_LOG
    value: /dev/stderr
    - name: KONG_ADMIN_LISTEN
    value: 0.0.0.0:8001, 0.0.0.0:8444 ssl
    - name: KONG_PROXY_LISTEN
    value: 'off'
    ports:
    - name: kong-admin
    containerPort: 8001
    livenessProbe:
    failureThreshold: 3
    httpGet:
    path: /status
    port: 8001
    scheme: HTTP
    initialDelaySeconds: 30
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 1
    readinessProbe:
    failureThreshold: 3
    httpGet:
    path: /status
    port: 8001
    scheme: HTTP
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 1
    - name: ingress-controller
    args:
    - /kong-ingress-controller
    # the kong URL points to the kong admin api server
    - --kong-url=https://localhost:8444
    - --admin-tls-skip-verify
    # the default service is the kong proxy service
    - --default-backend-service=kong/kong-proxy
    # Service from were we extract the IP address/es to use in Ingress status
    - --publish-service=kong/kong-proxy
    env:
    - name: POD_NAME
    valueFrom:
    fieldRef:
    apiVersion: v1
    fieldPath: metadata.name
    - name: POD_NAMESPACE
    valueFrom:
    fieldRef:
    apiVersion: v1
    fieldPath: metadata.namespace
    image: kong-docker-kubernetes-ingress-controller.bintray.io/kong-ingress-controller:0.3.0
    imagePullPolicy: IfNotPresent
    livenessProbe:
    failureThreshold: 3
    httpGet:
    path: /healthz
    port: 10254
    scheme: HTTP
    initialDelaySeconds: 30
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 1
    readinessProbe:
    failureThreshold: 3
    httpGet:
    path: /healthz
    port: 10254
    scheme: HTTP
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 1

    ---

    apiVersion: v1
    kind: Service
    metadata:
    name: kong-proxy
    namespace: kong
    spec:
    type: LoadBalancer
    ports:
    - name: kong-proxy
    port: 80
    targetPort: 8000
    protocol: TCP
    - name: kong-proxy-ssl
    port: 443
    targetPort: 8443
    protocol: TCP
    selector:
    app: kong


    ---

    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
    name: kong
    namespace: kong
    spec:
    template:
    metadata:
    labels:
    name: kong
    app: kong
    spec:
    initContainers:
    # hack to verify that the DB is up to date or not
    # TODO remove this for Kong >= 0.15.0
    - name: wait-for-migrations
    image: kong:1.0.0
    command: [ "/bin/sh", "-c", "kong migrations list" ]
    env:
    - name: KONG_ADMIN_LISTEN
    value: 'off'
    - name: KONG_PROXY_LISTEN
    value: 'off'
    - name: KONG_PROXY_ACCESS_LOG
    value: "/dev/stdout"
    - name: KONG_ADMIN_ACCESS_LOG
    value: "/dev/stdout"
    - name: KONG_PROXY_ERROR_LOG
    value: "/dev/stderr"
    - name: KONG_ADMIN_ERROR_LOG
    value: "/dev/stderr"
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_PASSWORD
    value: kong
    containers:
    - name: kong-proxy
    image: kong:1.0.0
    env:
    - name: KONG_PG_PASSWORD
    value: kong
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PROXY_ACCESS_LOG
    value: "/dev/stdout"
    - name: KONG_PROXY_ERROR_LOG
    value: "/dev/stderr"
    - name: KONG_ADMIN_LISTEN
    value: 'off'
    ports:
    - name: proxy
    containerPort: 8000
    protocol: TCP
    - name: proxy-ssl
    containerPort: 8443
    protocol: TCP

    ---
    apiVersion: batch/v1
    kind: Job
    metadata:
    name: kong-migrations
    namespace: kong
    spec:
    template:
    metadata:
    name: kong-migrations
    spec:
    initContainers:
    - name: wait-for-postgres
    image: busybox
    env:
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_PORT
    value: "5432"
    command: [ "/bin/sh", "-c", "until nc -zv $KONG_PG_HOST $KONG_PG_PORT -w1; do echo 'waiting for db'; sleep 1; done" ]
    containers:
    - name: kong-migrations
    image: kong:1.0.0-centos
    env:
    - name: KONG_PG_PASSWORD
    value: kong
    - name: KONG_PG_HOST
    value: zcrm365-postgresql1.postgres.database.azure.com
    - name: KONG_PG_PORT
    value: "5432"
    command: [ "/bin/sh", "-c", "kong migrations bootstrap" ]
    restartPolicy: OnFailure