Skip to content

Commit c265f3a

Browse files
Satyam Bhardwajgabemontero
authored andcommitted
results metrics exposed over https using kube-rbac-proxy
Signed-off-by: Satyam Bhardwaj <[email protected]>
1 parent b712a84 commit c265f3a

File tree

11 files changed

+154
-12
lines changed

11 files changed

+154
-12
lines changed

developer/config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
cluster_type: openshift
77

88
# git_url refers to a git repo to be considered as the source of truth for Argo CD applications.
9-
git_url: https://github.com/openshift-pipelines/pipeline-service.git
9+
git_url: https://github.com/ramessesii2/pipeline-service.git
1010

1111
# git_ref refers to the git repo's ref to be considered as the source of truth for Argo CD applications.
12-
git_ref: main
12+
git_ref: RAMESSESII2/results-kube-rbac-proxy-test
1313

1414
# Applications to be deployed on the cluster
1515
apps:

developer/openshift/gitops/argocd/pipeline-service-o11y.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ spec:
1212
server: https://kubernetes.default.svc
1313
source:
1414
path: developer/openshift/gitops/argocd/pipeline-service-o11y
15-
repoURL: https://github.com/openshift-pipelines/pipeline-service.git
16-
targetRevision: main
15+
repoURL: https://github.com/ramessesii2/pipeline-service.git
16+
targetRevision: RAMESSESII2/results-kube-rbac-proxy-test
1717
project: default
1818
syncPolicy:
1919
# Comment this out if you want to manually trigger deployments (using the

developer/openshift/gitops/argocd/pipeline-service-storage.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ spec:
1212
server: https://kubernetes.default.svc
1313
source:
1414
path: developer/openshift/gitops/argocd/pipeline-service-storage
15-
repoURL: https://github.com/openshift-pipelines/pipeline-service.git
16-
targetRevision: main
15+
repoURL: https://github.com/ramessesii2/pipeline-service.git
16+
targetRevision: RAMESSESII2/results-kube-rbac-proxy-test
1717
project: default
1818
syncPolicy:
1919
# Comment this out if you want to manually trigger deployments (using the

developer/openshift/gitops/argocd/pipeline-service.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ spec:
1212
server: https://kubernetes.default.svc
1313
source:
1414
path: developer/openshift/gitops/argocd/pipeline-service
15-
repoURL: https://github.com/openshift-pipelines/pipeline-service.git
16-
targetRevision: main
15+
repoURL: https://github.com/ramessesii2/pipeline-service.git
16+
targetRevision: RAMESSESII2/results-kube-rbac-proxy-test
1717
project: default
1818
syncPolicy:
1919
# Comment this out if you want to manually trigger deployments (using the
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: tekton-results-api
6+
namespace: tekton-pipelines
7+
spec:
8+
template:
9+
spec:
10+
containers:
11+
- name: kube-rbac-proxy
12+
image: registry.redhat.io/openshift4/ose-kube-rbac-proxy:v4.12
13+
args:
14+
- "--secure-listen-address=0.0.0.0:9443"
15+
- "--upstream=http://127.0.0.1:9090/"
16+
- "--logtostderr=true"
17+
- "--v=10"
18+
securityContext:
19+
allowPrivilegeEscalation: false
20+
seccompProfile:
21+
type: RuntimeDefault
22+
capabilities:
23+
drop:
24+
- ALL
25+
ports:
26+
- containerPort: 9443
27+
protocol: TCP
28+
name: metrics
29+
resources:
30+
limits:
31+
cpu: 500m
32+
memory: 128Mi
33+
requests:
34+
cpu: 5m
35+
memory: 64Mi
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
- op: replace
3+
path: /spec/ports/1/name
4+
value: metrics
5+
- op: replace
6+
path: /spec/ports/1/port
7+
value: 9443
8+
- op: replace
9+
path: /spec/ports/1/targetPort
10+
value: metrics

