Repository: kubernetes/kubernetes (language: go)

Issue:
E0728 07:40:02.660770       1 run.go:74] "command failed" err="leaderElection.resourceLock: Invalid value: \"configmaps\": resourceLock value must be \"leases\""
### What happened?

E0728 07:40:02.660770       1 run.go:74] "command failed" err="leaderElection.resourceLock: Invalid value: \"configmaps\": resourceLock value must be \"leases\""

```
apiVersion: kubescheduler.config.k8s.io/v1
kind: KubeSchedulerConfiguration
clientConnection:
  kubeconfig: "/etc/kubernetes/scheduler.conf"
leaderElection:
  leaderElect: true
  leaseDuration: 15s
  renewDeadline: 10s
  resourceLock: configmaps
  resourceName: kube-configmap
  resourceNamespace: kube-system
  retryPeriod: 2s
```

### What did you expect to happen?

can use configmap

### How can we reproduce it (as minimally and precisely as possible)?

change scheduler config

### Anything else we need to know?

_No response_

### Kubernetes version

<details>
Client Version: v1.30.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.30.0
</details>


### Cloud provider

<details>
pve 8
</details>


### OS version

<details>

```console
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
```

</details>


### Install tools

<details>

</details>


### Container runtime (CRI) and version (if applicable)

<details>

</details>


### Related plugins (CNI, CSI, ...) and versions (if applicable)

<details>

</details>



Discussion / hints:
This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the `triage/accepted` label and provide further guidance.

The `triage/accepted` label can be added by org members by writing `/triage accepted` in a comment.


<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
</details>
/sig scheduling
The error message indicates that the `resourceLock` value should be `leases` instead of `configmaps`.
try with this

```
apiVersion: kubescheduler.config.k8s.io/v1
kind: KubeSchedulerConfiguration
clientConnection:
  kubeconfig: "/etc/kubernetes/scheduler.conf"
leaderElection:
  leaderElect: true
  leaseDuration: 15s
  renewDeadline: 10s
  resourceLock: leases
  resourceName: kube-configmap
  resourceNamespace: kube-system
  retryPeriod: 2s
```
/remove-kind bug
/kind support
I want to use configmap
> I want to use configmap

They're all being moved to leases for performance reasons, which is why that's the only value permitted by the validation currently https://github.com/kubernetes/kubernetes/issues/80289

You should use leases.

You can find this by searching the error message and following the history for introducing that check:
https://github.com/kubernetes/kubernetes/blame/e8588e6493222ab623f794ca4aeb5261f86ef3d3/pkg/scheduler/apis/config/validation/validation.go#L41-L45
/assign

Fix patch:
diff --git a/staging/src/k8s.io/component-base/config/options/leaderelectionconfig.go b/staging/src/k8s.io/component-base/config/options/leaderelectionconfig.go
index bf2a44a0a832a..bd90b6481cac2 100644
--- a/staging/src/k8s.io/component-base/config/options/leaderelectionconfig.go
+++ b/staging/src/k8s.io/component-base/config/options/leaderelectionconfig.go
@@ -42,8 +42,7 @@ func BindLeaderElectionFlags(l *config.LeaderElectionConfiguration, fs *pflag.Fl
 		"of a leadership. This is only applicable if leader election is enabled.")
 	fs.StringVar(&l.ResourceLock, "leader-elect-resource-lock", l.ResourceLock, ""+
 		"The type of resource object that is used for locking during "+
-		"leader election. Supported options are 'leases', 'endpointsleases' "+
-		"and 'configmapsleases'.")
+		"leader election. Supported options are 'leases'.")
 	fs.StringVar(&l.ResourceName, "leader-elect-resource-name", l.ResourceName, ""+
 		"The name of resource object that is used for locking during "+
 		"leader election.")


Test patch: