Loading...
Loading...
Compare original and translation side by side
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj-labs/argocd-image-updater/stable/config/install.yamlkubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj-labs/argocd-image-updater/stable/config/install.yamlhelm repo add argo https://argoproj.github.io/argo-helm
helm install argocd-image-updater argo/argocd-image-updater -n argocdhelm repo add argo https://argoproj.github.io/argo-helm
helm install argocd-image-updater argo/argocd-image-updater -n argocd| Strategy | Description | Use Case |
|---|---|---|
| Semantic versioning with constraints | Production apps with version control |
| Most recently built image | CI/CD pipelines, dev environments |
| Track mutable tags via SHA digest | When using |
| Lexical sort (CalVer, custom schemes) | Calendar versioning, custom schemes |
| 策略 | 说明 | 适用场景 |
|---|---|---|
| 带约束的语义化版本控制 | 采用版本控制的生产环境应用 |
| 最新构建的镜像 | CI/CD流水线、开发环境 |
| 通过SHA摘要跟踪可变标签 | 使用 |
| 字典序排序(日历版本、自定义规则) | 日历版本控制、自定义版本规则 |
| Method | Description | Persistence |
|---|---|---|
| Updates via Argo CD API (default) | Pseudo-persistent (survives restarts) |
| Commits changes to Git repository | Permanent (requires Argo CD v2.0+) |
| 方式 | 说明 | 持久化特性 |
|---|---|---|
| 通过Argo CD API更新(默认方式) | 伪持久化(重启后仍保留) |
| 将变更提交到Git仓库 | 永久持久化(需要Argo CD v2.0+版本) |
apiVersion: argocd-image-updater.argoproj.io/v1alpha1
kind: ImageUpdater
metadata:
name: my-image-updater
namespace: argocd
spec:
namespace: argocd
commonUpdateSettings:
updateStrategy: "semver"
forceUpdate: false
applicationRefs:
- namePattern: "my-app-*"
images:
- alias: "myimage"
imageName: "myregistry/myimage"apiVersion: argocd-image-updater.argoproj.io/v1alpha1
kind: ImageUpdater
metadata:
name: my-image-updater
namespace: argocd
spec:
namespace: argocd
commonUpdateSettings:
updateStrategy: "semver"
forceUpdate: false
applicationRefs:
- namePattern: "my-app-*"
images:
- alias: "myimage"
imageName: "myregistry/myimage"spec:
applicationRefs:
- namePattern: "production-*"
images:
- alias: "app"
imageName: "myregistry/app:1.x"
commonUpdateSettings:
updateStrategy: "semver"1.x1.*1.2.x>=1.0.0 <2.0.0~1.2.3^1.2.3spec:
applicationRefs:
- namePattern: "production-*"
images:
- alias: "app"
imageName: "myregistry/app:1.x"
commonUpdateSettings:
updateStrategy: "semver"1.x1.*1.2.x>=1.0.0 <2.0.0~1.2.3^1.2.3spec:
applicationRefs:
- namePattern: "dev-*"
images:
- alias: "app"
imageName: "myregistry/app"
commonUpdateSettings:
updateStrategy: "newest-build"spec:
applicationRefs:
- namePattern: "dev-*"
images:
- alias: "app"
imageName: "myregistry/app"
commonUpdateSettings:
updateStrategy: "newest-build"latestspec:
applicationRefs:
- namePattern: "staging-*"
images:
- alias: "app"
imageName: "myregistry/app:latest"
commonUpdateSettings:
updateStrategy: "digest"latestspec:
applicationRefs:
- namePattern: "staging-*"
images:
- alias: "app"
imageName: "myregistry/app:latest"
commonUpdateSettings:
updateStrategy: "digest"spec:
applicationRefs:
- namePattern: "calver-*"
images:
- alias: "app"
imageName: "myregistry/app"
commonUpdateSettings:
updateStrategy: "alphabetical"spec:
applicationRefs:
- namePattern: "calver-*"
images:
- alias: "app"
imageName: "myregistry/app"
commonUpdateSettings:
updateStrategy: "alphabetical"apiVersion: argocd-image-updater.argoproj.io/v1alpha1
kind: ImageUpdater
metadata:
name: my-image-updater
namespace: argocd
spec:
namespace: argocd
writeBackConfig:
method: "git"
gitConfig:
repository: "git@github.com:myorg/myrepo.git"
branch: "main"
writeBackTarget: "helmvalues:./values.yaml"
applicationRefs:
- namePattern: "my-app-*"
images:
- alias: "nginx"
imageName: "nginx:1.20"
manifestTargets:
helm:
name: "image.repository"
tag: "image.tag"apiVersion: argocd-image-updater.argoproj.io/v1alpha1
kind: ImageUpdater
metadata:
name: my-image-updater
namespace: argocd
spec:
namespace: argocd
writeBackConfig:
method: "git"
gitConfig:
repository: "git@github.com:myorg/myrepo.git"
branch: "main"
writeBackTarget: "helmvalues:./values.yaml"
applicationRefs:
- namePattern: "my-app-*"
images:
- alias: "nginx"
imageName: "nginx:1.20"
manifestTargets:
helm:
name: "image.repository"
tag: "image.tag"| Target | Description |
|---|---|
| Default, creates parameter override file |
| Updates kustomization.yaml |
| Updates specified Helm values file |
| 目标 | 说明 |
|---|---|
| 默认方式,创建参数覆盖文件 |
| 更新kustomization.yaml文件 |
| 更新指定的Helm values文件 |
apiVersion: v1
kind: Secret
metadata:
name: docker-registry-secret
namespace: argocd
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: <base64-encoded-docker-config>spec:
registries:
- name: myregistry
prefix: myregistry.example.com
credentials: pullsecret:argocd/docker-registry-secretapiVersion: v1
kind: Secret
metadata:
name: docker-registry-secret
namespace: argocd
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: <base64-encoded-docker-config>spec:
registries:
- name: myregistry
prefix: myregistry.example.com
credentials: pullsecret:argocd/docker-registry-secretapiVersion: v1
kind: Secret
metadata:
name: git-creds
namespace: argocd
type: Opaque
stringData:
username: git
password: <your-token-or-password>apiVersion: v1
kind: Secret
metadata:
name: git-creds
namespace: argocd
type: Opaque
stringData:
username: git
password: <your-token-or-password>metadata:
annotations:
argocd-image-updater.argoproj.io/image-list: myimage=myregistry/myimage
argocd-image-updater.argoproj.io/myimage.update-strategy: semver
argocd-image-updater.argoproj.io/myimage.allow-tags: regexp:^[0-9]+\.[0-9]+\.[0-9]+$
argocd-image-updater.argoproj.io/write-back-method: gitmetadata:
annotations:
argocd-image-updater.argoproj.io/image-list: myimage=myregistry/myimage
argocd-image-updater.argoproj.io/myimage.update-strategy: semver
argocd-image-updater.argoproj.io/myimage.allow-tags: regexp:^[0-9]+\.[0-9]+\.[0-9]+$
argocd-image-updater.argoproj.io/write-back-method: gitkubectl logs -n argocd -l app.kubernetes.io/name=argocd-image-updater -fkubectl logs -n argocd -l app.kubernetes.io/name=argocd-image-updater -fkubectl rollout restart deployment argocd-image-updater -n argocdkubectl rollout restart deployment argocd-image-updater -n argocdkubectl get applications -n argocd -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.annotations.argocd-image-updater\.argoproj\.io/image-list}{"\n"}{end}'kubectl get applications -n argocd -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.annotations.argocd-image-updater\.argoproj\.io/image-list}{"\n"}{end}'kubectl get imageupdaters -n argocd
kubectl describe imageupdater <name> -n argocdkubectl get imageupdaters -n argocd
kubectl describe imageupdater <name> -n argocdundefinedundefinedundefinedundefinedspec.namespacespec.namespacespec:
namespace: argocd # Only discover Applications in argocd namespacespec:
namespace: argocd # 仅从argocd命名空间发现应用undefinedundefinedundefinedundefinedargocdpullsecret:NAMESPACE/SECRET-NAMEundefinedargocdpullsecret:NAMESPACE/SECRET-NAMEundefinedundefinedundefinedreferences/