Skip to content

Commit

Permalink
Add a priorityClass to btp manager (#860)
Browse files Browse the repository at this point in the history
* Add priority class to btp manager

* Add priority class to sap-btp-operator--deployment

* No labels in priority class

* Update test
  • Loading branch information
MarekMichali authored Sep 10, 2024
1 parent 03cf967 commit 42e94dd
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 29 deletions.
1 change: 1 addition & 0 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ resources:
#- ../certmanager
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
- ../prometheus
- ../priority-class

patchesStrategicMerge:
# Protect the /metrics endpoint by putting it behind auth.
Expand Down
1 change: 1 addition & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ spec:
labels:
app.kubernetes.io/component: btp-manager.kyma-project.io
spec:
priorityClassName: "kyma-priority"
securityContext:
runAsNonRoot: true
containers:
Expand Down
7 changes: 7 additions & 0 deletions config/priority-class/btp_manager_priority_class.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: kyma-priority
value: 2100000
globalDefault: false
description: "Scheduling priority of the btp-operator module. Must not be blocked by unschedulable user workloads."
2 changes: 2 additions & 0 deletions config/priority-class/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
resources:
- btp_manager_priority_class.yaml
7 changes: 0 additions & 7 deletions controllers/testdata/test-priorityclass.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions controllers/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
schedulingv1 "k8s.io/api/scheduling/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -55,7 +54,6 @@ const (
btpOperatorKind = "BtpOperator"
btpOperatorApiVersion = `operator.kyma-project.io\v1alpha1`
secretYamlPath = "testdata/test-secret.yaml"
priorityClassYamlPath = "testdata/test-priorityclass.yaml"
k8sOpsTimeout = time.Second * 3
k8sOpsPollingInterval = time.Millisecond * 200
extraLabelKey = "reconciler.kyma-project.io/managed-by"
Expand Down Expand Up @@ -324,16 +322,6 @@ func copyDirRecursively(src, target string) {
}

func createPrereqs() error {
pClass := &schedulingv1.PriorityClass{}
Expect(createK8sResourceFromYaml(pClass, priorityClassYamlPath)).To(Succeed())
if err := k8sClient.Get(ctx, client.ObjectKeyFromObject(pClass), pClass); err != nil {
if k8serrors.IsNotFound(err) {
Eventually(func() error { return k8sClient.Create(ctx, pClass) }).WithTimeout(k8sOpsTimeout).WithPolling(k8sOpsPollingInterval).Should(Succeed())
} else {
return err
}
}

kymaNs := &corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: kymaNamespace}}
if err := k8sClient.Get(ctx, client.ObjectKeyFromObject(kymaNs), kymaNs); err != nil {
if k8serrors.IsNotFound(err) {
Expand Down
9 changes: 1 addition & 8 deletions deployments/prerequisites.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@ kind: Namespace
apiVersion: v1
metadata:
name: kyma-system
---
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: kyma-system
value: 99
globalDefault: false
description: "This priority class should be used for Kyma pods only."

3 changes: 1 addition & 2 deletions docs/contributor/02-10-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ BTP Manager performs the following operations:
The prerequisites for the SAP BTP service operator provisioning are:

- Namespace `kyma-system`
- PriorityClass `kyma-system`
- Secret `sap-btp-manager` with data for the SAP BTP service operator

The namespace and PriorityClass resources are created during Kyma installation. The Secret is injected into the cluster
The namespace is created during Kyma installation. The Secret is injected into the cluster
by Kyma Environment Broker (KEB). If you want to provision the SAP BTP service operator in a cluster without Kyma, you must create
the prerequisites yourself.

Expand Down
1 change: 1 addition & 0 deletions module-chart/overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ manager:
kubernetesMatchLabels:
enabled: true
enable_limited_cache: false
priorityClassName: "btp-manager-kyma-priority"
1 change: 1 addition & 0 deletions module-resources/apply/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ spec:
name: cert
readOnly: true
terminationGracePeriodSeconds: 10
priorityClassName: btp-manager-kyma-priority
volumes:
- name: cert
secret:
Expand Down

0 comments on commit 42e94dd

Please sign in to comment.