-
Notifications
You must be signed in to change notification settings - Fork 2.3k
NO-JIRA: Add optional TLS scanner CI job for cert-manager-operator #82715
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
Changes from all commits
ed976da
ebebc78
d2c7ad2
3aca361
0389fe4
7bf722c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,10 @@ base_images: | |
| name: "4.19" | ||
| namespace: origin | ||
| tag: operator-sdk | ||
| tls-scanner-tool: | ||
| name: tls-scanner | ||
| namespace: tls-scanner | ||
| tag: tls-scanner-tool | ||
| upi-installer: | ||
| name: "4.22" | ||
| namespace: ocp | ||
|
|
@@ -424,6 +428,108 @@ tests: | |
| requests: | ||
| cpu: 100m | ||
| workflow: openshift-e2e-azure-manual-oidc-workload-identity | ||
| - always_run: false | ||
| as: tls-scanner | ||
| optional: true | ||
| steps: | ||
| cluster_profile: openshift-org-aws | ||
| dependencies: | ||
| OO_BUNDLE: cert-manager-operator-bundle | ||
| env: | ||
| OO_INSTALL_MODE: AllNamespaces | ||
| OO_INSTALL_NAMESPACE: cert-manager-operator | ||
| OO_SECURITY_CONTEXT: restricted | ||
| SCAN_NAMESPACE: cert-manager-operator,cert-manager | ||
| SCANNER_CPU: "1" | ||
| SCANNER_MEMORY: 1Gi | ||
| TLS_13_ENABLE_TLS_ADHERENCE: "true" | ||
| TLS_13_TLS_ADHERENCE_POLICY: StrictAllComponents | ||
| test: | ||
| - as: deploy-operand | ||
| cli: latest | ||
| commands: |- | ||
| set -o errexit | ||
| set -o nounset | ||
| set -o pipefail | ||
|
|
||
| echo "Waiting for default cert-manager operand deployments..." | ||
| oc wait --for=create namespace/cert-manager --timeout=5m | ||
| oc wait --for=create -n cert-manager deployment/cert-manager --timeout=5m | ||
| oc wait --for=create -n cert-manager deployment/cert-manager-webhook --timeout=5m | ||
| oc wait --for=create -n cert-manager deployment/cert-manager-cainjector --timeout=5m | ||
| oc wait --for=condition=Available -n cert-manager deployment/cert-manager --timeout=5m | ||
| oc wait --for=condition=Available -n cert-manager deployment/cert-manager-webhook --timeout=5m | ||
| oc wait --for=condition=Available -n cert-manager deployment/cert-manager-cainjector --timeout=5m | ||
|
|
||
| echo "Enabling TrustManager feature gate via subscription..." | ||
| # operator-sdk run bundle creates a versioned Subscription name | ||
| # (e.g. cert-manager-operator-v1-20-0-sub), not a fixed cert-manager-operator. | ||
| # Match e2e getCertManagerOperatorSubscription: list and patch the one present. | ||
| SUB=$(oc -n cert-manager-operator get subscriptions.operators.coreos.com -o jsonpath='{.items[0].metadata.name}') | ||
| if [[ -z "${SUB}" ]]; then | ||
| echo "No Subscription found in cert-manager-operator namespace" | ||
| oc -n cert-manager-operator get subscriptions.operators.coreos.com -o yaml || true | ||
| exit 1 | ||
| fi | ||
| echo "Patching Subscription ${SUB} (preserve existing env, match e2e patchSubscriptionWithEnvVars)" | ||
| PATCH=$(oc -n cert-manager-operator get "subscription/${SUB}" -o json | python3 -c 'import json,sys; sub=json.load(sys.stdin); cfg=(sub.get("spec") or {}).get("config") or {}; env=[e for e in (cfg.get("env") or []) if e.get("name")!="UNSUPPORTED_ADDON_FEATURES"]; env.append({"name":"UNSUPPORTED_ADDON_FEATURES","value":"TrustManager=true"}); print(json.dumps({"spec":{"config":{"env":env}}}))') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: it's always to be generic, but here I think it is not required, instead we could just patch it, since the subscription is fesh created. No harm having it though. |
||
| oc -n cert-manager-operator patch "subscription/${SUB}" --type=merge -p "${PATCH}" | ||
|
|
||
| echo "Waiting for TrustManager feature gate on operator deployment env and rollout..." | ||
| FOUND=false | ||
| for _ in $(seq 1 60); do | ||
| ENV_VAL=$(oc -n cert-manager-operator get deploy/cert-manager-operator-controller-manager \ | ||
| -o jsonpath='{range .spec.template.spec.containers[0].env[?(@.name=="UNSUPPORTED_ADDON_FEATURES")]}{.value}{end}' 2>/dev/null || true) | ||
| if [[ "${ENV_VAL}" == "TrustManager=true" ]]; then | ||
| echo "Found UNSUPPORTED_ADDON_FEATURES=${ENV_VAL} on operator deployment" | ||
| FOUND=true | ||
| break | ||
| fi | ||
| sleep 5 | ||
| done | ||
| if [[ "${FOUND}" != "true" ]]; then | ||
| echo "Timed out waiting for UNSUPPORTED_ADDON_FEATURES=TrustManager=true on operator deployment" | ||
| oc -n cert-manager-operator get deploy/cert-manager-operator-controller-manager -o yaml || true | ||
| exit 1 | ||
| fi | ||
| oc -n cert-manager-operator rollout status deployment/cert-manager-operator-controller-manager --timeout=5m | ||
|
|
||
| echo "Creating TrustManager CR (minimal, match e2e newTrustManagerCR)..." | ||
| oc apply -f - <<EOF | ||
| apiVersion: operator.openshift.io/v1alpha1 | ||
| kind: TrustManager | ||
| metadata: | ||
| name: cluster | ||
| spec: | ||
| trustManagerConfig: {} | ||
| EOF | ||
|
|
||
| echo "Waiting for TrustManager Ready and trust-manager deployment..." | ||
| FOUND=false | ||
| for _ in $(seq 1 60); do | ||
| READY=$(oc get trustmanagers.operator.openshift.io cluster \ | ||
| -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}' 2>/dev/null || true) | ||
| if [[ "${READY}" == "True" ]]; then | ||
| echo "TrustManager CR is Ready" | ||
| FOUND=true | ||
| break | ||
| fi | ||
| sleep 5 | ||
| done | ||
| if [[ "${FOUND}" != "true" ]]; then | ||
| echo "Timed out waiting for TrustManager Ready=True" | ||
| oc get trustmanagers.operator.openshift.io cluster -o yaml || true | ||
| exit 1 | ||
| fi | ||
| oc wait --for=create -n cert-manager deployment/trust-manager --timeout=5m | ||
| oc wait --for=condition=Available -n cert-manager deployment/trust-manager --timeout=5m | ||
| from: src | ||
| resources: | ||
| requests: | ||
| cpu: 100m | ||
| - ref: tls-13 | ||
| - ref: tls-scanner-run | ||
|
Comment on lines
+530
to
+531
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift Do not use the scanner’s default privileged host mode without an explicit security decision. This workflow does not set Use a supported restricted scanner mode for standard AWS clusters, or update the shared step before adding this workflow. If host mode is required, document and approve the exception. #!/usr/bin/env bash
set -euo pipefail
fd -t f -g 'tls-scanner-run-ref.yaml' -g 'tls-scanner-run-commands.sh' \
-x rg -n -C 4 \
'TLS_SCANNER_CLUSTER_LABEL|privileged: true|hostNetwork|hostPID|runAsUser|cluster-admin|allowPrivilegeEscalation|runAsNonRoot|capabilities'As per path instructions, this YAML review must flag 🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you let us know, where are you suggesting the change to be made?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
fd -t f -g 'tls-scanner-run-ref.yaml' -g 'tls-scanner-run-commands.sh' \
-x sh -c '
echo "===== $1 ====="
rg -n -C 5 "TLS_SCANNER_CLUSTER_LABEL|privileged: true|hostNetwork|hostPID|cluster-admin" "$1"
' sh {}Length of output: 682 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
step_dir='ci-operator/step-registry/tls/scanner/run'
echo '===== files ====='
fd -t f . "$step_dir"
echo '===== relevant configuration ====='
fd -t f . "$step_dir" -x rg -n -C 5 \
'TLS_SCANNER_CLUSTER_LABEL|privileged: true|hostNetwork|hostPID|cluster-admin|restricted'Length of output: 7878
For example, a HyperShift workflow would set: env:
TLS_SCANNER_CLUSTER_LABEL: guestHowever, I verified the current
Therefore, this job cannot select a supported restricted mode only by editing its
I should have stated this limitation in the original comment. 🧠 Learnings usedYou are interacting with an AI system. |
||
| workflow: optional-operators-ci-operator-sdk-aws | ||
| zz_generated_metadata: | ||
| branch: master | ||
| org: openshift | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: what is the use of the command here?