Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add ServiceMonitor for hub metrics #242

Merged
merged 1 commit into from
Jun 8, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ metadata:
categories: Modernization & Migration
certified: "false"
containerImage: quay.io/konveyor/tackle2-operator:latest
createdAt: "2023-05-31T20:22:24Z"
createdAt: "2023-06-08T20:09:08Z"
description: Konveyor is an open-source application modernization platform that
helps organizations safely and predictably modernize applications to Kubernetes
at scale.
Expand Down Expand Up @@ -283,7 +283,12 @@ spec:
- servicemonitors
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- apps.openshift.io
resources:
Expand Down
5 changes: 5 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ rules:
- servicemonitors
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- apps.openshift.io
resources:
Expand Down
8 changes: 8 additions & 0 deletions roles/tackle/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -513,3 +513,11 @@
api_version: apps/v1
name: "{{ keycloak_sso_deployment_name }}"
namespace: "{{ app_namespace }}"

- name: "Create Hub ServiceMonitor"
k8s:
state: present
definition: "{{ lookup('template', 'servicemonitor-hub.yml.j2') }}"
when:
- hub_metrics_enabled|bool
- openshift_cluster|bool
15 changes: 15 additions & 0 deletions roles/tackle/templates/networkpolicy.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,18 @@ spec:
- ports:
- port: 8080
- port: 8443
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ app_name }}-metrics
namespace: {{ app_namespace }}
labels:
app: {{ app_name }}
spec:
podSelector:
matchLabels:
role: {{ hub_service_name }}
ingress:
- ports:
- port: {{ hub_metrics_port }}
18 changes: 18 additions & 0 deletions roles/tackle/templates/servicemonitor-hub.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app.kubernetes.io/name: {{ hub_service_name }}
app.kubernetes.io/component: {{ hub_component_name }}
app.kubernetes.io/part-of: {{ app_name }}
name: {{ hub_service_name }}
namespace: {{ app_namespace }}
spec:
endpoints:
- interval: 30s
port: metrics
selector:
matchLabels:
app.kubernetes.io/name: {{ hub_service_name }}
app.kubernetes.io/component: {{ hub_component_name }}
app.kubernetes.io/part-of: {{ app_name }}
5 changes: 5 additions & 0 deletions tools/templates/clusterserviceversion.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,12 @@ spec:
- servicemonitors
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- apps.openshift.io
resources:
Expand Down