Skip to content

Commit 519e2eb

Browse files
authored
Merge pull request #149 from infrawatch/import/stf153
Import master into stable-1.5
2 parents 68808c3 + 0531e69 commit 519e2eb

10 files changed

Lines changed: 62 additions & 26 deletions

File tree

build/Dockerfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
FROM quay.io/openshift/origin-ansible-operator:4.10
1+
FROM quay.io/openshift/origin-ansible-operator:4.12
22

3+
# temporarily switch to root user to adjust image layers
4+
USER 0
5+
6+
# update the base image to allow forward-looking optimistic updates during the testing phase, with the added benefit of helping move closer to passing security scans.
7+
# -- excludes ansible so it remains at 2.9 tag as shipped with the base image
8+
# -- cleans up the cached data from dnf to keep the image as small as possible
9+
RUN dnf update -y --exclude=ansible* && dnf clean all && rm -rf /var/cache/dnf
10+
11+
# switch back to user 1001 when running the base image (non-root)
12+
USER 1001
13+
14+
# copy in required artifacts for the operator
315
COPY roles/ ${HOME}/roles/
416
COPY watches.yaml ${HOME}/watches.yaml

build/generate_bundle.sh

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,45 @@
11
#!/usr/bin/env bash
22
set -e
3-
REL=$(dirname "$0")
3+
set -x
4+
5+
LOGFILE=${LOGFILE:-/dev/null}
6+
# If LOGFILE is /dev/null, this command fails, so ignore that error
7+
truncate --size=0 ${LOGFILE} || true
8+
9+
OPERATOR_SDK=${OPERATOR_SDK:-operator-sdk}
10+
REL=$( readlink -f $(dirname "$0"))
411

512
# shellcheck source=build/metadata.sh
613
. "${REL}/metadata.sh"
714

815
generate_version() {
9-
echo "-- Generating operator version"
1016
UNIXDATE=$(date '+%s')
1117
OPERATOR_BUNDLE_VERSION=${OPERATOR_CSV_MAJOR_VERSION}.${UNIXDATE}
12-
echo "---- Operator Version: ${OPERATOR_BUNDLE_VERSION}"
1318
}
1419

1520
create_working_dir() {
16-
echo "-- Create working directory"
1721
WORKING_DIR=${WORKING_DIR:-"/tmp/${OPERATOR_NAME}-bundle-${OPERATOR_BUNDLE_VERSION}"}
1822
mkdir -p "${WORKING_DIR}"
19-
echo "---- Created working directory: ${WORKING_DIR}"
2023
}
2124

2225
generate_dockerfile() {
23-
echo "-- Generate Dockerfile for bundle"
2426
sed -E "s#<<OPERATOR_BUNDLE_VERSION>>#${OPERATOR_BUNDLE_VERSION}#g;s#<<BUNDLE_CHANNELS>>#${BUNDLE_CHANNELS}#g;s#<<BUNDLE_DEFAULT_CHANNEL>>#${BUNDLE_DEFAULT_CHANNEL}#g" "${REL}/../${BUNDLE_PATH}/Dockerfile.in" > "${WORKING_DIR}/Dockerfile"
25-
echo "---- Generated Dockerfile complete"
2627
}
2728

