k8s.io/kubernetes@v1.29.3/pkg/kubelet/types/pod_status.go (about) 1 /* 2 Copyright 2018 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package types 18 19 import ( 20 v1 "k8s.io/api/core/v1" 21 utilfeature "k8s.io/apiserver/pkg/util/feature" 22 "k8s.io/kubernetes/pkg/features" 23 ) 24 25 // PodConditionsByKubelet is the list of pod conditions owned by kubelet 26 var PodConditionsByKubelet = []v1.PodConditionType{ 27 v1.PodScheduled, 28 v1.PodReady, 29 v1.PodInitialized, 30 v1.ContainersReady, 31 } 32 33 // PodConditionByKubelet returns if the pod condition type is owned by kubelet 34 func PodConditionByKubelet(conditionType v1.PodConditionType) bool { 35 for _, c := range PodConditionsByKubelet { 36 if c == conditionType { 37 return true 38 } 39 } 40 if utilfeature.DefaultFeatureGate.Enabled(features.PodReadyToStartContainersCondition) { 41 if conditionType == v1.PodReadyToStartContainers { 42 return true 43 } 44 } 45 return false 46 } 47 48 // PodConditionSharedByKubelet returns if the pod condition type is shared by kubelet 49 func PodConditionSharedByKubelet(conditionType v1.PodConditionType) bool { 50 if utilfeature.DefaultFeatureGate.Enabled(features.PodDisruptionConditions) { 51 if conditionType == v1.DisruptionTarget { 52 return true 53 } 54 } 55 return false 56 }