Avoid getting label list directly from Jenkins
Jenkins allows agents to add labels. The pipeline could choose agents based on labels. And we could fetch all the labels from /v1alpha2/devops/{name}/jenkins/labelsdashboard/labelsData which base on this plugin.
Proposal
In order to reduce the binding between Jenkins and APIServer. We could get the labels list, and store it in a ConfigMap. So, We could stop using the Jenkins API in APIServer. Users could use the CI feature with or without Jenkins.
Actions
- [x] Create a controller for fetching label list periodically
- [x] Create a new API for getting the label list
- [ ] #739
/kind feature /assign
/assign
I prefer to put the Jenkins labels to the existing ConfigMap. See also:
apiVersion: v1
data:
agent.pod_resource_limit: default
agent.labels: base, go, java
kind: ConfigMap
metadata:
name: jenkins-agent-config
namespace: kubesphere-devops-system
The front-end only needs the label name. So, we can only store the label names to a ConfigMap until more feature requests are required.
We could serve it with API GET /v1alpha3/ci/nodelabels
See also
