Skip to content

Commit

Permalink
Merge pull request #102 from sustainable-computing-io/service-monitor…
Browse files Browse the repository at this point in the history
…-handle

susql service monitor config cleanup
  • Loading branch information
mamy-CS authored May 21, 2024
2 parents 47a7105 + ef569ae commit b76b56b
Show file tree
Hide file tree
Showing 14 changed files with 75 additions and 212 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ metadata:
labels:
app.kubernetes.io/component: metrics
app.kubernetes.io/created-by: susql-operator
app.kubernetes.io/instance: controller-manager-metrics-monitor
app.kubernetes.io/instance: susql-controller-manager-metrics-monitor
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: servicemonitor
app.kubernetes.io/part-of: susql-operator
name: susql-operator-controller-manager-metrics-monitor
control-plane: susql-controller-manager
name: susql-operator-susql-controller-manager-metrics-monitor
spec:
endpoints:
- port: metrics
selector:
matchLabels:
app.kubernetes.io/name: service
app.kubernetes.io/part-of: susql-operator
control-plane: susql-controller-manager
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ metadata:
labels:
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: susql-operator
app.kubernetes.io/instance: controller-manager-metrics-service
app.kubernetes.io/instance: susql-controller-manager-metrics-service
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: service
app.kubernetes.io/part-of: susql-operator
name: susql-operator-controller-manager-metrics-service
control-plane: susql-controller-manager
name: susql-operator-susql-controller-manager-metrics-service
spec:
ports:
- name: metrics
port: 8082
protocol: TCP
targetPort: metrics
selector:
app.kubernetes.io/component: manager
app.kubernetes.io/instance: controller-manager
control-plane: susql-controller-manager
status:
loadBalancer: {}
22 changes: 10 additions & 12 deletions bundle/manifests/susql-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ metadata:
capabilities: Basic Install
categories: Monitoring
containerImage: quay.io/sustainable_computing_io/susql_operator:0.0.15
createdAt: "2024-05-14T16:24:18Z"
createdAt: "2024-05-21T14:53:53Z"
description: 'Aggregates energy data from pods tagged with SusQL labels '
operators.operatorframework.io/builder: operator-sdk-v1.34.1
operators.operatorframework.io/project_layout: go.kubebuilder.io/v4
Expand Down Expand Up @@ -147,30 +147,28 @@ spec:
- get
- list
- watch
serviceAccountName: susql-operator-controller-manager
serviceAccountName: susql-operator-susql-controller-manager
deployments:
- label:
app.kubernetes.io/component: manager
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/created-by: susql-operator
app.kubernetes.io/instance: susql-controller-manager
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: deployment
app.kubernetes.io/part-of: susql-operator
name: susql-operator-controller
name: susql-operator-susql-controller-manager
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: manager
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/part-of: susql-operator
control-plane: susql-controller-manager
strategy: {}
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: manager
labels:
app.kubernetes.io/component: manager
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/part-of: susql-operator
control-plane: susql-controller-manager
spec:
affinity:
nodeAffinity:
Expand Down Expand Up @@ -244,7 +242,7 @@ spec:
- ALL
securityContext:
runAsNonRoot: true
serviceAccountName: susql-operator-controller-manager
serviceAccountName: susql-operator-susql-controller-manager
terminationGracePeriodSeconds: 10
permissions:
- rules:
Expand Down Expand Up @@ -279,7 +277,7 @@ spec:
verbs:
- create
- patch
serviceAccountName: susql-operator-controller-manager
serviceAccountName: susql-operator-susql-controller-manager
strategy: deployment
installModes:
- supported: true
Expand Down
18 changes: 17 additions & 1 deletion config/default/manager_auth_proxy_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
name: susql-controller-manager
namespace: system
spec:
template:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
- ppc64le
- s390x
- key: kubernetes.io/os
operator: In
values:
- linux
containers:
- name: kube-rbac-proxy
securityContext:
Expand Down
2 changes: 1 addition & 1 deletion config/default/manager_config_patch.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
name: susql-controller-manager
namespace: system
spec:
template:
Expand Down
17 changes: 8 additions & 9 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Namespace
metadata:
labels:
control-plane: susql-controller-manager
app.kubernetes.io/name: namespace
app.kubernetes.io/instance: system
app.kubernetes.io/component: manager
Expand All @@ -13,28 +14,26 @@ metadata:
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller
name: susql-controller-manager
namespace: system
labels:
app.kubernetes.io/name: deployment
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/instance: susql-controller-manager
app.kubernetes.io/component: manager
app.kubernetes.io/part-of: susql-operator
app.kubernetes.io/created-by: susql-operator
app.kubernetes.io/managed-by: kustomize
spec:
selector:
matchLabels:
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/component: manager
app.kubernetes.io/part-of: susql-operator
control-plane: susql-controller-manager
replicas: 1
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: manager
labels:
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/component: manager
app.kubernetes.io/part-of: susql-operator
control-plane: susql-controller-manager
spec:
# TODO(user): Uncomment the following code to configure the nodeAffinity expression
# according to the platforms which are supported by your solution.
Expand Down Expand Up @@ -123,5 +122,5 @@ spec:
- containerPort: 8082
protocol: TCP
name: metrics
serviceAccountName: controller-manager
serviceAccountName: susql-controller-manager
terminationGracePeriodSeconds: 10
154 changes: 2 additions & 152 deletions config/manifests/bases/susql-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,158 +78,8 @@ spec:
mediatype: image/png
install:
spec:
deployments:
- label:
app.kubernetes.io/component: manager
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/name: deployment
app.kubernetes.io/part-of: susql-operator
name: susql-operator-controller
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: manager
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/part-of: susql-operator
strategy: {}
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: manager
labels:
app.kubernetes.io/component: manager
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/part-of: susql-operator
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
- ppc64le
- s390x
- key: kubernetes.io/os
operator: In
values:
- linux
containers:
- args:
- --secure-listen-address=0.0.0.0:8443
- --upstream=http://127.0.0.1:8082/
- --logtostderr=true
- --v=0
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.14.1
name: kube-rbac-proxy
ports:
- containerPort: 8443
name: https
protocol: TCP
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 5m
memory: 64Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
- args:
- --leader-elect
- --kepler-prometheus-url=$(KEPLER-PROMETHEUS-URL)
- --kepler-metric-name=$(KEPLER-METRIC-NAME)
- --susql-prometheus-database-url=$(SUSQL-PROMETHEUS-DATABASE-URL)
- --susql-prometheus-metrics-url=$(SUSQL-PROMETHEUS-METRICS-URL)
- --sampling-rate=$(SAMPLING-RATE)
- --health-probe-bind-address=:8081
- --metrics-bind-address=127.0.0.1:8082
command:
- /manager
env:
- name: KEPLER-PROMETHEUS-URL
value: https://thanos-querier.openshift-monitoring.svc.cluster.local:9091
- name: KEPLER-METRIC-NAME
value: kepler_container_joules_total
- name: SUSQL-PROMETHEUS-DATABASE-URL
value: https://thanos-querier.openshift-monitoring.svc.cluster.local:9091
- name: SUSQL-PROMETHEUS-METRICS-URL
value: http://0.0.0.0:8082
- name: SAMPLING-RATE
value: "2"
image: <OPERATOR_IMG>
imagePullPolicy: Always
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
name: manager
readinessProbe:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 10m
memory: 64Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
securityContext:
runAsNonRoot: true
serviceAccountName: susql-operator-controller-manager
terminationGracePeriodSeconds: 10
permissions:
- rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
serviceAccountName: susql-operator-controller-manager
strategy: deployment
deployments: null
strategy: ""
installModes:
- supported: true
type: OwnNamespace
Expand Down
32 changes: 16 additions & 16 deletions config/manifests/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ resources:
# [WEBHOOK] To enable webhooks, uncomment all the sections with [WEBHOOK] prefix.
# Do NOT uncomment sections with prefix [CERTMANAGER], as OLM does not support cert-manager.
# These patches remove the unnecessary "cert" volume and its manager container volumeMount.
patchesJson6902:
- target:
group: apps
version: v1
kind: Deployment
name: controller-manager
namespace: system
patch: |-
# Remove the manager container's "cert" volumeMount, since OLM will create and mount a set of certs.
# Update the indices in this path if adding or removing containers/volumeMounts in the manager's Deployment.
- op: remove
path: /spec/template/spec/containers/0/volumeMounts/0
# Remove the "cert" volume, since OLM will create and mount a set of certs.
# Update the indices in this path if adding or removing volumes in the manager's Deployment.
- op: remove
path: /spec/template/spec/volumes/0
# patchesJson6902:
# - target:
# group: apps
# version: v1
# kind: Deployment
# name: susql-controller-manager
# namespace: system
# patch: |-
# # Remove the manager container's "cert" volumeMount, since OLM will create and mount a set of certs.
# # Update the indices in this path if adding or removing containers/volumeMounts in the manager's Deployment.
# - op: remove
# path: /spec/template/spec/containers/0/volumeMounts/0
# # Remove the "cert" volume, since OLM will create and mount a set of certs.
# # Update the indices in this path if adding or removing volumes in the manager's Deployment.
# - op: remove
# path: /spec/template/spec/volumes/0
Loading

0 comments on commit b76b56b

Please sign in to comment.