2829
generate_bundle() {
29-
echo "-- Generate bundle"
30-
REPLACE_REGEX="s#<<CREATED_DATE>>#${CREATED_DATE}#g;s#<<OPERATOR_IMAGE>>#${OPERATOR_IMAGE}#g;s#<<OPERATOR_TAG>>#${OPERATOR_TAG}#g;s#<<RELATED_IMAGE_BRIDGE_SMARTGATEWAY>>#${RELATED_IMAGE_BRIDGE_SMARTGATEWAY}#g;s#<<RELATED_IMAGE_BRIDGE_SMARTGATEWAY_TAG>>#${RELATED_IMAGE_BRIDGE_SMARTGATEWAY_TAG}#g;s#<<RELATED_IMAGE_CORE_SMARTGATEWAY>>#${RELATED_IMAGE_CORE_SMARTGATEWAY}#g;s#<<RELATED_IMAGE_CORE_SMARTGATEWAY_TAG>>#${RELATED_IMAGE_CORE_SMARTGATEWAY_TAG}#g;s#<<OPERATOR_BUNDLE_VERSION>>#${OPERATOR_BUNDLE_VERSION}#g;s#1.99.0#${OPERATOR_BUNDLE_VERSION}#g;s#<<BUNDLE_OLM_SKIP_RANGE_LOWER_BOUND>>#${BUNDLE_OLM_SKIP_RANGE_LOWER_BOUND}#g"
30+
REPLACE_REGEX="s#<<CREATED_DATE>>#${CREATED_DATE}#g;s#<<OPERATOR_IMAGE>>#${OPERATOR_IMAGE}#g;s#<<OPERATOR_TAG>>#${OPERATOR_TAG}#g;s#<<RELATED_IMAGE_BRIDGE_SMARTGATEWAY>>#${RELATED_IMAGE_BRIDGE_SMARTGATEWAY}#g;s#<<RELATED_IMAGE_BRIDGE_SMARTGATEWAY_TAG>>#${RELATED_IMAGE_BRIDGE_SMARTGATEWAY_TAG}#g;s#<<RELATED_IMAGE_CORE_SMARTGATEWAY>>#${RELATED_IMAGE_CORE_SMARTGATEWAY}#g;s#<<RELATED_IMAGE_CORE_SMARTGATEWAY_TAG>>#${RELATED_IMAGE_CORE_SMARTGATEWAY_TAG}#g;s#<<RELATED_IMAGE_OAUTH_PROXY>>#${RELATED_IMAGE_OAUTH_PROXY}#g;s#<<RELATED_IMAGE_OAUTH_PROXY_TAG>>#${RELATED_IMAGE_OAUTH_PROXY_TAG}#g;s#<<OPERATOR_BUNDLE_VERSION>>#${OPERATOR_BUNDLE_VERSION}#g;s#1.99.0#${OPERATOR_BUNDLE_VERSION}#g;s#<<BUNDLE_OLM_SKIP_RANGE_LOWER_BOUND>>#${BUNDLE_OLM_SKIP_RANGE_LOWER_BOUND}#g"
3131

32-
pushd "${REL}/../"
33-
${OPERATOR_SDK} generate bundle --channels ${BUNDLE_CHANNELS} --default-channel ${BUNDLE_DEFAULT_CHANNEL} --manifests --metadata --version "${OPERATOR_BUNDLE_VERSION}" --output-dir "${WORKING_DIR}"
34-
popd
32+
pushd "${REL}/../" > /dev/null 2>&1
33+
${OPERATOR_SDK} generate bundle --channels ${BUNDLE_CHANNELS} --default-channel ${BUNDLE_DEFAULT_CHANNEL} --manifests --metadata --version "${OPERATOR_BUNDLE_VERSION}" --output-dir "${WORKING_DIR}" >> ${LOGFILE} 2>&1
34+
popd > /dev/null 2>&1
3535

36-
echo "---- Replacing variables in generated manifest"
3736
sed -i -E "${REPLACE_REGEX}" "${WORKING_DIR}/manifests/${OPERATOR_NAME}.clusterserviceversion.yaml"
38-
echo "---- Generated bundle complete at ${WORKING_DIR}/manifests/${OPERATOR_NAME}.clusterserviceversion.yaml"
37+
}
38+
39+
copy_extra_metadata() {
40+
pushd "${REL}/../" > /dev/null 2>&1
41+
cp -r ./deploy/olm-catalog/smart-gateway-operator/tests/ "${WORKING_DIR}"
42+
cp ./deploy/olm-catalog/smart-gateway-operator/metadata/properties.yaml "${WORKING_DIR}/metadata/"
3943
}
4044