operator/gitops/argocd/pipeline-service/tekton-results/kustomization.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,18 @@ patches:
4141
- path: watcher-logging.yaml
4242
- path: watcher-sync.yaml
4343
- path: watcher-service-sync.yaml
44+
- path: api-kube-rbac-proxy.yaml
45+
- path: watcher-kube-rbac-proxy.yaml
46+
- path: watcher-cr-patch.yaml
47+
- path: watcher-service-patch.yaml
48+
target:
49+
version: v1
50+
kind: Service
51+
name: tekton-results-watcher
52+
labelSelector: "app.kubernetes.io/name=tekton-results-watcher"
53+
- path: api-service-patch.yaml
54+
target:
55+
version: v1
56+
kind: Service
57+
name: tekton-results-api-service
58+
labelSelector: "app.kubernetes.io/name=tekton-results-api"

operator/gitops/argocd/pipeline-service/tekton-results/service-monitor.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ metadata:
5454
spec:
5555
endpoints:
5656
- path: /metrics
57-
port: prometheus
58-
scheme: http
57+
port: metrics
58+
scheme: https
5959
bearerTokenSecret:
6060
name: "metrics-reader"
6161
key: token
@@ -75,8 +75,8 @@ metadata:
7575
spec:
7676
endpoints:
7777
- path: /metrics
78-
port: metrics
79-
scheme: http
78+
port: watchermetrics
79+
scheme: https
8080
bearerTokenSecret:
8181
name: "metrics-reader"
8282
key: token
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: watcher
5+
rules:
6+
# Watcher needs to be able to create new and update existing results.
7+
- apiGroups: ["results.tekton.dev"]
8+
resources: ["logs", "results", "records"]
9+
verbs: ["create", "get", "update"]
10+
# Needed to read results and update annotations with Result ID.
11+
- apiGroups: ["tekton.dev"]
12+
resources: ["pipelineruns", "taskruns"]
13+
verbs: ["get", "list", "patch", "update", "watch", "delete"]
14+
# Watcher currently get config from APISever, so will
15+
# fail to start if it does not have this permission.
16+
- apiGroups: [""]
17+
resources: ["configmaps", "pods"]
18+
verbs: ["get", "list", "watch"]
19+
# Required to read logs, when logs API is enabled
20+
- apiGroups: [""]
21+
resources: ["pods/log"]
22+
verbs: ["get"]
23+
- apiGroups: ["tekton.dev"]
24+
resources: ["pipelines"]
25+
verbs: ["get"]
26+
# Required for enabling leader election.
27+
- apiGroups: ["coordination.k8s.io"]
28+
resources: ["leases"]
29+
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
30+
# Watcher needs to be able to verify incoming auth tokens.
31+
- apiGroups: ["authentication.k8s.io"]
32+
resources: ["tokenreviews"]
33+
verbs: ["create"]
34+
# Watcher needs to be able to use RBAC to verify user authorization.
35+
- apiGroups: ["authorization.k8s.io"]
36+
resources: ["subjectaccessreviews"]
37+
verbs: ["create"]
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: tekton-results-watcher
6+
namespace: tekton-pipelines
7+
spec:
8+
template:
9+
spec:
10+
containers:
11+
- name: kube-rbac-proxy
12+
image: registry.redhat.io/openshift4/ose-kube-rbac-proxy:v4.12
13+
args:
14+
- "--secure-listen-address=0.0.0.0:8443"
15+
- "--upstream=http://127.0.0.1:9090/"
16+
- "--logtostderr=true"
17+
- "--v=10"
18+
securityContext:
19+
allowPrivilegeEscalation: false
20+
seccompProfile:
21+
type: RuntimeDefault
22+
capabilities:
23+
drop:
24+
- ALL
25+
ports:
26+
- containerPort: 8443
27+
protocol: TCP
28+
name: watchermetrics
29+
resources:
30+
limits:
31+
cpu: 500m
32+
memory: 128Mi
33+
requests:
34+
cpu: 5m
35+
memory: 64Mi

0 commit comments

Comments
 (0)