kn secret create --tls-cert creates the certificate under the wrong key
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 91/100
Research direction
The issue points to pkg/commands/secret/create.go and shows the incorrect certificate key. Read the TLS secret creation code and check for related tests for kn secret create. Change the certificate key to Kubernetes’ expected tls.crt; done means the secret contains tls.crt and tls.key and the command succeeds against the API server.
Written by the indexing model from the issue text.
Description
Bug report
kn secret create NAME --tls-cert CERT --tls-key KEY creates a secret of type kubernetes.io/tls, but stores the certificate under the key tls.cert. Kubernetes expects the certificate under tls.crt (corev1.TLSCertKey). The API server validates kubernetes.io/tls secrets and rejects one that has no tls.crt entry, so the command fails. Consumers such as DomainMapping TLS also read tls.crt.
The code is in pkg/commands/secret/create.go:
certData := map[string]string{
"tls.cert": string(cerFromFile),
"tls.key": string(keyFromFile),
}
toCreate.Type = corev1.SecretTypeTLS
Expected behavior
The secret contains tls.crt and tls.key, the same as kubectl create secret tls.
Steps to reproduce the problem
kn secret create my-tls --tls-cert tls.crt --tls-key tls.key
The API server rejects the request with an error like data[tls.crt]: Required value.
kn version
main (5817cd7)
Knative (serving/eventing) version
Not applicable. The key name is set by kn.
- Dominant language
- Go
- Stars
- 387
- Forks
- 278
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 8
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from knative/client
-
--node-affinity panics without Type and wipes existing affinity settingsPossibly taken @NopeCharon claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Env vars given with --env/--env-value-from/--env-file are silently dropped when they can't be matched in the command linePossibly taken @NopeCharon claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
kind/bug lifecycle/stale triage/accepted
Difficulty 3/5 1-2 days Newbie friendliness 35/100
knative/client#1965 · 4 comments ·
Maintainers usually reply within 1 day
-
[48h Knative] KServe pluginMay be free again @sharmaansh21 claimed this 1070 days ago, and no pull request is open. Openknative48h triage/accepted
knative/client#1866 · 4 comments · 1 reaction · 2 assignees ·
Maintainers usually reply within 1 day
-
CLI: add support for experimental new filters API in triggerMay be free again @JuneOh710 claimed this 1071 days ago, and no pull request is open. Openkind/feature triage/accepted
Difficulty 3/5 1-2 days Newbie friendliness 45/100
knative/client#1833 · 6 comments ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
masahitojp/mariamem#108 ·
Maintainers usually reply within 1 day
-
[Bug] Pod detail shows CPU usage ten times too high, and throws on decimal memory suffixesPossibly taken @RaphaelFakhri claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 11 days
-
tsuru_app_cname and tsuru_app_router don't handle removal outside terraformPossibly taken @lbarrosby claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
contributor-friendly good-first-issue lang:go
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
irbis-sh/zen-desktop#870 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day