Skip to content

Commit 44be5a2

Browse files
authored
Merge branch 'master' into efoley-zuul-ocp-4.16
2 parents bbab1a6 + 9206fa4 commit 44be5a2

File tree

14 files changed

+234
-89
lines changed

14 files changed

+234
-89
lines changed

.zuul.yaml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,15 @@
132132
vars:
133133
scenario: "local_build-index_deploy"
134134

135+
- job:
136+
name: stf-crc-nightly_bundles-index_deploy
137+
parent: stf-base
138+
abstract: true
139+
description: |
140+
Create an index image using nightly bundles and deploy STF from it
141+
vars:
142+
scenario: "nightly_bundles-index_deploy"
143+
135144
- job:
136145
name: stf-crc-ocp_412-nightly_bundles
137146
parent: stf-crc-nightly_bundles
@@ -188,14 +197,27 @@
188197
Build STF locally and deploy from index on OCP 4.14
189198
nodeset: stf-crc_extracted-ocp414
190199

191-
# TODO: add the other job variations for 4.16
192200
- job:
193201
name: stf-crc-ocp_416-local_build-index_deploy
194202
parent: stf-crc-local_build-index_deploy
195203
description: |
196204
Build STF locally and deploy from index on OCP 4.16
197205
nodeset: stf-crc_extracted-ocp416
198206

207+
- job:
208+
name: stf-crc-ocp_414-nightly_bundles-index_deploy
209+
parent: stf-crc-nightly_bundles-index_deploy
210+
description: |
211+
Create an index image using nightly bundles and deploy STF from it on OCP 4.14
212+
nodeset: stf-crc_extracted-ocp414
213+
214+
- job:
215+
name: stf-crc-ocp_416-nightly_bundles-index_deploy
216+
parent: stf-crc-nightly_bundles-index_deploy
217+
description: |
218+
Create an index image using nightly bundles and deploy STF from it on OCP 4.14
219+
nodeset: stf-crc_extracted-ocp416
220+
199221
- project-template:
200222
name: stf-crc-jobs
201223
description: |
@@ -208,6 +230,8 @@
208230
#- stf-crc-ocp_412-local_build-index_deploy
209231
#- stf-crc-ocp_414-local_build-index_deploy
210232
- stf-crc-ocp_416-local_build-index_deploy
233+
# - stf-crc-ocp_414-nightly_bundles-index_deploy
234+
- stf-crc-ocp_416-nightly_bundles-index_deploy
211235
- stf-crc-ocp_414-nightly_bundles
212236
- stf-crc-ocp_416-nightly_bundles
213237

@@ -218,4 +242,4 @@
218242
periodic:
219243
jobs:
220244
- stf-crc-ocp_412-nightly_bundles
221-
- stf-crc-ocp_414-nightly_bundles
245+
- stf-crc-ocp_414-nightly_bundles

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ loaded for you.
4040
* smartgatewayCollectdEventsManifest
4141
* smartgatewayCeilometerEventsManifest
4242
* servicemonitorManifest
43+
* scrapeconfigManifest
4344

4445
## Development
4546

