ks-devops icon indicating copy to clipboard operation
ks-devops copied to clipboard

Avoid getting label list directly from Jenkins

Open LinuxSuRen opened this issue 3 years ago • 3 comments

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

LinuxSuRen avatar Jul 14 '22 10:07 LinuxSuRen

/assign

LinuxSuRen avatar Jul 20 '22 09:07 LinuxSuRen

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

LinuxSuRen avatar Jul 20 '22 10:07 LinuxSuRen

See also image

LinuxSuRen avatar Jul 25 '22 03:07 LinuxSuRen