Skip to content
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bin/*
.idea
values.yaml
/build.sh
10 changes: 10 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ rules:
- patch
- update
- watch
- apiGroups:
- argoproj.io
resources:
- applications
- applicationsets
- appprojects
verbs:
- get
- list
- watch
- apiGroups:
- batch
resources:
Expand Down
23 changes: 5 additions & 18 deletions controller/cluster_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ func (r *CorootReconciler) clusterAgentClusterRole(cr *corootv1.Coroot) *rbacv1.
Resources: []string{"*"},
Verbs: verbs,
},
{
APIGroups: []string{"argoproj.io"},
Resources: []string{"applications", "applicationsets", "appprojects"},
Verbs: verbs,
},
},
}
return role
Expand Down Expand Up @@ -126,8 +131,6 @@ func (r *CorootReconciler) clusterAgentDeployment(cr *corootv1.Coroot) *appsv1.D
env = append(env, e)
}
image := r.getAppImage(cr, AppClusterAgent)
ksmImage := r.getAppImage(cr, AppKubeStateMetrics)

volumeMounts := []corev1.VolumeMount{
{Name: "tmp", MountPath: "/tmp"},
}
Expand Down Expand Up @@ -181,22 +184,6 @@ func (r *CorootReconciler) clusterAgentDeployment(cr *corootv1.Coroot) *appsv1.D
VolumeMounts: volumeMounts,
Env: env,
},
{
Image: ksmImage.Name,
ImagePullPolicy: ksmImage.PullPolicy,
Name: "kube-state-metrics",
Args: []string{
"--host=127.0.0.1",
"--port=10302",
"--resources=namespaces,nodes,daemonsets,deployments,cronjobs,jobs,persistentvolumeclaims,persistentvolumes,pods,replicasets,services,endpoints,statefulsets,storageclasses,volumeattachments",
"--metric-labels-allowlist=pods=[*]",
"--metric-annotations-allowlist=*=[coroot.com/application-category,coroot.com/custom-application-name]",
},
Resources: corev1.ResourceRequirements{
Requests: cr.Spec.ClusterAgent.Resources.Requests,
Limits: cr.Spec.ClusterAgent.Resources.Limits,
},
},
},
Volumes: volumes,
},
Expand Down
1 change: 1 addition & 0 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func detectIngressAPIVersion(mgr ctrl.Manager) string {
// +kubebuilder:rbac:groups=security.openshift.io,resources=securitycontextconstraints,verbs=use
// +kubebuilder:rbac:groups=apiextensions.k8s.io,resources=customresourcedefinitions,verbs=get;list;watch
// +kubebuilder:rbac:groups=source.toolkit.fluxcd.io;kustomize.toolkit.fluxcd.io;helm.toolkit.fluxcd.io;notification.toolkit.fluxcd.io;image.toolkit.fluxcd.io;fluxcd.controlplane.io,resources=*,verbs=get;list;watch
// +kubebuilder:rbac:groups=argoproj.io,resources=applications;applicationsets;appprojects,verbs=get;list;watch

func (r *CorootReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
logger := ctrl.Log.WithValues("namespace", req.Namespace, "name", req.Name)
Expand Down
9 changes: 2 additions & 7 deletions controller/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ import (
)

const (
ClickhouseImage = "clickhouse:25.11.2-ubi9-0"
PrometheusImage = "prometheus:2.55.1-ubi9-0"
KubeStateMetricsImage = "kube-state-metrics:2.15.0-ubi9-0"
ClickhouseImage = "clickhouse:25.11.2-ubi9-0"
PrometheusImage = "prometheus:2.55.1-ubi9-0"
)

type App string
Expand All @@ -30,7 +29,6 @@ const (
AppClickhouse App = "clickhouse"
AppClickhouseKeeper App = "clickhouse-keeper"
AppPrometheus App = "prometheus"
AppKubeStateMetrics App = "kube-state-metrics"
)

func (r *CorootReconciler) getAppImage(cr *corootv1.Coroot, app App) corootv1.ImageSpec {
Expand All @@ -44,8 +42,6 @@ func (r *CorootReconciler) getAppImage(cr *corootv1.Coroot, app App) corootv1.Im
image = cr.Spec.NodeAgent.Image
case AppClusterAgent:
image = cr.Spec.ClusterAgent.Image
case AppKubeStateMetrics:
image = cr.Spec.ClusterAgent.KubeStateMetrics.Image
case AppClickhouse:
image = cr.Spec.Clickhouse.Image
case AppClickhouseKeeper:
Expand Down Expand Up @@ -89,7 +85,6 @@ func (r *CorootReconciler) fetchAppVersions() {
r.versions[AppClickhouse] = r.RegistryConfig.Image(ClickhouseImage)
r.versions[AppClickhouseKeeper] = r.RegistryConfig.Image(ClickhouseImage)
r.versions[AppPrometheus] = r.RegistryConfig.Image(PrometheusImage)
r.versions[AppKubeStateMetrics] = r.RegistryConfig.Image(KubeStateMetricsImage)
}

func (r *CorootReconciler) fetchAppVersion(app App) (string, error) {
Expand Down
Loading