Skip to content
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

secretInjectionConfig applied when expectedResponse is false #78

Closed
drewburr opened this issue Jan 3, 2025 · 0 comments · Fixed by #79
Closed

secretInjectionConfig applied when expectedResponse is false #78

drewburr opened this issue Jan 3, 2025 · 0 comments · Fixed by #79
Labels
bug Something isn't working

Comments

@drewburr
Copy link

drewburr commented Jan 3, 2025

What happened?

When using a DisposableRequest, we are hoping to use expectedResponse as a way to stop processing if the response is not expected. For example, the below object shows that a 500 error was returned, and the body does not have the password key. We see that the DisposableRequest does not become ready, but secretInjectionConfigs seems to still run and we receive an unexpected object in our secret.

I wanted to check if this is expected, or if there is a configuration point we've missed that would prevent the body from being used to create a secret when expectedResponse is falsey. The hope would be that the secret would only be templated when the response passes the JQ test.

apiVersion: http.crossplane.io/v1alpha2
kind: DisposableRequest
spec:
  deletionPolicy: Orphan
  forProvider:
    body: |-
      { ... }
    expectedResponse: .body.password != null
    method: POST
    secretInjectionConfigs:
    - keyMappings:
      - responseJQ: .body | tostring
        secretKey: example-key
      secretRef:
        name: example-secret-name
        namespace: example-secret-namespace
  response:
    body: '{"statusCode":500,"error":"Internal Server Error","message":"An internal
      server error occurred"}'

Resulting secret data:

{
  "example-key": "{\"error\":\"Internal Server Error\",\"message\":\"An internal server error occurred\",\"statusCode\":500}"
}

How can we reproduce it?

Please let me know if a more complete example is needed, I could likely create something that uses a public facing API

What environment did it happen in?

Crossplane version: v1.17.1
K8s version: v1.29.8

@drewburr drewburr added the bug Something isn't working label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant