Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
IMAGE_UPDATER_CONTROLLER_NAMESPACE?=argocd
IMAGE_NAMESPACE?=quay.io/argoprojlabs
IMAGE_NAME=argocd-image-updater
ifdef IMAGE_NAMESPACE
Expand Down Expand Up @@ -196,11 +197,11 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
.PHONY: deploy
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image argocd-image-updater-controller=${IMG}
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -n ${IMAGE_UPDATER_CONTROLLER_NAMESPACE} -f -

.PHONY: undeploy
undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
$(KUSTOMIZE) build config/default | $(KUBECTL) delete -n ${IMAGE_UPDATER_CONTROLLER_NAMESPACE} --ignore-not-found=$(ignore-not-found) -f -

##@ Dependencies

Expand Down
12 changes: 8 additions & 4 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,16 @@ This enables a CRD-driven approach to automated image updates with Argo CD.
WithValues(logrusFieldsToLogrValues(common.ControllerLogFields)...)

setupLogger.Info("Controller runtime logger initialized.", "setAppLogLevel", cfg.LogLevel)
setupLogger.Info("starting",
"app", version.BinaryName()+": "+version.Version(),
logFields := []interface{}{
"app", version.BinaryName() + ": " + version.Version(),
"loglevel", strings.ToUpper(cfg.LogLevel),
"interval", argocd.GetPrintableInterval(cfg.CheckInterval),
"healthPort", probeAddr,
)
}
if cfg.ArgocdNamespace != "" {
logFields = append(logFields, "argocdNamespace", cfg.ArgocdNamespace)
}
setupLogger.Info("starting", logFields...)

// Create context with signal handling
ctx := ctrl.SetupSignalHandler()
Expand Down Expand Up @@ -285,7 +289,7 @@ This enables a CRD-driven approach to automated image updates with Argo CD.
controllerCmd.Flags().StringVar(&cfg.RegistriesConf, "registries-conf-path", common.DefaultRegistriesConfPath, "path to registries configuration file")
controllerCmd.Flags().IntVar(&cfg.MaxConcurrentApps, "max-concurrent-apps", env.ParseNumFromEnv("MAX_CONCURRENT_APPS", 10, 1, 100), "maximum number of ArgoCD applications that can be updated concurrently (must be >= 1)")
controllerCmd.Flags().IntVar(&MaxConcurrentReconciles, "max-concurrent-reconciles", env.ParseNumFromEnv("MAX_CONCURRENT_RECONCILES", 1, 1, 10), "maximum number of concurrent Reconciles which can be run (must be >= 1)")
controllerCmd.Flags().StringVar(&cfg.ArgocdNamespace, "argocd-namespace", "", "namespace where ArgoCD runs in (current namespace by default)")
controllerCmd.Flags().StringVar(&cfg.ArgocdNamespace, "argocd-namespace", env.GetStringVal("ARGOCD_NAMESPACE", ""), "namespace where ArgoCD runs in (controller namespace by default)")
controllerCmd.Flags().BoolVar(&warmUpCache, "warmup-cache", true, "whether to perform a cache warm-up on startup")
controllerCmd.Flags().BoolVar(&cfg.DisableKubeEvents, "disable-kube-events", env.GetBoolVal("IMAGE_UPDATER_KUBE_EVENTS", false), "Disable kubernetes events")

