Skip to content

Commit

Permalink
fix: reintroduce env var CONTAINERDEBUG_LOG_DIRECTORY (#670)
Browse files Browse the repository at this point in the history
* fix: reintroduce env var CONTAINERDEBUG_LOG_DIRECTORY

* factor out ctnrdebug test
  • Loading branch information
razvan authored Jan 13, 2025
1 parent 4e632b1 commit 797c6af
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions rust/operator-binary/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,10 @@ fn build_server_rolegroup_daemonset(
&opa_container_name,
)])
.add_env_vars(env)
.add_env_var(
"CONTAINERDEBUG_LOG_DIRECTORY",
format!("{STACKABLE_LOG_DIR}/containerdebug"),
)
.add_container_port(APP_PORT_NAME, APP_PORT.into())
.add_volume_mount(CONFIG_VOLUME_NAME, CONFIG_DIR)
.context(AddVolumeMountSnafu)?
Expand Down
9 changes: 0 additions & 9 deletions tests/templates/kuttl/smoke/10-assert.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,3 @@ spec:
- name: vector
{% endif %}
terminationGracePeriodSeconds: 125 # 2 minutes + 5s safety buffer
---
# This test checks if the containerdebug-state.json file is present and valid
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 600
commands:
- script: |
FIRST_OPA_POD=$(kubectl get -n $NAMESPACE pods --field-selector=status.phase=Running --selector app.kubernetes.io/instance=test-opa -o jsonpath='{.items[0].metadata.name}')
kubectl exec -n $NAMESPACE --container opa $FIRST_OPA_POD -- cat /stackable/log/containerdebug-state.json | jq --exit-status
9 changes: 9 additions & 0 deletions tests/templates/kuttl/smoke/11-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# This test checks if the containerdebug-state.json file is present and valid
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 600
commands:
- script: |
FIRST_OPA_POD=$(kubectl get -n $NAMESPACE pods --field-selector=status.phase=Running --selector app.kubernetes.io/instance=test-opa -o jsonpath='{.items[0].metadata.name}')
kubectl exec -n $NAMESPACE --container opa $FIRST_OPA_POD -- cat /stackable/log/containerdebug-state.json | jq --exit-status '"valid JSON"'

0 comments on commit 797c6af

Please sign in to comment.