kuma icon indicating copy to clipboard operation
kuma copied to clipboard

Cannot specify validation period for days/months/years when generating tokens using kumactl

Open bartsmykla opened this issue 3 years ago • 9 comments

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 avatar Jan 20 '22 09:01 bartsmykla

@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.

tharun208 avatar Jan 20 '22 09:01 tharun208

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.

github-actions[bot] avatar Feb 21 '22 08:02 github-actions[bot]

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.

github-actions[bot] avatar Oct 10 '22 08:10 github-actions[bot]

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.

github-actions[bot] avatar Jan 30 '23 08:01 github-actions[bot]

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.

github-actions[bot] avatar May 01 '23 07:05 github-actions[bot]

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.

github-actions[bot] avatar Aug 02 '23 07:08 github-actions[bot]

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.

github-actions[bot] avatar Nov 08 '23 07:11 github-actions[bot]

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.

github-actions[bot] avatar Feb 08 '24 07:02 github-actions[bot]

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.

github-actions[bot] avatar May 10 '24 07:05 github-actions[bot]

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.

github-actions[bot] avatar Aug 12 '24 07:08 github-actions[bot]

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"

slonka avatar Aug 12 '24 10:08 slonka