Skip to content

Commit c438133

Browse files
authored
Adds resource for KRP (#772)
1 parent 18b0b16 commit c438133

File tree

2 files changed

+87
-2
lines changed

2 files changed

+87
-2
lines changed

magefiles/operator.go

+53-2
Original file line numberDiff line numberDiff line change
@@ -796,9 +796,41 @@ func operatorResources(namespace string, m TemplateMaps) []runtime.Object {
796796
},
797797
},
798798
},
799-
800-
// Deployment
801799
operatorDeployment(namespace, m),
800+
operatorServingCertConfigMap(namespace),
801+
}
802+
}
803+
804+
func operatorServingCertConfigMap(namespace string) *corev1.ConfigMap {
805+
return &corev1.ConfigMap{
806+
TypeMeta: metav1.TypeMeta{
807+
APIVersion: "v1",
808+
Kind: "ConfigMap",
809+
},
810+
ObjectMeta: metav1.ObjectMeta{
811+
Name: "thanos-operator-serving-cert",
812+
Namespace: namespace,
813+
Labels: map[string]string{
814+
"app.kubernetes.io/component": "manager",
815+
"app.kubernetes.io/created-by": "thanos-operator",
816+
"app.kubernetes.io/instance": "controller-manager",
817+
"app.kubernetes.io/managed-by": "rhobs",
818+
"app.kubernetes.io/name": "configmap",
819+
"app.kubernetes.io/part-of": "thanos-operator",
820+
},
821+
Annotations: map[string]string{
822+
"service.beta.openshift.io/inject-cabundle": "true",
823+
},
824+
},
825+
Data: map[string]string{
826+
"config.yaml": `"authorization":
827+
"static":
828+
- "path": "/metrics"
829+
"resourceRequest": false
830+
"user":
831+
"name": "system:serviceaccount:openshift-customer-monitoring:prometheus-k8s"
832+
"verb": "get"`,
833+
},
802834
}
803835
}
804836

@@ -860,13 +892,20 @@ func operatorDeployment(namespace string, m TemplateMaps) *appsv1.Deployment {
860892
"--v=4",
861893
"--tls-cert-file=/etc/tls/private/tls.crt",
862894
"--tls-private-key-file=/etc/tls/private/tls.key",
895+
"--client-ca-file=/etc/service-ca/service-ca.crt",
896+
"--config-file=/etc/service-ca/config.yaml",
863897
},
864898
VolumeMounts: []corev1.VolumeMount{
865899
{
866900
Name: "tls",
867901
MountPath: "/etc/tls/private",
868902
ReadOnly: true,
869903
},
904+
{
905+
Name: "service-ca",
906+
MountPath: "/etc/service-ca",
907+
ReadOnly: true,
908+
},
870909
},
871910
Ports: []corev1.ContainerPort{
872911
{
@@ -943,6 +982,18 @@ func operatorDeployment(namespace string, m TemplateMaps) *appsv1.Deployment {
943982
},
944983
},
945984
},
985+
{
986+
Name: "service-ca",
987+
VolumeSource: corev1.VolumeSource{
988+
ConfigMap: &corev1.ConfigMapVolumeSource{
989+
LocalObjectReference: corev1.LocalObjectReference{
990+
Name: "openshift-service-ca.crt",
991+
},
992+
DefaultMode: ptr.To(int32(420)),
993+
Optional: ptr.To(false),
994+
},
995+
},
996+
},
946997
},
947998
ServiceAccountName: "thanos-operator-controller-manager",
948999
TerminationGracePeriodSeconds: ptr.To(int64(10)),

resources/services/bundle/staging/operator.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ objects:
7070
- --v=4
7171
- --tls-cert-file=/etc/tls/private/tls.crt
7272
- --tls-private-key-file=/etc/tls/private/tls.key
73+
- --client-ca-file=/etc/service-ca/service-ca.crt
74+
- --config-file=/etc/service-ca/config.yaml
7375
image: registry.redhat.io/openshift4/ose-kube-rbac-proxy@sha256:98455d503b797b6b02edcfd37045c8fab0796b95ee5cf4cfe73b221a07e805f0
7476
imagePullPolicy: IfNotPresent
7577
name: kube-rbac-proxy
@@ -93,6 +95,9 @@ objects:
9395
- mountPath: /etc/tls/private
9496
name: tls
9597
readOnly: true
98+
- mountPath: /etc/service-ca
99+
name: service-ca
100+
readOnly: true
96101
- args:
97102
- --health-probe-bind-address=:8081
98103
- --metrics-bind-address=127.0.0.1:8080
@@ -146,6 +151,11 @@ objects:
146151
defaultMode: 420
147152
optional: false
148153
secretName: kube-rbac-proxy-tls
154+
- configMap:
155+
defaultMode: 420
156+
name: openshift-service-ca.crt
157+
optional: false
158+
name: service-ca
149159
status: {}
150160
- apiVersion: v1
151161
kind: ServiceAccount
@@ -429,6 +439,30 @@ objects:
429439
- kind: ServiceAccount
430440
name: thanos-operator-controller-manager
431441
namespace: rhobs-stage
442+
- apiVersion: v1
443+
data:
444+
config.yaml: |-
445+
"authorization":
446+
"static":
447+
- "path": "/metrics"
448+
"resourceRequest": false
449+
"user":
450+
"name": "system:serviceaccount:openshift-customer-monitoring:prometheus-k8s"
451+
"verb": "get"
452+
kind: ConfigMap
453+
metadata:
454+
annotations:
455+
service.beta.openshift.io/inject-cabundle: "true"
456+
creationTimestamp: null
457+
labels:
458+
app.kubernetes.io/component: manager
459+
app.kubernetes.io/created-by: thanos-operator
460+
app.kubernetes.io/instance: controller-manager
461+
app.kubernetes.io/managed-by: rhobs
462+
app.kubernetes.io/name: configmap
463+
app.kubernetes.io/part-of: thanos-operator
464+
name: thanos-operator-serving-cert
465+
namespace: rhobs-stage
432466
- apiVersion: rbac.authorization.k8s.io/v1
433467
kind: ClusterRole
434468
metadata:

0 commit comments

Comments
 (0)