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

generate client key and certificates #1282

Merged
merged 10 commits into from
Jul 21, 2021
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 assets/alertmanager/service-monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ spec:
scheme: https
tlsConfig:
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
certFile: /etc/prometheus/secrets/metrics-client-certs/tls.crt
keyFile: /etc/prometheus/secrets/metrics-client-certs/tls.key
serverName: alertmanager-main
selector:
matchLabels:
Expand Down
6 changes: 6 additions & 0 deletions assets/cluster-monitoring-operator/metrics-client-ca.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
data: {}
kind: ConfigMap
metadata:
name: metrics-client-ca
namespace: openshift-monitoring
7 changes: 7 additions & 0 deletions assets/cluster-monitoring-operator/metrics-client-certs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
data: {}
kind: Secret
metadata:
name: metrics-client-certs
namespace: openshift-monitoring
type: Opaque
6 changes: 6 additions & 0 deletions assets/control-plane/service-monitor-kubelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ spec:
scrapeTimeout: 30s
tlsConfig:
caFile: /etc/prometheus/configmaps/kubelet-serving-ca-bundle/ca-bundle.crt
certFile: /etc/prometheus/secrets/metrics-client-certs/tls.crt
insecureSkipVerify: false
keyFile: /etc/prometheus/secrets/metrics-client-certs/tls.key
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
honorLabels: true
honorTimestamps: false
Expand All @@ -77,7 +79,9 @@ spec:
scrapeTimeout: 30s
tlsConfig:
caFile: /etc/prometheus/configmaps/kubelet-serving-ca-bundle/ca-bundle.crt
certFile: /etc/prometheus/secrets/metrics-client-certs/tls.crt
insecureSkipVerify: false
keyFile: /etc/prometheus/secrets/metrics-client-certs/tls.key
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
honorLabels: true
interval: 30s
Expand All @@ -91,7 +95,9 @@ spec:
scrapeTimeout: 30s
tlsConfig:
caFile: /etc/prometheus/configmaps/kubelet-serving-ca-bundle/ca-bundle.crt
certFile: /etc/prometheus/secrets/metrics-client-certs/tls.crt
insecureSkipVerify: false
keyFile: /etc/prometheus/secrets/metrics-client-certs/tls.key
- interval: 30s
metricRelabelings:
- action: drop
Expand Down
2 changes: 2 additions & 0 deletions assets/grafana/service-monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ spec:
scheme: https
tlsConfig:
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
certFile: /etc/prometheus/secrets/metrics-client-certs/tls.crt
keyFile: /etc/prometheus/secrets/metrics-client-certs/tls.key
serverName: server-name-replaced-at-runtime
selector:
matchLabels:
Expand Down
11 changes: 11 additions & 0 deletions assets/kube-state-metrics/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ spec:
- --upstream=http://127.0.0.1:8081/
- --tls-cert-file=/etc/tls/private/tls.crt
- --tls-private-key-file=/etc/tls/private/tls.key
- --client-ca-file=/etc/tls/client/client-ca.crt
image: quay.io/brancz/kube-rbac-proxy:v0.9.0
name: kube-rbac-proxy-main
ports:
Expand All @@ -80,13 +81,17 @@ spec:
- mountPath: /etc/tls/private
name: kube-state-metrics-tls
readOnly: false
- mountPath: /etc/tls/client
name: metrics-client-ca
readOnly: false
- args:
- --logtostderr
- --secure-listen-address=:9443
- --tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
- --upstream=http://127.0.0.1:8082/
- --tls-cert-file=/etc/tls/private/tls.crt
- --tls-private-key-file=/etc/tls/private/tls.key
- --client-ca-file=/etc/tls/client/client-ca.crt
image: quay.io/brancz/kube-rbac-proxy:v0.9.0
name: kube-rbac-proxy-self
ports:
Expand All @@ -102,6 +107,9 @@ spec:
- mountPath: /etc/tls/private
name: kube-state-metrics-tls
readOnly: false
- mountPath: /etc/tls/client
name: metrics-client-ca
readOnly: false
nodeSelector:
kubernetes.io/os: linux
priorityClassName: system-cluster-critical
Expand All @@ -113,3 +121,6 @@ spec:
- name: kube-state-metrics-tls
secret:
secretName: kube-state-metrics-tls
- configMap:
name: metrics-client-ca
name: metrics-client-ca
2 changes: 2 additions & 0 deletions assets/kube-state-metrics/service-monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ spec:
scrapeTimeout: 1m
tlsConfig:
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
certFile: /etc/prometheus/secrets/metrics-client-certs/tls.crt
keyFile: /etc/prometheus/secrets/metrics-client-certs/tls.key
serverName: server-name-replaced-at-runtime
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
interval: 1m
Expand Down
7 changes: 7 additions & 0 deletions assets/node-exporter/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ spec:
- --upstream=http://127.0.0.1:9100/
- --tls-cert-file=/etc/tls/private/tls.crt
- --tls-private-key-file=/etc/tls/private/tls.key
- --client-ca-file=/etc/tls/client/client-ca.crt
env:
- name: IP
valueFrom:
Expand All @@ -87,6 +88,9 @@ spec:
- mountPath: /etc/tls/private
name: node-exporter-tls
readOnly: false
- mountPath: /etc/tls/client
name: metrics-client-ca
readOnly: false
hostNetwork: true
hostPID: true
initContainers:
Expand Down Expand Up @@ -139,6 +143,9 @@ spec:
path: /var/log/wtmp
type: File
name: node-exporter-wtmp
- configMap:
name: metrics-client-ca
name: metrics-client-ca
updateStrategy:
rollingUpdate:
maxUnavailable: 10%
Expand Down
2 changes: 2 additions & 0 deletions assets/node-exporter/service-monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ spec:
scheme: https
tlsConfig:
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
certFile: /etc/prometheus/secrets/metrics-client-certs/tls.crt
insecureSkipVerify: false
keyFile: /etc/prometheus/secrets/metrics-client-certs/tls.key
serverName: server-name-replaced-at-runtime
jobLabel: app.kubernetes.io/name
selector:
Expand Down
1 change: 1 addition & 0 deletions assets/prometheus-k8s/prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ spec:
- prometheus-k8s-proxy
- prometheus-k8s-thanos-sidecar-tls
- kube-rbac-proxy
- metrics-client-certs
securityContext:
fsGroup: 65534
runAsNonRoot: true
Expand Down
2 changes: 2 additions & 0 deletions assets/prometheus-k8s/service-monitor-thanos-sidecar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ spec:
scheme: https
tlsConfig:
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
certFile: /etc/prometheus/secrets/metrics-client-certs/tls.crt
keyFile: /etc/prometheus/secrets/metrics-client-certs/tls.key
serverName: prometheus-k8s-thanos-sidecar
selector:
matchLabels:
Expand Down
2 changes: 2 additions & 0 deletions assets/prometheus-k8s/service-monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ spec:
scheme: https
tlsConfig:
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
certFile: /etc/prometheus/secrets/metrics-client-certs/tls.crt
keyFile: /etc/prometheus/secrets/metrics-client-certs/tls.key
serverName: prometheus-k8s
selector:
matchLabels:
Expand Down
7 changes: 7 additions & 0 deletions assets/prometheus-operator/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ spec:
- --upstream=https://prometheus-operator.openshift-monitoring.svc:8080/
- --tls-cert-file=/etc/tls/private/tls.crt
- --tls-private-key-file=/etc/tls/private/tls.key
- --client-ca-file=/etc/tls/client/client-ca.crt
- --upstream-ca-file=/etc/configmaps/operator-cert-ca-bundle/service-ca.crt
image: quay.io/brancz/kube-rbac-proxy:v0.9.0
name: kube-rbac-proxy
Expand All @@ -79,6 +80,9 @@ spec:
- mountPath: /etc/configmaps/operator-cert-ca-bundle
name: operator-certs-ca-bundle
readOnly: false
- mountPath: /etc/tls/client
name: metrics-client-ca
readOnly: false
nodeSelector:
kubernetes.io/os: linux
node-role.kubernetes.io/master: ""
Expand All @@ -96,3 +100,6 @@ spec:
- configMap:
name: operator-certs-ca-bundle
name: operator-certs-ca-bundle
- configMap:
name: metrics-client-ca
name: metrics-client-ca
2 changes: 2 additions & 0 deletions assets/prometheus-operator/service-monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ spec:
scheme: https
tlsConfig:
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
certFile: /etc/prometheus/secrets/metrics-client-certs/tls.crt
keyFile: /etc/prometheus/secrets/metrics-client-certs/tls.key
serverName: server-name-replaced-at-runtime
selector:
matchLabels:
Expand Down
2 changes: 2 additions & 0 deletions assets/thanos-querier/service-monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ spec:
scheme: https
tlsConfig:
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
certFile: /etc/prometheus/secrets/metrics-client-certs/tls.crt
keyFile: /etc/prometheus/secrets/metrics-client-certs/tls.key
serverName: server-name-replaced-at-runtime
selector:
matchLabels:
Expand Down
2 changes: 2 additions & 0 deletions assets/thanos-ruler/service-monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ spec:
scheme: https
tlsConfig:
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
certFile: /etc/prometheus/secrets/metrics-client-certs/tls.crt
keyFile: /etc/prometheus/secrets/metrics-client-certs/tls.key
serverName: server-name-replaced-at-runtime
selector:
matchLabels:
Expand Down
2 changes: 1 addition & 1 deletion cmd/operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func Main() int {

wg, ctx := errgroup.WithContext(ctx)

wg.Go(func() error { return o.Run(ctx.Done()) })
wg.Go(func() error { return o.Run(ctx) })

term := make(chan os.Signal)
signal.Notify(term, os.Interrupt, syscall.SIGTERM)
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ require (
github.com/ghodss/yaml v1.0.0
github.com/gogo/protobuf v1.3.2
github.com/imdario/mergo v0.3.7
github.com/openshift/api v0.0.0-20210225162315-bae60f47eed7
github.com/openshift/client-go v0.0.0-20201214125552-e615e336eb49
github.com/openshift/library-go v0.0.0-20210113192829-cfbb3f4c80c2
github.com/openshift/api v0.0.0-20210706092853-b63d499a70ce
github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142
github.com/openshift/library-go v0.0.0-20210720093535-f8ed43828870
github.com/pkg/errors v0.9.1
github.com/prometheus-operator/prometheus-operator v0.47.1
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.48.1
Expand All @@ -24,7 +24,7 @@ require (
k8s.io/apiserver v0.21.2
k8s.io/client-go v12.0.0+incompatible
k8s.io/klog/v2 v2.8.0
k8s.io/kube-aggregator v0.20.0
k8s.io/kube-aggregator v0.21.1
k8s.io/metrics v0.19.4
)

Expand Down
Loading