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

[release-5.7] Backport PR grafana/loki#12164 and grafana/loki#12216 #274

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
2 changes: 2 additions & 0 deletions operator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Release 5.7.12

- [12164](https://github.com/grafana/loki/pull/12164) **periklis**: Use safe bearer token authentication to scrape operator metrics
- [12216](https://github.com/grafana/loki/pull/12216) **xperimental**: Fix duplicate operator metrics due to ServiceMonitor selector
- [11968](https://github.com/grafana/loki/pull/11968) **xperimental**: Extend status to show difference between running and ready
- [11824](https://github.com/grafana/loki/pull/11824) **xperimental**: Improve messages for errors in storage secret

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: ServiceAccount
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/instance: loki-operator-v0.2.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: loki-operator
app.kubernetes.io/version: 0.2.0
name: loki-operator-controller-manager-metrics-reader
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
service.beta.openshift.io/serving-cert-secret-name: loki-operator-metrics
creationTimestamp: null
labels:
app.kubernetes.io/component: metrics
app.kubernetes.io/instance: loki-operator-v0.2.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Secret
metadata:
annotations:
kubernetes.io/service-account.name: loki-operator-controller-manager-metrics-reader
labels:
app.kubernetes.io/instance: loki-operator-v0.2.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: loki-operator
app.kubernetes.io/version: 0.2.0
name: loki-operator-controller-manager-metrics-token
type: kubernetes.io/service-account-token
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/instance: loki-operator-v0.2.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: loki-operator
app.kubernetes.io/version: 0.2.0
name: loki-operator-controller-manager-read-metrics
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: loki-operator-metrics-reader
subjects:
- kind: ServiceAccount
name: loki-operator-controller-manager-metrics-reader
namespace: kubernetes-operators
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,23 @@ metadata:
name: loki-operator-metrics-monitor
spec:
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
- authorization:
credentials:
key: token
name: loki-operator-controller-manager-metrics-token
type: bearer
interval: 30s
path: /metrics
scheme: https
scrapeTimeout: 10s
targetPort: 8443
tlsConfig:
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
ca:
secret:
key: service-ca.crt
name: loki-operator-controller-manager-metrics-token
serverName: loki-operator-controller-manager-metrics-service.kubernetes-operators.svc
selector:
matchLabels:
app.kubernetes.io/component: metrics
app.kubernetes.io/name: loki-operator
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ metadata:
categories: OpenShift Optional, Logging & Tracing
certified: "false"
containerImage: docker.io/grafana/loki-operator:main-99acb9b
createdAt: "2024-03-04T17:34:37Z"
createdAt: "2024-03-14T20:44:25Z"
description: The Community Loki Operator provides Kubernetes native deployment
and management of Loki and related logging components.
features.operators.openshift.io/disconnected: "true"
Expand Down Expand Up @@ -1508,7 +1508,7 @@ spec:
- subjectaccessreviews
verbs:
- create
serviceAccountName: default
serviceAccountName: loki-operator-controller-manager
deployments:
- label:
app.kubernetes.io/instance: loki-operator-v0.2.0
Expand Down Expand Up @@ -1607,6 +1607,7 @@ spec:
kubernetes.io/os: linux
securityContext:
runAsNonRoot: true
serviceAccountName: loki-operator-controller-manager
terminationGracePeriodSeconds: 10
volumes:
- configMap:
Expand Down Expand Up @@ -1640,7 +1641,7 @@ spec:
verbs:
- create
- patch
serviceAccountName: default
serviceAccountName: loki-operator-controller-manager
strategy: deployment
installModes:
- supported: false
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: ServiceAccount
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/instance: loki-operator-v0.2.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: loki-operator
app.kubernetes.io/version: 0.2.0
name: loki-operator-controller-manager-metrics-reader
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: Service
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/component: metrics
app.kubernetes.io/instance: loki-operator-v0.2.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/instance: loki-operator-v0.2.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: loki-operator
app.kubernetes.io/version: 0.2.0
name: loki-operator-controller-manager-read-metrics
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: loki-operator-metrics-reader
subjects:
- kind: ServiceAccount
name: loki-operator-controller-manager-metrics-reader
namespace: loki-operator
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ metadata:
categories: OpenShift Optional, Logging & Tracing
certified: "false"
containerImage: docker.io/grafana/loki-operator:main-99acb9b
createdAt: "2024-03-04T17:34:34Z"
createdAt: "2024-03-14T20:44:23Z"
description: The Community Loki Operator provides Kubernetes native deployment
and management of Loki and related logging components.
operators.operatorframework.io/builder: operator-sdk-unknown
Expand Down Expand Up @@ -1488,7 +1488,7 @@ spec:
- subjectaccessreviews
verbs:
- create
serviceAccountName: default
serviceAccountName: loki-operator-controller-manager
deployments:
- label:
app.kubernetes.io/instance: loki-operator-v0.2.0
Expand Down Expand Up @@ -1583,6 +1583,7 @@ spec:
kubernetes.io/os: linux
securityContext:
runAsNonRoot: true
serviceAccountName: loki-operator-controller-manager
terminationGracePeriodSeconds: 10
volumes:
- name: webhook-cert
Expand Down Expand Up @@ -1615,7 +1616,7 @@ spec:
verbs:
- create
- patch
serviceAccountName: default
serviceAccountName: loki-operator-controller-manager
strategy: deployment
installModes:
- supported: false
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: ServiceAccount
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/instance: loki-operator-v0.1.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: cluster-logging
app.kubernetes.io/version: 0.1.0
name: loki-operator-controller-manager-metrics-reader
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
service.beta.openshift.io/serving-cert-secret-name: loki-operator-metrics
creationTimestamp: null
labels:
app.kubernetes.io/component: metrics
app.kubernetes.io/instance: loki-operator-v0.1.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Secret
metadata:
annotations:
kubernetes.io/service-account.name: loki-operator-controller-manager-metrics-reader
labels:
app.kubernetes.io/instance: loki-operator-v0.1.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: cluster-logging
app.kubernetes.io/version: 0.1.0
name: loki-operator-controller-manager-metrics-token
type: kubernetes.io/service-account-token
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/instance: loki-operator-v0.1.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: cluster-logging
app.kubernetes.io/version: 0.1.0
name: loki-operator-controller-manager-read-metrics
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: loki-operator-metrics-reader
subjects:
- kind: ServiceAccount
name: loki-operator-controller-manager-metrics-reader
namespace: openshift-operators-redhat
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,23 @@ metadata:
name: loki-operator-metrics-monitor
spec:
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
- authorization:
credentials:
key: token
name: loki-operator-controller-manager-metrics-token
type: bearer
interval: 30s
path: /metrics
scheme: https
scrapeTimeout: 10s
targetPort: 8443
tlsConfig:
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
ca:
secret:
key: service-ca.crt
name: loki-operator-controller-manager-metrics-token
serverName: loki-operator-controller-manager-metrics-service.openshift-operators-redhat.svc
selector:
matchLabels:
app.kubernetes.io/component: metrics
app.kubernetes.io/name: loki-operator
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ metadata:
categories: OpenShift Optional, Logging & Tracing
certified: "false"
containerImage: quay.io/openshift-logging/loki-operator:v0.1.0
createdAt: "2024-03-04T17:34:40Z"
createdAt: "2024-03-14T20:44:26Z"
description: |
The Loki Operator for OCP provides a means for configuring and managing a Loki stack for cluster logging.
## Prerequisites and Requirements
Expand Down Expand Up @@ -1493,7 +1493,7 @@ spec:
- subjectaccessreviews
verbs:
- create
serviceAccountName: default
serviceAccountName: loki-operator-controller-manager
deployments:
- label:
app.kubernetes.io/instance: loki-operator-v0.1.0
Expand Down Expand Up @@ -1592,6 +1592,7 @@ spec:
kubernetes.io/os: linux
securityContext:
runAsNonRoot: true
serviceAccountName: loki-operator-controller-manager
terminationGracePeriodSeconds: 10
volumes:
- configMap:
Expand Down Expand Up @@ -1625,7 +1626,7 @@ spec:
verbs:
- create
- patch
serviceAccountName: default
serviceAccountName: loki-operator-controller-manager
strategy: deployment
installModes:
- supported: false
Expand Down
1 change: 1 addition & 0 deletions operator/config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ spec:
periodSeconds: 10
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: controller-manager
terminationGracePeriodSeconds: 10
securityContext:
runAsNonRoot: true
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ metadata:
name: metrics-monitor
spec:
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
path: /metrics
- path: /metrics
targetPort: 8443
scheme: https
interval: 30s
scrapeTimeout: 10s
authorization:
type: bearer
credentials:
key: token
name: loki-operator-controller-manager-metrics-token
tlsConfig:
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
ca:
secret:
key: service-ca.crt
name: loki-operator-controller-manager-metrics-token
serverName: loki-operator-controller-manager-metrics-service.kubernetes-operators.svc
1 change: 1 addition & 0 deletions operator/config/overlays/openshift/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ resources:
- ../../manager
- ../../webhook
- ../../prometheus
- manager_metrics_secret_token.yaml

# Adds namespace to all resources.
namespace: openshift-operators-redhat
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: controller-manager-metrics-token
annotations:
kubernetes.io/service-account.name: loki-operator-controller-manager-metrics-reader
type: kubernetes.io/service-account-token
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ metadata:
name: metrics-monitor
spec:
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
path: /metrics
- path: /metrics
targetPort: 8443
scheme: https
interval: 30s
scrapeTimeout: 10s
authorization:
type: bearer
credentials:
key: token
name: loki-operator-controller-manager-metrics-token
tlsConfig:
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
ca:
secret:
key: service-ca.crt
name: loki-operator-controller-manager-metrics-token
serverName: loki-operator-controller-manager-metrics-service.openshift-operators-redhat.svc
1 change: 1 addition & 0 deletions operator/config/prometheus/monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ spec:
selector:
matchLabels:
app.kubernetes.io/name: loki-operator
app.kubernetes.io/component: metrics
Loading