Skip to content

harbor.redis.pwdfromsecret should work without lookup#1894

Closed
cthtrifork wants to merge 2 commits intogoharbor:mainfrom
cthtrifork:patch-1
Closed

harbor.redis.pwdfromsecret should work without lookup#1894
cthtrifork wants to merge 2 commits intogoharbor:mainfrom
cthtrifork:patch-1

Conversation

@cthtrifork
Copy link

@cthtrifork cthtrifork commented Dec 18, 2024

Currently harbor.redis.pwdfromsecret fails when using ´dry-run` with helm, as it insist on making a lookup and fails if there is no secret. I have tried to make it fallback.

Otherwise exception is thrown:

 error calling include: template: harbor/templates/_helpers.tpl:182:25: executing "harbor.redis.cred" at <include "harbor.redis.pwdfromsecret" $>: error calling include: template: harbor/templates/_helpers.tpl:176:56: executing "harbor.redis.pwdfromsecret" at <.Values.redis.external.existingSecret>: nil pointer evaluating interface {}.REDIS_PASSWORD  

Currently `harbor.redis.pwdfromsecret` fails when using ´dry-run` with helm, as it insist on making a lookup and fails if there is no secret. I have tried to make it fallback.

Signed-off-by: Casper Thygesen <cth@trifork.com>
@MinerYang
Copy link
Collaborator

MinerYang commented Dec 23, 2024

Hi @cthtrifork ,

I understood this lookup validation would have some issues when using helm templates or dry-run purely cause it needs interactive with Kubernetes API and it is a limitation from helm.
Could you try to use --dry-run=server

Setting --dry-run=server will additionally execute any lookup in your chart towards the server.

ref: https://helm.sh/docs/chart_template_guide/debugging/

@PseudoResonance
Copy link

PseudoResonance commented Jan 6, 2025

This also breaks Helm diff, and Helmfile. Helm diff apparently has an environment variable you can set to enable this, but I can't get it to work through Helmfile, so I have no way to deploy Harbor at all...

Edit: Never mind, I just realized after commenting that I still needed to pass the argument as well as the environment variable. This can be done in the helmDefaults of Helmfile. But it's still annoying to have to set the environment variable outside of Helmfile.

helmDefaults:
  diffArgs:
    - "--dry-run=server"

@cthtrifork
Copy link
Author

cthtrifork commented Mar 4, 2025

--dry-run=server

@MinerYang

The lookup function can not be invoked with this flag is set

Update Complete. ⎈Happy Helming!⎈
Templating Helm chart to ./rendered
lookup_func.go:130: [ERROR] unable to retrieve resource list for: v1 , error: Get "https://127.0.0.1:43421/api/v1?timeout=32s": dial tcp 127.0.0.1:43421: connect: connection refused
lookup_func.go:104: [ERROR] unable to get apiresource from unstructured: /v1, Kind=Secret , error Get "https://127.0.0.1:43421/api/v1?timeout=32s": dial tcp 127.0.0.1:43421: connect: connection refused
Error: template: harbor/templates/registry/registry-secret.yaml:1:23: executing "harbor/templates/registry/registry-secret.yaml" at <lookup "v1" "Secret" .Release.Namespace (include "harbor.registry" .)>: error calling lookup: unable to get apiresource from unstructured: /v1, Kind=Secret: Get "https://127.0.0.1:43421/api/v1?timeout=32s": dial tcp 127.0.0.1:43421: connect: connection refused

@cthtrifork
Copy link
Author

@PseudoResonance hi josh. Could you soon have a look at this?

@PseudoResonance
Copy link

@PseudoResonance hi josh. Could you soon have a look at this?

Did you mean to ping @MinerYang ? I'm not a maintainer of Harbor.

@cthtrifork
Copy link
Author

Yes I am sorry! I misclicked

@MinerYang
Copy link
Collaborator

Hi @cthtrifork ,

From the helm doc, the --dry-run-server mode should work with helm install not helm template

@github-actions
Copy link

This PR is being marked stale due to a period of inactivty. If this PR is still relevant, please comment or remove the stale label. Otherwise, this PR will close in 30 days.

@github-actions github-actions bot added the Stale label May 31, 2025
@github-actions
Copy link

This PR was closed because it has been stalled for 30 days with no activity. If this PR is still relevant, please re-open a new PR against main.

@github-actions github-actions bot closed this Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants