Skip to content

Commit 873139a

Browse files
Merge pull request #720 from elfiesmelfie/efoley/cloud-kitty-job
[zuul] Add a CloudKitty CI job
2 parents d10b8ca + 54fb11e commit 873139a

5 files changed

Lines changed: 328 additions & 2 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
- name: "Install loki for cloudkitty"
3+
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
4+
gather_facts: true
5+
environment:
6+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig | default(ansible_env.HOME + '/.kube.config' ) }}"
7+
PATH: "{{ cifmw_path | default(ansible_env.PATH) }}"
8+
tasks:
9+
- name: Set zuul
10+
when: not zuul is defined
11+
ansible.builtin.set_fact:
12+
zuul:
13+
projects:
14+
github.com/openstack-k8s-operators/telemetry-operator:
15+
src_dir: "{{ telemetry_operator_dir | default('telemetry-operator/') }}"
16+
17+
# NOTE: The value doesn't get used unless the deploy-loki-for-ck is converted into a template and rendered.
18+
# TODO: Update the yaml to a template
19+
- name: Set the loki-operator version to pin the version
20+
ansible.builtin.set_fact:
21+
loki_operator_version: "v6.3.0"
22+
23+
- name: Deploy loki operator
24+
ansible.builtin.shell:
25+
cmd: |
26+
oc apply -f {{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/telemetry-operator'].src_dir }}/ci/deploy-loki-for-ck.yaml
27+
28+
- name: Get and approve the installplan when the version is pinned
29+
when: loki_operator_version is defined
30+
block:
31+
- name: Get the installplan from the loki-operator subscription
32+
ansible.builtin.shell:
33+
cmd: |
34+
oc get installplan -n openshift-operators-redhat | grep "loki-operator.{{ loki_operator_version }}" | awk '{print $1}'
35+
retries: 10
36+
delay: 10
37+
register: loki_installplan
38+
until: loki_installplan.stdout_lines | length != 0
39+
40+
- name: Show the loki_installplan from oc get installplan
41+
ansible.builtin.debug:
42+
var: loki_installplan
43+
44+
- name: Approve the installation
45+
ansible.builtin.shell:
46+
cmd: |
47+
oc patch -n openshift-operators-redhat installplan {{ loki_installplan.stdout }} --type='json' -p='[{"op": "replace", "path": "/spec/approved", "value":true}]'
48+
49+
- name: Wait up to 5 minutes until the Loki CSV is Succeeded
50+
ansible.builtin.shell:
51+
cmd: |
52+
oc get csv | grep loki-operator
53+
ignore_errors: true
54+
register: output
55+
until: output.stdout_lines | length == 1 and "Succeeded" in output.stdout
56+
retries: 30
57+
delay: 10

ci/configure-cloudkitty.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
- name: "Create the kustomization for deploying CloudKitty"
3+
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
4+
gather_facts: false
5+
environment:
6+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
7+
PATH: "{{ cifmw_path }}"
8+
tasks:
9+
- name: Copy controlplane kustomization
10+
ansible.builtin.copy:
11+
dest: "{{ cifmw_basedir }}/artifacts/manifests/kustomizations/controlplane/90-kustomize-controlplane-cloudkitty.yaml"
12+
content: |-
13+
apiVersion: kustomize.config.k8s.io/v1beta1
14+
kind: Kustomization
15+
namespace: openstack
16+
patches:
17+
- patch: |-
18+
apiVersion: core.openstack.org/v1beta1
19+
kind: OpenStackControlPlane
20+
metadata:
21+
name: unused
22+
spec:
23+
# Set overall storage class so we don't need to increase the
24+
# number of PVCs that install_yamls creates
25+
# this is only applicable to crc-based jobs, it is not in
26+
# openshift by default, but is included in the crc distribution
27+
storageClass: crc-csi-hostpath-provisioner
28+
telemetry:
29+
enabled: true
30+
template:
31+
logging:
32+
enabled: false
33+
autoscaling:
34+
enabled: false
35+
cloudkitty:
36+
enabled: true
37+
s3StorageConfig:
38+
secret:
39+
name: cloudkitty-loki-s3
40+
type: s3
41+
metricStorage:
42+
enabled: true
43+
target:
44+
kind: OpenStackControlPlane

ci/deploy-loki-for-ck.yaml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
---
2+
apiVersion: v1
3+
kind: Namespace
4+
metadata:
5+
name: openshift-operators-redhat
6+
labels:
7+
name: openshift-operators-redhat
8+
---
9+
apiVersion: operators.coreos.com/v1
10+
kind: OperatorGroup
11+
metadata:
12+
name: loki-operator
13+
namespace: openshift-operators-redhat
14+
spec:
15+
upgradeStrategy: Default
16+
---
17+
apiVersion: operators.coreos.com/v1alpha1
18+
kind: Subscription
19+
metadata:
20+
name: loki-operator
21+
namespace: openshift-operators-redhat
22+
spec:
23+
channel: stable-6.3
24+
installPlanApproval: Manual
25+
startingCSV: loki-operator.v6.3.0
26+
name: loki-operator
27+
source: redhat-operators
28+
sourceNamespace: openshift-marketplace
29+
---
30+
# Deploys a new Namespace for the MinIO Pod
31+
apiVersion: v1
32+
kind: Namespace
33+
metadata:
34+
name: minio-dev # Change this value if you want a different namespace name
35+
labels:
36+
name: minio-dev # Change this value to match metadata.name
37+
---
38+
# Deploys a new MinIO Pod into the metadata.namespace Kubernetes namespace
39+
#
40+
apiVersion: v1
41+
kind: Pod
42+
metadata:
43+
labels:
44+
app: minio
45+
name: minio
46+
namespace: minio-dev # Change this value to match the namespace metadata.name
47+
spec:
48+
containers:
49+
- name: minio
50+
image: quay.io/minio/minio:latest
51+
command:
52+
- /bin/bash
53+
- -c
54+
- |
55+
mkdir -p /data/loki && \
56+
minio server /data
57+
env:
58+
- name: MINIO_ACCESS_KEY
59+
value: minio
60+
- name: MINIO_SECRET_KEY
61+
value: minio123
62+
volumeMounts:
63+
- mountPath: /data
64+
name: storage # Corresponds to the `spec.volumes` Persistent Volume
65+
volumes:
66+
- name: storage
67+
persistentVolumeClaim:
68+
claimName: minio-pvc
69+
---
70+
apiVersion: v1
71+
kind: PersistentVolumeClaim
72+
metadata:
73+
name: minio-pvc
74+
namespace: minio-dev
75+
spec:
76+
accessModes:
77+
- ReadWriteOnce
78+
resources:
79+
requests:
80+
storage: 10Gi
81+
storageClassName: crc-csi-hostpath-provisioner
82+
---
83+
apiVersion: v1
84+
kind: Service
85+
metadata:
86+
name: minio
87+
namespace: minio-dev
88+
spec:
89+
selector:
90+
app: minio
91+
ports:
92+
- name: api
93+
protocol: TCP
94+
port: 9000
95+
- name: console
96+
protocol: TCP
97+
port: 9090
98+
---
99+
kind: Route
100+
apiVersion: route.openshift.io/v1
101+
metadata:
102+
name: minio-console
103+
namespace: minio-dev
104+
spec:
105+
host: console-minio-dev.apps-crc.testing
106+
to:
107+
kind: Service
108+
name: minio
109+
weight: 100
110+
port:
111+
targetPort: console
112+
wildcardPolicy: None
113+
---
114+
kind: Route
115+
apiVersion: route.openshift.io/v1
116+
metadata:
117+
name: minio-api
118+
namespace: minio-dev
119+
spec:
120+
host: api-minio-dev.apps-crc.testing
121+
to:
122+
kind: Service
123+
name: minio
124+
weight: 100
125+
port:
126+
targetPort: api
127+
wildcardPolicy: None
128+
---
129+
apiVersion: v1
130+
kind: Secret
131+
metadata:
132+
name: cloudkitty-loki-s3
133+
namespace: openstack
134+
stringData:
135+
access_key_id: minio
136+
access_key_secret: minio123
137+
bucketnames: loki
138+
endpoint: http://minio.minio-dev.svc.cluster.local:9000

ci/vars-cloudkitty-tempest.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
cifmw_deploy_obs: true
3+
cifmw_openshift_obs_definition:
4+
apiVersion: operators.coreos.com/v1alpha1
5+
kind: Subscription
6+
metadata:
7+
name: observability-operator
8+
namespace: openshift-operators
9+
spec:
10+
channel: stable
11+
installPlanApproval: Automatic
12+
name: cluster-observability-operator
13+
source: redhat-operators
14+
sourceNamespace: openshift-marketplace
15+
16+
pre_deploy_kustomize_cloudkitty:
17+
source: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/telemetry-operator'].src_dir }}/ci/configure-cloudkitty.yml"
18+
type: playbook
19+
20+
pre_deploy_loki_setup:
21+
source: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/telemetry-operator'].src_dir }}/ci/cloudkitty-pre_deploy-install_loki.yml"
22+
type: playbook
23+
# test cloudkitty
24+
cifmw_run_tests: true
25+
cifmw_run_test_role: test_operator
26+
# TODO: Consider switching to podified-master-centos10 for features that patch master
27+
cifmw_test_operator_tempest_namespace: podified-antelope-centos9
28+
# cloudkitty tempest plugin is not part of the tempest rpm.
29+
# https://review.rdoproject.org/cgit/openstack/tempest-distgit/tree/openstack-tempest.spec
30+
# We need to add the cloudkitty-tempest-plugin package to RDO, same as TTTP
31+
# https://review.rdoproject.org/cgit/openstack/telemetry-tempest-plugin-distgit/#
32+
# For now, we can force install using the cifmw_test_operator_tempest_external_plugin below.
33+
cifmw_test_operator_tempest_container: openstack-tempest-all
34+
cifmw_test_operator_tempest_image_tag: 'current-podified'
35+
# This value is used to populate the `tempestconfRun` parameter of the Tempest CR: https://openstack-k8s-operators.github.io/test-operator/crds.html#tempest-custom-resource
36+
# https://github.com/openstack-k8s-operators/ci-framework/blob/main/roles/test_operator/defaults/main.yml
37+
# TODO: Refine this tempest config
38+
tempest_conf:
39+
overrides: |
40+
validation.run_validation true
41+
identity.v3_endpoint_type public
42+
service_available.ceilometer true
43+
service_available.sg_core true
44+
service_available.aodh false
45+
service_available.cinder false
46+
telemetry.sg_core_service_url "https://ceilometer-internal.openstack.svc.cluster.local:3000"
47+
telemetry.prometheus_service_url "https://metric-storage-prometheus.openstack.svc.cluster.local:9090"
48+
telemetry.ceilometer_polling_interval 120
49+
telemetry.prometheus_scrape_interval 30
50+
telemetry.alarm_threshold 50000000000
51+
52+
cifmw_test_operator_tempest_tempestconf_config: "{{ tempest_conf }}"
53+
cifmw_test_operator_tempest_include_list: |
54+
^tempest.*\[.*\bsmoke\b.*\]
55+
cloudkitty_tempest_plugin.*
56+
telemetry_tempest_plugin.*
57+
cifmw_test_operator_tempest_exclude_list: |
58+
telemetry_tempest_plugin.scenario.test_telemetry_integration_prometheus.PrometheusGabbiTest.test_autoscaling
59+
60+
# TODO: update this to allow multiple external plugins to be listed with Depends-On.
61+
# Potentially, this can be done via the meta content provider, by adding the tempest images to the list.
62+
external_plugin: "opendev.org/openstack/cloudkitty-tempest-plugin"
63+
change_item: "{{ zuul['items'] | selectattr('project.canonical_name', 'equalto', external_plugin) }}"
64+
# WORKAROUND: CloudKitty tempest is not packaged in RDO. Typically, the default would be [], since we would not require an external installation.
65+
cifmw_test_operator_tempest_external_plugin: "{{ [ {'repository': 'https://' + external_plugin + '.git'} ] if change_item | length < 1 else [ { 'repository': 'https://' + external_plugin + '.git', 'changeRepository': 'https://review' + external_plugin, 'changeRefspec': [ 'refs/changes', change_item[0].change[-2:], change_item[0].change, change_item[0].patchset ] | join('/') } ] }}"

zuul.d/projects.yaml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,27 @@
105105
- "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/telemetry-operator'].src_dir }}/ci/vars-power-monitoring.yml"
106106
irrelevant-files: *irrelevant_files
107107

108+
- job:
109+
name: telemetry-operator-multinode-cloudkitty
110+
dependencies: ["telemetry-openstack-meta-content-provider-master"]
111+
parent: telemetry-operator-multinode-autoscaling
112+
description: |
113+
Deploy CloudKitty and run tempest tests
114+
required-projects:
115+
- name: infrawatch/feature-verification-tests
116+
override-checkout: master
117+
extra-vars: *mcp_extra_vars
118+
vars:
119+
#patch_observabilityclient: true
120+
cifmw_update_containers: false
121+
cifmw_extras:
122+
- "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/ci-framework'].src_dir }}/scenarios/centos-9/multinode-ci.yml"
123+
- "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/telemetry-operator'].src_dir }}/ci/vars-cloudkitty-tempest.yml"
124+
- "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/infrawatch/feature-verification-tests'].src_dir }}/ci/vars-use-master-containers.yml"
125+
roles:
126+
- zuul: github.com/openstack-k8s-operators/ci-framework
127+
irrelevant-files: *irrelevant_files
128+
108129
- project-template:
109130
name: rdo-telemetry-tempest-plugin-jobs
110131
openstack-experimental:
@@ -134,13 +155,14 @@
134155

135156
- project:
136157
name: openstack-k8s-operators/telemetry-operator
137-
templates:
138-
- podified-multinode-edpm-pipeline
139158
github-check:
140159
jobs:
141160
- openstack-k8s-operators-content-provider:
142161
vars:
143162
cifmw_install_yamls_sdk_version: v1.41.1
163+
- telemetry-operator-multinode-cloudkitty:
164+
dependencies:
165+
- telemetry-openstack-meta-content-provider-master
144166
- telemetry-openstack-meta-content-provider-master
145167
- telemetry-operator-multinode-default-telemetry
146168
- functional-tests-osp18: &fvt_jobs_config

0 commit comments

Comments
 (0)