Skip to content

Commit

Permalink
feat: add lvm operator monitoring config files
Browse files Browse the repository at this point in the history
Signed-off-by: Arun Kumar Mohan <[email protected]>
  • Loading branch information
aruniiird committed Jan 18, 2022
1 parent f7fe182 commit 80e5b9a
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Dockerfile.combined
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ COPY pkg/ pkg/
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o vgmanager cmd/vgmanager/main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o metricsexporter cmd/metricsexporter/exporter.go

# vgmanager needs 'nsenter' and other basic linux utils to correctly function
FROM centos:8
WORKDIR /
COPY --from=builder /workspace/manager .
COPY --from=builder /workspace/vgmanager .
COPY --from=builder /workspace/metricsexporter .
EXPOSE 23532
USER 65532:65532

# '/manager' is lvm-operator entrypoint
Expand Down
5 changes: 5 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ spec:
metadata:
labels:
control-plane: controller-manager
exporter: lvm-operator
spec:
securityContext:
runAsNonRoot: true
Expand Down Expand Up @@ -66,5 +67,9 @@ spec:
envFrom:
- configMapRef:
name: lvm-operator-manager-config
- command:
- /metricsexporter
image: controller:latest
name: metricsexporter
serviceAccountName: controller-manager
terminationGracePeriodSeconds: 10
7 changes: 6 additions & 1 deletion config/prometheus/monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ spec:
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
tlsConfig:
insecureSkipVerify: true
- path: /metrics
port: lvm-metrics
scheme: http
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
tlsConfig:
insecureSkipVerify: true
selector:
matchLabels:
app.kubernetes.io/compose: metrics
control-plane: controller-manager
3 changes: 3 additions & 0 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ resources:
- topolvm_controller_service_account.yaml
- topolvm_controller_role.yaml
- topolvm_controller_role_bindings.yaml
# lvm-node metric rbac
- lvm_metric_service_config.yaml
- lvm_node_role_n_rolebindings.yaml
# topolvm-node metric rbac
- topolvm_metric_service_config.yaml
- topolvm_node_role_n_rolebindings.yaml
Expand Down
15 changes: 15 additions & 0 deletions config/rbac/lvm_metric_service_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: lvm-node-metrics
namespace: system
labels:
app.kubernetes.io/compose: metrics
spec:
selector:
exporter: lvm-operator
ports:
- name: lvm-metrics
protocol: TCP
port: 23532
targetPort: 23532
31 changes: 31 additions & 0 deletions config/rbac/lvm_node_role_n_rolebindings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: lvm-metrics
namespace: system
rules:
- apiGroups:
- ""
resources:
- services
- endpoints
- pods
verbs:
- get
- list
- watch
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: lvm-metrics
namespace: system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: lvm-metrics
subjects:
- kind: ServiceAccount
name: prometheus-k8s
namespace: openshift-monitoring

0 comments on commit 80e5b9a

Please sign in to comment.