Skip to content

Commit ded743d

Browse files
Francisco Borges Aurindo BarrosOblynx
Francisco Borges Aurindo Barros
authored andcommitted
Added thread option and enabled monit for Prometheus
1 parent 4c6919d commit ded743d

File tree

7 files changed

+30
-3
lines changed

7 files changed

+30
-3
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ This reference is useful to run the operator locally.
6868
argument | example | description
6969
--- | --- | ---
7070
`sitebuilder-image` | gitlab-registry.cern.ch/drupal/paas/cern-drupal-distribution/site-builder | The sitebuilder source image name
71-
`nginx-image` | gitlab-registry.cern.ch/drupal/paas/cern-drupal-distribution/nginx | The nginx source image name
71+
`php-fpm-exporter-image` | gitlab-registry.cern.ch/drupal/paas/php-fpm-prometheus-exporter:RELEASE.2021.06.02T09-41-38Z | The php-fpm-exporter source image name
72+
`velero-namespace` | openshift-cern-drupal | The namespace of the Velero server to create backups
73+
`webdav-image` | gitlab-registry.cern.ch/drupal/paas/sabredav/webdav:RELEASE-2021.10.07T13-46-43Z | The webdav source image name
74+
`parallel-thread-count` | 5 | The number of threads used by the main controller of DrupalSite Operator
7275

7376
#### Configmaps for each QoS class
7477

chart/drupalsite-operator/templates/manager-deploy.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ spec:
2929
- --zap-stacktrace-level={{.Values.drupalsiteOperator.logStacktraceLevel}}
3030
- --zap-log-level={{.Values.drupalsiteOperator.logLevel}}
3131
- --default-release-spec={{.Values.drupalsiteOperator.defaultReleaseSpec}}
32+
- --parallel-thread-count={{.Values.drupalsiteOperator.parallelThreadCount}}
3233
command:
3334
- /manager
3435
image: {{ .Values.image | quote }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Prometheus Monitor Service (Metrics)
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: ServiceMonitor
4+
metadata:
5+
labels:
6+
control-plane: controller-manager
7+
name: controller-manager-metrics-monitor
8+
namespace: system
9+
spec:
10+
endpoints:
11+
- path: /metrics
12+
port: https
13+
selector:
14+
matchLabels:
15+
control-plane: controller-manager

chart/drupalsite-operator/values.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ drupalsiteOperator:
2424
# Zap Level at and above which stacktraces are captured (one of 'info', 'error')
2525
logStacktraceLevel: "error"
2626
defaultReleaseSpec: "RELEASE-2021.09.13T09-24-02Z"
27+
parallelThreadCount: 1

config/default/kustomization.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ bases:
2222
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
2323
#- ../certmanager
2424
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
25-
#- ../prometheus
25+
- ../prometheus
2626

2727
patchesStrategicMerge:
2828
# Protect the /metrics endpoint by putting it behind auth.

controllers/drupalsite_controller.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import (
4141
"k8s.io/apimachinery/pkg/types"
4242
ctrl "sigs.k8s.io/controller-runtime"
4343
"sigs.k8s.io/controller-runtime/pkg/client"
44+
"sigs.k8s.io/controller-runtime/pkg/controller"
4445
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
4546
"sigs.k8s.io/controller-runtime/pkg/handler"
4647
"sigs.k8s.io/controller-runtime/pkg/reconcile"
@@ -65,8 +66,10 @@ var (
6566
SMTPHost string
6667
// VeleroNamespace refers to the namespace of the velero server to create backups
6768
VeleroNamespace string
68-
// ReleaseSpec refers to the releaseSpec of the drupalSite to be defaulted incase it is empty
69+
// DefaultReleaseSpec refers to the releaseSpec of the drupalSite to be defaulted incase it is empty
6970
DefaultReleaseSpec string
71+
// ParallelThreadCount refers to the number of parallel reconciliations done by the Operator
72+
ParallelThreadCount int
7073
)
7174

7275
// DrupalSiteReconciler reconciles a DrupalSite object
@@ -134,6 +137,9 @@ func (r *DrupalSiteReconciler) SetupWithManager(mgr ctrl.Manager) error {
134137
return []reconcile.Request{}
135138
}),
136139
).
140+
WithOptions(controller.Options{
141+
MaxConcurrentReconciles: ParallelThreadCount,
142+
}).
137143
Complete(r)
138144
}
139145

main.go

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ func main() {
7777
flag.StringVar(&controllers.SMTPHost, "smtp-host", "cernmx.cern.ch", "SMTP host used by Drupal server pods to send emails.")
7878
flag.StringVar(&controllers.VeleroNamespace, "velero-namespace", "openshift-cern-drupal", "The namespace of the Velero server to create backups")
7979
flag.StringVar(&controllers.DefaultReleaseSpec, "default-release-spec", "RELEASE-2021.10.07T14-52-56Z", "The default releaseSpec value to be passed to the DrupalSites")
80+
flag.IntVar(&controllers.ParallelThreadCount, "parallel-thread-count", 1, "The default number of parallel threads executed by the DrupalSite Operator controllers")
8081
opts := zap.Options{
8182
Development: false,
8283
}

0 commit comments

Comments
 (0)