{"record":{"id":"07494d0f94de9bd0","repo":"kubernetes/kops","slug":"attachdetachreconcilesyncperiod-cannot-be-set-to-l","errorCode":null,"errorMessage":"AttachDetachReconcileSyncPeriod cannot be set to less than 1 second","messagePattern":"AttachDetachReconcileSyncPeriod cannot be set to less than 1 second","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/components/kubecontrollermanager.go","lineNumber":73,"sourceCode":"\t{\n\t\tklog.V(4).Infof(\"Kubernetes version %q supports AttachDetachReconcileSyncPeriod; will configure\", b.ControlPlaneKubernetesVersion().String())\n\t\t// If not set ... or set to 0s ... which is stupid\n\t\tif kcm.AttachDetachReconcileSyncPeriod == nil ||\n\t\t\tkcm.AttachDetachReconcileSyncPeriod.Duration.String() == \"0s\" {\n\n\t\t\tklog.V(8).Infof(\"AttachDetachReconcileSyncPeriod is not set; will set to default %v\", defaultAttachDetachReconcileSyncPeriod)\n\t\t\tkcm.AttachDetachReconcileSyncPeriod = &metav1.Duration{Duration: defaultAttachDetachReconcileSyncPeriod}\n\n\t\t\t// If less than 1 min and greater than 1 sec ... you get a warning\n\t\t} else if kcm.AttachDetachReconcileSyncPeriod.Duration < defaultAttachDetachReconcileSyncPeriod &&\n\t\t\tkcm.AttachDetachReconcileSyncPeriod.Duration > time.Second {\n\n\t\t\tklog.Infof(\"KubeControllerManager AttachDetachReconcileSyncPeriod is set lower than recommended: %s\", defaultAttachDetachReconcileSyncPeriod)\n\n\t\t\t// If less than 1sec you get an error.  Controller is coded to not allow configuration\n\t\t\t// less than one second.\n\t\t} else if kcm.AttachDetachReconcileSyncPeriod.Duration < time.Second {\n\t\t\treturn fmt.Errorf(\"AttachDetachReconcileSyncPeriod cannot be set to less than 1 second\")\n\t\t}\n\t}\n\n\tkcm.ClusterName = b.ClusterName\n\tkcm.CloudProvider = \"external\"\n\n\tif kcm.LogLevel == 0 {\n\t\tkcm.LogLevel = 2\n\t}\n\n\timage, err := Image(\"kube-controller-manager\", clusterSpec, b.AssetBuilder)\n\tif err != nil {\n\t\treturn err\n\t}\n\tkcm.Image = image\n\n\t// Doesn't seem to be any real downside to always doing a leader election\n\tkcm.LeaderElection = &kops.LeaderElectionConfiguration{LeaderElect: new(true)}","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/components/kubecontrollermanager.go#L55-L91","documentation":"BuildOptions in the KubeControllerManager component builder validates the AttachDetachReconcileSyncPeriod configured on the cluster spec. The kube-controller-manager itself refuses sub-second values for this flag, so kOps pre-emptively rejects anything under 1 second with this error to fail fast at cluster-spec validation time instead of at controller-manager startup.","triggerScenarios":"Setting cluster.spec.kubeControllerManager.attachDetachReconcileSyncPeriod to a duration below time.Second (e.g. \"500ms\", \"0s\") and then calling BuildOptions via the KCM builder, as exercised by Test_Build_KCM_Builder and Test_Build_KCM_Builder_Change_Duration.","commonSituations":"Operators tuning volume attach/detach reconciliation speed for stateful workloads copy a sub-second value from a blog or upstream flag docs; copying a k8s upstream flag default that is expressed in milliseconds; accidentally writing \"0\" meaning 'default' when the code interprets it as 0s.","solutions":["Set attachDetachReconcileSyncPeriod to at least 1s in cluster.spec.kubeControllerManager","Remove the field entirely to fall back to the kOps default (defaultAttachDetachReconcileSyncPeriod)","If faster reconciliation is needed, note the controller-manager hard-codes a 1s minimum, so choose 1s and tune other knobs instead"],"exampleFix":"// before\nspec:\n  kubeControllerManager:\n    attachDetachReconcileSyncPeriod: 500ms\n// after\nspec:\n  kubeControllerManager:\n    attachDetachReconcileSyncPeriod: 1s","handlingStrategy":"validation","validationCode":"d, err := time.ParseDuration(cluster.Spec.KubeControllerManager.AttachDetachReconcileSyncPeriod.Duration.String())\nif err != nil {\n    return fmt.Errorf(\"invalid attachDetachReconcileSyncPeriod: %w\", err)\n}\nif d < time.Second {\n    return fmt.Errorf(\"attachDetachReconcileSyncPeriod must be >= 1s, got %s\", d)\n}","typeGuard":null,"tryCatchPattern":"if err := builder.BuildOptions(cluster); err != nil {\n    if strings.Contains(err.Error(), \"AttachDetachReconcileSyncPeriod cannot be set to less than 1 second\") {\n        cluster.Spec.KubeControllerManager.AttachDetachReconcileSyncPeriod = metav1.Duration{Duration: time.Second}\n        err = builder.BuildOptions(cluster)\n    }\n    return err\n}","preventionTips":["Only set attachDetachReconcileSyncPeriod in multiples of seconds","Omit the field to use the kOps default","Add a unit test asserting durations >= 1s (see Test_Build_KCM_Builder_Change_Duration)"],"tags":["kube-controller-manager","configuration","validation","duration"],"backgroundTag":"invalid-config-value","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}