3 # ============LICENSE_START===============================================
4 # Copyright (C) 2023 Nordix Foundation. All rights reserved.
5 # ========================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END=================================================
20 echo "######### Installing ACM components #########"
22 ENABLE_COMPONENTS=(policy-models-simulator policy-clamp-runtime-acm policy-clamp-ac-kserve-ppnt policy-clamp-ac-k8s-ppnt policy-clamp-ac-a1pms-ppnt)
23 DISABLE_COMPONENTS=(policy-api policy-pap policy-apex-pdp policy-pdpd-cl policy-xacml-pdp policy-distribution policy-clamp-ac-pf-ppnt policy-clamp-ac-http-ppnt)
25 ACM_VALUES_FILE="docker/helm/policy/values.yaml"
26 A1PMS_CONFIGURATION_FILE="docker/helm/policy/components/policy-clamp-ac-a1pms-ppnt/resources/config/A1pmsParticipantParameters.yaml"
27 K8S_CONFIGURATION_FILE="docker/helm/policy/components/policy-clamp-ac-k8s-ppnt/values.yaml"
29 IP_ADDRESS=$(hostname -I | awk '{print $1}')
30 echo "IP Address : $IP_ADDRESS"
32 git clone -b london "https://gerrit.onap.org/r/policy/docker"
35 export WORKSPACE="$CWD/docker"
37 echo "Updating policy docker image versions..."
38 bash docker/compose/get-k8s-versions.sh
40 echo "Enabling the access for the clusterroles..."
41 kubectl apply -f resources/acm-role-binding.yaml
43 for element in "${ENABLE_COMPONENTS[@]}"; do
44 echo "Enabling component $element"
45 yq eval ".$element.enabled"="true" -i $ACM_VALUES_FILE
48 for element in "${DISABLE_COMPONENTS[@]}"; do
49 echo "Disabling component $element"
50 yq eval ".$element.enabled"="false" -i $ACM_VALUES_FILE
53 echo "Updating A1PMS Participant"
54 yq eval '.a1pms.baseUrl="http://policymanagementservice.nonrtric:9080"' -i $A1PMS_CONFIGURATION_FILE
56 echo "Updating the k8s participant repo list"
57 yq eval '.repoList.helm.repos += {"repoName":"local","address":"http://'$IP_ADDRESS':8879/charts"}' -i $K8S_CONFIGURATION_FILE
59 echo "Building policy helm charts..."
60 helm dependency build docker/helm/policy/
62 echo "Installing policy helm charts..."
63 helm install csit-policy docker/helm/policy/ -n default
65 while [[ $TIME -lt 2000 ]]; do
66 NONRTRIC_PODS=$(kubectl get pods -n default --field-selector=status.phase!=Running,status.phase!=Succeeded --no-headers)
67 if [[ -z "$NONRTRIC_PODS" ]]; then
68 echo "All ACM Components are running."
69 kubectl get pods -n default
73 echo "Waiting for ACM Components to be running..."
74 echo "These pods are not running"
76 TIME=$(expr $TIME + 5)
80 echo "ACM Components Installation Completed."