|
| 1 | +apiVersion: v1 |
| 2 | +kind: ServiceAccount |
| 3 | +metadata: |
| 4 | + name: nai-prereq-job |
| 5 | + namespace: ${releaseNamespace} |
| 6 | +--- |
| 7 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 8 | +kind: Role |
| 9 | +metadata: |
| 10 | + name: nai-prereq-job |
| 11 | + namespace: ${releaseNamespace} |
| 12 | +rules: |
| 13 | + - apiGroups: ["networking.istio.io/v1"] |
| 14 | + resources: ["gateways"] |
| 15 | + verbs: ["get", "watch", "list", "patch"] |
| 16 | +--- |
| 17 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 18 | +kind: RoleBinding |
| 19 | +metadata: |
| 20 | + name: nai-prereq-job |
| 21 | + namespace: ${releaseNamespace} |
| 22 | +roleRef: |
| 23 | + apiGroup: rbac.authorization.k8s.io |
| 24 | + kind: Role |
| 25 | + name: nai-prereq-job |
| 26 | +subjects: |
| 27 | + - kind: ServiceAccount |
| 28 | + name: nai-prereq-job |
| 29 | + namespace: ${releaseNamespace} |
| 30 | +--- |
| 31 | +apiVersion: batch/v1 |
| 32 | +kind: Job |
| 33 | +metadata: |
| 34 | + name: nai-prereq-job |
| 35 | + namespace: ${releaseNamespace} |
| 36 | +spec: |
| 37 | + template: |
| 38 | + metadata: |
| 39 | + name: nai-prereq-job |
| 40 | + spec: |
| 41 | + serviceAccountName: nai-prereq-job |
| 42 | + priorityClassName: system-cluster-critical |
| 43 | + restartPolicy: OnFailure |
| 44 | + containers: |
| 45 | + - name: pre-install |
| 46 | + image: "${kubetoolsImageRepository:=bitnami/kubectl}:${kubetoolsImageTag:=1.30.5}" |
| 47 | + env: |
| 48 | + - name: KNATIVE_INGRESS_GATEWAY_PATCH |
| 49 | + value: | |
| 50 | + { |
| 51 | + "spec": { |
| 52 | + "selector": { |
| 53 | + "istio": "ingressgateway" |
| 54 | + }, |
| 55 | + "servers": [ |
| 56 | + { |
| 57 | + "hosts": ["*"], |
| 58 | + "port": { |
| 59 | + "name": "http", |
| 60 | + "number": 80, |
| 61 | + "protocol": "HTTP" |
| 62 | + }, |
| 63 | + "tls": { |
| 64 | + "httpsRedirect": true |
| 65 | + } |
| 66 | + }, |
| 67 | + { |
| 68 | + "hosts": ["*"], |
| 69 | + "port": { |
| 70 | + "name": "https", |
| 71 | + "number": 443, |
| 72 | + "protocol": "HTTPS" |
| 73 | + }, |
| 74 | + "tls": { |
| 75 | + "credentialName": "nai-self-signed-cert", |
| 76 | + "mode": "SIMPLE" |
| 77 | + } |
| 78 | + } |
| 79 | + ] |
| 80 | + } |
| 81 | + } |
| 82 | + command: |
| 83 | + - sh |
| 84 | + - -c |
| 85 | + - | |
| 86 | + while ! kubectl wait --for condition=established --timeout=30s crd/gateways.networking.istio.io ; |
| 87 | + do |
| 88 | + echo "Waiting for gateways.networking.istio.io CRD to be established" |
| 89 | + sleep 30 |
| 90 | + done |
| 91 | + echo "Patching knative-ingress-gateway" |
| 92 | + kubectl patch gateways.networking.istio.io knative-ingress-gateway -n knative-serving --type='merge' --patch ${KNATIVE_INGRESS_GATEWAY_PATCH} |
| 93 | + echo "TODO: kubectl patch cm nai-ui after waiting for the external IP or FQDN of the istio-ingressgateway service" |
0 commit comments