Skip to content

Commit a1db277

Browse files
authored
Upgrades to AI Telemetry to zookeeper-operator and solr-operator (#824)
* Add Kafka support to AI Telemetry This is used for event driven messaging from other microservices and tasks that take a long time, like bare metal fulfillment. * Replace bitnami zookeeper with zookeeper-operator Because bitnami images are now proprietary, we are migrating to the open source zookeeper-operator in OpenShift instead. * Migrate from bitnami solr to solr-operator Because bitnami images are now proprietary, we are migrating to the open source solr-operator on OpenShift instead. Because the solr-operator upstream does not support OpenShift yet, it is pointed to my fork where I have contributed OpenShift support to solr-operator pull request [1]. [1] apache/solr-operator#706 * Adding setup jobs for ai-telemetry for solr migration Because we are migrating to the solr-operator, there is a solr setup job and db-to-solr-sync job that are run to migrate the persistent data in the database to be cached in the Solr search engine which is used by the AI Telemetry JSON REST API. * Updating the prom-keycloak-proxy to 2.3.0 This resolves and import error for handling null metrics results. Also fixes the PROXY_PROMETHEUS_CA_CERT and PROXY_PROMETHEUS_TLS_CERT environment variables.
1 parent 39eb141 commit a1db277

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+961
-594
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: aitelemetry-setup-defaults
5+
namespace: aitelemetry
6+
data:
7+
main.yaml: |
8+
# The namespace in OpenShift where Solr will run.
9+
SOLR_NAMESPACE: "solr"
10+
# Whether to use SSL when connecting to Solr.
11+
SOLR_SSL: "false"
12+
# The host name to connect to Solr in OpenShift.
13+
SOLR_HOST_NAME: "solr-solrcloud-common.solr.svc"
14+
# The default port that Solr runs.
15+
SOLR_PORT: "80"
16+
# The solr collection to use for the site.
17+
SOLR_COLLECTION: "aitelemetry"
18+
# The solr configset to use for the site.
19+
SOLR_CONFIGSET: "computate"
20+
# The Solr admin username
21+
SOLR_USERNAME: "admin"
22+
# The Solr admin password
23+
SOLR_PASSWORD: "{{ query('kubernetes.core.k8s', kind='Secret', resource_name='solr-solrcloud-security-bootstrap', namespace=SOLR_NAMESPACE)[0].data['admin'] | b64decode }}"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: aitelemetry-setup-playbook
5+
namespace: aitelemetry
6+
data:
7+
aitelemetry-setup.yaml: |
8+
---
9+
- name: aitelemetry-setup
10+
hosts: localhost
11+
connection: local
12+
gather_facts: false
13+
roles:
14+
- aitelemetry-setup
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: aitelemetry-setup-tasks
5+
namespace: aitelemetry
6+
data:
7+
main.yaml: |
8+
# Create default computate Solr configset
9+
- name: "Download computate configset: curl -k https://raw.githubusercontent.com/computate-org/computate/refs/heads/main/config/solr/computate-configset.zip -o /tmp/computate-configset.zip"
10+
kubernetes.core.k8s_exec:
11+
namespace: solr
12+
pod: solr-solrcloud-0
13+
command: >-
14+
curl -k https://raw.githubusercontent.com/computate-org/computate/refs/heads/main/config/solr/computate-configset.zip -o /tmp/computate-configset.zip
15+
- name: >-
16+
Upload default computate configset:
17+
curl -k -X POST
18+
-H "Content-Type:application/octet-stream"
19+
--data-binary @/tmp/computate-configset.zip
20+
"https://solr.apps-crc.testing/solr/admin/configs?action=UPLOAD&name=computate&overwrite=true"
21+
kubernetes.core.k8s_exec:
22+
namespace: solr
23+
pod: solr-solrcloud-0
24+
command: >-
25+
bash -c '
26+
curl -k -X POST
27+
-H "Content-Type:application/octet-stream"
28+
--data-binary @/tmp/computate-configset.zip
29+
"http://localhost:8983/solr/admin/configs?action=UPLOAD&name=computate&overwrite=true"
30+
'
31+
register: upload_computate_configset
32+
- name: Debug upload_computate_configset
33+
debug:
34+
var: upload_computate_configset
35+
36+
# Create aitelemetry Solr collection
37+
- name: >-
38+
Create {{ SOLR_COLLECTION }} collection:
39+
SOLR_AUTH_TYPE=basic
40+
/opt/solr/bin/solr create_collection --solr-url http://localhost:8983 -c {{ SOLR_COLLECTION }} -n computate'
41+
kubernetes.core.k8s_exec:
42+
namespace: solr
43+
pod: solr-solrcloud-0
44+
command: >-
45+
bash -c '
46+
SOLR_AUTH_TYPE=basic
47+
SOLR_AUTHENTICATION_OPTS="-Dbasicauth=admin:{{ SOLR_PASSWORD }}"
48+
/opt/solr/bin/solr create_collection --solr-url http://localhost:8983 -c {{ SOLR_COLLECTION }} -n computate
49+
'
50+
register: create_collection
51+
ignore_errors: true
52+
- name: Debug create_collection
53+
debug:
54+
var: create_collection
55+
- name: Test create {{ SOLR_COLLECTION }} collection success
56+
fail:
57+
msg: "{{ command_status }}"
58+
when: create_collection.failed and create_collection is not search("already exists")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- configmap-cloud-setup-playbook.yaml
5+
- configmap-cloud-setup-defaults.yaml
6+
- configmap-cloud-setup-tasks.yaml
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
apiVersion: batch/v1
2+
kind: Job
3+
metadata:
4+
name: aitelemetry-setup
5+
namespace: aitelemetry
6+
spec:
7+
backoffLimit: 1000
8+
template:
9+
spec:
10+
restartPolicy: OnFailure
11+
serviceAccountName: aitelemetry-setup
12+
volumes:
13+
- name: aitelemetry-setup-playbook
14+
configMap:
15+
name: aitelemetry-setup-playbook
16+
- name: aitelemetry-setup-defaults
17+
configMap:
18+
name: aitelemetry-setup-defaults
19+
- name: aitelemetry-setup-tasks
20+
configMap:
21+
name: aitelemetry-setup-tasks
22+
- name: home
23+
emptyDir: {}
24+
- name: ansible-tmp
25+
emptyDir: {}
26+
containers:
27+
- name: aitelemetry-setup
28+
image: quay.io/nerc-images/keycloak-ansible:ansible-collection-upgrade
29+
imagePullPolicy: Always
30+
volumeMounts:
31+
- name: aitelemetry-setup-playbook
32+
mountPath: /home/ansible/.ansible/playbooks/
33+
- name: aitelemetry-setup-tasks
34+
mountPath: /home/ansible/.ansible/roles/aitelemetry-setup/tasks/
35+
- name: aitelemetry-setup-defaults
36+
mountPath: /home/ansible/.ansible/roles/aitelemetry-setup/defaults/
37+
- name: home
38+
mountPath: /home/ansible
39+
- name: ansible-tmp
40+
mountPath: /home/ansible/.ansible/tmp/
41+
env:
42+
- name: ANSIBLE_ROLES_PATH
43+
value: /home/ansible/.ansible/roles
44+
- name: POD_NAMESPACE
45+
valueFrom:
46+
fieldRef:
47+
fieldPath: metadata.namespace
48+
command: ["/bin/bash", "-c", "--"]
49+
args:
50+
- |
51+
ansible-playbook /home/ansible/.ansible/playbooks/aitelemetry-setup.yaml
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
labels:
4+
- pairs:
5+
job: aitelemetry-setup
6+
includeSelectors: true
7+
resources:
8+
- aitelemetry-setup.yaml
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- serviceaccounts/
5+
- rolebindings/
6+
- configmaps/
7+
- jobs/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- rolebinding.yaml
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: Role
4+
metadata:
5+
namespace: solr
6+
name: solr-aitelemetry-setup-aitelemetry-exec
7+
rules:
8+
- apiGroups: [""]
9+
resources: ["pods/exec"]
10+
verbs: ["get", "create"]
11+
- apiGroups: [""]
12+
resources: ["pods"]
13+
verbs: ["get", "list"]
14+
---
15+
apiVersion: rbac.authorization.k8s.io/v1
16+
kind: RoleBinding
17+
metadata:
18+
namespace: solr
19+
name: solr-aitelemetry-setup-aitelemetry-exec
20+
subjects:
21+
- kind: ServiceAccount
22+
name: aitelemetry-setup
23+
namespace: aitelemetry
24+
roleRef:
25+
apiGroup: rbac.authorization.k8s.io
26+
kind: Role
27+
name: solr-aitelemetry-setup-aitelemetry-exec
28+
---
29+
apiVersion: rbac.authorization.k8s.io/v1
30+
kind: Role
31+
metadata:
32+
namespace: solr
33+
name: aitelemetry-aitelemetry-setup-solr-secrets
34+
rules:
35+
- apiGroups: [""]
36+
resources: ["secrets"]
37+
verbs: ["get", "list"]
38+
---
39+
apiVersion: rbac.authorization.k8s.io/v1
40+
kind: RoleBinding
41+
metadata:
42+
namespace: solr
43+
name: aitelemetry-aitelemetry-setup-solr-secrets
44+
subjects:
45+
- kind: ServiceAccount
46+
name: aitelemetry-setup
47+
namespace: aitelemetry
48+
roleRef:
49+
apiGroup: rbac.authorization.k8s.io
50+
kind: Role
51+
name: aitelemetry-aitelemetry-setup-solr-secrets
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- aitelemetry-setup/

0 commit comments

Comments
 (0)