Path: blob/main/install/installer/pkg/common/pod_disruption_budget.go
2500 views
// Copyright (c) 2023 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34package common56import (7"fmt"89policy "k8s.io/api/policy/v1"10v1 "k8s.io/apimachinery/pkg/apis/meta/v1"11"k8s.io/apimachinery/pkg/util/intstr"12)1314func PodDisruptionBudget(ctx *RenderContext, component string, maxUnavailable int, selector *v1.LabelSelector) *policy.PodDisruptionBudget {15muCount := intstr.FromInt(maxUnavailable)1617return &policy.PodDisruptionBudget{18TypeMeta: TypePodDisruptionBudget,19ObjectMeta: v1.ObjectMeta{20Name: fmt.Sprintf("%v-pdb", component),21Namespace: ctx.Namespace,22},23Spec: policy.PodDisruptionBudgetSpec{24MaxUnavailable: &muCount,25Selector: selector,26},27}28}293031