kuma
kuma copied to clipboard
Cannot specify validation period for days/months/years when generating tokens using kumactl
What happened?
As parsing time.Duration works only with time periods (i.e 1m
, 24h
, 23h59m
etc.) you cannot specify period in days/months/years as we suggests in help/docs of our commands:
https://github.com/kumahq/kuma/blob/8708885a8ef244f0806aa7d5dae08c7dde64a7bb/app/kumactl/cmd/generate/generate_zoneingress_token.go#L29
we can fix it by changing flag description/help, but I think we should add possibility to provide values like 1d
or 1y
by using something like https://github.com/hako/durafmt or similar
@bartsmykla, I remember facing a similar issue while working on expanding the ca expiration
field to include months and years also. I wrote a helper function ParseDuration
inside the mesh_helper
file. ref - https://github.com/tharun208/kuma/blob/master/pkg/core/resources/apis/mesh/mesh_helpers.go#L94.
I think this will help you. But there is a limitation with the above function as it won't support 23h59m
. If we are going with https://github.com/hako/durafmt means, we can also change for expiration
field on the mTLS.
This issue was inactive for 30 days it will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant please comment on it promptly or attend the next triage meeting.
This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.
This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.
This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.
This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.
This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.
This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.
This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.
This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.
Still the case:
kumactl generate zone-token --zone zone-1 --valid-for 30d --scope ingress
Error: invalid argument "30d" for "--valid-for" flag: time: unknown unit "d" in duration "30d"