KNOX-3364: New loadAliasesFromK8sSecrets method in entrypoint.sh to l…#1282
Merged
Conversation
…oad aliases from k8s secrets. Install jq in the container as well.
Test Results28 tests 28 ✅ 3s ⏱️ Results for commit 9651977. |
smolnar82
approved these changes
Jun 29, 2026
smolnar82
left a comment
Contributor
There was a problem hiding this comment.
Just a minor observation on the curl command, it's not a blocker...
Comment on lines
+115
to
+119
| http_code=$(curl -sS \ | ||
| --cacert "${sa_ca_file}" \ | ||
| -H "Authorization: Bearer ${token}" \ | ||
| -o "${resp_file}" -w "%{http_code}" \ | ||
| "https://kubernetes.default.svc/api/v1/namespaces/${namespace}/secrets?labelSelector=${label}") || http_code="000" |
Contributor
There was a problem hiding this comment.
nit: there's no explicit timeout on the curl call. If the k8s API is slow or unreachable, this could stall container startup. Adding --max-time 10 or similar would make the failure path faster.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…oad aliases from k8s secrets. Install jq in the container as well.
KNOX-3364 - Bootstrap Knox aliases from labeled Kubernetes Secrets on container startup
What changes were proposed in this pull request?
Helper function to load Knox aliases from labeled Kubernetes Secrets. Uses the pod's mounted ServiceAccount token to list Secrets in the pod's namespace that carry KNOX_ALIAS_LABEL and feeds the names to
knoxcli create-k8s-alias, so aliases are restored on every pod restart. Skips silently when no ServiceAccount token is mounted (non-k8s runs); logs a warning and continues on API errors so Knox startup isn't blocked by transient cluster issues. Requires: jq in the image; the pod's ServiceAccount must have list on Secrets in its namespace.How was this patch tested?
Tested on a local kind cluster, tested by just running without k8s, tested with no secrets, tested with different labels
Secrets:
./bin/knoxcli.sh list-alias --cluster __gateway,sandbox