问题已解决。思路如下:
kubernetes 升级到 >= v1.23。
Kubesphere 通过 ks-installer + ansible 来安装各个组件,其中 ArgoCD 的相关信息如下:
https://github.com/kubesphere/ks-installer/blob/v3.4.1/roles/ks-devops/tasks/main.yaml
# line:176
- name: ks-devops | Upgrading or installing Argo CD
args:
executable: /bin/bash
shell: |
{{ bin_dir }}/helm upgrade --install devops {{ kubesphere_dir }}/ks-devops/charts/argo-cd-4.4.0.tgz \
-n argocd --create-namespace --reuse-values \
-f {{ kubesphere_dir }}/ks-devops/argo-cd-values.yaml
https://github.com/kubesphere/ks-installer/blob/v3.4.1/roles/ks-devops/templates/argo-cd-values.yaml.j2
通过 Kubesphere 的 Dockerfile 及 Makefile 可以知道,Kubesphere 把 argo-cd 的 helm chart 和 ansible task 都直接打进镜像里了。
https://github.com/kubesphere/ks-installer/blob/v3.4.1/Dockerfile
https://github.com/kubesphere/ks-installer/blob/v3.4.1/Makefile
我们只需要基于原镜像把 ansible task 和 helm chart 替换掉,同时关注下 helm chart values 是否有变更即可。
如果 helm chart values 有变更,则还需要替换 argo-cd-values.yaml.js
/kubesphere/installer/roles/ks-devops/tasks/main.yaml
/kubesphere/installer/roles/ks-devops/files/ks-devops/charts/argo-cd-4.4.0.tgz
操作
helm repo add argo https://argoproj.github.io/argo-helm
helm search repo argo
NAME CHART VERSION APP VERSION DESCRIPTION
argo/argo 1.0.0 v2.12.5 A Helm chart for Argo Workflows
argo/argo-cd 7.3.7 v2.11.5 A Helm chart for Argo CD, a declarative, GitOps...
argo/argo-ci 1.0.0 v1.0.0-alpha2 A Helm chart for Argo-CI
argo/argo-events 2.4.7 v1.9.2 A Helm chart for Argo Events, the event-driven ...
argo/argo-lite 0.1.0 Lighweight workflow engine for Kubernetes
argo/argo-rollouts 2.37.2 v1.7.1 A Helm chart for Argo Rollouts
helm pull argo/argo-cd --version 7.3.7
FROM kubesphere/ks-installer:v3.4.1-patch.0
WORKDIR /kubesphere/installer/roles/ks-devops/files/ks-devops/charts/
COPY . .
WORKDIR /kubesphere
USER root
RUN sed -i 's|argo-cd-4.4.0.tgz|argo-cd-7.3.7.tgz|g' /kubesphere/installer/roles/ks-devops/tasks/main.yaml
USER kubesphere
ls
Dockerfile argo-cd-7.3.7.tgz
docker build --no-cache -t {registry.example.com}/kubesphere/ks-installer:v3.4.1-patch.0-argocd-7.3.7 -f ./Dockerfile .
docker push {registry.example.com}/kubesphere/ks-installer:v3.4.1-patch.0-argocd-7.3.7
kubectl edit deploy ks-installer -n kubesphere-system
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l 'app in (ks-install, ks-installer)' -o jsonpath='{.items[0].metadata.name}') -f