"Fossies" - the Fresh Open Source Software Archive

Member "magnum-8.1.0/magnum/drivers/common/templates/kubernetes/helm/ingress-nginx.sh" (1 Oct 2019, 6308 Bytes) of package /linux/misc/openstack/magnum-8.1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 
    3 . /etc/sysconfig/heat-params
    4 
    5 set -ex
    6 
    7 step="nginx-ingress"
    8 printf "Starting to run ${step}\n"
    9 
   10 ### Configuration
   11 ###############################################################################
   12 CHART_NAME="nginx-ingress"
   13 CHART_VERSION="1.4.0"
   14 
   15 if [ "$(echo ${INGRESS_CONTROLLER} | tr '[:upper:]' '[:lower:]')" = "nginx" ]; then
   16 
   17 HELM_MODULE_CONFIG_FILE="/srv/magnum/kubernetes/helm/${CHART_NAME}.yaml"
   18 [ -f ${HELM_MODULE_CONFIG_FILE} ] || {
   19     echo "Writing File: ${HELM_MODULE_CONFIG_FILE}"
   20     mkdir -p $(dirname ${HELM_MODULE_CONFIG_FILE})
   21     cat << EOF > ${HELM_MODULE_CONFIG_FILE}
   22 ---
   23 kind: ConfigMap
   24 apiVersion: v1
   25 metadata:
   26   name: ${CHART_NAME}-config
   27   namespace: magnum-tiller
   28   labels:
   29     app: helm
   30 data:
   31   install-${CHART_NAME}.sh: |
   32     #!/bin/bash
   33     set -e
   34     set -x
   35     mkdir -p \${HELM_HOME}
   36     cp /etc/helm/* \${HELM_HOME}
   37 
   38     # HACK - Force wait because of bug https://github.com/helm/helm/issues/5170
   39     until helm init --client-only --wait
   40     do
   41         sleep 5s
   42     done
   43     helm repo update
   44 
   45     if [[ \$(helm history ${CHART_NAME} | grep ${CHART_NAME}) ]]; then
   46         echo "${CHART_NAME} already installed on server. Continue..."
   47         exit 0
   48     else
   49         helm install stable/${CHART_NAME} --namespace kube-system --name ${CHART_NAME} --version v${CHART_VERSION} --values /opt/magnum/install-${CHART_NAME}-values.yaml
   50     fi
   51 
   52   install-${CHART_NAME}-values.yaml:  |
   53     controller:
   54       name: controller
   55       image:
   56         repository: ${CONTAINER_INFRA_PREFIX:-quay.io/kubernetes-ingress-controller/}nginx-ingress-controller
   57         tag: ${NGINX_INGRESS_CONTROLLER_TAG}
   58         pullPolicy: IfNotPresent
   59         runAsUser: 33
   60       config: {}
   61       headers: {}
   62       hostNetwork: true
   63       dnsPolicy: ClusterFirst
   64       daemonset:
   65         useHostPort: true
   66         hostPorts:
   67           http: 80
   68           https: 443
   69           stats: 18080
   70       defaultBackendService: ""
   71       electionID: ingress-controller-leader
   72       ingressClass: nginx
   73       podLabels: {}
   74       publishService:
   75         enabled: false
   76         pathOverride: ""
   77       scope:
   78         enabled: false
   79         namespace: ""   # defaults to .Release.Namespace
   80       extraArgs:
   81         enable-ssl-passthrough: ""
   82       extraEnvs: []
   83       kind: DaemonSet
   84       updateStrategy: {}
   85       minReadySeconds: 0
   86       tolerations: []
   87       affinity: {}
   88       nodeSelector:
   89         role: ${INGRESS_CONTROLLER_ROLE}
   90       livenessProbe:
   91         failureThreshold: 3
   92         initialDelaySeconds: 10
   93         periodSeconds: 10
   94         successThreshold: 1
   95         timeoutSeconds: 1
   96         port: 10254
   97       readinessProbe:
   98         failureThreshold: 3
   99         initialDelaySeconds: 10
  100         periodSeconds: 10
  101         successThreshold: 1
  102         timeoutSeconds: 1
  103         port: 10254
  104       podAnnotations: {}
  105       replicaCount: 1
  106       minAvailable: 1
  107       resources:
  108         limits:
  109           cpu: 100m
  110           memory: 64Mi
  111         requests:
  112           cpu: 100m
  113           memory: 64Mi
  114       autoscaling:
  115         enabled: false
  116       customTemplate:
  117         configMapName: ""
  118         configMapKey: ""
  119       service:
  120         annotations: {}
  121         labels: {}
  122         clusterIP: ""
  123         externalIPs: []
  124         loadBalancerIP: ""
  125         loadBalancerSourceRanges: []
  126         enableHttp: true
  127         enableHttps: true
  128         externalTrafficPolicy: ""
  129         healthCheckNodePort: 0
  130         targetPorts:
  131           http: http
  132           https: https
  133         type: NodePort
  134         nodePorts:
  135           http: "32080"
  136           https: "32443"
  137       extraContainers: []
  138       extraVolumeMounts: []
  139       extraVolumes: []
  140       extraInitContainers: []
  141       stats:
  142         enabled: false
  143         service:
  144           annotations: {}
  145           clusterIP: ""
  146           externalIPs: []
  147           loadBalancerIP: ""
  148           loadBalancerSourceRanges: []
  149           servicePort: 18080
  150           type: ClusterIP
  151       metrics:
  152         enabled: false
  153         service:
  154           annotations: {}
  155           clusterIP: ""
  156           externalIPs: []
  157           loadBalancerIP: ""
  158           loadBalancerSourceRanges: []
  159           servicePort: 9913
  160           type: ClusterIP
  161         serviceMonitor:
  162           enabled: false
  163           additionalLabels: {}
  164           namespace: ""
  165       lifecycle: {}
  166       priorityClassName: ""
  167     revisionHistoryLimit: 10
  168     defaultBackend:
  169       enabled: true
  170       name: default-backend
  171       image:
  172         repository: ${CONTAINER_INFRA_PREFIX:-k8s.gcr.io/}defaultbackend
  173         tag: "1.4"
  174         pullPolicy: IfNotPresent
  175       extraArgs: {}
  176       port: 8080
  177       tolerations: []
  178       affinity: {}
  179       podLabels: {}
  180       nodeSelector: {}
  181       podAnnotations: {}
  182       replicaCount: 1
  183       minAvailable: 1
  184       resources:
  185         limits:
  186           cpu: 10m
  187           memory: 20Mi
  188         requests:
  189           cpu: 10m
  190           memory: 20Mi
  191       service:
  192         annotations: {}
  193         clusterIP: ""
  194         externalIPs: []
  195         loadBalancerIP: ""
  196         loadBalancerSourceRanges: []
  197         servicePort: 80
  198         type: ClusterIP
  199       priorityClassName: ""
  200     rbac:
  201       create: true
  202     podSecurityPolicy:
  203       enabled: false
  204     serviceAccount:
  205       create: true
  206       name:
  207     imagePullSecrets: []
  208     tcp: {}
  209     udp: {}
  210 ---
  211 apiVersion: batch/v1
  212 kind: Job
  213 metadata:
  214   name: install-${CHART_NAME}-job
  215   namespace: magnum-tiller
  216 spec:
  217   backoffLimit: 5
  218   template:
  219     spec:
  220       serviceAccountName: tiller
  221       containers:
  222       - name: config-helm
  223         image: ${CONTAINER_INFRA_PREFIX:-docker.io/openstackmagnum/}helm-client:dev
  224         command:
  225         - bash
  226         args:
  227         - /opt/magnum/install-${CHART_NAME}.sh
  228         env:
  229         - name: HELM_HOME
  230           value: /helm_home
  231         - name: TILLER_NAMESPACE
  232           value: magnum-tiller
  233         - name: HELM_TLS_ENABLE
  234           value: "true"
  235         volumeMounts:
  236         - name: install-${CHART_NAME}-config
  237           mountPath: /opt/magnum/
  238         - mountPath: /etc/helm
  239           name: helm-client-certs
  240       restartPolicy: Never
  241       volumes:
  242       - name: install-${CHART_NAME}-config
  243         configMap:
  244           name: ${CHART_NAME}-config
  245       - name: helm-client-certs
  246         secret:
  247           secretName: helm-client-secret
  248 EOF
  249 }
  250 fi
  251 
  252 printf "Finished running ${step}\n"