kubesphere / devops-agent

Agents for Kubesphere DevOps
Apache License 2.0
61 stars 73 forks source link

How to manage jenkins agent with PodTemplate? #81

Closed PurplestViper closed 1 year ago

PurplestViper commented 1 year ago

In https://github.com/kubesphere/devops-agent/issues/75 and https://github.com/kubesphere/ks-devops/pull/764 it is mentioned to use new method to manage jenkins agent, but no documentation is provided. Then I searched in Google and found the following article published by Rick.

According to the description, I checked the yaml of devops-controller, devops-jenkins, and all of them were consistent with the article description except devops-controller args. The default devops-controller args is --enabled-controllers argocd=true --argocd-namespace=argocd --pipelinerun-data-store=configmap. Then I used kubectl to create the following PodTemplate, but jenkins-casc-config has not been updated. Changing devops-controller args to be consistent with the content of the article (--enabled-controllers all=false,jenkinsagent=true,jenkinsconfig=true) or --enabled-controllers all=true still doesn’t work. Is my understanding wrong?

apiVersion: v1
kind: PodTemplate
metadata:
  name: jenkins-agent-dotnet
  namespace: kubesphere-devops-system
  labels:
    jenkins.agent.pod: 'true'
  annotations:
    jenkins.agent.labels: "dotnet"
    inherit.from: "base"
    devops.kubesphere.io/displayNameEN: 'dotnet sdk 7.0.305'
    devops.kubesphere.io/descriptionEN: 'This is a PodTemplate for the Jenkins agent with dotnet sdk 7.0.305'
template:
  metadata:
    name: jenkins-agent-dotnet
  spec:
    containers:
      - name: jenkins-agent-dotnet
        image: 'kubesphere/builder-dotnet:v3.2.2-sdk-7.0.305'
        resources:
          requests:
            cpu: '100m'
            memory: 100Mi
          limits:
            cpu: '4000m'
            memory: 4096Mi
        volumeMounts:
          - name: containerd
            mountPath: /run/containerd/containerd.sock
          - name: buildkit
            mountPath: /run/buildkit/buildkitd.sock
          - name: nugetcache
            mountPath: /root/.nuget
          - name: sonarcache
            mountPath: /root/.sonar/cache
    volumes:
      - hostPath:
          path: /run/buildkit/buildkitd.sock
        name: buildkit
      - hostPath:
          path: /run/containerd/containerd.sock
        name: containerd
      - hostPath:
          path: /var/data/jenkins_dotnet_cache
        name: nugetcache
      - hostPath:
          path: /var/data/jenkins_sonar_cache
        name: sonarcache

kubesphere: v3.3.2 k8s: v1.24.9

yudong2015 commented 1 year ago

same as : https://github.com/kubesphere/ks-devops/issues/975