Small fixes on UX of Automated Root Rotation parameters (#29685)

This commit is contained in:
vinay-gopalan
2025-02-25 09:14:38 -08:00
committed by GitHub
parent 13d302d509
commit e8c07ec68e
7 changed files with 156 additions and 39 deletions

View File

@@ -40,8 +40,8 @@ type RotationJobConfigureRequest struct {
MountPoint string
ReqPath string
RotationSchedule string
RotationWindow int
RotationPeriod int
RotationWindow time.Duration
RotationPeriod time.Duration
}
type RotationJobDeregisterRequest struct {
@@ -58,7 +58,7 @@ func (s *RotationJob) Validate() error {
return fmt.Errorf("ReqPath is required")
}
if s.Schedule.RotationSchedule == "" && s.Schedule.RotationPeriod == 0 {
if s.Schedule.RotationSchedule == "" && s.Schedule.RotationPeriod.Seconds() == 0 {
return fmt.Errorf("RotationSchedule or RotationPeriod is required to set up rotation job")
}
@@ -78,8 +78,8 @@ func newRotationJob(configRequest *RotationJobConfigureRequest) (*RotationJob, e
rs := &RotationSchedule{
Schedule: cronSc,
RotationSchedule: configRequest.RotationSchedule,
RotationWindow: time.Duration(configRequest.RotationWindow) * time.Second,
RotationPeriod: time.Duration(configRequest.RotationPeriod) * time.Second,
RotationWindow: configRequest.RotationWindow,
RotationPeriod: configRequest.RotationPeriod,
NextVaultRotation: time.Time{},
LastVaultRotation: time.Time{},
}