Update AI Conductor
Topics
Detailed Steps
For detailed explanations of {variables}, refer to the Terminology page
# env for update variables
export AIC_RELEASE_VERSION=
export AIC_BACKEND_IMAGE_TAG=
export AIC_FRONTEND_IMAGE_TAG=
# env for fixed variables
export AWS_ACCOUNT_ID=
export AWS_DEFAULT_REGION=
export AWS_DEFAULT_REGION_ALIAS=
export DOMAIN_NAME=
export INFRA_NAME=
export DEPLOY_ENV=
export REDIS_HOST=
export REDIS_PORT=
export AIC_BACKEND_IMAGE_URL=${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/ecr-repo-${AWS_DEFAULT_REGION_ALIAS}-${INFRA_NAME}-${DEPLOY_ENV}/ai-advisor/ai-conductor/aic-webserver
export AIC_FRONTEND_IMAGE_URL=${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/ecr-repo-${AWS_DEFAULT_REGION_ALIAS}-${INFRA_NAME}-${DEPLOY_ENV}/ai-advisor/ai-conductor/aic-frontend
export AWS_SECRETS_MANAGER_RDS=/parameter/${AWS_DEFAULT_REGION}/${INFRA_NAME}/${DEPLOY_ENV}/rds
export AIC_ECR_BASE_PATH=${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/ecr-repo-${AWS_DEFAULT_REGION_ALIAS}-${INFRA_NAME}-${DEPLOY_ENV}/
export DASHBOARD_PREFIX=https://aicond-mon.${DOMAIN_NAME}.com/d/
# env for update version
export AIC_BACKEND_URL=aicond-${DOMAIN_NAME}/api/v1/docs
export AIC_ADMIN_USER=admin
export AIC_ADMIN_PASSWD=
1. AI Conductor Update
For detailed instructions on the initial deployment of AI Conductor, please refer to the Deploying AI Conductor page.
[OPTION] AI Conductor DB Update
If an update of the AI Conductor DB is necessary, please follow the steps below:
-
Obtain the ai-conductor-{AIC_RELEASE_VERSION}.sql file from the developer.
-
Update the AI Conductor Table.
mysql -h ${DB_HOST} -P ${DB_PORT} -u ${DB_ADMIN_USERNAME} -p < ai-conductor-${AIC_RELEASE_VERSION}.sql
# insert : ${DB_ADMIN_PASSWORD} -
Verify the AI Conductor Table update.
- Ensure that the alembic_version in ai-conductor-{AIC_RELEASE_VERSION}.sql matches the AI Conductor Table.
-
Clone the AI Conductor Deployment using the command below.
git clone https://github.com/mellerikat/AI-Conductor.git
-
Update the AI Conductor Backend.
- Update the AI Conductor Backend settings.
- NOTE: Ignore if already set.
# path : ${TOP}/AI-Conductor/backend
# Set Redis.
sed -i "s|host=.*|host=${REDIS_HOST}|g" params/redis.env
sed -i "s|port=.*|port=${REDIS_PORT}|g" params/redis.env
# Set RDS from Secrets Manager.
yq e -i '.spec.parameters.objects |= sub("/parameter.*rds",env(AWS_SECRETS_MANAGER_RDS))' base/secret-provider-class.yaml
# Set environment variables.
yq e -i '.spec.template.spec.containers[].env += {"name" : "AIC_ECR_BASE_PATH"}' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1] += {"value" : env(AIC_ECR_BASE_PATH)}' base/deployment/ai-conductor-backend.yaml
# Set prefix for monitoring Dashboard
yq e -i '.spec.template.spec.containers[].env += [{"name" : "DASHBOARD_PREFIX"}]' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1] += {"value" : env(DASHBOARD_PREFIX)}' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1].value |= . style="double"' base/deployment/ai-conductor-backend.yaml-
Update the AI Conductor Backend LDAP settings. (Required if using LDAP)
- NOTE: Ignore if already set.
[Expand AI Conductor LDAP Settings]
# path : ${TOP}/AI-Conductor/backend
# Set LDAP Secret.
yq e -i '. += {"secretGenerator"}' kustomization.yaml
yq e -i '.secretGenerator += [{"name":"ldap-secret"}]' kustomization.yaml
yq e -i '.secretGenerator[-1] += {"namespace":"ai-conductor"}' kustomization.yaml
yq e -i '.secretGenerator[-1].options += {"disablenamesuffixhash":true}' kustomization.yaml
yq e -i '.secretGenerator[-1].files += ["./params/lge_root_ca.crt"]' kustomization.yaml
# Enable LDAP Secret usage.
yq e -i '.spec.template.spec.volumes += [{"name" : "aic-volume"}]' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.volumes[-1].secret += {"secretName" : "ldap-secret"}' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].volumeMounts += [{"name" : "aic-volume"}]' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].volumeMounts[-1] += {"readOnly":true}' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].volumeMounts[-1] += {"mountPath":"/etc/aic"}' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].volumeMounts[-1].mountPath |= . style="double"' base/deployment/ai-conductor-backend.yaml
# Set LDAP settings.
yq -i '(.spec.template.spec.containers[] | select(.env[] | select(.name == "LDAP_ENABLED")).env[] | select(.name == "LDAP_ENABLED")).value = "true"' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env += [{"name" : "LDAP_HOST_NAME"}]' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1] += {"value" : "ldaps://lgesaapds01.lge.net"}' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1].value |= . style="double"' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env += [{"name" : "LDAP_HOST_PORT"}]' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1] += {"value" : "636"}' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1].value |= . style="double"' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env += [{"name" : "LDAP_BASE_DN"}]' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1] += {"value" : "OU=LGE Users,dc=LGE,dc=NET"}' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1].value |= . style="double"' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env += [{"name" : "LDAP_SEARCH_DN"}]' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1] += {"value" : "dc=lge,dc=net"}' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1].value |= . style="double"' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env += [{"name" : "LDAP_BIND_ID"}]' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1] += {"value" : "{login_id}@lge.net"}' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1].value |= . style="double"' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env += [{"name" : "LDAP_QUERY"}]' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1] += {"value" : "(cn={login_id})"}' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1].value |= . style="double"' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env += [{"name" : "LDAPS_CA_CERT"}]' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1] += {"value" : "/etc/aic/lge_root_ca.crt"}' base/deployment/ai-conductor-backend.yaml
yq e -i '.spec.template.spec.containers[].env[-1].value |= . style="double"' base/deployment/ai-conductor-backend.yaml- Save the
lge_root_ca.crt
file received from the infrastructure manager to the location{TOP}/AI-Conductor/backend/params/lge_root_ca.crt
.
-
Update the AI Conductor Backend image.
# path : ${TOP}/AI-Conductor/backend
cd AI-Conductor/backend
# Set the updated image for AI Conductor Backend
yq e -i '.images[].newName = env(AIC_BACKEND_IMAGE_URL)' kustomization.yaml
yq e -i '.images[].newTag = env(AIC_BACKEND_IMAGE_TAG)' kustomization.yaml
# Update the AI Conductor Backend
kubectl apply -k . - Update the AI Conductor Backend settings.
-
Update the AI Conductor Frontend.
- NOTE: Update the Frontend after the Backend update.
# path : ${TOP}/AI-Conductor/frontend
# Set the updated image for AI Conductor Frontend
yq e -i '.images[].newName = env(AIC_FRONTEND_IMAGE_URL)' kustomization.yaml
yq e -i '.images[].newTag = env(AIC_FRONTEND_IMAGE_TAG)' kustomization.yaml
# Update the AI Conductor Frontend
kubectl apply -k . -
Verify the AI Conductor update.
-
Check if the AI Conductor images were updated successfully.
[Expand AI Conductor Update Verification]
After the update is complete, the STATUS of the pods should be 'Running' as shown below.
kubectl get pod -n ai-conductor
# output
NAME READY STATUS RESTARTS AGE
ai-conductor-web-749bcd95d5-jjg9d 1/1 Running 0 15s
ai-conductor-web-749bcd95d5-r7jk5 1/1 Running 0 15s
frontend-server-6b6994d545-5x4cc 1/1 Running 0 1m2s
frontend-server-6b6994d545-cgq8s 1/1 Running 0 1m2s -
Check if the AI Conductor images were updated to {AIC_BACKEND_IMAGE_TAG} and {AIC_FRONTEND_IMAGE_TAG}.
[Expand AI Conductor Image Update Verification]
Verify the updated images for {AIC_BACKEND_IMAGE_TAG} and {AIC_FRONTEND_IMAGE_TAG}.
kubectl describe pod -n ai-conductor ai-conductor-web-749bcd95d5-7f9qc
# output
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 29m default-scheduler Successfully assigned ai-conductor/ai-conductor-web-58497c76d6-77mg9 to ip-10-0-128-222.ap-northeast-2.compute.internal
Normal Pulling 29m kubelet Pulling image "339713051385.dkr.ecr.ap-northeast-2.amazonaws.com/ecr-repo-an2-meerkat-dev/ai-advisor/ai-conductor/aic-webserver:${AIC_BACKEND_IMAGE_TAG}"
kubectl describe pod -n ai-conductor frontend-server-6b6994d545-5x4cc
# output
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 29m default-scheduler Successfully assigned ai-conductor/frontend-server-6b6994d545-5x4cc to ip-10-0-128-222.ap-northeast-2.compute.internal
Normal Pulling 29m kubelet Pulling image "339713051385.dkr.ecr.ap-northeast-2.amazonaws.com/ecr-repo-an2-meerkat-dev/ai-advisor/ai-conductor/aic-frontend:${AIC_FRONTEND_IMAGE_TAG}"
-
2. AI Conductor Version Update
- Access {AIC_BACKEND_URL}
- Log in as admin at POST/api/v1/auth/login
- login_id: {AIC_ADMIN_USER}
- login_pw: {AIC_ADMIN_PASSWD}
- Update the version via POST/api/v1/versions
- ver_str: {AIC_RELEASE_VERSION}
- frontend_hash: {AIC_FRONTEND_TAG}
- backend_hash: {AIC_BACKEND_TAG}
- description: Desired message (not exposed to users)