Skip to content

fix: compare enum fields by name in Qute templates - #331

Open
Abhayanthk wants to merge 3 commits into
microcks:mainfrom
Abhayanthk:fix/330-grpc-ingress-condition
Open

Abhayanthk wants to merge 3 commits into
microcks:mainfrom
Abhayanthk:fix/330-grpc-ingress-condition

Conversation

@Abhayanthk

@Abhayanthk Abhayanthk commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Several template conditions compared an enum field with a string, for example {#if spec.commonExpositions.type == "INGRESS"}. In Qute an enum is never equal to a String, so these conditions were always false. Because of this, the web app never got its gRPC TLS properties, even with the default INGRESS exposition, and the async minion never got its SQS and SNS profile credentials settings.

This PR compares the enum's name instead, as #306 did for the Kafka authentication type. It also fixes the SNS condition, which checked the SQS secret by mistake.

To keep this from happening again, it adds a test that scans every template and fails when a condition compares an enum with a string.

With this change, the web app's gRPC server uses the certificate the operator already generates, so gRPC traffic is encrypted (TLS) on default installs, as with the Helm chart.

Profile credentials also need their secret mounted in the async-minion pod, which the operator does not do yet. I'll open a separate issue for that.

Tests

  • MicrocksConfigMapDependentResourceTest: INGRESS renders both gRPC TLS properties, NONE and GATEWAYROUTE render neither.
  • AsyncMinionConfigMapDependentResourceTest: SQS and SNS profile credentials render their profile name and location (including SNS with only its own secret), env-variable renders neither.
  • QuteTemplateEnumComparisonTest: on main it reports exactly the three broken conditions, on this branch it passes.
  • The new tests fail on main and pass with the fix. Full operator suite on a k3s cluster: 24 tests, 0 failures.
  • End to end on k3s (a Microcks CR with default exposition settings, Keycloak off to save memory): on main the gRPC port 9090 does not speak TLS, with the fix it completes a TLS handshake using the generated certificate.

Related issue(s)

Fixes #330

I used AI tools while working on this and verified everything myself.

`commonExpositions.type` is an ExpositionType enum, but the web app
template compared it to the String "INGRESS". The condition never
matched, so grpc.server.certChainFilePath and
grpc.server.privateKeyFilePath were never rendered, even with the
default INGRESS exposition.

Compare `type.name` instead, as done for the Kafka authentication type
in microcks#306.

Fixes microcks#330

Signed-off-by: Abhayanth K <abhayanth2006@gmail.com>
`credentialsType` is the AmazonCredentialsProviderType enum, but the
SQS and SNS conditions compared it to the String 'profile'. They never
matched, so credentials-profile-name and credentials-profile-location
were never rendered. Compare `credentialsType.name` instead, as done
for the Kafka authentication and exposition types.

The SNS condition also checked `sqs.credentialsSecretRef` instead of
`sns.credentialsSecretRef`.

Refs microcks#330

Signed-off-by: Abhayanth K <abhayanth2006@gmail.com>
Fail when an {#if} or {#else if} condition compares an expression with
a string literal and that expression resolves to an enum through the
@CheckedTemplate parameter types. Qute never finds an enum equal to a
String, so such a condition silently never matches (microcks#330). Expressions
that cannot be resolved also fail the test, so they get checked by hand.

Refs microcks#330

Signed-off-by: Abhayanth K <abhayanth2006@gmail.com>
@Abhayanthk

Copy link
Copy Markdown
Contributor Author

/cc @lbroudoux PTAL when you have time.

This branch had an error being deployed

1 failed deployment
Build — c58f5737 Deployed Oct 23, 2026 by Abhayanthk via build-verify-package #522
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

{#if spec.commonExpositions.type == "INGRESS"} never matches, so the gRPC TLS properties are never rendered

1 participant