Accelerate ideas
Tsinghua source plug-address jenkins
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
View json, there are still a lot of point source
updates.jenkins-ci.org
Ideas, add pod jenkins is located in a sidecar, updates.jenkins-ci.org will be redirected to mirrors.tuna.tsinghua.edu.cn, not the original invasion mirrored jenkins, to facilitate future upgrades
Construction of proxy-tuna mirroring
docker build -t dolphintwo/jenkins-plugins-proxy:v0.1 .
- Dockerfile
FROM nginx:1.17.6-alpine
LABEL maintainer="dolphintwo [email protected]"
COPY nginx.conf /etc/nginx/nginx.conf
- nginx.conf
user nginx; worker_processes auto; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; location /download/plugins { proxy_next_upstream http_502 http_504 error timeout invalid_header; proxy_set_header Host mirrors.tuna.tsinghua.edu.cn; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; rewrite /download/plugins(.*) /jenkins/plugins/$1 break; proxy_pass https://mirrors.tuna.tsinghua.edu.cn; } } }
deploy
- Jenkins-deployment.yaml
apiVersion: apps/v1 kind: Deployment metadata: name: jenkins labels: name: jenkins spec: replicas: 1 selector: matchLabels: name: jenkins template: metadata: name: jenkins labels: name: jenkins spec: serviceAccountName: jenkins hostAliases: - ip: "127.0.0.1" hostnames: - "updates.jenkins-ci.org" containers: - name: tuna-proxy image: dolphintwo/jenkins-plugins-proxy:v0.1 imagePullPolicy: Always ports: - containerPort: 80 - name: jenkins image: jenkins/jenkins:lts-alpine imagePullPolicy: Always ports: - containerPort: 8080 - containerPort: 50000 resources: limits: cpu: 4 memory: 8Gi requests: cpu: 0.5 memory: 1000Mi env: - name: LIMITS_MEMORY valueFrom: resourceFieldRef: resource: limits.memory divisor: 1Mi - name: JAVA_OPTS value: -Xmx$(LIMITS_MEMORY)m -XshowSettings:vm -Dhudson.slaves.NodeProvisioner.initialDelay=0 -Dhudson.slaves.NodeProvisioner.MARGIN=50 -Dhudson.slaves.NodeProvisioner.MARGIN0=0.85 volumeMounts: - name: jenkins-home mountPath: /var/jenkins_home securityContext: fsGroup: 1000 volumes: - name: jenkins-home persistentVolumeClaim: claimName: jenkins-home
Note Adding sidecar intercepts the request and specify the host
Just this deployment demonstration experiments, should be able to create applications using stateful
verification
In the center of the plug-update plug-ins, log query pod in two containers
1 kubernetes-operator|⇒ kubectl -n ops logs jenkins-5f4996b99-77r98 jenkins --tail 50 2 ... 3 2019-12-27 07:36:14.430+0000 [id=84] INFO hudson.PluginManager#install: Starting installation of a batch of 1 plugins plus their dependencies 4 2019-12-27 07:36:21.510+0000 [id=85] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of localization-zh-cn on behalf of admin 5 2019-12-27 07:36:22.140+0000 [id=85] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading localization-zh-cn 6 2019-12-27 07:37:32.662+0000 [id=79] INFO hudson.PluginManager#install: Starting installation of a batch of 15 plugins plus their dependencies 7 2019-12-27 07:37:32.663+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of docker-commons on behalf of admin 8 2019-12-27 07:37:32.666+0000 [id=79] INFO hudson.model.UpdateSite$Plugin#deploy: Adding dependent install of pipeline-model-api for plugin pipeline-model-extensions 9 2019-12-27 07:37:33.703+0000 [id=90] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading docker-commons 10 2019-12-27 07:37:34.042+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of kubernetes on behalf of admin 11 2019-12-27 07:37:37.615+0000 [id=90] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading kubernetes 12 2019-12-27 07:37:43.745+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of pipeline-stage-tags-metadata on behalf of admin 13 2019-12-27 07:37:44.129+0000 [id=90] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading pipeline-stage-tags-metadata 14 2019-12-27 07:37:44.186+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of git-server on behalf of admin 15 2019-12-27 07:37:45.111+0000 [id=90] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading git-server 16 2019-12-27 07:37:45.186+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of workflow-api on behalf of admin 17 2019-12-27 07:37:46.614+0000 [id=90] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading workflow-api 18 2019-12-27 07:37:46.952+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of workflow-cps on behalf of admin 19 2019-12-27 07:37:47.469+0000 [id=90] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading workflow-cps 20 2019-12-27 07:37:48.834+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of pipeline-model-api on behalf of admin 21 2019-12-27 07:37:49.382+0000 [id=90] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading pipeline-model-api 22 2019-12-27 07:37:51.666+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of pipeline-model-extensions on behalf of admin 23 2019-12-27 07:37:52.192+0000 [id=90] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading pipeline-model-extensions 24 2019-12-27 07:37:52.308+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of kubernetes-cd on behalf of admin 25 2019-12-27 07:37:53.188+0000 [id=90] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading kubernetes-cd 26 2019-12-27 07:38:29.885+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of branch-api on behalf of admin 27 2019-12-27 07:38:30.424+0000 [id=90] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading branch-api 28 2019-12-27 07:38:31.292+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of cloudbees-folder on behalf of admin 29 2019-12-27 07:38:32.434+0000 [id=90] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading cloudbees-folder 30 2019-12-27 07:38:33.025+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of pipeline-model-definition on behalf of admin 31 2019-12-27 07:38:33.521+0000 [id=90] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading pipeline-model-definition 32 2019-12-27 07:38:35.165+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of pipeline-model-api on behalf of admin 33 2019-12-27 07:38:35.165+0000 [id=90] INFO h.m.UpdateCenter$InstallationJob#_run: Skipping duplicate install of: Pipeline: Model API@1.5.0 34 2019-12-27 07:38:35.166+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Installation successful: pipeline-model-api 35 2019-12-27 07:38:35.166+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of config-file-provider on behalf of admin 36 2019-12-27 07:38:35.738+0000 [id=90] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading config-file-provider 37 2019-12-27 07:38:36.331+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of gradle on behalf of admin 38 2019-12-27 07:38:39.430+0000 [id=90] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading gradle 39 2019-12-27 07:38:41.012+0000 [id=90] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of role-strategy on behalf of admin 40 2019-12-27 07:38:41.536+0000 [id=90] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading role-strategy 41 kubernetes-operator|⇒ kubectl -n ops logs jenkins-5f4996b99-77r98 tuna-proxy --tail 50 42 127.0.0.1 - - [27/Dec/2019:07:36:22 +0000] "GET /download/plugins/localization-zh-cn/1.0.13/localization-zh-cn.hpi HTTP/1.1" 200 542952 "-" "Java/1.8.0_212" "-" 43 127.0.0.1 - - [27/Dec/2019:07:37:34 +0000] "GET /download/plugins/docker-commons/1.16/docker-commons.hpi HTTP/1.1" 200 91018 "-" "Java/1.8.0_212" "-" 44 127.0.0.1 - - [27/Dec/2019:07:37:43 +0000] "GET /download/plugins/kubernetes/1.22.3/kubernetes.hpi HTTP/1.1" 200 995984 "-" "Java/1.8.0_212" "-" 45 127.0.0.1 - - [27/Dec/2019:07:37:44 +0000] "GET /download/plugins/pipeline-stage-tags-metadata/1.5.0/pipeline-stage-tags-metadata.hpi HTTP/1.1" 200 10708 "-" "Java/1.8.0_212" "-" 46 127.0.0.1 - - [27/Dec/2019:07:37:45 +0000] "GET /download/plugins/git-server/1.9/git-server.hpi HTTP/1.1" 200 30408 "-" "Java/1.8.0_212" "-" 47 127.0.0.1 - - [27/Dec/2019:07:37:46 +0000] "GET /download/plugins/workflow-api/2.38/workflow-api.hpi HTTP/1.1" 200 155980 "-" "Java/1.8.0_212" "-" 48 127.0.0.1 - - [27/Dec/2019:07:37:48 +0000] "GET /download/plugins/workflow-cps/2.78/workflow-cps.hpi HTTP/1.1" 200 597525 "-" "Java/1.8.0_212" "-" 49 127.0.0.1 - - [27/Dec/2019:07:37:51 +0000] "GET /download/plugins/pipeline-model-api/1.5.0/pipeline-model-api.hpi HTTP/1.1" 200 2436323 "-" "Java/1.8.0_212" "-" 50 127.0.0.1 - - [27/Dec/2019:07:37:52 +0000] "GET /download/plugins/pipeline-model-extensions/1.5.0/pipeline-model-extensions.hpi HTTP/1.1" 200 38764 "-" "Java/1.8.0_212" "-" 51 127.0.0.1 - - [27/Dec/2019:07:38:29 +0000] "GET /download/plugins/kubernetes-cd/2.2.0/kubernetes-cd.hpi HTTP/1.1" 200 34436567 "-" "Java/1.8.0_212" "-" 52 127.0.0.1 - - [27/Dec/2019:07:38:31 +0000] "GET /download/plugins/branch-api/2.5.5/branch-api.hpi HTTP/1.1" 200 308984 "-" "Java/1.8.0_212" "-" 53 127.0.0.1 - - [27/Dec/2019:07:38:32 +0000] "GET /download/plugins/cloudbees-folder/6.10.1/cloudbees-folder.hpi HTTP/1.1" 200 218594 "-" "Java/1.8.0_212" "-" 54 127.0.0.1 - - [27/Dec/2019:07:38:35 +0000] "GET /download/plugins/pipeline-model-definition/1.5.0/pipeline-model-definition.hpi HTTP/1.1" 200 1490265 "-" "Java/1.8.0_212" "-" 55 127.0.0.1 - - [27/Dec/2019:07:38:36 +0000] "GET /download/plugins/config-file-provider/3.6.3/config-file-provider.hpi HTTP/1.1" 200 196260 "-" "Java/1.8.0_212" "-" 56 127.0.0.1 - - [27/Dec/2019:07:38:40 +0000] "GET /download/plugins/gradle/1.35/gradle.hpi HTTP/1.1" 200 71048 "-" "Java/1.8.0_212" "-" 57 127.0.0.1 - - [27/Dec/2019:07:38:41 +0000] "GET /download/plugins/role-strategy/2.16/role-strategy.hpi HTTP/1.1" 200 104551 "-" "Java/1.8.0_212" "-"
success!