build/stf-run-ci/README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ choose to override:
2020
| `__deploy_stf` | {true,false} | true | Whether to deploy an instance of STF |
2121
| `__local_build_enabled` | {true,false} | true | Whether to deploy STF from local built artifacts. Also see `working_branch`, `sg_branch`, `sgo_branch` |
2222
| `__deploy_from_bundles_enabled` | {true,false} | false | Whether to deploy STF from OLM bundles (TODO: compat with `__local_build_enabled`) |
23-
| `__deploy_from_index_enabled` | {true,false} | false | Whether to deploy STF from locally built bundles and index image. |
23+
| `__deploy_from_index_enabled` | {true,false} | false | Whether to deploy STF from locally built bundles/OLM bundles and index image. |
2424
| `__disconnected_deploy` | {true,false} | false | Whether to deploy on a disconnected cluster |
2525
| `__service_telemetry_bundle_image_path` | <image_path> | `quay.io/infrawatch-operators/service-telemetry-operator-bundle:nightly-head` | Image path to Service Telemetry Operator bundle |
2626
| `__smart_gateway_bundle_image_path` | <image_path> | `quay.io/infrawatch-operators/smart-gateway-operator-bundle:nightly-head` | Image path to Smart Gateway Operator bundle |
@@ -83,9 +83,10 @@ choose to override:
8383
You can deploy Service Telemetry Framework using this role in a few
8484
configuration methods:
8585
86-
* local build artifacts from Git repository cloned locally
87-
* local build artifacts, local bundle artifacts, and Subscription via OLM using locally built index image
88-
* standard deployment using Subscription and OLM
86+
* local build artifacts from Git repository cloned locally (local build)
87+
* local build artifacts, local bundle artifacts, and Subscription via OLM using locally built index image (local build + deploy from index)
88+
* externally build bundle artifacts and Subscription via OLM using locally built index image (deploy from bundles + deploy from index)
89+
* standard deployment using Subscription and OLM (deploy from bundles)
8990
* supporting components but no instance of Service Telemetry Operator
9091
9192
## Basic deployment
@@ -134,6 +135,27 @@ You can perform a deployment using OLM and a Subscription from locally built art
134135
ansible-playbook -e __local_build_enabled=true -e __deploy_from_index_enabled=true run-ci.yaml
135136
```
136137

138+
## Deployment with pre-build bundles and index
139+
140+
Instead of relying on the operator-sdk to deploy from selected bundles using the "operator-sdk run bundle" utility,
141+
you can perform a deployment using OLM and a Subscription to a locally created index image like this:
142+
143+
```sh
144+
ansible-playbook -e __local_build_enabled=false -e __deploy_from_bundles_enabled=true \
145+
-e __deploy_from_index_enabled=true \
146+
-e __service_telemetry_bundle_image_path=<registry>/<namespace>/stf-service-telemetry-operator-bundle:<tag> \
147+
-e __smart_gateway_bundle_image_path=<registry>/<namespace>/stf-smart-gateway-operator-bundle:<tag> \
148+
-e pull_secret_registry=<registry> \
149+
-e pull_secret_user=<username> \
150+
-e pull_secret_pass=<password>
151+
run-ci.yaml
152+
```
153+
154+
Since you will fetch the selected images from a bundle registry, it is required that you have all the required
155+
access credentials for the desired registry correctly configured. Check the "Deployment with pre-build bundles"
156+
docs above to get more information about this.
157+
158+
137159
# License
138160

139161
Apache v2.0

build/stf-run-ci/tasks/create_catalog.yml

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,65 @@
77

88
# Updating to use stdout_lines[-1] so that any additional info that gets added to generate_bundles (e.g. for debug) doesn't break this task
99
# Adding from_json so that the JSON output is parsed into a dictionary
10-
- name: Create info variables from bundle generation output
10+
- name: Create info variables from bundle generation output (local build)
11+
when: __local_build_enabled | bool and not __deploy_from_bundles_enabled | bool
1112
ansible.builtin.set_fact:
1213
sto_bundle_info: "{{ generate_bundle_sto.stdout_lines[-1] | from_json }}"
1314
sgo_bundle_info: "{{ generate_bundle_sgo.stdout_lines[-1] | from_json }}"
1415

16+
- name: Create info variables from provided pre-built bundles (deploy from bundles)
17+
when: __deploy_from_bundles_enabled | bool and not __local_build_enabled | bool
18+
block:
19+
- name: Get STO operator bundle info
20+
ansible.builtin.command: oc image info {{ __service_telemetry_bundle_image_path }}
21+
register: sto_prebuilt_image_info
22+
23+
- name: Get SGO operator bundle info
24+
ansible.builtin.command: oc image info {{ __smart_gateway_bundle_image_path }}
25+
register: sgo_prebuilt_image_info
26+
27+
- name: Get STO and SGO bundle versions
28+
ansible.builtin.set_fact:
29+
sto_prebuilt_bundle_version: "{{ sto_prebuilt_image_info.stdout_lines[-1] | split('=') | last }}"
30+
sgo_prebuilt_bundle_version: "{{ sgo_prebuilt_image_info.stdout_lines[-1] | split('=') | last }}"
31+
32+
- name: Set info variables from provided pre-built bundles
33+
ansible.builtin.set_fact:
34+
sto_bundle_info:
35+
'bundle_default_channel': "{{ stf_channel }}"
36+
'bundle_channels': "{{ stf_channel }}"
37+
'operator_bundle_version': "{{ sto_prebuilt_bundle_version }}"
38+
sgo_bundle_info:
39+
'bundle_default_channel': "{{ stf_channel }}"
40+
'bundle_channels': "{{ stf_channel }}"
41+
'operator_bundle_version': "{{ sgo_prebuilt_bundle_version }}"
42+
43+
- name: Show STO and SGO bundle info that will used in the index image
44+
ansible.builtin.debug:
45+
msg:
46+
- "{{ sto_bundle_info }}"
47+
- "{{ sgo_bundle_info }}"
48+
49+
- name: Create ImageStream for STO and SGO (deploying from bundles)
50+
when: __deploy_from_bundles_enabled | bool
51+
block:
52+
- name: Set correct STO and SGO bundle paths when deploying from index with pre-built bundles
53+
ansible.builtin.set_fact:
54+
sto_bundle_image_path: "{{ __internal_registry_path }}/{{ namespace }}/service-telemetry-operator-bundle:{{ sto_bundle_image_tag }}"
55+
sgo_bundle_image_path: "{{ __internal_registry_path }}/{{ namespace }}/smart-gateway-operator-bundle:{{ sgo_bundle_image_tag }}"
56+
57+
- name: Create ImageStream for STO
58+
ansible.builtin.command:
59+
cmd: |
60+
oc import-image -n {{ namespace }} service-telemetry-operator-bundle:{{ sto_bundle_image_tag }} --from={{ __service_telemetry_bundle_image_path }} --confirm --insecure
61+
register: sto_is
62+
63+
- name: Create ImageStream for SGO
64+
ansible.builtin.command:
65+
cmd: |
66+
oc import-image -n {{ namespace }} smart-gateway-operator-bundle:{{ sgo_bundle_image_tag }} --from={{ __smart_gateway_bundle_image_path }} --confirm --insecure
67+
register: sgo_is
68+
1569
- name: Get the builder-dockercfg Secret name
1670
ansible.builtin.command: oc get secret -n {{ namespace }} --field-selector='type==kubernetes.io/dockercfg' -ojsonpath='{.items[?(@.metadata.annotations.kubernetes\.io/service-account\.name=="builder")].metadata.name}'
1771
register: secret_builder_dockercfg_name

build/stf-run-ci/tasks/main.yml

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,6 @@
2828
- __local_build_enabled | bool
2929
- __deploy_from_bundles_enabled | bool
3030

31-
- name: Fail when deploying from index image and local build disabled
32-
ansible.builtin.fail:
33-
msg: __deploy_from_index_enabled must also have __local_build_enabled
34-
when:
35-
- __deploy_from_index_enabled | bool
36-
- not __local_build_enabled | bool
37-
38-
- name: Fail when deploying from index images and deployment from bundles also requested (mutually exclusive methods)
39-
ansible.builtin.fail:
40-
msg: __deploy_from_index_enabled can not be used with __deploy_from_bundles_enabled
41-
when:
42-
- __deploy_from_index_enabled | bool
43-
- __deploy_from_bundles_enabled | bool
44-
45-
- name: Fail when disconnected deploy and other deployment options also requested
46-
ansible.builtin.fail:
47-
msg: __disconnected_deploy cannot be used if __deploy_from_bundles_enabled, __deploy_from_index_enabled or __local_build_enabled
48-
when:
49-
- __disconnected_deploy | bool
50-
- __deploy_from_bundles_enabled | bool or __deploy_from_index_enabled | bool or __local_build_enabled | bool
51-
5231
- name: Get the list of nodes
5332
kubernetes.core.k8s_info:
5433
kind: Node
@@ -159,7 +138,7 @@
159138
pod-security.kubernetes.io/audit: restricted
160139
pod-security.kubernetes.io/warn: restricted
161140

162-
- when: __deploy_from_index_enabled | bool
141+
- when: __deploy_from_index_enabled | bool and __local_build_enabled | bool
163142
tags:
164143
- create_bundles
165144
block:
@@ -180,11 +159,13 @@
180159
tags:
181160
- build
182161

162+
- when: __deploy_from_index_enabled | bool
163+
block:
183164
- name: Create file-based catalog
184165
ansible.builtin.include_tasks: create_catalog.yml
185166

186167
# -- deploy
187-
- when: not __local_build_enabled | bool
168+
- when: not __local_build_enabled | bool and not __deploy_from_index_enabled | bool
188169
block:
189170
- name: Setup Service Telemetry Framework from supplied bundle URLs
190171
ansible.builtin.include_tasks: setup_stf_from_bundles.yml
@@ -206,7 +187,7 @@
206187
name: service-telemetry-operator
207188
namespace: "{{ namespace }}"
208189
spec:
209-
channel: unstable
190+
channel: "{{ stf_channel }}"
210191
installPlanApproval: Automatic
211192
name: service-telemetry-operator
212193
source: service-telemetry-framework-operators
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
# ansible-playbook -e __local_build_enabled=false -e __deploy_from_index_enabled=true -e __deploy_from_bundles_enabled=true -e __service_telemetry_bundle_image_path=quay.io/infrawatch-operators/service-telemetry-operator-bundle:nightly-head -e __smart_gateway_bundle_image_path=quay.io/infrawatch-operators/smart-gateway-operator-bundle:nightly-head --skip-tags bundle_registry_tls_ca --skip-tags bundle_registry_auth build/run-ci.yaml
3+
__local_build_enabled: false
4+
__deploy_from_bundles_enabled: true
5+
__deploy_from_index_enabled: true

deploy/olm-catalog/service-telemetry-operator/manifests/service-telemetry-operator.clusterserviceversion.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,15 @@ spec:
203203
- kind: ServiceMonitors
204204
name: servicemonitors.monitoring.coreos.com
205205
version: v1
206+
- kind: ScrapeConfigs
207+
name: scrapeconfigs.monitoring.coreos.com
208+
version: v1alpha1
209+
- kind: ServiceMonitors
210+
name: servicemonitors.monitoring.rhobs
211+
version: v1
212+
- kind: ScrapeConfigs
213+
name: scrapeconfigs.monitoring.rhobs
214+
version: v1alpha1
206215
version: v1beta1
207216
description: Service Telemetry Operator for monitoring clouds
208217
displayName: Service Telemetry Operator
@@ -378,17 +387,21 @@ spec:
378387
- apiGroups:
379388
- monitoring.coreos.com
380389
resources:
390+
- scrapeconfigs
381391
- servicemonitors
382392
verbs:
383393
- get
384394
- create
395+
- delete
385396
- apiGroups:
386397
- monitoring.rhobs
387398
resources:
399+
- scrapeconfigs
388400
- servicemonitors
389401
verbs:
390402
- get
391403
- create
404+
- delete
392405
- apiGroups:
393406
- apps
394407
resourceNames:

deploy/role.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,21 @@ rules:
129129
- apiGroups:
130130
- monitoring.coreos.com
131131
resources:
132+
- scrapeconfigs
132133
- servicemonitors
133134
verbs:
134135
- get
135136
- create
137+
- delete
136138
- apiGroups:
137139
- monitoring.rhobs
138140
resources:
141+
- scrapeconfigs
139142
- servicemonitors
140143
verbs:
141144
- get
142145
- create
146+
- delete
143147
- apiGroups:
144148
- apps
145149
resourceNames:

roles/servicetelemetry/tasks/base_smartgateway.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
k8s:
77
definition: "{{ lookup('template', manifest) | from_yaml }}"
88

9-
- name: Deploy SG-specific ServiceMonitor for metrics SGs
10-
include_tasks: component_servicemonitor.yml
9+
- name: Deploy SG-specific ScrapeConfig for metrics SGs
10+
include_tasks: component_scrapeconfig.yml
1111
when:
1212
- data_type == 'metrics'
1313
- has_monitoring_api | bool

0 commit comments

Comments
 (0)