Skip to content

Commit

Permalink
KRV-20573/csm status (#446)
Browse files Browse the repository at this point in the history
* add module status

* Adding CSM Module status

* Addressing the comments for PR

* Making code reusable

* Fix formatting issue

* Resolving gosec issue
  • Loading branch information
abhi16394 authored and panigs7 committed Feb 6, 2024
1 parent b03fcd2 commit af44981
Show file tree
Hide file tree
Showing 13 changed files with 270 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
kubectl.kubernetes.io/default-container: manager
labels:
control-plane: controller-manager
csm: application-mobility
csm: <NAME>
spec:
containers:
- args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ spec:
metadata:
labels:
name: application-mobility-velero
csm: application-mobility
csm: <NAME>
app.kubernetes.io/name: application-mobility-velero
app.kubernetes.io/instance: application-mobility

Expand Down
6 changes: 3 additions & 3 deletions operatorconfig/moduleconfig/common/cert-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ spec:
metadata:
labels:
app: cainjector
csm: cert-manager
csm: <NAME>
app.kubernetes.io/name: cainjector
app.kubernetes.io/instance: <NAMESPACE>
app.kubernetes.io/component: "cainjector"
Expand Down Expand Up @@ -883,7 +883,7 @@ spec:
metadata:
labels:
app: cert-manager
csm: cert-manager
csm: <NAME>
app.kubernetes.io/name: cert-manager
app.kubernetes.io/instance: <NAMESPACE>
app.kubernetes.io/component: "controller"
Expand Down Expand Up @@ -948,7 +948,7 @@ spec:
metadata:
labels:
app: webhook
csm: cert-manager
csm: <NAME>
app.kubernetes.io/name: webhook
app.kubernetes.io/instance: <NAMESPACE>
app.kubernetes.io/component: "webhook"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5257,7 +5257,7 @@ spec:
metadata:
labels:
app: cainjector
csm: cert-manager
csm: <NAME>
app.kubernetes.io/name: cainjector
app.kubernetes.io/instance: cert-manager
app.kubernetes.io/component: "cainjector"
Expand Down Expand Up @@ -5311,7 +5311,7 @@ spec:
metadata:
labels:
app: cert-manager
csm: cert-manager
csm: <NAME>
app.kubernetes.io/name: cert-manager
app.kubernetes.io/instance: cert-manager
app.kubernetes.io/component: "controller"
Expand Down Expand Up @@ -5376,7 +5376,7 @@ spec:
metadata:
labels:
app: webhook
csm: cert-manager
csm: <NAME>
app.kubernetes.io/name: webhook
app.kubernetes.io/instance: cert-manager
app.kubernetes.io/component: "webhook"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ spec:
labels:
app.kubernetes.io/name: karavi-metrics-powerflex
app.kubernetes.io/instance: karavi
csm: <NAME>
spec:
serviceAccount: karavi-metrics-powerflex-controller
containers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ spec:
labels:
app.kubernetes.io/name: karavi-metrics-powermax
app.kubernetes.io/instance: karavi
csm: <NAME>
spec:
serviceAccountName: karavi-metrics-powermax-controller
containers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ spec:
labels:
app.kubernetes.io/name: karavi-metrics-powerscale
app.kubernetes.io/instance: karavi
csm: <NAME>
spec:
serviceAccount: karavi-metrics-powerscale-controller
containers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ spec:
labels:
app.kubernetes.io/name: otel-collector
app.kubernetes.io/instance: karavi-observability
csm: <NAME>
spec:
volumes:
- name: tls-secret
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ spec:
labels:
app.kubernetes.io/name: karavi-topology
app.kubernetes.io/instance: karavi-observability
csm: <NAME>
spec:
volumes:
- name: karavi-topology-secret-volume
Expand Down
4 changes: 4 additions & 0 deletions pkg/modules/application_mobility.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ const (
AppMobCertManagerComponent = "cert-manager"
// AppMobVeleroComponent - velero component
AppMobVeleroComponent = "velero"
// CSMName - name
CSMName = "<NAME>"
)

// getAppMobilityModule - get instance of app mobility module
Expand Down Expand Up @@ -250,6 +252,7 @@ func getAppMobilityModuleDeployment(op utils.OperatorConfig, cr csmv1.ContainerS
}
}

