#!/bin/bash

set -e
source setup_comita_aml.conf

helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='vault-unsealer' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/operation/docker/vault-unsealer" --set image.tag='latest' vault-unsealer vault-unsealer
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='eureka' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/operation/eureka-service-discovery" --set image.tag='latest' eureka spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='dict-holiday' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/services/dict-holiday" --set image.tag='latest' dict-holiday dict-holiday
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cert' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/services/cert-kk-4.7.0" --set image.tag='latest' --set ingress.path='/rest/cert/' cert cert-service
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='audit' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/audit" --set image.tag='release.1.2.0' --set ingress.path='/api/v1/audit/' audit cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='authad' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/auth-admin" --set image.tag='release.1.7.0' --set ingress.path='/api/v1/authad/' --set ingress.websocket='true' --set ports.grpc.enabled='true' authad spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='crypt' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/services/crypt-service" --set image.tag='release.1.3.0' --set cryptopro.license.key="$CRYPTOPRO_LIC" --set cryptopro.license.company="$CRYPTOPRO_ORG" --set cryptopro.keys_b64_archive="$CRYPTOPRO_B64_ARC_KEYS" crypt crypt
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='frontend' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/aml-front" --set image.tag='release.1.6.0' --set ingress.path='/' frontend frontend
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='aml-dictionary' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/dictionaries/aml-dictionary" --set image.tag='release.1.4.0' --set ingress.path='/api/v1/dictionary/' --set ports.grpc.enabled='false' aml-dictionary cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='aml-dictionary-response' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/dictionaries/aml-dictionary-response" --set image.tag='release.1.1.0' --set ingress.path='/api/v1/dictionaryResponse/' --set ports.grpc.enabled='false' aml-dictionary-response cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='dictionary-5861' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/dictionaries/aml-dictionary-5861" --set image.tag='release.1.3.0' --set ingress.path='/api/v1/dictionary5861/' dictionary-5861 cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cls-refusal' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/cls/cls-refusal" --set image.tag='release.1.2.0' --set ingress.path='/api/v1/cls/refusal/' cls-refusal cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='fm-registry' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/fm/fm-registry" --set image.tag='release.1.5.0' fm-registry spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cls-ctfb' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/cls/cls-ctfb" --set image.tag='release.1.2.0' --set ingress.path='/api/v1/cls/ctfb/' --set ports.grpc.enabled='false' cls-ctfb cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cls-ctfb-5016' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/cls/cls-ctfb-5016" --set image.tag='release.1.2.0' --set ingress.path='/api/v1/cls/ctfb5016/' --set ports.grpc.enabled='false' cls-ctfb-5016 cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='dictionary-strateg' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/dictionaries/aml-dictionary-strateg" --set image.tag='release.1.0.0' --set ingress.path='/api/v1/dictionaryStrateg/' --set ports.grpc.enabled='false' dictionary-strateg cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='registry-strateg' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/strateg/fm-registry-strateg" --set image.tag='release.1.1.0' --set spring.application.name='fm-registry-strateg' registry-strateg spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-inc-04' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-inc-04" --set image.tag='release.1.0.0' cs-ko-inc-04 cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-request' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-request" --set image.tag='release.1.2.0' cs-ko-request cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-otkr-zakr-chet' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-otkr-zakr-chet" --set image.tag='release.1.1.0' cs-ko-otkr-zakr-chet cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-otkr-zakr-chet-goz' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-otkr-zakr-chet-goz" --set image.tag='release.1.3.0' cs-ko-otkr-zakr-chet-goz cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-izm-chet-goz' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-izm-chet-goz" --set image.tag='release.1.3.0' cs-ko-izm-chet-goz cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-izm-chet' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-izm-chet" --set image.tag='release.1.2.0' cs-ko-izm-chet cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-securities' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-securities" --set image.tag='release.1.3.0' cs-ko-securities cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-izm-akkred' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-izm-akkred" --set image.tag='release.1.2.0' cs-ko-izm-akkred cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-izm-chet-depo' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-izm-chet-depo" --set image.tag='release.1.3.0' cs-ko-izm-chet-depo cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-otkr-zakr-akkr' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-otkr-zakr-akkr" --set image.tag='release.1.2.0' cs-ko-otkr-zakr-akkr cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-otkr-zakr-chet-depo' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-otkr-zakr-chet-depo" --set image.tag='release.1.2.0' cs-ko-otkr-zakr-chet-depo cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-oes-otkaz-goz' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-oes-otkaz-goz" --set image.tag='release.1.3.0' cs-ko-oes-otkaz-goz cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-reasponse' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-reasponse" --set image.tag='release.1.2.0' cs-ko-reasponse cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-inc-91' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-inc-91" --set image.tag='release.1.2.0' cs-ko-inc-91 cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-inc-07' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-inc-07" --set image.tag='release.1.2.0' cs-ko-inc-07 cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-inc-06' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-inc-06" --set image.tag='release.1.2.0' cs-ko-inc-06 cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-inc-09' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-inc-09" --set image.tag='release.1.2.0' cs-ko-inc-09 cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-inc-05' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-inc-05" --set image.tag='release.1.2.0' cs-ko-inc-05 cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-verification-result' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-verification-result" --set image.tag='release.1.5.0' cs-ko-verification-result cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-suspicious-activity' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-suspicious-activity" --set image.tag='release.1.5.0' cs-ko-suspicious-activity cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-refuse-operation' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-refuse-operation" --set image.tag='release.1.5.0' cs-ko-refuse-operation cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-refuse-contract' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-refuse-contract" --set image.tag='release.1.5.0' cs-ko-refuse-contract cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-obstruction-facts' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-obstruction-facts" --set image.tag='release.1.5.0' cs-ko-obstruction-facts cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-freezing-funds' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-freezing-funds" --set image.tag='release.1.5.0' cs-ko-freezing-funds cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='cs-ko-operations' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/check_server/ko/cs-ko-operations" --set image.tag='release.1.7.0' cs-ko-operations cs-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='docs-main' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/fm/docs-main" --set image.tag='release.1.7.0' --set ingress.path='/api/v1/documents/' docs-main spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-operations' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/fm/operations" --set image.tag='release.1.5.0' --set spring.application.name='operations' --set ingress.path='/api/v1/documents/operations/' sd-ko-operations spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-freezing-funds' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/fm/freezing-funds" --set image.tag='release.1.5.0' --set spring.application.name='freezing-funds' --set ingress.path='/api/v1/documents/freezing/' sd-ko-freezing-funds spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-verification-result' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/fm/verification-result" --set image.tag='release.1.5.0' --set spring.application.name='verification-result' --set ingress.path='/api/v1/documents/verificationResult/' sd-ko-verification-result spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-obstruction-facts' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/fm/obstruction-facts" --set image.tag='release.1.5.0' --set spring.application.name='obstruction-facts' --set ingress.path='/api/v1/documents/obstruction/' sd-ko-obstruction-facts spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-suspicious-activity' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/fm/suspicious-activity" --set image.tag='release.1.5.0' --set spring.application.name='suspicious-activity' --set ingress.path='/api/v1/documents/suspicious/' sd-ko-suspicious-activity spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-refuse-operation' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/fm/refuse-operation" --set image.tag='release.1.5.0' --set spring.application.name='refuse-operation' --set ingress.path='/api/v1/documents/refuseOperation/' sd-ko-refuse-operation spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-refuse-contract' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/fm/refuse-contract" --set image.tag='release.1.5.0' --set spring.application.name='refuse-contract' --set ingress.path='/api/v1/documents/refuseContract/' sd-ko-refuse-contract spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-registry-rejection' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/fm/bank/registry-rejection" --set image.tag='release.1.3.0' --set spring.application.name='registry-rejection' --set ingress.path='/api/v1/documents/registryRejection/' sd-ko-registry-rejection spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-oes-otkaz-goz' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/strateg/oes-otkaz-goz" --set image.tag='release.1.3.0' --set spring.application.name='oes-otkaz-goz' --set ingress.path='/api/v1/documents/oes/otkaz/goz/' sd-ko-oes-otkaz-goz spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-otkr-zakr-chet' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/strateg/sd-ko-otkr-zakr-chet" --set image.tag='release.1.1.0' --set ingress.path='/api/v1/documents/otkr/zakr/chet/' sd-ko-otkr-zakr-chet spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-otkr-zakr-chet-goz' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/strateg/sd-ko-otkr-zakr-chet-goz" --set image.tag='release.1.1.0' --set ingress.path='/api/v1/documents/otkr/zakr/chetGoz/' sd-ko-otkr-zakr-chet-goz spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-izm-chet' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/strateg/sd-ko-izm-chet" --set image.tag='release.1.1.0' --set ingress.path='/api/v1/documents/izm/chet/' sd-ko-izm-chet spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-izm-chet-goz' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/strateg/sd-ko-izm-chet-goz" --set image.tag='release.1.1.0' --set ingress.path='/api/v1/documents/izm/chetGoz/' sd-ko-izm-chet-goz spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-otkr-zakr-chet-depo' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/strateg/sd-ko-otkr-zakr-chet-depo" --set image.tag='release.1.1.0' --set ingress.path='/api/v1/documents/otkr/zakr/chet/depo/' sd-ko-otkr-zakr-chet-depo spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-izm-chet-depo' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/strateg/sd-ko-izm-chet-depo" --set image.tag='release.1.3.0' --set ingress.path='/api/v1/documents/sd/ko/izm/chet/depo/' sd-ko-izm-chet-depo spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-otkr-zakr-akkr' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/strateg/sd-ko-otkr-zakr-akkr" --set image.tag='release.1.3.0' --set ingress.path='/api/v1/documents/sd/ko/otkr/zakr/akkr/' sd-ko-otkr-zakr-akkr spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-izm-akkred' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/strateg/sd-ko-izm-akkred" --set image.tag='release.1.1.0' --set ingress.path='/api/v1/documents/izm/akkred/' sd-ko-izm-akkred spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-securities' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/strateg/sd-ko-securities" --set image.tag='release.1.3.0' --set ingress.path='/api/v1/documents/sd/ko/securities/' sd-ko-securities spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-p407answer' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/fm/bank/407p-answer" --set image.tag='release.1.3.0' --set spring.application.name='p407answer' --set ingress.path='/api/v1/documents/p407answer/' sd-ko-p407answer spr-common
helm upgrade -i -n "$NAMESPACE" --create-namespace --set name='sd-ko-p407request' --set image.repository="$REGISTRY_ADDR/infra-harbor.comita.sel:80/library/dev/aml/fm/bank/407p-request" --set image.tag='release.1.2.0' --set spring.application.name='p407request' --set ingress.path='/api/v1/documents/requests/407p/' sd-ko-p407request spr-common
