Skip to content

Commit 00a3cc0

Browse files
committed
chore(crd): fix rbac rules
Signed-off-by: Denis Karpelevich <[email protected]>
1 parent 24f5e51 commit 00a3cc0

37 files changed

+1073
-179
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ help: ## Display this help.
8282

8383
.PHONY: manifests
8484
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
85-
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
85+
$(CONTROLLER_GEN) rbac:roleName=argocd-image-updater-manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
8686

8787
.PHONY: generate
8888
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
@@ -160,7 +160,7 @@ docker-buildx: ## Build and push docker image for the manager for cross-platform
160160
.PHONY: build-installer
161161
build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment.
162162
mkdir -p dist
163-
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
163+
cd config/manager && $(KUSTOMIZE) edit set image argocd-image-updater-controller=${IMG}
164164
$(KUSTOMIZE) build config/default > dist/install.yaml
165165

166166
.PHONY: release-binaries
@@ -196,7 +196,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
196196

197197
.PHONY: deploy
198198
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
199-
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
199+
cd config/manager && $(KUSTOMIZE) edit set image argocd-image-updater-controller=${IMG}
200200
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
201201

202202
.PHONY: undeploy

api/v1alpha1/imageupdater_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ type ImageApplicationLastUpdated struct {
274274

275275
// +kubebuilder:object:root=true
276276
// +kubebuilder:subresource:status
277+
// +kubebuilder:resource:scope=Cluster
277278

278279
// ImageUpdater is the Schema for the imageupdaters API
279280
type ImageUpdater struct {

cmd/run.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,20 +266,25 @@ This enables a CRD-driven approach to automated image updates with Argo CD.
266266
return nil
267267
},
268268
}
269+
270+
// TODO: flags below are not documented yet and don't have env vars yet. Metrics and health checks will be implemented in GITOPS-7113
269271
controllerCmd.Flags().StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metrics endpoint binds to. Use :8443 for HTTPS or :8080 for HTTP, or leave as 0 to disable the metrics service.")
270272
controllerCmd.Flags().StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
271-
controllerCmd.Flags().BoolVar(&enableLeaderElection, "leader-election", true, "Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.")
272-
controllerCmd.Flags().StringVar(&leaderElectionNamespace, "leader-election-namespace", "", "The namespace used for the leader election lease. If empty, the controller will use the namespace of the pod it is running in. When running locally this value must be set.")
273273
controllerCmd.Flags().BoolVar(&secureMetrics, "metrics-secure", true, "If set, the metrics endpoint is served securely via HTTPS. Use --metrics-secure=false to use HTTP instead.")
274274
controllerCmd.Flags().BoolVar(&enableHTTP2, "enable-http2", false, "If set, HTTP/2 will be enabled for the metrics and webhook servers")
275275

276+
// TODO: most probably legacy flags. Will be checked in GITOPS-7113
277+
controllerCmd.Flags().IntVar(&cfg.HealthPort, "health-port", 8080, "port to start the health server on, 0 to disable")
278+
controllerCmd.Flags().IntVar(&cfg.MetricsPort, "metrics-port", 8081, "port to start the metrics server on, 0 to disable")
279+
280+
controllerCmd.Flags().BoolVar(&enableLeaderElection, "leader-election", true, "Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.")
281+
controllerCmd.Flags().StringVar(&leaderElectionNamespace, "leader-election-namespace", "", "The namespace used for the leader election lease. If empty, the controller will use the namespace of the pod it is running in. When running locally this value must be set.")
276282
controllerCmd.Flags().BoolVar(&cfg.DryRun, "dry-run", false, "run in dry-run mode. If set to true, do not perform any changes")
277283
controllerCmd.Flags().DurationVar(&cfg.CheckInterval, "interval", env.GetDurationVal("IMAGE_UPDATER_INTERVAL", 2*time.Minute), "interval for how often to check for updates")
278284
controllerCmd.Flags().StringVar(&cfg.LogLevel, "loglevel", env.GetStringVal("IMAGE_UPDATER_LOGLEVEL", "info"), "set the loglevel to one of trace|debug|info|warn|error")
279285
controllerCmd.Flags().StringVar(&cfg.LogFormat, "logformat", env.GetStringVal("IMAGE_UPDATER_LOGFORMAT", "text"), "set the log format to one of text|json")
280286
controllerCmd.Flags().StringVar(&kubeConfig, "kubeconfig", "", "full path to kubernetes client configuration, i.e. ~/.kube/config")
281-
controllerCmd.Flags().IntVar(&cfg.HealthPort, "health-port", 8080, "port to start the health server on, 0 to disable")
282-
controllerCmd.Flags().IntVar(&cfg.MetricsPort, "metrics-port", 8081, "port to start the metrics server on, 0 to disable")
287+
283288
controllerCmd.Flags().BoolVar(&once, "once", false, "run only once, same as specifying --warmup-cache=true, --interval=0 and --health-port=0")
284289
controllerCmd.Flags().StringVar(&cfg.RegistriesConf, "registries-conf-path", common.DefaultRegistriesConfPath, "path to registries configuration file")
285290
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)")

config/crd/bases/argocd-image-updater.argoproj.io_imageupdaters.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ spec:
1212
listKind: ImageUpdaterList
1313
plural: imageupdaters
1414
singular: imageupdater
15-
scope: Namespaced
15+
scope: Cluster
1616
versions:
1717
- name: v1alpha1
1818
schema:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: argocd-image-updater-config
5+
labels:
6+
app.kubernetes.io/name: argocd-image-updater-config
7+
app.kubernetes.io/part-of: argocd-image-updater-controller
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: argocd-image-updater-secret
5+
labels:
6+
app.kubernetes.io/name: argocd-image-updater-secret
7+
app.kubernetes.io/part-of: argocd-image-updater-controller
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: argocd-image-updater-ssh-config
5+
labels:
6+
app.kubernetes.io/name: argocd-image-updater-ssh-config
7+
app.kubernetes.io/part-of: argocd-image-updater-controller

config/default/image-updater-cm.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

config/default/image-updater-secret.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

config/default/image-updater-ssh-config.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)