Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up dependency installation in stf-run-ci #455

Merged
merged 5 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion build/stf-run-ci/tasks/pre-clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@
displayName: OperatorHub.io Operators
publisher: OperatorHub.io

# Upstream Source + Sub from https://github.com/rhobs/observability-operator/tree/main/hack/olm
# Moved to using Community Operators Catalog, so no longer require upstream CatalogSource. Eventually move to Red Hat Operators CatalogSource.
- name: Remove Red Hat Observability Operator CatalogSource if it is installed
k8s:
state: absent
definition:
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
annotations:
name: observability-operator
namespace: openshift-marketplace

- name: Remove CloudOps CatalogSource if it is installed
k8s:
state: absent
Expand Down Expand Up @@ -130,4 +143,4 @@
kind: Elasticsearch
metadata:
name: elasticsearch
namespace: "{{ namespace }}"
namespace: "{{ namespace }}"
90 changes: 45 additions & 45 deletions build/stf-run-ci/tasks/setup_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
name: certified-operators
- disabled: false
name: redhat-operators
- disabled: "{{ false if __service_telemetry_observability_strategy in ['use_community', 'use_hybrid'] else true }}"
- disabled: false
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this conditional so that ObO could be installed. There are priority rules on the CatalogSources which will dictate order of installation preference with dependency resolution. With local builds (non-index based) we specify the source Catalog.

Ideally in the future we'll be able to update the ObO installation source to redhat-operators vs community-operators.

name: community-operators

- name: Create OperatorGroup
- name: Create OperatorGroup for service-telemetry
k8s:
definition:
apiVersion: operators.coreos.com/v1
Expand All @@ -28,7 +28,8 @@
targetNamespaces:
- "{{ namespace }}"

- when: not __deploy_from_index_enabled | bool
# deploy cert-manager from tech-preview when using versions of OCP < 4.12
- when: not __deploy_from_index_enabled | bool and ocp_ver.stdout is version ('4.12', '<')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

block:
- name: Create openshift-cert-manager-operator namespace
k8s:
Expand Down Expand Up @@ -66,6 +67,28 @@
source: redhat-operators
sourceNamespace: openshift-marketplace

# deploy cert-manager from stable-v1 in 4.12 and later using namespace scoped operator
- when: not __deploy_from_index_enabled | bool and ocp_ver.stdout is version ('4.12', '>=')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a bit of liberties in this file and refactored this so that in installations of OCP 4.10 (and 4.11) we use the tech-preview channel as a cluster scoped Operator, and in 4.12 and later using the stable-v1 channel in a namespace scoped Operator to simulate how dependency resolution would work in an OCP without cert-manager already installed at the cluster scope.

block:
- name: Subscribe to Cert Manager for OpenShift Operator
k8s:
definition:
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
labels:
operators.coreos.com/openshift-cert-manager-operator.service-telemetry: ""
name: openshift-cert-manager-operator-stable-v1-redhat-operators-openshift-marketplace
namespace: service-telemetry
spec:
channel: stable-v1
installPlanApproval: Automatic
name: openshift-cert-manager-operator
source: redhat-operators
sourceNamespace: openshift-marketplace

- when: not __deploy_from_index_enabled | bool
block:
- name: Subscribe to AMQ Interconnect Operator
k8s:
definition:
Expand Down Expand Up @@ -98,6 +121,25 @@
when:
- __service_telemetry_observability_strategy == "use_community"

- name: Subscribe to Red Hat Obervability Operator
k8s:
definition:
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
labels:
operators.coreos.com/observability-operator.openshift-operators: ""
name: observability-operator
namespace: openshift-operators
spec:
channel: stable
installPlanApproval: Automatic
name: observability-operator
source: community-operators
sourceNamespace: openshift-marketplace
when:
- __service_telemetry_observability_strategy in ['use_redhat', 'use_hybrid']

- name: Subscribe to Elastic Cloud on Kubernetes Operator
k8s:
definition:
Expand All @@ -122,45 +164,3 @@
until: eckCRD.resources[0] is defined
retries: 5
delay: 30

- block:
# Upstream Source + Sub from https://github.com/rhobs/observability-operator/tree/main/hack/olm
- name: Create CatalogSource for Red Hat Observability Operator
k8s:
definition:
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
annotations:
name: observability-operator
namespace: openshift-marketplace
spec:
displayName: Observability Operator - Test
icon:
base64data: ""
mediatype: ""
image: quay.io/rhobs/observability-operator-catalog:latest
publisher: Sunil Thaha
sourceType: grpc
updateStrategy:
registryPoll:
interval: 10m0s

- name: Subscribe to Red Hat Obervability Operator
k8s:
definition:
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
labels:
operators.coreos.com/observability-operator.openshift-operators: ""
name: observability-operator
namespace: openshift-operators
spec:
channel: development
installPlanApproval: Automatic
name: observability-operator
source: observability-operator
sourceNamespace: openshift-marketplace
when:
- __service_telemetry_observability_strategy in ['use_redhat', 'use_hybrid']