Expand Down
2 changes: 1 addition & 1 deletion cmd/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestNewRunCommand(t *testing.T) {
asser.Equal(common.DefaultRegistriesConfPath, controllerCommand.Flag("registries-conf-path").Value.String())
asser.Equal(strconv.Itoa(env.ParseNumFromEnv("MAX_CONCURRENT_APPS", 10, 1, 100)), controllerCommand.Flag("max-concurrent-apps").Value.String())
asser.Equal(strconv.Itoa(env.ParseNumFromEnv("MAX_CONCURRENT_RECONCILES", 1, 1, 10)), controllerCommand.Flag("max-concurrent-reconciles").Value.String())
asser.Equal("", controllerCommand.Flag("argocd-namespace").Value.String())
asser.Equal(env.GetStringVal("ARGOCD_NAMESPACE", ""), controllerCommand.Flag("argocd-namespace").Value.String())
asser.Equal("true", controllerCommand.Flag("warmup-cache").Value.String())
asser.Equal(env.GetStringVal("GIT_COMMIT_USER", "argocd-image-updater"), controllerCommand.Flag("git-commit-user").Value.String())
asser.Equal(env.GetStringVal("GIT_COMMIT_EMAIL", "noreply@argoproj.io"), controllerCommand.Flag("git-commit-email").Value.String())
Expand Down
2 changes: 1 addition & 1 deletion cmd/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Supported registries:
webhookCmd.Flags().StringVar(&cfg.RegistriesConf, "registries-conf-path", common.DefaultRegistriesConfPath, "path to registries configuration file")
webhookCmd.Flags().IntVar(&cfg.MaxConcurrentApps, "max-concurrent-apps", env.ParseNumFromEnv("MAX_CONCURRENT_APPS", 10, 1, 100), "maximum number of ArgoCD applications that can be updated concurrently (must be >= 1)")
webhookCmd.Flags().IntVar(&MaxConcurrentUpdaters, "max-concurrent-updaters", env.ParseNumFromEnv("MAX_CONCURRENT_UPDATERS", 1, 1, 10), "maximum number of concurrent ImageUpdater CRs that can be processed (must be >= 1)")
webhookCmd.Flags().StringVar(&cfg.ArgocdNamespace, "argocd-namespace", "", "namespace where ArgoCD runs in (current namespace by default)")
webhookCmd.Flags().StringVar(&cfg.ArgocdNamespace, "argocd-namespace", env.GetStringVal("ARGOCD_NAMESPACE", ""), "namespace where ArgoCD runs in (controller namespace by default)")

webhookCmd.Flags().StringVar(&cfg.GitCommitUser, "git-commit-user", env.GetStringVal("GIT_COMMIT_USER", "argocd-image-updater"), "Username to use for Git commits")
webhookCmd.Flags().StringVar(&cfg.GitCommitMail, "git-commit-email", env.GetStringVal("GIT_COMMIT_EMAIL", "noreply@argoproj.io"), "E-Mail address to use for Git commits")
Expand Down
2 changes: 1 addition & 1 deletion cmd/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestNewWebhookCommand(t *testing.T) {
asser.Equal(common.DefaultRegistriesConfPath, controllerCommand.Flag("registries-conf-path").Value.String())
asser.Equal(strconv.Itoa(env.ParseNumFromEnv("MAX_CONCURRENT_APPS", 10, 1, 100)), controllerCommand.Flag("max-concurrent-apps").Value.String())
asser.Equal(strconv.Itoa(env.ParseNumFromEnv("MAX_CONCURRENT_UPDATERS", 1, 1, 10)), controllerCommand.Flag("max-concurrent-updaters").Value.String())
asser.Equal("", controllerCommand.Flag("argocd-namespace").Value.String())
asser.Equal(env.GetStringVal("ARGOCD_NAMESPACE", ""), controllerCommand.Flag("argocd-namespace").Value.String())
asser.Equal(env.GetStringVal("GIT_COMMIT_USER", "argocd-image-updater"), controllerCommand.Flag("git-commit-user").Value.String())
asser.Equal(env.GetStringVal("GIT_COMMIT_EMAIL", "noreply@argoproj.io"), controllerCommand.Flag("git-commit-email").Value.String())
asser.Equal(env.GetStringVal("GIT_COMMIT_SIGNING_KEY", ""), controllerCommand.Flag("git-commit-signing-key").Value.String())
Expand Down
3 changes: 0 additions & 3 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Adds namespace to all resources.
namespace: argocd-image-updater-system

# Labels to add to all resources and selectors.
#labels:
#- includeSelectors: true
Expand Down
1 change: 0 additions & 1 deletion config/default/metrics_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ metadata:
app.kubernetes.io/name: argocd-image-updater
app.kubernetes.io/managed-by: kustomize
name: argocd-image-updater-controller-metrics-service
namespace: argocd-image-updater-system
spec:
ports:
- name: https
Expand Down
35 changes: 9 additions & 26 deletions config/install.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: argocd-image-updater-system
control-plane: argocd-image-updater-controller
metrics: enabled
name: argocd-image-updater-system
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down Expand Up @@ -550,7 +540,6 @@ metadata:
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: argocd-image-updater
name: argocd-image-updater-controller
namespace: argocd-image-updater-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
Expand All @@ -560,7 +549,6 @@ metadata:
app.kubernetes.io/name: argocd-image-updater
app.kubernetes.io/part-of: argocd-image-updater
name: argocd-image-updater
namespace: argocd-image-updater-system
rules:
- apiGroups:
- ""
Expand All @@ -579,7 +567,6 @@ metadata:
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: argocd-image-updater
name: argocd-image-updater-leader-election-role
namespace: argocd-image-updater-system
rules:
- apiGroups:
- ""
Expand Down Expand Up @@ -697,15 +684,13 @@ metadata:
app.kubernetes.io/name: argocd-image-updater
app.kubernetes.io/part-of: argocd-image-updater
name: argocd-image-updater
namespace: argocd-image-updater-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: argocd-image-updater
subjects:
- kind: ServiceAccount
name: argocd-image-updater-controller
namespace: argocd-image-updater-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand All @@ -714,15 +699,13 @@ metadata:
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: argocd-image-updater
name: argocd-image-updater-leader-election-rolebinding
namespace: argocd-image-updater-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: argocd-image-updater-leader-election-role
subjects:
- kind: ServiceAccount
name: argocd-image-updater-controller
namespace: argocd-image-updater-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand All @@ -738,7 +721,7 @@ roleRef:
subjects:
- kind: ServiceAccount
name: argocd-image-updater-controller
namespace: argocd-image-updater-system
namespace: argocd
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand All @@ -751,7 +734,7 @@ roleRef:
subjects:
- kind: ServiceAccount
name: argocd-image-updater-controller
namespace: argocd-image-updater-system
namespace: argocd
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand All @@ -764,7 +747,7 @@ roleRef:
subjects:
- kind: ServiceAccount
name: argocd-image-updater-controller
namespace: argocd-image-updater-system
namespace: argocd
---
apiVersion: v1
kind: ConfigMap
Expand All @@ -773,7 +756,6 @@ metadata:
app.kubernetes.io/name: argocd-image-updater-config
app.kubernetes.io/part-of: argocd-image-updater-controller
name: argocd-image-updater-config
namespace: argocd-image-updater-system
---
apiVersion: v1
kind: ConfigMap
Expand All @@ -782,7 +764,6 @@ metadata:
app.kubernetes.io/name: argocd-image-updater-ssh-config
app.kubernetes.io/part-of: argocd-image-updater-controller
name: argocd-image-updater-ssh-config
namespace: argocd-image-updater-system
---
apiVersion: v1
kind: Secret
Expand All @@ -791,7 +772,6 @@ metadata:
app.kubernetes.io/name: argocd-image-updater-secret
app.kubernetes.io/part-of: argocd-image-updater-controller
name: argocd-image-updater-secret
namespace: argocd-image-updater-system
---
apiVersion: v1
kind: Service
Expand All @@ -801,7 +781,6 @@ metadata:
app.kubernetes.io/name: argocd-image-updater
control-plane: argocd-image-updater-controller
name: argocd-image-updater-controller-metrics-service
namespace: argocd-image-updater-system
spec:
ports:
- name: https
Expand All @@ -819,7 +798,6 @@ metadata:
app.kubernetes.io/name: argocd-image-updater-controller
control-plane: argocd-image-updater-controller
name: argocd-image-updater-controller
namespace: argocd-image-updater-system
spec:
replicas: 1
selector:
Expand All @@ -840,6 +818,12 @@ spec:
command:
- /manager
env:
- name: ARGOCD_NAMESPACE
valueFrom:
configMapKeyRef:
key: argocd.namespace
name: argocd-image-updater-config
optional: true
- name: IMAGE_UPDATER_INTERVAL
valueFrom:
configMapKeyRef:
Expand Down Expand Up @@ -1028,7 +1012,6 @@ metadata:
app.kubernetes.io/name: argocd-image-updater-controller
control-plane: argocd-image-updater-controller
name: allow-metrics-traffic
namespace: argocd-image-updater-system
spec:
ingress:
- from:
Expand Down
17 changes: 6 additions & 11 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
control-plane: argocd-image-updater-controller
app.kubernetes.io/name: argocd-image-updater-system
app.kubernetes.io/managed-by: kustomize
metrics: enabled
name: argocd-image-updater-system
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: argocd-image-updater-controller
namespace: argocd-image-updater-system
labels:
control-plane: argocd-image-updater-controller
app.kubernetes.io/name: argocd-image-updater-controller
Expand Down Expand Up @@ -67,6 +56,12 @@ spec:
image: argocd-image-updater-controller:latest
name: argocd-image-updater-controller
env:
- name: ARGOCD_NAMESPACE
valueFrom:
configMapKeyRef:
name: argocd-image-updater-config
key: argocd.namespace
optional: true
- name: IMAGE_UPDATER_INTERVAL
valueFrom:
configMapKeyRef:
Expand Down
1 change: 0 additions & 1 deletion config/network-policy/allow-metrics-traffic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ metadata:
app.kubernetes.io/name: argocd-image-updater-controller
app.kubernetes.io/managed-by: kustomize
name: allow-metrics-traffic
namespace: argocd-image-updater-system
spec:
podSelector:
matchLabels:
Expand Down
2 changes: 1 addition & 1 deletion config/prometheus/monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
app.kubernetes.io/name: argocd-image-updater
app.kubernetes.io/managed-by: kustomize
name: argocd-image-updater-controller-metrics-monitor
namespace: system
namespace: argocd
spec:
endpoints:
- path: /metrics
Expand Down
1 change: 0 additions & 1 deletion config/rbac/leader_election_role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ roleRef:
subjects:
- kind: ServiceAccount
name: argocd-image-updater-controller
namespace: argocd-image-updater-system
2 changes: 1 addition & 1 deletion config/rbac/metrics_auth_role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ roleRef:
subjects:
- kind: ServiceAccount
name: argocd-image-updater-controller
namespace: argocd-image-updater-system
namespace: argocd
2 changes: 1 addition & 1 deletion config/rbac/metrics_reader_role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ roleRef:
subjects:
- kind: ServiceAccount
name: argocd-image-updater-controller
namespace: argocd-image-updater-system
namespace: argocd
2 changes: 1 addition & 1 deletion config/rbac/role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ roleRef:
subjects:
- kind: ServiceAccount
name: argocd-image-updater-controller
namespace: argocd-image-updater-system
namespace: argocd
1 change: 0 additions & 1 deletion config/rbac/service_account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ metadata:
app.kubernetes.io/name: argocd-image-updater
app.kubernetes.io/managed-by: kustomize
name: argocd-image-updater-controller
namespace: argocd-image-updater-system
7 changes: 5 additions & 2 deletions docs/install/cmd/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ Runs the Argo CD Image Updater in a reconciliation loop with a set of options.

### Flags

**-argocd-namespace *namespace***
**--argocd-namespace *namespace***

namespace where ArgoCD runs in (current namespace by default)
The namespace where Argo CD is running. Required only if the Image Updater runs in a different namespace than Argo CD.
Defaults to the namespace the controller is running in.

Can also be set with the `ARGOCD_NAMESPACE` environment variable.

**--disable-kube-events**

Expand Down
Loading