Skip to content

Commit

Permalink
Add tool version for community operators (#1221)
Browse files Browse the repository at this point in the history
  • Loading branch information
khewonc authored Jun 7, 2024
1 parent f2e1d7a commit f201593
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: DD_TOOL_VERSION
value: "datadog-operator"
resources:
limits:
cpu: 100m
Expand Down
7 changes: 6 additions & 1 deletion hack/patch-bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,19 @@ $YQ -i ".spec.\"replaces\" = \"datadog-operator.v$LATEST_VERSION\"" bundle/manif
# Add OpenShift version annotation (adding in main bundle as it's used for OpenShift Community)
$YQ -i ".annotations.\"com.redhat.openshift.versions\" = \"v4.6\"" bundle/metadata/annotations.yaml

# set `DD_TOOL_VERSION` to `redhat`
$YQ -i "(.spec.install.spec.deployments[] | select(.name == \"datadog-operator-manager\") | .spec.template.spec.containers[] | select(.name == \"manager\") | .env[] | select(.name == \"DD_TOOL_VERSION\") | .value) = \"redhat\"" bundle/manifests/datadog-operator.clusterserviceversion.yaml

# Patch deploymentName, as `operator-sdk generate bundle` sets it to something that doesn't exist
eval $SED 's/datadog-operator-webhook/datadog-operator-manager/g' bundle/manifests/datadog-operator.clusterserviceversion.yaml


# The Operators in k8s-operatorhub/community-operators have slightly different requirements
COMM_OPS_PATH="bundle-community-operators/"
rm -rf "$COMM_OPS_PATH"
cp -R "bundle/" "$COMM_OPS_PATH"

# Delete spec.replaces
$YQ -i "del(.spec.\"replaces\")" "$COMM_OPS_PATH/manifests/datadog-operator.clusterserviceversion.yaml"

# set `DD_TOOL_VERSION` to `operatorhub`
$YQ -i "(.spec.install.spec.deployments[] | select(.name == \"datadog-operator-manager\") | .spec.template.spec.containers[] | select(.name == \"manager\") | .env[] | select(.name == \"DD_TOOL_VERSION\") | .value) = \"operatorhub\"" $COMM_OPS_PATH/manifests/datadog-operator.clusterserviceversion.yaml
6 changes: 6 additions & 0 deletions hack/redhat-bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ eval $SED -e \'s/operators.operatorframework.io.bundle.package.v1: datadog-opera
eval $SED \'s#image: gcr.io/datadoghq/operator:#image: registry.connect.redhat.com/datadog/operator:#g\' "$RH_BUNDLE_PATH/manifests/datadog-operator.clusterserviceversion.yaml"
eval $SED \'s#containerImage: gcr.io/datadoghq/operator:#containerImage: registry.connect.redhat.com/datadog/operator:#g\' "$RH_BUNDLE_PATH/manifests/datadog-operator.clusterserviceversion.yaml"

# set `DD_TOOL_VERSION` to `redhat`
$YQ -i "(.spec.install.spec.deployments[] | select(.name == \"datadog-operator-manager\") | .spec.template.spec.containers[] | select(.name == \"manager\") | .env[] | select(.name == \"DD_TOOL_VERSION\") | .value) = \"redhat\"" $RH_BUNDLE_PATH/manifests/datadog-operator.clusterserviceversion.yaml

# Pin images
$ROOT/bin/$PLATFORM/operator-manifest-tools pinning pin "$RH_BUNDLE_PATH/manifests" -a ~/.redhat/auths.json

Expand All @@ -39,3 +42,6 @@ eval $SED \'s/datadog-operator-certified/datadog-operator-certified-rhmp/g\' "$R
# Add marketplace annotations in CSV
$YQ -i '.metadata.annotations."marketplace.openshift.io/remote-workflow" = "https://marketplace.redhat.com/en-us/operators/datadog-operator-certified-rhmp/pricing?utm_source=openshift_console"' $RHMP_BUNDLE_PATH/manifests/datadog-operator-certified-rhmp.clusterserviceversion.yaml
$YQ -i '.metadata.annotations."marketplace.openshift.io/support-workflow" = "https://marketplace.redhat.com/en-us/operators/datadog-operator-certified-rhmp/support?utm_source=openshift_console"' $RHMP_BUNDLE_PATH/manifests/datadog-operator-certified-rhmp.clusterserviceversion.yaml

# set `DD_TOOL_VERSION` to `redhat`
$YQ -i "(.spec.install.spec.deployments[] | select(.name == \"datadog-operator-manager\") | .spec.template.spec.containers[] | select(.name == \"manager\") | .env[] | select(.name == \"DD_TOOL_VERSION\") | .value) = \"redhat\"" $RHMP_BUNDLE_PATH/manifests/datadog-operator-certified-rhmp.clusterserviceversion.yaml

0 comments on commit f201593

Please sign in to comment.