Skip to content

Commit

Permalink
fix type meta
Browse files Browse the repository at this point in the history
Signed-off-by: Thibault Mange <[email protected]>
  • Loading branch information
thibaultmg committed Sep 28, 2023
1 parent a34478a commit 09f7b64
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,25 @@ objects:
storage: 500Gi
storageClassName: gp2
status: {}
- apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/component: database-compactor
app.kubernetes.io/instance: observatorium
app.kubernetes.io/name: thanos-compact
app.kubernetes.io/part-of: observatorium
name: observatorium-thanos-compact
namespace: rhobs
spec:
maxUnavailable: 1
selector:
matchLabels:
app.kubernetes.io/component: database-compactor
app.kubernetes.io/instance: observatorium
app.kubernetes.io/name: thanos-compact
app.kubernetes.io/part-of: observatorium
parameters:
- from: '[a-zA-Z0-9]{40}'
generate: expression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ metadata:
creationTimestamp: null
name: observatorium-metrics-store
objects:
- metadata:
- apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/component: object-store-gateway
Expand All @@ -21,7 +23,9 @@ objects:
verbs:
- get
- list
- metadata:
- apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/component: object-store-gateway
Expand Down Expand Up @@ -63,14 +67,16 @@ objects:
app.kubernetes.io/version: v0.32.3
name: hashmod-config-template
namespace: rhobs
- metadata:
- apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/component: object-store-gateway
app.kubernetes.io/instance: observatorium
app.kubernetes.io/name: thanos-store
app.kubernetes.io/part-of: observatorium
name: store
name: observatorium-thanos-store
namespace: rhobs
spec:
maxUnavailable: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,25 @@ objects:
storage: 500Gi
storageClassName: gp2
status: {}
- apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/component: database-compactor
app.kubernetes.io/instance: observatorium
app.kubernetes.io/name: thanos-compact
app.kubernetes.io/part-of: observatorium
name: observatorium-thanos-compact
namespace: rhobs
spec:
maxUnavailable: 1
selector:
matchLabels:
app.kubernetes.io/component: database-compactor
app.kubernetes.io/instance: observatorium
app.kubernetes.io/name: thanos-compact
app.kubernetes.io/part-of: observatorium
parameters:
- from: '[a-zA-Z0-9]{40}'
generate: expression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ metadata:
creationTimestamp: null
name: observatorium-metrics-store
objects:
- metadata:
- apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/component: object-store-gateway
Expand All @@ -21,7 +23,9 @@ objects:
verbs:
- get
- list
- metadata:
- apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/component: object-store-gateway
Expand Down Expand Up @@ -63,14 +67,16 @@ objects:
app.kubernetes.io/version: v0.32.3
name: hashmod-config-template
namespace: rhobs
- metadata:
- apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/component: object-store-gateway
app.kubernetes.io/instance: observatorium
app.kubernetes.io/name: thanos-store
app.kubernetes.io/part-of: observatorium
name: store
name: observatorium-thanos-store
namespace: rhobs
spec:
maxUnavailable: 1
Expand Down
39 changes: 38 additions & 1 deletion services_go/observatorium/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,31 @@ func makeCompactor(namespace string, preManifestsHook func(*compactor.CompactorS
service.ObjectMeta.Annotations[servingCertSecretNameAnnotation] = tlsSecret
postProcessServiceMonitor(getObject[*monv1.ServiceMonitor](manifests))

// Add pod disruption budget
labels := maps.Clone(getObject[*appsv1.StatefulSet](manifests).ObjectMeta.Labels)
delete(labels, k8sutil.VersionLabel)
manifests["store-pdb"] = &policyv1.PodDisruptionBudget{
TypeMeta: metav1.TypeMeta{
Kind: "PodDisruptionBudget",
APIVersion: policyv1.SchemeGroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{
Name: compactorSatefulset.Name,
Namespace: namespace,
Labels: labels,
},
Spec: policyv1.PodDisruptionBudgetSpec{
MaxUnavailable: &intstr.IntOrString{

Type: intstr.Int,
IntVal: 1,
},
Selector: &metav1.LabelSelector{
MatchLabels: labels,
},
},
}

return manifests

}
Expand Down Expand Up @@ -189,6 +214,10 @@ func makeStore(namespace string, preManifestHook func(*store.StoreStatefulSet))
labels := maps.Clone(statefulset.ObjectMeta.Labels)
delete(labels, k8sutil.VersionLabel)
manifests["list-pods-rbac"] = &rbacv1.Role{
TypeMeta: metav1.TypeMeta{
Kind: "Role",
APIVersion: rbacv1.SchemeGroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{
Name: "list-pods",
Namespace: namespace,
Expand All @@ -203,6 +232,10 @@ func makeStore(namespace string, preManifestHook func(*store.StoreStatefulSet))
},
}
manifests["list-pods-rbac-binding"] = &rbacv1.RoleBinding{
TypeMeta: metav1.TypeMeta{
Kind: "RoleBinding",
APIVersion: rbacv1.SchemeGroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{
Name: "list-pods",
Namespace: namespace,
Expand All @@ -225,8 +258,12 @@ func makeStore(namespace string, preManifestHook func(*store.StoreStatefulSet))

// Add pod disruption budget
manifests["store-pdb"] = &policyv1.PodDisruptionBudget{
TypeMeta: metav1.TypeMeta{
Kind: "PodDisruptionBudget",
APIVersion: policyv1.SchemeGroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{
Name: "store",
Name: storeStatefulSet.Name,
Namespace: namespace,
Labels: labels,
},
Expand Down

0 comments on commit 09f7b64

Please sign in to comment.