diff --git a/roles/cmoa_install/files/02-base/base/charts/analysis/templates/imxc-metric-analyzer-worker.yaml b/roles/cmoa_install/files/02-base/base/charts/analysis/templates/imxc-metric-analyzer-worker.yaml index 76eea2b..38074b9 100644 --- a/roles/cmoa_install/files/02-base/base/charts/analysis/templates/imxc-metric-analyzer-worker.yaml +++ b/roles/cmoa_install/files/02-base/base/charts/analysis/templates/imxc-metric-analyzer-worker.yaml @@ -6,7 +6,7 @@ metadata: name: metric-analyzer-worker namespace: imxc spec: - replicas: 10 + replicas: 3 selector: matchLabels: app: metric-analyzer-worker diff --git a/roles/cmoa_install/files/02-base/base/charts/cortex/values.yaml b/roles/cmoa_install/files/02-base/base/charts/cortex/values.yaml index 1f5f409..22fbef5 100644 --- a/roles/cmoa_install/files/02-base/base/charts/cortex/values.yaml +++ b/roles/cmoa_install/files/02-base/base/charts/cortex/values.yaml @@ -355,7 +355,7 @@ alertmanager: readOnlyRootFilesystem: true distributor: - replicas: 2 + replicas: 1 service: annotations: {} @@ -458,7 +458,7 @@ distributor: lifecycle: {} ingester: - replicas: 3 + replicas: 1 statefulSet: # -- If true, use a statefulset instead of a deployment for pod management. @@ -737,7 +737,7 @@ ruler: readOnlyRootFilesystem: true querier: - replicas: 2 + replicas: 1 service: annotations: {} @@ -839,7 +839,7 @@ querier: lifecycle: {} query_frontend: - replicas: 2 + replicas: 1 service: annotations: {} @@ -1087,7 +1087,7 @@ configs: nginx: enabled: true - replicas: 2 + replicas: 1 http_listen_port: 80 config: dnsResolver: coredns.kube-system.svc.cluster.local diff --git a/roles/cmoa_install/files/04-keycloak/values.yaml b/roles/cmoa_install/files/04-keycloak/values.yaml index a95521f..aae6c31 100644 --- a/roles/cmoa_install/files/04-keycloak/values.yaml +++ b/roles/cmoa_install/files/04-keycloak/values.yaml @@ -5,7 +5,7 @@ fullnameOverride: "imxc-keycloak" nameOverride: "" # The number of replicas to create (has no effect if autoscaling enabled) -replicas: 2 +replicas: 1 image: # The Keycloak image repository diff --git a/roles/cmoa_install/files/05-imxc/templates/cmoa-kube-exporter.yaml b/roles/cmoa_install/files/05-imxc/templates/cmoa-kube-exporter.yaml index f03799a..50f13fe 100755 --- a/roles/cmoa_install/files/05-imxc/templates/cmoa-kube-exporter.yaml +++ b/roles/cmoa_install/files/05-imxc/templates/cmoa-kube-exporter.yaml @@ -2,22 +2,22 @@ apiVersion: apps/v1 kind: Deployment metadata: labels: - app: cmoa-pod-exporter - name: cmoa-pod-exporter + app: cmoa-kube-exporter + name: cmoa-kube-exporter namespace: imxc spec: replicas: 1 selector: matchLabels: - app: cmoa-pod-exporter + app: cmoa-kube-exporter template: metadata: labels: - app: cmoa-pod-exporter + app: cmoa-kube-exporter spec: containers: - image: {{ .Values.global.IMXC_IN_REGISTRY }}/cmoa-kube-exporter:{{ .Values.global.KUBE_EXPORTER_VERSION }} - name: cmoa-pod-exporter + name: cmoa-kube-exporter ports: - containerPort: 8080 livenessProbe: diff --git a/roles/cmoa_install/files/05-imxc/templates/cmoa-kube-info-flat.yaml b/roles/cmoa_install/files/05-imxc/templates/cmoa-kube-info-flat.yaml index 00dd62f..7404111 100755 --- a/roles/cmoa_install/files/05-imxc/templates/cmoa-kube-info-flat.yaml +++ b/roles/cmoa_install/files/05-imxc/templates/cmoa-kube-info-flat.yaml @@ -39,6 +39,6 @@ spec: value: {{ .Values.global.BLACK_LIST_FALT }} resources: limits: - memory: 1Gi + memory: 2Gi requests: - memory: 200Mi + memory: 500Mi diff --git a/roles/cmoa_password/defaults/main.yml b/roles/cmoa_password/defaults/main.yml new file mode 100644 index 0000000..371e031 --- /dev/null +++ b/roles/cmoa_password/defaults/main.yml @@ -0,0 +1,4 @@ +--- +cmoa_namespace: imxc +pg_version: + - 3.5.5 diff --git a/roles/cmoa_password/files/password.sh b/roles/cmoa_password/files/password.sh new file mode 100755 index 0000000..b339442 --- /dev/null +++ b/roles/cmoa_password/files/password.sh @@ -0,0 +1,7 @@ +KEYCLOAK_HOST=http://10.10.43.210:31082 +ADMIN_USER_OLD_PASSWORD="cmoaA13!#" +ADMIN_USER_NEW_PASSWORD=admin + +TOKEN=$(curl -s -X POST -H 'Content-Type: application/x-www-form-urlencoded' -d "username=admin&password=$ADMIN_USER_OLD_PASSWORD&client_id=admin-cli&grant_type=password" "$KEYCLOAK_HOST/auth/realms/master/exem/openid-connect/token" | jq -r ".access_token" ;) + +curl -s -X PUT -H "Authorization: Bearer $TOKEN" -H "Content-type: application/json;charset=UTF-8" -H 'Accept: application/json' "$KEYCLOAK_HOST/auth/admin/realms/exem/users/admin/reset-password" -d "{\"type\":\"password\",\"value\":\"$ADMIN_USER_NEW_PASSWORD\",\"temporary\":false}" diff --git a/roles/cmoa_password/tasks/main.yml b/roles/cmoa_password/tasks/main.yml new file mode 100644 index 0000000..990c05b --- /dev/null +++ b/roles/cmoa_password/tasks/main.yml @@ -0,0 +1,37 @@ +--- +- name: 1. Get a list of all pods from the namespace + shell: kubectl -n "{{ cmoa_namespace }}" get pods --no-headers -o custom-columns=":metadata.name" |grep postgres + register: pod_list + when: kubernetes_role == 'master' + +- debug: + msg: "{{ pod_list.stdout_lines }}" + when: kubernetes_role == 'master' + +- name: 2. Copy psql file in postgres + kubernetes.core.k8s_cp: + namespace: "{{ cmoa_namespace }}" + pod: "{{ pod_list.stdout }}" + remote_path: /tmp/postgres_patch_{{ item }}.psql + local_path: "{{ role_path }}/files/pg-patch/postgres_patch_{{ item }}.psql" + with_items: "{{ pg_version }}" + when: kubernetes_role == 'master' + +- name: 3. Execute a command in postgres + kubernetes.core.k8s_exec: + namespace: "{{ cmoa_namespace }}" + pod: "{{ pod_list.stdout }}" + command: bash -c "PGPASSWORD='eorbahrhkswp' && /usr/bin/psql -h 'localhost' -U 'admin' -d 'postgresdb' -f /tmp/postgres_patch_{{ item }}.psql" + register: execute_register + with_items: "{{ pg_version }}" + when: kubernetes_role == 'master' + +- debug: + msg: | + ______ _ _ _ _____ ___ ___ _____ ___ + | ___ \| | | | | | / __ \| \/ || _ | / _ \ + | |_/ /| | ___ __ _ ___ ___ _ __ ___ ___ | |_ __ _ _ __ | |_ | / \/| . . || | | |/ /_\ \ + | __/ | | / _ \ / _` |/ __| / _ \ | '__| / _ \/ __|| __| / _` || '__|| __| | | | |\/| || | | || _ | + | | | || __/| (_| |\__ \| __/ | | | __/\__ \| |_ | (_| || | | |_ | \__/\| | | |\ \_/ /| | | | + \_| |_| \___| \__,_||___/ \___| |_| \___||___/ \__| \__,_||_| \__| \____/\_| |_/ \___/ \_| |_/ + when: kubernetes_role == 'master'