README.md 18.2 KB
Newer Older
1
2
# Helm Installation Instructions

Daniel Scholl's avatar
Daniel Scholl committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
__CLI Login__

Login to Azure CLI using the OSDU Environment Service Principal.

```bash
# This logs your local Azure CLI in using the configured service principal.
az login --service-principal -u $ARM_CLIENT_ID -p $ARM_CLIENT_SECRET --tenant $ARM_TENANT_ID
```

__Helm Values__

Create the helm chart values file necessary to install charts.

- Download [helm-config.yaml](https://community.opengroup.org/osdu/platform/deployment-and-operations/infra-azure-provisioning/-/raw/master/charts/helm-config.yaml), which will configure OSDU on Azure.

  `wget https://community.opengroup.org/osdu/platform/deployment-and-operations/infra-azure-provisioning/-/raw/master/charts/helm-config.yaml -O config.yaml`

- Edit the newly downloaded [config.yaml](https://community.opengroup.org/osdu/platform/deployment-and-operations/infra-azure-provisioning/-/raw/master/charts/helm-config.yaml) and fill out the required sections `azure`, `ingress` and `istio`.

Daniel Scholl's avatar
Daniel Scholl committed
22
23


Daniel Scholl's avatar
Daniel Scholl committed
24
25
26
27
28
```bash
# Setup Variables
ADMIN_EMAIL="<your_cert_admin>"     # ie: admin@email.com
DNS_HOST="<your_ingress_hostname>"  # ie: osdu.contoso.com

Jason's avatar
Jason committed
29
GROUP=$(az group list --query "[?contains(name, 'cr${UNIQUE}')].name" -otsv)
Daniel Scholl's avatar
Daniel Scholl committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
ENV_VAULT=$(az keyvault list --resource-group $GROUP --query [].name -otsv)

# Translate Values File
cat > config.yaml << EOF
# This file contains the essential configs for the osdu on azure helm chart
global:

  # Service(s) Replica Count
  replicaCount: 2

  ################################################################################
  # Specify the azure environment specific values
  #
  azure:
    tenant: $(az keyvault secret show --id https://${ENV_VAULT}.vault.azure.net/secrets/tenant-id --query value -otsv)
    subscription: $(az keyvault secret show --id https://${ENV_VAULT}.vault.azure.net/secrets/subscription-id --query value -otsv)
    resourcegroup: $(az keyvault secret show --id https://${ENV_VAULT}.vault.azure.net/secrets/base-name-cr --query value -otsv)-rg
    identity: $(az keyvault secret show --id https://${ENV_VAULT}.vault.azure.net/secrets/base-name-cr --query value -otsv)-osdu-identity
    identity_id: $(az keyvault secret show --id https://${ENV_VAULT}.vault.azure.net/secrets/osdu-identity-id --query value -otsv)
    keyvault: $ENV_VAULT
    appid: $(az keyvault secret show --id https://${ENV_VAULT}.vault.azure.net/secrets/aad-client-id --query value -otsv)

  ################################################################################
  # Specify the Ingress Settings
  # DNS Hostname for thet Gateway
  # Admin Email Address to be notified for SSL expirations
  # Lets Encrypt SSL Server
  #     https://acme-staging-v02.api.letsencrypt.org/directory  --> Staging Server
  #     https://acme-v02.api.letsencrypt.org/directory --> Production Server
  #
  ingress:
    hostname: $DNS_HOST
    admin: $ADMIN_EMAIL
    sslServer: https://acme-v02.api.letsencrypt.org/directory  # Production

  ################################################################################
  # Specify the istio specific values
  # based64 encoded username and password
  #
  istio:
Jason's avatar
Jason committed
70
71
    username: $(az keyvault secret show --id https://${COMMON_VAULT}.vault.azure.net/secrets/istio-username --query value -otsv)
    password: $(az keyvault secret show --id https://${COMMON_VAULT}.vault.azure.net/secrets/istio-password --query value -otsv)
Daniel Scholl's avatar
Daniel Scholl committed
72
73
EOF
```
74
75
76
77
78
79
80
81
82
83
84
85
Create the helm chart values file necessary to install airflow charts.

- Download [helm-config.yaml](https://community.opengroup.org/osdu/platform/deployment-and-operations/infra-azure-provisioning/-/raw/master/charts/airflow/helm-config.yaml), which will configure OSDU on Azure.

  `wget https://community.opengroup.org/osdu/platform/deployment-and-operations/infra-azure-provisioning/-/raw/master/charts/airflow/helm-config.yaml -O config_airflow.yaml`

- Edit the newly downloaded [config_airflow.yaml](https://community.opengroup.org/osdu/platform/deployment-and-operations/infra-azure-provisioning/-/raw/master/charts/airflow/helm-config.yaml) and fill out the required sections `externalDatabase` and `externalRedis`.



```bash
# Setup Variables
86
87
BRANCH="master"
TAG="latest"
88
DNS_HOST="<your_ingress_hostname>"  # ie: osdu.contoso.com
89

90
91
92
93
94
GROUP=$(az group list --query "[?contains(name, 'cr${UNIQUE}')].name" -otsv)
ENV_VAULT=$(az keyvault list --resource-group $GROUP --query [].name -otsv)

# Translate Values File
cat > config_airflow.yaml << EOF
95
96
97
################################################################################
# Specify the azure environment specific values
#
98
99
appinsightstatsd:
  aadpodidbinding: "osdu-identity"
100
101
102
103
104
105
106
107
108

################################################################################
# Specify any optional override values
#
image:
  repository: $(az keyvault secret show --id https://${ENV_VAULT}.vault.azure.net/secrets/container-registry --query value -otsv).azurecr.io
  branch: $BRANCH
  tag: $TAG

109
110
airflowLogin:
  name: admin
111
112
113
114
115


################################################################################
# Specify the airflow configuration
#
116
airflow:
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227

  ###################################
  # Kubernetes - Ingress Configs
  ###################################
  ingress:
    enabled: false                  #<-- Set this enabled to true for Admin UI
    web:
      annotations:
        kubernetes.io/ingress.class: azure/application-gateway
        appgw.ingress.kubernetes.io/request-timeout: "300"
        appgw.ingress.kubernetes.io/connection-draining: "true"
        appgw.ingress.kubernetes.io/connection-draining-timeout: "30"
        cert-manager.io/cluster-issuer: letsencrypt
        cert-manager.io/acme-challenge-type: http01
      path: "/airflow"
      host: $DNS_HOST
      livenessPath: "/airflow/health"
      tls:
        enabled: true
        secretName: osdu-certificate
      precedingPaths:
        - path: "/airflow/*"
          serviceName: airflow-web
          servicePort: 8080

  ###################################
  # Database - External Database
  ###################################
  postgresql:
    enabled: false
  externalDatabase:
    type: postgres
    ## Azure PostgreSQL Database username, formatted as {username}@{hostname}
    user:  osdu_admin@$(az keyvault secret show --id https://${ENV_VAULT}.vault.azure.net/secrets/base-name-sr --query value -otsv)-pg
    passwordSecret: "postgres"
    passwordSecretKey: "postgres-password"
    ## Azure PostgreSQL Database host
    host: $(az keyvault secret show --id https://${ENV_VAULT}.vault.azure.net/secrets/base-name-sr --query value -otsv)-pg.postgres.database.azure.com
    port: 5432
    properties: "?sslmode=require"
    database: airflow

  ###################################
  # Database - External Redis
  ###################################
  redis:
    enabled: false
  externalRedis:
    ## Azure Redis Cache host
    host: $(az keyvault secret show --id https://${ENV_VAULT}.vault.azure.net/secrets/base-name-sr --query value -otsv)-cache.redis.cache.windows.net
    port: 6380
    passwordSecret: "redis"
    passwordSecretKey: "redis-password"

  ###################################
  # Airflow - DAGs Configs
  ###################################
  dags:
    installRequirements: true
    persistence:
      enabled: true
      existingClaim: airflowdagpvc
      subPath: "dags"

  ###################################
  # Airflow - WebUI Configs
  ###################################
  web:
    podLabels:
      aadpodidbinding: "osdu-identity"
    baseUrl: "http://localhost/airflow"

  ###################################
  # Airflow - Worker Configs
  ###################################
  workers:
    podLabels:
      aadpodidbinding: "osdu-identity"
    autoscaling:
      enabled: true
      ## minReplicas is picked from Values.workers.replicas and default value is 1
      maxReplicas: 3
      metrics:
      - type: Resource
        resource:
          name: memory
          target:
            type: Utilization
            averageUtilization: 50
    resources:
      requests:
        memory: "512Mi"

  ###################################
  # Airflow - Flower Configs
  ###################################
  flower:
    enabled: false

  ###################################
  # Airflow - Scheduler Configs
  ###################################
  scheduler:
    podLabels:
      aadpodidbinding: "osdu-identity"
    variables: |
      {}

  ###################################
  # Airflow - Common Configs
  ###################################
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
  airflow:
    image:
      repository: apache/airflow
      tag: 1.10.12-python3.6
      pullPolicy: IfNotPresent
      pullSecret: ""
    config:
      AIRFLOW__SCHEDULER__STATSD_ON: "True"
      AIRFLOW__SCHEDULER__STATSD_HOST: "appinsights-statsd"
      AIRFLOW__SCHEDULER__STATSD_PORT: 8125
      AIRFLOW__SCHEDULER__STATSD_PREFIX: "osdu_airflow"
      AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: "False"
      ## Enable for Debug purpose
      AIRFLOW__WEBSERVER__EXPOSE_CONFIG: "False"
      AIRFLOW__WEBSERVER__AUTHENTICATE: "True"
      AIRFLOW__WEBSERVER__AUTH_BACKEND: "airflow.contrib.auth.backends.password_auth"
      AIRFLOW__API__AUTH_BACKEND: "airflow.contrib.auth.backends.password_auth"
      AIRFLOW__CORE__REMOTE_LOGGING: "True"
      AIRFLOW__CORE__REMOTE_LOG_CONN_ID: "az_log"
      AIRFLOW__CORE__REMOTE_BASE_LOG_FOLDER: "wasb-airflowlog"
      AIRFLOW__CORE__LOGGING_CONFIG_CLASS: "log_config.DEFAULT_LOGGING_CONFIG"
Ankush Jain's avatar
Ankush Jain committed
249
      AIRFLOW__CORE__LOG_FILENAME_TEMPLATE: "{{ run_id }}/{{ ti.dag_id }}/{{ ti.task_id }}/{{ ts }}/{% if 'correlationId' in dag_run.conf %}{{ dag_run.conf['correlationId'] }}{% else %}None{% endif %}/{{ try_number }}.log"
250
251
      AIRFLOW__CELERY__SSL_ACTIVE: "True"
      AIRFLOW__WEBSERVER__ENABLE_PROXY_FIX: "True"
252
      AIRFLOW__CORE__PLUGINS_FOLDER: "/opt/airflow/plugins"
253
      AIRFLOW__SCHEDULER__DAG_DIR_LIST_INTERVAL: 60
254
      AIRFLOW__CORE__LOGGING_LEVEL: DEBUG
255
256
257
258
259
260
261
262
263
264
265
    extraEnv:
      - name: AIRFLOW__CORE__FERNET_KEY
        valueFrom:
          secretKeyRef:
            name: airflow
            key: fernet-key
      - name: AIRFLOW_CONN_AZ_LOG
        valueFrom:
          secretKeyRef:
            name: airflow
            key: remote-log-connection
266
267
268
269
270
271
272
      - name: CLOUD_PROVIDER
        value: "azure"
      - name: KEYVAULT_URI
        valueFrom:
          configMapKeyRef:
            name: osdu-svc-properties
            key: ENV_KEYVAULT
273
274
275
276
277
278
279
280
281
    extraConfigmapMounts:
      - name: remote-log-config
        mountPath: /opt/airflow/config
        configMap: airflow-remote-log-config
        readOnly: true
    extraPipPackages: [
        "flask-bcrypt",
        "apache-airflow[statsd]",
        "apache-airflow[kubernetes]",
282
283
284
285
286
287
288
        "apache-airflow-backport-providers-microsoft-azure",
        "dataclasses",
        "google-cloud-storage",
        "azure-identity",
        "azure-keyvault-secrets",
        "msal",
        "https://azglobalosdutestlake.blob.core.windows.net/pythonsdk/osdu_api-0.0.4.tar.gz"
289
290
291
292
293
    ]
    extraVolumeMounts:
      - name: azure-keyvault
        mountPath: "/mnt/azure-keyvault"
        readOnly: true
294
295
296
      - name: dags-data
        mountPath: /opt/airflow/plugins
        subPath: plugins
297
298
299
300
301
302
303
304
305
    extraVolumes:
      - name: azure-keyvault
        csi:
          driver: secrets-store.csi.k8s.io
          readOnly: true
          volumeAttributes:
            secretProviderClass: azure-keyvault
EOF
```
Daniel Scholl's avatar
Daniel Scholl committed
306
307
308
309

__Clone Service Repositories__

Manually ensure all the services have been cloned to your machine.
310
311

```bash
Daniel Scholl's avatar
Daniel Scholl committed
312
313
314
315
SRC_DIR="<ROOT_PATH_TO_SOURCE>" #  $HOME/source/osdu/osdu-gitlab

git clone https://community.opengroup.org/osdu/platform/system/partition.git $SRC_DIR/partition
git clone https://community.opengroup.org/osdu/platform/security-and-compliance/entitlements-azure.git $SRC_DIR/entitlements-azure
Rostislav_Vatolin's avatar
Rostislav_Vatolin committed
316
git clone https://community.opengroup.org/osdu/platform/security-and-compliance/entitlements.git $SRC_DIR/entitlements
Daniel Scholl's avatar
Daniel Scholl committed
317
318
319
320
321
git clone https://community.opengroup.org/osdu/platform/security-and-compliance/legal.git $SRC_DIR/legal
git clone https://community.opengroup.org/osdu/platform/system/storage.git $SRC_DIR/storage
git clone https://community.opengroup.org/osdu/platform/system/indexer-queue.git $SRC_DIR/indexer-queue
git clone https://community.opengroup.org/osdu/platform/system/indexer-service.git $SRC_DIR/indexer-service
git clone https://community.opengroup.org/osdu/platform/system/search-service.git $SRC_DIR/search-service
322
323
git clone https://community.opengroup.org/osdu/platform/system/file.git $SRC_DIR/file-service
git clone https://community.opengroup.org/osdu/platform/system/delivery.git $SRC_DIR/delivery
324
325
git clone https://community.opengroup.org/osdu/platform/system/reference/ unit-service.git $SRC_DIR/unit-service
git clone https://community.opengroup.org/osdu/platform/system/reference/crs-catalog-service.git $SRC_DIR/crs-catalog-service
Sumra Zafar's avatar
Sumra Zafar committed
326
git clone https://community.opengroup.org/osdu/platform/system/reference/crs-conversion-service.git $SRC_DIR/crs-conversion-service
Komal Makkar's avatar
Komal Makkar committed
327
git clone https://community.opengroup.org/osdu/platform/system/notification.git $SRC_DIR/notification
harshit aggarwal's avatar
harshit aggarwal committed
328
329
git clone https://community.opengroup.org/osdu/platform/data-flow/enrichment/wks.git $SRC_DIR/wks
git clone https://community.opengroup.org/osdu/platform/system/register.git $SRC_DIR/register
harshit aggarwal's avatar
harshit aggarwal committed
330
git clone https://community.opengroup.org/osdu/platform/system/schema-service.git $SRC_DIR/schema-service
331
git clonehttps://community.opengroup.org/osdu/platform/data-flow/ingestion/ingestion-workflow.git $SRC_DIR/ingestion-workflow
332
git clone https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-service.git $SRC_DIR/seismic-store-service
333
git clone https://community.opengroup.org:osdu/platform/domain-data-mgmt-services/wellbore/wellbore-domain-services.git $SRC_DIR/wellbore-domain-services
334
335
```

Sumra Zafar's avatar
Sumra Zafar committed
336
__Additional Manual Steps__
337
Following services require additional steps for manual setup.
Sumra Zafar's avatar
Sumra Zafar committed
338
- [CRS Catalog Service](https://community.opengroup.org/osdu/platform/deployment-and-operations/infra-azure-provisioning/-/issues/56)
339
340
- [CRS Conversion Serice](https://community.opengroup.org/osdu/platform/deployment-and-operations/infra-azure-provisioning/-/issues/65)
- [Unit Service](https://community.opengroup.org/osdu/platform/deployment-and-operations/infra-azure-provisioning/-/issues/55)
341
342
- [Wellbore DMS](https://community.opengroup.org/osdu/platform/deployment-and-operations/infra-azure-provisioning/-/issues/36)

343

Daniel Scholl's avatar
Daniel Scholl committed
344
345
346
347
__Kubernetes API Access__

> Optional

Daniel Scholl's avatar
Daniel Scholl committed
348
It can often be helpful to be able to retrieve the cluster context and execute queries directly against the Kubernetes API.
Daniel Scholl's avatar
Daniel Scholl committed
349
350

```bash
Jason's avatar
Jason committed
351
BASE_NAME=$(az group list --query "[?contains(name, 'sr${UNIQUE}')].name" -otsv |grep -v MC | rev | cut -c 3- | rev)
Daniel Scholl's avatar
Daniel Scholl committed
352
353
354
355
356

az aks get-credentials -n ${BASE_NAME}aks -g ${BASE_NAME}rg
```


Daniel Scholl's avatar
Daniel Scholl committed
357
358
359
__Helm Manifests__

Manually extract the manifests from the helm charts to your Flux Repo Directory.
360
361

```bash
Daniel Scholl's avatar
Daniel Scholl committed
362
363
INFRA_SRC="$SRC_DIR/infra-azure-provisioning"
FLUX_SRC="$INFRA_SRC/k8-gitops-manifests"
364
365
366
BRANCH="master"
TAG="latest"

Daniel Scholl's avatar
Daniel Scholl committed
367
368
369
# Setup the Flux Directory
mkdir -p ${FLUX_SRC}/providers/azure/hld-registry

370
371
372
# Extract manifests from the common osdu chart.
helm template osdu-flux ${INFRA_SRC}/charts/osdu-common -f ${INFRA_SRC}/charts/config.yaml > ${FLUX_SRC}/providers/azure/hld-registry/osdu-common.yaml

Daniel Scholl's avatar
Daniel Scholl committed
373
374
375
376
377
378
379
# Commit and Checkin to Deploy
(cd $FLUX_SRC \
  && git switch -c $UNIQUE \
  && git add ${FLUX_SRC}/providers/azure/hld-registry/osdu-common.yaml \
  && git commit -m "Initialize Common Chart" \
  && git push origin $UNIQUE)

Daniel Scholl's avatar
Daniel Scholl committed
380
# Extract manifests from the istio charts.
381
382
383
384
helm template osdu-flux ${INFRA_SRC}/charts/osdu-istio -f ${INFRA_SRC}/charts/config.yaml > ${FLUX_SRC}/providers/azure/hld-registry/osdu-istio.yaml

helm template osdu-flux ${INFRA_SRC}/charts/osdu-istio-auth -f ${INFRA_SRC}/charts/config.yaml > ${FLUX_SRC}/providers/azure/hld-registry/osdu-istio-auth.yaml

Daniel Scholl's avatar
Daniel Scholl committed
385
386
387
# Commit and Checkin to Deploy
(cd $FLUX_SRC \
  && git switch $UNIQUE \
Daniel Scholl's avatar
Daniel Scholl committed
388
  && git add ${FLUX_SRC}/providers/azure/hld-registry/osdu-istio.yaml \
Daniel Scholl's avatar
Daniel Scholl committed
389
390
391
392
  && git add ${FLUX_SRC}/providers/azure/hld-registry/osdu-istio-auth.yaml \
  && git commit -m "Initialize Istio Auth Chart" \
  && git push origin $UNIQUE)

393
394
395
# Publish Docker Images for airflow components
CONTAINER_REGISTRY=$(az keyvault secret show --id https://${ENV_VAULT}.vault.azure.net/secrets/container-registry --query value -otsv)
az acr login -n $CONTAINER_REGISTRY
396
for SERVICE in airflow-function airflow-statsd;
397
398
399
400
401
402
403
404
do
  cd ${INFRA_SRC}/source/$SERVICE
  IMAGE=$CONTAINER_REGISTRY.azurecr.io/$SERVICE-$BRANCH:$(TAG)
  docker build -t $IMAGE .
  docker push $IMAGE
done

# Installing PyYaml required for airflow
405
pip3 install -U PyYAML
406

407
408
409
410
411
412
413
414
415
416
# Extract manifests from the airflow charts.
helm template airflow ${INFRA_SRC}/charts/airflow -f ${INFRA_SRC}/charts/config_airflow.yaml | python3 ${INFRA_SRC}/charts/airflow/scripts/add-namespace.py > ${FLUX_SRC}/providers/azure/hld-registry/airflow.yaml

# Commit and Checkin to Deploy
(cd $FLUX_SRC \
  && git switch $UNIQUE \
  && git add ${FLUX_SRC}/providers/azure/hld-registry/airflow.yaml \
  && git commit -m "Initialize Airflow Chart" \
  && git push origin $UNIQUE)

Daniel Scholl's avatar
Daniel Scholl committed
417
# Extract manifests from each service chart.
418
419
420
SERVICE_LIST="infra-azure-provisioning \
              partition \
              entitlements-azure \
Rostislav_Vatolin's avatar
Rostislav_Vatolin committed
421
              entitlements \
422
423
424
425
426
427
              legal \
              storage \
              indexer-queue \
              indexer-service \
              search-service \
              delivery \
Jason's avatar
Jason committed
428
              file-service \
429
430
              unit-service \
              crs-conversion-service \
Komal Makkar's avatar
Komal Makkar committed
431
              crs-catalog-service \
harshit aggarwal's avatar
harshit aggarwal committed
432
              wks \
Komal Makkar's avatar
Komal Makkar committed
433
              register \
harshit aggarwal's avatar
harshit aggarwal committed
434
              notification \
Jason's avatar
Jason committed
435
              schema-service \
436
              ingestion-workflow"
437

Jason's avatar
Jason committed
438
for SERVICE in $SERVICE_LIST;
Daniel Scholl's avatar
Daniel Scholl committed
439
440
441
442
do
  helm template $SERVICE ${SRC_DIR}/$SERVICE/devops/azure/chart --set image.branch=$BRANCH --set image.tag=$TAG > ${FLUX_SRC}/providers/azure/hld-registry/$SERVICE.yaml
done

443
444
445
446
447
448
449
450
451
452
453
454
455

SERVICE=wellbore-domain-services
helm template $SERVICE ${SRC_DIR}/$SERVICE/devops/azure/chart \
  --set image.repository=${CONTAINER_REGISTRY_NAME}.azurecr.io/${SERVICE}-${BRANCH} \
  --set image.tag=$TAG \
  --set annotations.buildNumber=undefined \
  --set annotations.buildOrigin=manual \
  --set annotations.commitBranch=undefined \
  --set annotations.commitId=undefined \
  --set labels.env=dev \
  > ${FLUX_SRC}/providers/azure/hld-registry/$SERVICE.yaml


Daniel Scholl's avatar
Daniel Scholl committed
456
457
458
459
460
461
# Commit and Checkin to Deploy
(cd $FLUX_SRC \
  && git switch $UNIQUE \
  && git add ${FLUX_SRC}/providers/azure/hld-registry/*.yaml \
  && git commit -m "Adding OSDU Services" \
  && git push origin $UNIQUE)
462
```