Skip to content

Commit

Permalink
openstack_operators namespace
Browse files Browse the repository at this point in the history
Add support for installing operators into a different namespace than
the OpenStack services. By default operators are now installed into
openstack-operators
  • Loading branch information
dprince committed May 31, 2023
1 parent 9971180 commit dc38c75
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 79 deletions.
129 changes: 73 additions & 56 deletions Makefile

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion ci/playbooks/deploy_podified_openstack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

- name: Make sure all Openstack operators are deployed
ansible.builtin.shell: |
set -o pipefail && oc get csv -l operators.coreos.com/openstack-operator.openstack --no-headers=true | grep -i "succeeded"
set -o pipefail && \
oc get csv -l operators.coreos.com/openstack-operator.openstack-operators -n "openstack-operators" --no-headers=true | grep -i "succeeded"
register: operator_status
until: operator_status.rc == 0
changed_when: false
Expand Down
19 changes: 6 additions & 13 deletions scripts/gen-olm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# under the License.
set -ex

if [ -z "${NAMESPACE}" ]; then
echo "Please set NAMESPACE"; exit 1
if [ -z "${OPERATOR_NAMESPACE}" ]; then
echo "Please set OPERATOR_NAMESPACE"; exit 1
fi
if [ -z "${OPERATOR_NAME}" ]; then
echo "Please set OPERATOR_NAME"; exit 1
Expand All @@ -40,18 +40,15 @@ apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: openstack
namespace: ${NAMESPACE}
spec:
targetNamespaces:
- ${NAMESPACE}
namespace: ${OPERATOR_NAMESPACE}
EOF_CAT

cat > ${OPERATOR_DIR}/catalogsource.yaml <<EOF_CAT
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: $OPERATOR_NAME-operator-index
namespace: ${NAMESPACE}
namespace: ${OPERATOR_NAMESPACE}
spec:
image: ${IMAGE}
sourceType: grpc
Expand All @@ -62,14 +59,10 @@ apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: ${OPERATOR_NAME}-operator
namespace: ${NAMESPACE}
namespace: ${OPERATOR_NAMESPACE}
spec:
name: ${OPERATOR_NAME}-operator
channel: alpha
config:
env:
- name: WATCH_NAMESPACE
value: ${NAMESPACE}
source: ${OPERATOR_NAME}-operator-index
sourceNamespace: ${NAMESPACE}
sourceNamespace: ${OPERATOR_NAMESPACE}
EOF_CAT
10 changes: 5 additions & 5 deletions scripts/operator-cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# under the License.
set -x

if [ -z "$NAMESPACE" ]; then
echo "Please set NAMESPACE"; exit 1
if [ -z "$OPERATOR_NAMESPACE" ]; then
echo "Please set OPERATOR_NAMESPACE"; exit 1
fi

if [ -z "$OPERATOR_NAME" ]; then
Expand All @@ -26,7 +26,7 @@ fi
CSV=$(oc get csv --no-headers -o custom-columns=":metadata.name" --ignore-not-found=true | grep $OPERATOR_NAME)

if [ -n "$CSV" ]; then
oc delete -n ${NAMESPACE} csv ${CSV} --ignore-not-found=true
oc delete -n ${OPERATOR_NAMESPACE} csv ${CSV} --ignore-not-found=true
fi
oc delete -n ${NAMESPACE} subscription ${OPERATOR_NAME}-operator --ignore-not-found=true
oc delete -n ${NAMESPACE} catalogsource ${OPERATOR_NAME}-operator-index --ignore-not-found=true
oc delete -n ${OPERATOR_NAMESPACE} subscription ${OPERATOR_NAME}-operator --ignore-not-found=true
oc delete -n ${OPERATOR_NAMESPACE} catalogsource ${OPERATOR_NAME}-operator-index --ignore-not-found=true
8 changes: 4 additions & 4 deletions scripts/operator-wait.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@

set -x

if [ -z "$NAMESPACE" ]; then
echo "Please set NAMESPACE"; exit 1
if [ -z "${OPERATOR_NAMESPACE}" ]; then
echo "Please set OPERATOR_NAMESPACE"; exit 1
fi

if [ -z "$OPERATOR_NAME" ]; then
echo "Please set OPERATOR_NAME"; exit 1
fi

# wait for controller-manager deployment to appear
timeout 300s bash -c 'until [ "$(oc get deployment -l openstack.org/operator-name=${OPERATOR_NAME} -n ${NAMESPACE} -o name)" != "" ]; do sleep 1; done'
timeout 300s bash -c 'until [ "$(oc get deployment -l openstack.org/operator-name=${OPERATOR_NAME} -n ${OPERATOR_NAMESPACE} -o name)" != "" ]; do sleep 1; done'

# wait for controller-manager deployment to reach available state
oc wait deployment -l openstack.org/operator-name=${OPERATOR_NAME} -n ${NAMESPACE} --for condition=Available --timeout=300s
oc wait deployment -l openstack.org/operator-name=${OPERATOR_NAME} -n ${OPERATOR_NAMESPACE} --for condition=Available --timeout=300s
1 change: 1 addition & 0 deletions zuul.d/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- zuul: github.com/openstack-k8s-operators/ci-framework
vars:
crc_parameters: "--memory 20000 --disk-size 120 --cpus 6"
operators_namespace: openstack-operators
pre_pull_images:
- registry.redhat.io/rhosp-rhel9/openstack-rabbitmq:17.0
- quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:afa73a12a1ffd31f77b10a25c43a4d02b0fd62f927f6209c26983bd8aee021bf
Expand Down

0 comments on commit dc38c75

Please sign in to comment.