4145
copy_extra_metadata() {
@@ -53,11 +57,14 @@ build_bundle_instructions() {
5357

5458

5559
# generate templates
56-
echo "## Begin bundle creation"
5760
generate_version
5861
create_working_dir
5962
generate_dockerfile
6063
generate_bundle
6164
copy_extra_metadata
62-
build_bundle_instructions
63-
echo "## End Bundle creation"
65+
#build_bundle_instructions
66+
67+
set +x
68+
69+
JSON_OUTPUT='{"operator_bundle_image":"%s","operator_bundle_version":"%s","operator_image":"%s","bundle_channels":"%s","bundle_default_channel":"%s","operator_tag":"%s","working_dir":"%s"}'
70+
printf "$JSON_OUTPUT" "$OPERATOR_BUNDLE_IMAGE" "$OPERATOR_BUNDLE_VERSION" "$OPERATOR_IMAGE" "$BUNDLE_CHANNELS" "$BUNDLE_DEFAULT_CHANNEL" "$OPERATOR_TAG" "$WORKING_DIR"

build/metadata.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ RELATED_IMAGE_CORE_SMARTGATEWAY=${RELATED_IMAGE_CORE_SMARTGATEWAY:-quay.io/infra
1111
RELATED_IMAGE_CORE_SMARTGATEWAY_TAG=${RELATED_IMAGE_CORE_SMARTGATEWAY_TAG:-stable-1.5}
1212
RELATED_IMAGE_BRIDGE_SMARTGATEWAY=${RELATED_IMAGE_BRIDGE_SMARTGATEWAY:-quay.io/infrawatch/sg-bridge}
1313
RELATED_IMAGE_BRIDGE_SMARTGATEWAY_TAG=${RELATED_IMAGE_BRIDGE_SMARTGATEWAY_TAG:-stable-1.5}
14+
RELATED_IMAGE_OAUTH_PROXY=${RELATED_IMAGE_OAUTH_PROXY:-quay.io/openshift/origin-oauth-proxy}
15+
RELATED_IMAGE_OAUTH_PROXY_TAG=${RELATED_IMAGE_OAUTH_PROXY_TAG:-latest}
1416
BUNDLE_PATH=${BUNDLE_PATH:-deploy/olm-catalog/smart-gateway-operator}
1517
BUNDLE_CHANNELS=${BUNDLE_CHANNELS:-stable-1.5}
1618
BUNDLE_DEFAULT_CHANNEL=${BUNDLE_DEFAULT_CHANNEL:-stable-1.5}

deploy/olm-catalog/smart-gateway-operator/Dockerfile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
1313
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v0.19.4
1414
LABEL operators.operatorframework.io.metrics.project_layout=ansible
1515
LABEL com.redhat.delivery.operator.bundle=true
16-
LABEL com.redhat.openshift.versions="v4.10-v4.12"
16+
LABEL com.redhat.openshift.versions="v4.11-v4.14"
1717
LABEL com.redhat.delivery.backport=false
1818

1919
LABEL com.redhat.component="smart-gateway-operator-bundle-container" \

deploy/olm-catalog/smart-gateway-operator/manifests/smart-gateway-operator.clusterserviceversion.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,21 @@ metadata:
6969
createdAt: <<CREATED_DATE>>
7070
description: Operator for managing the Smart Gateway Custom Resources, resulting
7171
in deployments of the Smart Gateway.
72+
features.operators.openshift.io/cnf: "false"
73+
features.operators.openshift.io/cni: "false"
74+
features.operators.openshift.io/csi: "false"
75+
features.operators.openshift.io/disconnected: "false"
76+
features.operators.openshift.io/fips-compliant: "false"
77+
features.operators.openshift.io/proxy-aware: "false"
78+
features.operators.openshift.io/tls-profiles: "false"
79+
features.operators.openshift.io/token-auth-aws: "false"
80+
features.operators.openshift.io/token-auth-azure: "false"
81+
features.operators.openshift.io/token-auth-gcp: "false"
7282
olm.skipRange: =><<BUNDLE_OLM_SKIP_RANGE_LOWER_BOUND>> <<<OPERATOR_BUNDLE_VERSION>>
73-
operators.operatorframework.io/builder: operator-sdk-v0.19.4
74-
operators.operatorframework.io/project_layout: ansible
7583
operators.openshift.io/valid-subscription: '["OpenStack Platform", "Cloud Infrastructure",
7684
"Cloud Suite"]'
85+
operators.operatorframework.io/builder: operator-sdk-v0.19.4
86+
operators.operatorframework.io/project_layout: ansible
7787
repository: https://github.com/infrawatch/smart-gateway-operator
7888
support: Red Hat
7989
name: smart-gateway-operator.v1.99.0
@@ -235,6 +245,8 @@ spec:
235245
value: <<RELATED_IMAGE_CORE_SMARTGATEWAY>>:<<RELATED_IMAGE_CORE_SMARTGATEWAY_TAG>>
236246
- name: RELATED_IMAGE_BRIDGE_SMARTGATEWAY_IMAGE
237247
value: <<RELATED_IMAGE_BRIDGE_SMARTGATEWAY>>:<<RELATED_IMAGE_BRIDGE_SMARTGATEWAY_TAG>>
248+
- name: RELATED_IMAGE_OAUTH_PROXY_IMAGE
249+
value: <<RELATED_IMAGE_OAUTH_PROXY>>:<<RELATED_IMAGE_OAUTH_PROXY_TAG>>
238250
image: <<OPERATOR_IMAGE>>:<<OPERATOR_TAG>>
239251
imagePullPolicy: Always
240252
name: operator
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
properties:
22
- type: olm.maxOpenShiftVersion
3-
value: "4.12"
3+
value: "4.14"

deploy/operator.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ spec:
4141
value: <<RELATED_IMAGE_CORE_SMARTGATEWAY>>:<<RELATED_IMAGE_CORE_SMARTGATEWAY_TAG>>
4242
- name: RELATED_IMAGE_BRIDGE_SMARTGATEWAY_IMAGE
4343
value: <<RELATED_IMAGE_BRIDGE_SMARTGATEWAY>>:<<RELATED_IMAGE_BRIDGE_SMARTGATEWAY_TAG>>
44+
- name: RELATED_IMAGE_OAUTH_PROXY_IMAGE
45+
value: <<RELATED_IMAGE_OAUTH_PROXY>>:<<RELATED_IMAGE_OAUTH_PROXY_TAG>>
4446
volumes:
4547
- emptyDir: {}
4648
name: runner

roles/smartgateway/defaults/main.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ exporter_port: 8081
1111
block_event_bus: false
1212
service_account_name: smart-gateway
1313

14-
# - This image works on OCP 4.6, 4.7, and 4.8
15-
oauth_proxy_image: image-registry.openshift-image-registry.svc:5000/openshift/oauth-proxy:v4.4
16-
1714
# used in conjunction with sg_vars in vars/main.yml to provide single parameter override for the dictionaries
1815
sg_defaults:
1916
bridge:

roles/smartgateway/tasks/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
bridge_container_image_path: "{{ lookup('env', 'RELATED_IMAGE_BRIDGE_SMARTGATEWAY_IMAGE') | default('quay.io/infrawatch/sg-bridge:latest', true) }}"
2424
when: bridge_container_image_path is undefined
2525

26+
- name: Set OAuth Proxy image
27+
set_fact:
28+
oauth_proxy_image: "{{ lookup('env', 'RELATED_IMAGE_OAUTH_PROXY_IMAGE') | default('quay.io/openshift/origin-oauth-proxy:latest', true) }}"
29+
2630
- name: Check for existing cookie secret
2731
k8s_info:
2832
api_version: v1

roles/smartgateway/templates/deployment.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ spec:
154154
{% if (applications | selectattr('name','equalto','elasticsearch') | list | count > 0) %}
155155
- name: elastic-certs
156156
secret:
157-
secretName: {{ tls_secret_name }}
157+
secretName: {{ (applications | selectattr('name','equalto','elasticsearch') | map(attribute='config') | first | from_yaml).tlsSecretName | default(tls_secret_name)}}
158158
{% endif %}
159159
- name: session-secret
160160
secret:

0 commit comments

Comments
 (0)