Skip to content

Add platform outputs - #26

Open
marcelovilla wants to merge 1 commit into
mainfrom
feat/platform-outputs
Open

Add platform outputs#26
marcelovilla wants to merge 1 commit into
mainfrom
feat/platform-outputs

Conversation

@marcelovilla

Copy link
Copy Markdown
Member

Adds the outputs consumers need to talk to the platform this action just deployed: the Keycloak and ArgoCD admin credentials (masked in logs), the gateway address, the domain, and the Keycloak issuer URL.

Implementation notes:

  • Credentials are read from the platform secrets. The realm admin password is polled briefly because NIC provisions it async.
  • The gateway address is looked up by the owning-Gateway label instead of a hardcoded namespace.
  • The domain and issuer URL are read from the deployed keycloak HTTPRoute, so NIC's domain defaulting is reflected. The config file is only a fallback.
  • Every output degrades to an empty string instead of failing the deploy.
  • All of this is scaffolding until Add a nic outputs command exposing the deployed platform's entry points nebari-infrastructure-core#606 gives us nic outputs.

Related to #12. This covers the outputs gap only, pack registration and in-cluster DNS are still open.

@viniciusdc viniciusdc left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @marcelo, re-reviewed this now that nebari-dev/nebari-infrastructure-core#609 (the new nic outputs) is on the table, and it shifts how I would read this a bit.

No blockers, and the module is honest that it is scaffolding until nic outputs lands (closes #606), so I would not over-invest here - once #609 is in, this whole extraction becomes the thin passthrough it already calls itself.

Two things I would fix before merge though, and #609 sharpens both - left them inline. The gateway lookup and the credential polling are the ones that matter; the rest are small.

Comment thread src/outputs.ts
'-l',
GATEWAY_SVC_SELECTOR,
'-o',
`jsonpath={.items[?(@.spec.type=="LoadBalancer")].status.loadBalancer.ingress[0].${field}}`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This jsonpath emits one value per matched item with no separator, so two LoadBalancer services matching the selector give you a fused 10.0.0.410.0.0.5. #609 does this same lookup in pkg/endpoint (owning-gateway-name, single-shot, hostname-or-IP) - worth matching that shape, or at least scoping the selector with owning-gateway-namespace.

Comment thread src/outputs.ts
// runs longer can read the secret themselves once it materializes.
setSecretOutput(
'keycloak-realm-admin-password',
poll('secret keycloak/nebari-realm-admin-credentials', 6, 5, () =>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#609 corrected something we had backwards: nebari-realm-admin-credentials is created eagerly in createKeycloakSecrets, not async by the PostSync hook, so this poll is not buying us anything. The one that is actually async is argocd-initial-admin-secret (Argo CD writes it on first start), and we read that one single-shot at :191 - that is the one that comes back empty on a fast or wait: false run. I would flip it: poll the argocd secret, drop the poll here.

Comment thread src/outputs.ts
let issuerUrl: string
if (issuerHost) {
domain = issuerHost.replace(/^keycloak\./, '')
issuerUrl = `https://${issuerHost}`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://${issuerHost} misses KeycloakBasePath - #609 pulls the issuer from NewTemplateData for exactly that reason. Empty on default deploys so not urgent, but wrong once a base path is set.

Comment thread src/outputs.ts
readSecretKey('argocd', 'argocd-initial-admin-secret', 'password', env)
)

const gatewayIp = poll('gateway LoadBalancer address', 12, 5, () =>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sandbox just hit a metallb-speaker stall where the LB IP was not assigned for over 300s on cold kind, and a 60s poll would have come back empty there. Worth bumping, or leaning on nic outputs --wait once #609 lands.

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.

2 participants