yamlString = strings.ReplaceAll(yamlString, CSMName, cr.Name)
yamlString = strings.ReplaceAll(yamlString, AppMobNamespace, cr.Namespace)
yamlString = strings.ReplaceAll(yamlString, ControllerImg, controllerImage)
yamlString = strings.ReplaceAll(yamlString, ControllerImagePullPolicy, controllerImagePullPolicy)
Expand Down Expand Up @@ -652,6 +655,7 @@ func getVelero(op utils.OperatorConfig, cr csmv1.ContainerStorageModule) (string
}
}

yamlString = strings.ReplaceAll(yamlString, CSMName, cr.Name)
yamlString = strings.ReplaceAll(yamlString, AppMobNamespace, cr.Namespace)
yamlString = strings.ReplaceAll(yamlString, VeleroImage, veleroImg)
yamlString = strings.ReplaceAll(yamlString, VeleroImagePullPolicy, veleroImgPullPolicy)
Expand Down
1 change: 1 addition & 0 deletions pkg/modules/commonconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func getCertManager(op utils.OperatorConfig, cr csmv1.ContainerStorageModule) (s
YamlString = string(buf)
certNamespace := cr.Namespace
YamlString = strings.ReplaceAll(YamlString, CommonNamespace, certNamespace)
YamlString = strings.ReplaceAll(YamlString, CSMName, cr.Name)

return YamlString, nil
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/modules/observability.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ func getTopology(op utils.OperatorConfig, cr csmv1.ContainerStorageModule) (stri
}
}

YamlString = strings.ReplaceAll(YamlString, CSMName, cr.Name)
YamlString = strings.ReplaceAll(YamlString, TopologyLogLevel, logLevel)
YamlString = strings.ReplaceAll(YamlString, TopologyImage, topologyImage)
return YamlString, nil
Expand Down Expand Up @@ -354,6 +355,7 @@ func getOtelCollector(op utils.OperatorConfig, cr csmv1.ContainerStorageModule)
}
}

YamlString = strings.ReplaceAll(YamlString, CSMName, cr.Name)
YamlString = strings.ReplaceAll(YamlString, OtelCollectorImage, otelCollectorImage)
YamlString = strings.ReplaceAll(YamlString, NginxProxyImage, nginxProxyImage)
return YamlString, nil
Expand Down Expand Up @@ -499,6 +501,7 @@ func getPowerScaleMetricsObjects(op utils.OperatorConfig, cr csmv1.ContainerStor
}
}

YamlString = strings.ReplaceAll(YamlString, CSMName, cr.Name)
YamlString = strings.ReplaceAll(YamlString, PowerScaleImage, pscaleImage)
YamlString = strings.ReplaceAll(YamlString, PowerscaleLogLevel, logLevel)
YamlString = strings.ReplaceAll(YamlString, PowerScaleMaxConcurrentQueries, maxConcurrentQueries)
Expand Down Expand Up @@ -699,6 +702,7 @@ func getPowerFlexMetricsObject(op utils.OperatorConfig, cr csmv1.ContainerStorag
}
}

YamlString = strings.ReplaceAll(YamlString, CSMName, cr.Name)
YamlString = strings.ReplaceAll(YamlString, PowerflexImage, pflexImage)
YamlString = strings.ReplaceAll(YamlString, PowerflexLogLevel, logLevel)
YamlString = strings.ReplaceAll(YamlString, PowerflexMaxConcurrentQueries, maxConcurrentQueries)
Expand Down Expand Up @@ -919,6 +923,7 @@ func getPowerMaxMetricsObject(op utils.OperatorConfig, cr csmv1.ContainerStorage
}
}

YamlString = strings.ReplaceAll(YamlString, CSMName, cr.Name)
YamlString = strings.ReplaceAll(YamlString, PmaxObsImage, pmaxImage)
YamlString = strings.ReplaceAll(YamlString, PmaxLogLevel, logLevel)
YamlString = strings.ReplaceAll(YamlString, PmaxLogFormat, logFormat)
Expand Down
Loading

0 comments on commit af44981

Please sign in to comment.