update lifted files to k8s 1.26
Signed-off-by: Tanggui Bian <softwarebtg@163.com>
This commit is contained in:
parent
8388314fbe
commit
2390cde5f8
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/helper/helpers.go
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -31,7 +31,8 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L57-L61
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/helper/helpers.go#L57-L61
|
||||
// +lifted:changed
|
||||
|
||||
// IsQuotaHugePageResourceName returns true if the resource name has the quota
|
||||
// related huge page resource prefix.
|
||||
|
@ -39,7 +40,9 @@ func IsQuotaHugePageResourceName(name corev1.ResourceName) bool {
|
|||
return strings.HasPrefix(string(name), corev1.ResourceHugePagesPrefix) || strings.HasPrefix(string(name), corev1.ResourceRequestsHugePagesPrefix)
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L212-L232
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/helper/helpers.go#L210-L230
|
||||
// +lifted:changed
|
||||
|
||||
var standardQuotaResources = sets.NewString(
|
||||
string(corev1.ResourceCPU),
|
||||
string(corev1.ResourceMemory),
|
||||
|
@ -62,7 +65,7 @@ var standardQuotaResources = sets.NewString(
|
|||
string(corev1.ResourceServicesLoadBalancers),
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L234-L238
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/helper/helpers.go#L232-L236
|
||||
|
||||
// IsStandardQuotaResourceName returns true if the resource is known to
|
||||
// the quota tracking system
|
||||
|
@ -70,7 +73,9 @@ func IsStandardQuotaResourceName(str string) bool {
|
|||
return standardQuotaResources.Has(str) || IsQuotaHugePageResourceName(corev1.ResourceName(str))
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L240-L261
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/helper/helpers.go#L238-L259
|
||||
// +lifted:changed
|
||||
|
||||
var standardResources = sets.NewString(
|
||||
string(corev1.ResourceCPU),
|
||||
string(corev1.ResourceMemory),
|
||||
|
@ -94,14 +99,16 @@ var standardResources = sets.NewString(
|
|||
string(corev1.ResourceServicesLoadBalancers),
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L263-L266
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/helper/helpers.go#L261-L264
|
||||
|
||||
// IsStandardResourceName returns true if the resource is known to the system
|
||||
func IsStandardResourceName(str string) bool {
|
||||
return standardResources.Has(str) || IsQuotaHugePageResourceName(corev1.ResourceName(str))
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L268-L278
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/helper/helpers.go#LL266-L276
|
||||
// +lifted:changed
|
||||
|
||||
var integerResources = sets.NewString(
|
||||
string(corev1.ResourcePods),
|
||||
string(corev1.ResourceQuotas),
|
||||
|
@ -114,7 +121,7 @@ var integerResources = sets.NewString(
|
|||
string(corev1.ResourceServicesLoadBalancers),
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L280-L283
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/helper/helpers.go#L278-L281
|
||||
|
||||
// IsIntegerResourceName returns true if the resource is measured in integer values
|
||||
func IsIntegerResourceName(str string) bool {
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers_test.go
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/helper/helpers_test.go
|
||||
|
||||
package lifted
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/v1/helper/helpers.go
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/v1/helper/helpers.go
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -28,7 +28,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/validation"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/v1/helper/helpers.go#L31-L46
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/v1/helper/helpers.go#L31-L46
|
||||
// +lifted:changed
|
||||
|
||||
// IsExtendedResourceName returns true if:
|
||||
|
@ -48,7 +48,7 @@ func IsExtendedResourceName(name corev1.ResourceName) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/v1/helper/helpers.go#L48-L51
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/v1/helper/helpers.go#L48-L51
|
||||
|
||||
// IsPrefixedNativeResource returns true if the resource name is in the
|
||||
// *kubernetes.io/ namespace.
|
||||
|
@ -56,7 +56,7 @@ func IsPrefixedNativeResource(name corev1.ResourceName) bool {
|
|||
return strings.Contains(string(name), corev1.ResourceDefaultNamespacePrefix)
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/v1/helper/helpers.go#L54-L60
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/v1/helper/helpers.go#L54-L60
|
||||
|
||||
// IsNativeResource returns true if the resource name is in the
|
||||
// *kubernetes.io/ namespace. Partially-qualified (unprefixed) names are
|
||||
|
@ -66,7 +66,7 @@ func IsNativeResource(name corev1.ResourceName) bool {
|
|||
IsPrefixedNativeResource(name)
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/v1/helper/helpers.go#L62-L66
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/v1/helper/helpers.go#L62-L66
|
||||
|
||||
// IsHugePageResourceName returns true if the resource name has the huge page
|
||||
// resource prefix.
|
||||
|
@ -74,7 +74,7 @@ func IsHugePageResourceName(name corev1.ResourceName) bool {
|
|||
return strings.HasPrefix(string(name), corev1.ResourceHugePagesPrefix)
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/v1/helper/helpers.go#L132-L135
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/v1/helper/helpers.go#L132-L135
|
||||
|
||||
// IsAttachableVolumeResourceName returns true when the resource name is prefixed in attachable volume
|
||||
func IsAttachableVolumeResourceName(name corev1.ResourceName) bool {
|
||||
|
|
|
@ -55,6 +55,7 @@ func TestIsNativeResource(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(fmt.Sprintf("resourceName input=%s, expected value=%v", tc.resourceName, tc.expectVal), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
v := IsNativeResource(tc.resourceName)
|
||||
|
|
|
@ -16,13 +16,13 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L59-L60
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L62
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L225-L228
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L311-L318
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L5036-L5054
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L5073-L5084
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L5651-L5661
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L59
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L61
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L237-L240
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L320-L327
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L5522-L5540
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L5559-L5570
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L6167-L6177
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -35,23 +35,23 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L59
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L58
|
||||
const isNegativeErrorMsg string = apimachineryvalidation.IsNegativeErrorMsg
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L60
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L59
|
||||
const isInvalidQuotaResource string = `must be a standard resource for quota`
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L62
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L61
|
||||
const isNotIntegerErrorMsg string = `must be an integer`
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L225-L228
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L237-L240
|
||||
|
||||
// ValidatePodName can be used to check whether the given pod name is valid.
|
||||
// Prefix indicates this name will be used as part of generation, in which case
|
||||
// trailing dashes are allowed.
|
||||
var ValidatePodName = apimachineryvalidation.NameIsDNSSubdomain
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L311-L318
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L320-L327
|
||||
|
||||
// ValidateNonnegativeQuantity Validates that a Quantity is not negative
|
||||
func ValidateNonnegativeQuantity(value resource.Quantity, fldPath *field.Path) field.ErrorList {
|
||||
|
@ -62,7 +62,7 @@ func ValidateNonnegativeQuantity(value resource.Quantity, fldPath *field.Path) f
|
|||
return allErrs
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L5036-L5054
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L5522-L5540
|
||||
// +lifted:changed
|
||||
|
||||
// Validate compute resource typename.
|
||||
|
@ -85,7 +85,7 @@ func validateResourceName(value string, fldPath *field.Path) field.ErrorList {
|
|||
return allErrs
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L5073-L5084
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L5559-L5570
|
||||
// +lifted:changed
|
||||
|
||||
// ValidateResourceQuotaResourceName Validate resource names that can go in a resource quota
|
||||
|
@ -101,7 +101,7 @@ func ValidateResourceQuotaResourceName(value string, fldPath *field.Path) field.
|
|||
return allErrs
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L5651-L5661
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L6167-L6177
|
||||
// +lifted:changed
|
||||
|
||||
// ValidateResourceQuantityValue enforces that specified quantity is valid for specified resource
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/validation/validation_test.go#L15475-L15518
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation_test.go#L15475-L15518
|
||||
|
||||
package lifted
|
||||
|
||||
|
|
|
@ -16,9 +16,6 @@ limitations under the License.
|
|||
|
||||
// This code is lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// However the code has been revised for using Lister instead of API interface.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/controller_utils.go#L1003-L1012
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util.go
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -27,7 +24,7 @@ import (
|
|||
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/equality"
|
||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
@ -36,10 +33,10 @@ import (
|
|||
// PodListFunc returns the Pod slice from the Pod namespace and a selector.
|
||||
type PodListFunc func(string, labels.Selector) ([]*corev1.Pod, error)
|
||||
|
||||
// ReplicaSetListFunc returns the ReplicaSet slice from the ReplicaSet namespace and a selector.
|
||||
type ReplicaSetListFunc func(string, labels.Selector) ([]*appsv1.ReplicaSet, error)
|
||||
// RsListFunc returns the ReplicaSet from the ReplicaSet namespace and the List metav1.ListOptions.
|
||||
type RsListFunc func(string, labels.Selector) ([]*appsv1.ReplicaSet, error)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/controller_utils.go#L1003-L1012
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/controller_utils.go#L1004-L1015
|
||||
|
||||
// ReplicaSetsByCreationTimestamp sorts a list of ReplicaSet by creation timestamp, using their names as a tie breaker.
|
||||
type ReplicaSetsByCreationTimestamp []*appsv1.ReplicaSet
|
||||
|
@ -53,14 +50,14 @@ func (o ReplicaSetsByCreationTimestamp) Less(i, j int) bool {
|
|||
return o[i].CreationTimestamp.Before(&o[j].CreationTimestamp)
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util.go#L569-L594
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util.go#L536-L561
|
||||
// +lifted:changed
|
||||
|
||||
// ListReplicaSetsByDeployment returns a slice of RSes the given deployment targets.
|
||||
// Note that this does NOT attempt to reconcile ControllerRef (adopt/orphan),
|
||||
// because only the controller itself should do that.
|
||||
// However, it does filter out anything whose ControllerRef doesn't match.
|
||||
func ListReplicaSetsByDeployment(deployment *appsv1.Deployment, f ReplicaSetListFunc) ([]*appsv1.ReplicaSet, error) {
|
||||
func ListReplicaSetsByDeployment(deployment *appsv1.Deployment, getRSList RsListFunc) ([]*appsv1.ReplicaSet, error) {
|
||||
// TODO: Right now we list replica sets by their labels. We should list them by selector, i.e. the replica set's selector
|
||||
// should be a superset of the deployment's selector, see https://github.com/kubernetes/kubernetes/issues/19830.
|
||||
namespace := deployment.Namespace
|
||||
|
@ -68,7 +65,7 @@ func ListReplicaSetsByDeployment(deployment *appsv1.Deployment, f ReplicaSetList
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
all, err := f(namespace, selector)
|
||||
all, err := getRSList(namespace, selector)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -82,7 +79,7 @@ func ListReplicaSetsByDeployment(deployment *appsv1.Deployment, f ReplicaSetList
|
|||
return owned, nil
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util.go#L596-L628
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util.go#L563C1-L595
|
||||
// +lifted:changed
|
||||
|
||||
// ListPodsByRS returns a list of pods the given deployment targets.
|
||||
|
@ -120,7 +117,7 @@ func ListPodsByRS(deployment *appsv1.Deployment, rsList []*appsv1.ReplicaSet, f
|
|||
return owned, nil
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util.go#L630-L642
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util.go#L597-L609
|
||||
|
||||
// EqualIgnoreHash returns true if two given podTemplateSpec are equal, ignoring the diff in value of Labels[pod-template-hash]
|
||||
// We ignore pod-template-hash because:
|
||||
|
@ -133,15 +130,15 @@ func EqualIgnoreHash(template1, template2 *corev1.PodTemplateSpec) bool {
|
|||
// Remove hash labels from template.Labels before comparing
|
||||
delete(t1Copy.Labels, appsv1.DefaultDeploymentUniqueLabelKey)
|
||||
delete(t2Copy.Labels, appsv1.DefaultDeploymentUniqueLabelKey)
|
||||
return equality.Semantic.DeepEqual(t1Copy, t2Copy)
|
||||
return apiequality.Semantic.DeepEqual(t1Copy, t2Copy)
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util.go#L536-L544
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/test/utils/deployment.go#L179-L187
|
||||
// +lifted:changed
|
||||
|
||||
// GetNewReplicaSet returns a replica set that matches the intent of the given deployment; get ReplicaSetList from client interface.
|
||||
// Returns nil if the new replica set doesn't exist yet.
|
||||
func GetNewReplicaSet(deployment *appsv1.Deployment, f ReplicaSetListFunc) (*appsv1.ReplicaSet, error) {
|
||||
func GetNewReplicaSet(deployment *appsv1.Deployment, f RsListFunc) (*appsv1.ReplicaSet, error) {
|
||||
rsList, err := ListReplicaSetsByDeployment(deployment, f)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -149,7 +146,7 @@ func GetNewReplicaSet(deployment *appsv1.Deployment, f ReplicaSetListFunc) (*app
|
|||
return FindNewReplicaSet(deployment, rsList), nil
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util.go#L644-L658
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util.go#L611-L625
|
||||
|
||||
// FindNewReplicaSet returns the new RS this given deployment targets (the one with the same pod template).
|
||||
func FindNewReplicaSet(deployment *appsv1.Deployment, rsList []*appsv1.ReplicaSet) *appsv1.ReplicaSet {
|
||||
|
|
|
@ -15,7 +15,41 @@ import (
|
|||
"k8s.io/utils/pointer"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util_test.go#LL151C1-L186C2
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util_test.go#L40-L49
|
||||
|
||||
func newDControllerRef(d *appsv1.Deployment) *metav1.OwnerReference {
|
||||
isController := true
|
||||
return &metav1.OwnerReference{
|
||||
APIVersion: "apps/v1",
|
||||
Kind: "Deployment",
|
||||
Name: d.GetName(),
|
||||
UID: d.GetUID(),
|
||||
Controller: &isController,
|
||||
}
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util_test.go#L51-L67
|
||||
// +lifted:changed
|
||||
|
||||
// generateRS creates a replica set, with the input deployment's template as its template
|
||||
func generateRS(deployment appsv1.Deployment) appsv1.ReplicaSet {
|
||||
template := deployment.Spec.Template.DeepCopy()
|
||||
return appsv1.ReplicaSet{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
UID: "test",
|
||||
Name: names.SimpleNameGenerator.GenerateName("replicaset"),
|
||||
Labels: template.Labels,
|
||||
OwnerReferences: []metav1.OwnerReference{*newDControllerRef(&deployment)},
|
||||
},
|
||||
Spec: appsv1.ReplicaSetSpec{
|
||||
Replicas: new(int32),
|
||||
Template: *template,
|
||||
Selector: &metav1.LabelSelector{MatchLabels: template.Labels},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util_test.go#L73-L108
|
||||
|
||||
// generateDeployment creates a deployment, with the input image as its template
|
||||
func generateDeployment(image string) appsv1.Deployment {
|
||||
|
@ -54,41 +88,7 @@ func generateDeployment(image string) appsv1.Deployment {
|
|||
}
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util_test.go#LL129C1-L145C2
|
||||
// +lifted:changed
|
||||
|
||||
// generateRS creates a replica set, with the input deployment's template as its template
|
||||
func generateRS(deployment appsv1.Deployment) appsv1.ReplicaSet {
|
||||
template := deployment.Spec.Template.DeepCopy()
|
||||
return appsv1.ReplicaSet{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
UID: "test",
|
||||
Name: names.SimpleNameGenerator.GenerateName("replicaset"),
|
||||
Labels: template.Labels,
|
||||
OwnerReferences: []metav1.OwnerReference{*newDControllerRef(&deployment)},
|
||||
},
|
||||
Spec: appsv1.ReplicaSetSpec{
|
||||
Replicas: new(int32),
|
||||
Template: *template,
|
||||
Selector: &metav1.LabelSelector{MatchLabels: template.Labels},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util_test.go#LL118C1-L127C2
|
||||
|
||||
func newDControllerRef(d *appsv1.Deployment) *metav1.OwnerReference {
|
||||
isController := true
|
||||
return &metav1.OwnerReference{
|
||||
APIVersion: "apps/v1",
|
||||
Kind: "Deployment",
|
||||
Name: d.GetName(),
|
||||
UID: d.GetUID(),
|
||||
Controller: &isController,
|
||||
}
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util_test.go#L326
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util_test.go#L110-L121
|
||||
|
||||
func generatePodTemplateSpec(name, nodeName string, annotations, labels map[string]string) corev1.PodTemplateSpec {
|
||||
return corev1.PodTemplateSpec{
|
||||
|
@ -197,7 +197,7 @@ func TestListReplicaSetsByDeployment(t *testing.T) {
|
|||
name string
|
||||
deployment *appsv1.Deployment
|
||||
rs *appsv1.ReplicaSet
|
||||
rsListFunc ReplicaSetListFunc
|
||||
rsListFunc RsListFunc
|
||||
wantErr bool
|
||||
wantRS bool
|
||||
}{
|
||||
|
@ -431,7 +431,7 @@ func TestListPodsByRS(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util_test.go#L339
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util_test.go#L123-L214
|
||||
|
||||
func TestEqualIgnoreHash(t *testing.T) {
|
||||
tests := []struct {
|
||||
|
@ -601,7 +601,7 @@ func TestGetNewReplicaSet(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util_test.go#L432
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util_test.go#L216-L267
|
||||
|
||||
func TestFindNewReplicaSet(t *testing.T) {
|
||||
now := metav1.Now()
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/garbagecollector/garbagecollector.go#L696-L732
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/garbagecollector/garbagecollector.go#L741-L777
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -26,7 +26,7 @@ import (
|
|||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/garbagecollector/garbagecollector.go#L696-L732
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/garbagecollector/garbagecollector.go#L741-L777
|
||||
|
||||
// GetDeletableResources returns all resources from discoveryClient that the
|
||||
// garbage collector should recognize and work with. More specifically, all
|
||||
|
@ -39,9 +39,9 @@ func GetDeletableResources(discoveryClient discovery.ServerResourcesInterface) m
|
|||
preferredResources, err := discoveryClient.ServerPreferredResources()
|
||||
if err != nil {
|
||||
if discovery.IsGroupDiscoveryFailedError(err) {
|
||||
klog.Warningf("Failed to discover some groups: %v", err.(*discovery.ErrGroupDiscoveryFailed).Groups)
|
||||
klog.Warningf("failed to discover some groups: %v", err.(*discovery.ErrGroupDiscoveryFailed).Groups)
|
||||
} else {
|
||||
klog.Warningf("Failed to discover preferred resources: %v", err)
|
||||
klog.Warningf("failed to discover preferred resources: %v", err)
|
||||
}
|
||||
}
|
||||
if preferredResources == nil {
|
||||
|
@ -55,7 +55,7 @@ func GetDeletableResources(discoveryClient discovery.ServerResourcesInterface) m
|
|||
for _, rl := range deletableResources {
|
||||
gv, err := schema.ParseGroupVersion(rl.GroupVersion)
|
||||
if err != nil {
|
||||
klog.Warningf("Ignore invalid discovered resource %q: %v", rl.GroupVersion, err)
|
||||
klog.Warningf("ignoring invalid discovered resource %q: %v", rl.GroupVersion, err)
|
||||
continue
|
||||
}
|
||||
for i := range rl.APIResources {
|
||||
|
|
|
@ -13,8 +13,8 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/garbagecollector/garbagecollector_test.go#L943-L990
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/garbagecollector/garbagecollector_test.go#L707-L797
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/garbagecollector/garbagecollector_test.go#L943-L990
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/garbagecollector/garbagecollector_test.go#L707-L797
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -29,39 +29,7 @@ import (
|
|||
"k8s.io/client-go/discovery"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/garbagecollector/garbagecollector_test.go#L943-L990
|
||||
type fakeServerResources struct {
|
||||
PreferredResources []*metav1.APIResourceList
|
||||
Error error
|
||||
Lock sync.Mutex
|
||||
InterfaceUsedCount int
|
||||
}
|
||||
|
||||
func (*fakeServerResources) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Deprecated: use ServerGroupsAndResources instead.
|
||||
func (*fakeServerResources) ServerResources() ([]*metav1.APIResourceList, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (*fakeServerResources) ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
func (f *fakeServerResources) ServerPreferredResources() ([]*metav1.APIResourceList, error) {
|
||||
f.Lock.Lock()
|
||||
defer f.Lock.Unlock()
|
||||
f.InterfaceUsedCount++
|
||||
return f.PreferredResources, f.Error
|
||||
}
|
||||
|
||||
func (*fakeServerResources) ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/garbagecollector/garbagecollector_test.go#L707-L797
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/garbagecollector/garbagecollector_test.go#L712-L802
|
||||
|
||||
// TestGetDeletableResources ensures GetDeletableResources always returns
|
||||
// something usable regardless of discovery output.
|
||||
|
@ -154,3 +122,36 @@ func TestGetDeletableResources(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/garbagecollector/garbagecollector_test.go#L948-L990
|
||||
|
||||
type fakeServerResources struct {
|
||||
PreferredResources []*metav1.APIResourceList
|
||||
Error error
|
||||
Lock sync.Mutex
|
||||
InterfaceUsedCount int
|
||||
}
|
||||
|
||||
func (*fakeServerResources) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Deprecated: use ServerGroupsAndResources instead.
|
||||
func (*fakeServerResources) ServerResources() ([]*metav1.APIResourceList, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (*fakeServerResources) ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
func (f *fakeServerResources) ServerPreferredResources() ([]*metav1.APIResourceList, error) {
|
||||
f.Lock.Lock()
|
||||
defer f.Lock.Unlock()
|
||||
f.InterfaceUsedCount++
|
||||
return f.PreferredResources, f.Error
|
||||
}
|
||||
|
||||
func (*fakeServerResources) ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
@ -4,108 +4,109 @@
|
|||
package lifted
|
||||
|
||||
/*
|
||||
| lifted file | source file | const/var/type/func | changed |
|
||||
|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|---------|
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L57-L61 | func IsQuotaHugePageResourceName | N |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L212-L232 | var standardQuotaResources | N |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L234-L238 | func IsStandardQuotaResourceName | N |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L240-L261 | var standardResources | N |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L263-L266 | func IsStandardResourceName | N |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L268-L278 | var integerResources | N |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L280-L283 | func IsIntegerResourceName | N |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/core/validation/validation.go | type ValidateNameFunc | N |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/core/helper/helpers.go | var standardFinalizers | N |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/staging/src/k8s.io/apimachinery/pkg/api/validation/generic.go | func NameIsDNSSubdomain | N |
|
||||
| corev1helpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/v1/helper/helpers.go#L31-L46 | func IsExtendedResourceName | Y |
|
||||
| corev1helpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/v1/helper/helpers.go#L48-L51 | func IsPrefixedNativeResource | N |
|
||||
| corev1helpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/v1/helper/helpers.go#L54-L60 | func IsNativeResource | N |
|
||||
| corev1helpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/v1/helper/helpers.go#L62-L66 | func IsHugePageResourceName | N |
|
||||
| corev1helpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/v1/helper/helpers.go#L132-L135 | func IsAttachableVolumeResourceName | N |
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L59 | const isNegativeErrorMsg | N |
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L60 | const isInvalidQuotaResource | N |
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L62 | const isNotIntegerErrorMsg | N |
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L225-L228 | var ValidatePodName | N |
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L311-L318 | func ValidateNonnegativeQuantity | N |
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L5036-L5054 | func validateResourceName | Y |
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L5073-L5084 | func ValidateResourceQuotaResourceName | Y |
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L5651-L5661 | func ValidateResourceQuantityValue | Y |
|
||||
| deployment.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/controller_utils.go#L1003-L1012 | type ReplicaSetsByCreationTimestamp | N |
|
||||
| deployment.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util.go#L569-L594 | func ListReplicaSetsByDeployment | Y |
|
||||
| deployment.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util.go#L596-L628 | func ListPodsByRS | Y |
|
||||
| deployment.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util.go#L630-L642 | func EqualIgnoreHash | N |
|
||||
| deployment.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util.go#L536-L544 | func GetNewReplicaSet | Y |
|
||||
| deployment.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util.go#L644-L658 | func FindNewReplicaSet | N |
|
||||
| deployment_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util_test.go#LL151C1-L186C2 | func generateDeployment | N |
|
||||
| deployment_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util_test.go#LL129C1-L145C2 | func generateRS | Y |
|
||||
| deployment_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util_test.go#LL118C1-L127C2 | func newDControllerRef | N |
|
||||
| deployment_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util_test.go#L326 | func generatePodTemplateSpec | N |
|
||||
| deployment_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util_test.go#L339 | func TestEqualIgnoreHash | N |
|
||||
| deployment_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util_test.go#L432 | func TestFindNewReplicaSet | N |
|
||||
| discovery.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/garbagecollector/garbagecollector.go#L696-L732 | func GetDeletableResources | N |
|
||||
| discovery_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/garbagecollector/garbagecollector_test.go#L943-L990 | type fakeServerResources | N |
|
||||
| discovery_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/garbagecollector/garbagecollector_test.go#L707-L797 | func TestGetDeletableResources | N |
|
||||
| genutils.go | https://github.com/kubernetes/kubernetes/blob/release-1.25/cmd/genutils/genutils.go | func OutDir | N |
|
||||
| genutils_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.25/cmd/genutils/genutils_test.go#L23-L28 | func TestValidDir | N |
|
||||
| genutils_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.25/cmd/genutils/genutils_test.go#L30-L35 | func TestInvalidDir | N |
|
||||
| genutils_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.25/cmd/genutils/genutils_test.go#L37-L42 | func TestNotDir | N |
|
||||
| nodeselector.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L365-L397 | func NodeSelectorRequirementsAsSelector | N |
|
||||
| nodeselector_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers_test.go#L138-L200 | func TestNodeSelectorRequirementsAsSelector | N |
|
||||
| objectwatcher.go | https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/util/propagatedversion.go#L35-L43 | func ObjectVersion | N |
|
||||
| objectwatcher.go | https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/util/propagatedversion.go#L45-L59 | func ObjectNeedsUpdate | N |
|
||||
| objectwatcher.go | https://github.com/kubernetes-retired/kubefed/blob/master/pkg/controller/util/meta.go#L82-L103 | func objectMetaObjEquivalent | Y |
|
||||
| podtemplate.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/controller_utils.go#L466-L472 | func getPodsLabelSet | N |
|
||||
| podtemplate.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/controller_utils.go#L474-L478 | func getPodsFinalizers | N |
|
||||
| podtemplate.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/controller_utils.go#L480-L486 | func getPodsAnnotationSet | N |
|
||||
| podtemplate.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/controller_utils.go#L488-L495 | func getPodsPrefix | N |
|
||||
| podtemplate.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/controller_utils.go#L539-L562 | func GetPodFromTemplate | Y |
|
||||
| requestinfo.go | https://github.com/kubernetes/apiserver/blob/release-1.26/pkg/endpoints/request/requestinfo.go#L67-L71 | var specialVerbs | N |
|
||||
| requestinfo.go | https://github.com/kubernetes/apiserver/blob/release-1.26/pkg/endpoints/request/requestinfo.go#L73-L74 | var specialVerbsNoSubresources | N |
|
||||
| requestinfo.go | https://github.com/kubernetes/apiserver/blob/release-1.26/pkg/endpoints/request/requestinfo.go#L76-L78 | var namespaceSubresources | N |
|
||||
| requestinfo.go | https://github.com/kubernetes/apiserver/blob/release-1.26/pkg/endpoints/request/requestinfo.go#L88-L247 | func NewRequestInfo | Y |
|
||||
| requestinfo.go | https://github.com/kubernetes/apiserver/blob/release-1.26/pkg/endpoints/request/requestinfo.go#L267-L274 | func SplitPath | Y |
|
||||
| requestinfo_test.go | https://github.com/kubernetes/apiserver/blob/release-1.23/pkg/endpoints/request/requestinfo_test.go#L30-L148 | func TestGetAPIRequestInfo | Y |
|
||||
| requestinfo_test.go | https://github.com/kubernetes/apiserver/blob/release-1.23/pkg/endpoints/request/requestinfo_test.go#L150-L184 | func TestGetNonAPIRequestInfo | Y |
|
||||
| resourcename.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/scheduler/util/utils.go#L144-L148 | func IsScalarResourceName | Y |
|
||||
| retain.go | https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain.go | func RetainServiceFields | Y |
|
||||
| retain.go | https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain.go | func retainServiceHealthCheckNodePort | Y |
|
||||
| retain.go | https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain.go | func retainServiceClusterIP | Y |
|
||||
| retain.go | https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain.go | func RetainServiceAccountFields | Y |
|
||||
| retain_test.go | https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain_test.go#L91-L174 | func TestRetainHealthCheckNodePortInServiceFields | Y |
|
||||
| retain_test.go | https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain_test.go#L176-L292 | func TestRetainClusterIPInServiceFields | Y |
|
||||
| taint.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L37-L73 | func ParseTaints | N |
|
||||
| taint.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L75-L118 | func parseTaint | N |
|
||||
| taint.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L120-L126 | func validateTaintEffect | N |
|
||||
| validateclustertaints.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/validation/validation.go#L5001-L5033 | func ValidateClusterTaints | Y |
|
||||
| validateclustertaints.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/validation/validation.go#L3305-L3326 | func validateClusterTaintEffect | Y |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L326-L348 | func ValidateIngressSpec | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L468C1-L509 | func validateIngressBackend | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L547C1-L578 | func validateIngressTypedLocalObjectReference | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L379-L409 | func validateIngressRules | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L411C1-L417 | func validateIngressRuleValue | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L419-L428 | func validateHTTPIngressRuleValue | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L430-L466 | func validateHTTPIngressPath | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L299-L324 | func validateIngressTLS | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L641-L646 | func validateTLSSecretName | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L357-L377 | func ValidateIngressLoadBalancerStatus | N |
|
||||
| validatingmci_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation_test.go | func TestValidateIngress | Y |
|
||||
| validatingmci_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation_test.go | func TestValidateIngressTLS | N |
|
||||
| validatingmci_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation_test.go | func TestValidateEmptyIngressTLS | N |
|
||||
| validatingmci_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation_test.go | func TestValidateIngressStatusUpdate | Y |
|
||||
| validatingmcs.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/core/validation/validation.go#L6826-L6846 | func ValidateLoadBalancerStatus | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L53-L63 | type ContainerType | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L65-L66 | const AllContainers | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L78-L80 | type ContainerVisitor | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L82-L83 | type Visitor | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L85-L94 | func skipEmptyNames | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L96-L123 | func VisitContainers | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L125-L195 | func VisitPodSecretNames | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L197-L213 | func visitContainerSecretNames | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L215-L243 | func VisitPodConfigmapNames | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L245-L261 | func visitContainerConfigmapNames | N |
|
||||
| visitpod_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L68-L76 | func AllFeatureEnabledContainers | N |
|
||||
| visitpod_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/staging/src/k8s.io/component-base/featuregate/testing/feature_gate.go#L26-L44 | func SetFeatureGateDuringTest | N |
|
||||
| visitpod_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util_test.go#L205-L392 | func TestVisitContainers | Y |
|
||||
| visitpod_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util_test.go#L394-L551 | func TestPodSecrets | Y |
|
||||
| visitpod_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util_test.go#L553-L591 | func collectResourcePaths | N |
|
||||
| visitpod_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util_test.go#L593-L695 | func TestPodConfigmaps | Y |
|
||||
| lifted file | source file | const/var/type/func | changed |
|
||||
|--------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|---------|
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/helper/helpers.go#L57-L61 | func IsQuotaHugePageResourceName | Y |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/helper/helpers.go#L210-L230 | var standardQuotaResources | Y |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/helper/helpers.go#L232-L236 | func IsStandardQuotaResourceName | N |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/helper/helpers.go#L238-L259 | var standardResources | Y |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/helper/helpers.go#L261-L264 | func IsStandardResourceName | N |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/helper/helpers.go#LL266-L276 | var integerResources | Y |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/helper/helpers.go#L278-L281 | func IsIntegerResourceName | N |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/core/validation/validation.go | type ValidateNameFunc | N |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/core/helper/helpers.go | var standardFinalizers | N |
|
||||
| corehelpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/staging/src/k8s.io/apimachinery/pkg/api/validation/generic.go | func NameIsDNSSubdomain | N |
|
||||
| corev1helpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/v1/helper/helpers.go#L31-L46 | func IsExtendedResourceName | Y |
|
||||
| corev1helpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/v1/helper/helpers.go#L48-L51 | func IsPrefixedNativeResource | N |
|
||||
| corev1helpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/v1/helper/helpers.go#L54-L60 | func IsNativeResource | N |
|
||||
| corev1helpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/v1/helper/helpers.go#L62-L66 | func IsHugePageResourceName | N |
|
||||
| corev1helpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/v1/helper/helpers.go#L132-L135 | func IsAttachableVolumeResourceName | N |
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L58 | const isNegativeErrorMsg | N |
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L59 | const isInvalidQuotaResource | N |
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L61 | const isNotIntegerErrorMsg | N |
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L237-L240 | var ValidatePodName | N |
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L320-L327 | func ValidateNonnegativeQuantity | N |
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L5522-L5540 | func validateResourceName | Y |
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L5559-L5570 | func ValidateResourceQuotaResourceName | Y |
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L6167-L6177 | func ValidateResourceQuantityValue | Y |
|
||||
| deployment.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/controller_utils.go#L1004-L1015 | type ReplicaSetsByCreationTimestamp | N |
|
||||
| deployment.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util.go#L536-L561 | func ListReplicaSetsByDeployment | Y |
|
||||
| deployment.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util.go#L563C1-L595 | func ListPodsByRS | Y |
|
||||
| deployment.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util.go#L597-L609 | func EqualIgnoreHash | N |
|
||||
| deployment.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/test/utils/deployment.go#L179-L187 | func GetNewReplicaSet | Y |
|
||||
| deployment.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util.go#L611-L625 | func FindNewReplicaSet | N |
|
||||
| deployment_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util_test.go#L40-L49 | func newDControllerRef | N |
|
||||
| deployment_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util_test.go#L51-L67 | func generateRS | Y |
|
||||
| deployment_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util_test.go#L73-L108 | func generateDeployment | N |
|
||||
| deployment_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util_test.go#L110-L121 | func generatePodTemplateSpec | N |
|
||||
| deployment_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util_test.go#L123-L214 | func TestEqualIgnoreHash | N |
|
||||
| deployment_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/deployment/util/deployment_util_test.go#L216-L267 | func TestFindNewReplicaSet | N |
|
||||
| discovery.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/garbagecollector/garbagecollector.go#L741-L777 | func GetDeletableResources | N |
|
||||
| discovery_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/garbagecollector/garbagecollector_test.go#L712-L802 | func TestGetDeletableResources | N |
|
||||
| discovery_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/garbagecollector/garbagecollector_test.go#L948-L990 | type fakeServerResources | N |
|
||||
| genutils.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/cmd/genutils/genutils.go | func OutDir | N |
|
||||
| genutils_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/cmd/genutils/genutils_test.go#L23-L28 | func TestValidDir | N |
|
||||
| genutils_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/cmd/genutils/genutils_test.go#L30-L35 | func TestInvalidDir | N |
|
||||
| genutils_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/cmd/genutils/genutils_test.go#L37-L42 | func TestNotDir | N |
|
||||
| nodeaffinity.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/component-helpers/scheduling/corev1/nodeaffinity/nodeaffinity.go#L203-L242 | func NodeSelectorRequirementsAsSelector | Y |
|
||||
| nodeaffinity_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/component-helpers/scheduling/corev1/nodeaffinity/nodeaffinity_test.go#L297-L360 | func TestNodeSelectorRequirementsAsSelector | N |
|
||||
| objectwatcher.go | https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/util/propagatedversion.go#L35-L43 | func ObjectVersion | N |
|
||||
| objectwatcher.go | https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/util/propagatedversion.go#L45-L59 | func ObjectNeedsUpdate | N |
|
||||
| objectwatcher.go | https://github.com/kubernetes-retired/kubefed/blob/master/pkg/controller/util/meta.go#L82-L103 | func objectMetaObjEquivalent | Y |
|
||||
| podtemplate.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/controller_utils.go#L466-L472 | func getPodsLabelSet | N |
|
||||
| podtemplate.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/controller_utils.go#L474-L478 | func getPodsFinalizers | N |
|
||||
| podtemplate.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/controller_utils.go#L480-L486 | func getPodsAnnotationSet | N |
|
||||
| podtemplate.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/controller_utils.go#L488-L495 | func getPodsPrefix | N |
|
||||
| podtemplate.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/controller_utils.go#L539-L562 | func GetPodFromTemplate | Y |
|
||||
| requestinfo.go | https://github.com/kubernetes/apiserver/blob/release-1.26/pkg/endpoints/request/requestinfo.go#L67-L71 | var specialVerbs | N |
|
||||
| requestinfo.go | https://github.com/kubernetes/apiserver/blob/release-1.26/pkg/endpoints/request/requestinfo.go#L73-L74 | var specialVerbsNoSubresources | N |
|
||||
| requestinfo.go | https://github.com/kubernetes/apiserver/blob/release-1.26/pkg/endpoints/request/requestinfo.go#L76-L78 | var namespaceSubresources | N |
|
||||
| requestinfo.go | https://github.com/kubernetes/apiserver/blob/release-1.26/pkg/endpoints/request/requestinfo.go#L88-L247 | func NewRequestInfo | Y |
|
||||
| requestinfo.go | https://github.com/kubernetes/apiserver/blob/release-1.26/pkg/endpoints/request/requestinfo.go#L267-L274 | func SplitPath | Y |
|
||||
| requestinfo_test.go | https://github.com/kubernetes/apiserver/blob/release-1.26/pkg/endpoints/request/requestinfo_test.go#L30-L148 | func TestGetAPIRequestInfo | Y |
|
||||
| requestinfo_test.go | https://github.com/kubernetes/apiserver/blob/release-1.26/pkg/endpoints/request/requestinfo_test.go#L150-L184 | func TestGetNonAPIRequestInfo | Y |
|
||||
| resourcename.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/util/utils.go#L157-L161 | func IsScalarResourceName | Y |
|
||||
| retain.go | https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain.go | func RetainServiceFields | Y |
|
||||
| retain.go | https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain.go | func retainServiceHealthCheckNodePort | Y |
|
||||
| retain.go | https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain.go | func retainServiceClusterIP | Y |
|
||||
| retain.go | https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain.go | func RetainServiceAccountFields | Y |
|
||||
| retain_test.go | https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain_test.go#L91-L174 | func TestRetainHealthCheckNodePortInServiceFields | Y |
|
||||
| retain_test.go | https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain_test.go#L176-L292 | func TestRetainClusterIPInServiceFields | Y |
|
||||
| taint.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L37-L73 | func ParseTaints | Y |
|
||||
| taint.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L75-L118 | func parseTaint | N |
|
||||
| taint.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L120-L126 | func validateTaintEffect | N |
|
||||
| taint_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils_test.go#L372-L533 | func TestParseTaints | N |
|
||||
| validateclustertaints.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L3497-L3518 | func validateClusterTaintEffect | Y |
|
||||
| validateclustertaints.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L5227-L5259 | func ValidateClusterTaints | Y |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L326-L348 | func ValidateIngressSpec | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L468C1-L509 | func validateIngressBackend | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L547C1-L578 | func validateIngressTypedLocalObjectReference | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L379-L409 | func validateIngressRules | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L411C1-L417 | func validateIngressRuleValue | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L419-L428 | func validateHTTPIngressRuleValue | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L430-L466 | func validateHTTPIngressPath | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L299-L324 | func validateIngressTLS | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L641-L646 | func validateTLSSecretName | N |
|
||||
| validatingmci.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation.go#L357-L377 | func ValidateIngressLoadBalancerStatus | N |
|
||||
| validatingmci_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation_test.go#L591-L824 | func TestValidateIngress | Y |
|
||||
| validatingmci_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation_test.go#L1747-L1836 | func TestValidateIngressTLS | N |
|
||||
| validatingmci_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation_test.go#L1838-L1897 | func TestValidateEmptyIngressTLS | N |
|
||||
| validatingmci_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation_test.go#L1899-L1991 | func TestValidateIngressStatusUpdate | Y |
|
||||
| validatingmcs.go | https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/core/validation/validation.go#L6826-L6846 | func ValidateLoadBalancerStatus | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L51-L61 | type ContainerType | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L63-L64 | const AllContainers | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L72-L74 | type ContainerVisitor | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L76-L77 | type Visitor | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L79-L88 | func skipEmptyNames | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L79-L88 | func VisitContainers | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L119-L189 | func VisitPodSecretNames | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L191-L208 | func visitContainerSecretNames | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L210-L238 | func VisitPodConfigmapNames | N |
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L240-L257 | func visitContainerConfigmapNames | N |
|
||||
| visitpod_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L66-L70 | func AllFeatureEnabledContainers | Y |
|
||||
| visitpod_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/component-base/featuregate/testing/feature_gate.go#L26-L44 | func SetFeatureGateDuringTest | N |
|
||||
| visitpod_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util_test.go#L202-L366 | func TestVisitContainers | Y |
|
||||
| visitpod_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util_test.go#L368-L523 | func TestPodSecrets | Y |
|
||||
| visitpod_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util_test.go#L525-L563 | func collectResourcePaths | N |
|
||||
| visitpod_test.go | https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util_test.go#L565-L665 | func TestPodConfigmaps | Y |
|
||||
*/
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.25/cmd/genutils/genutils.go
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/cmd/genutils/genutils.go
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -26,7 +26,7 @@ import (
|
|||
"path/filepath"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.25/cmd/genutils/genutils.go
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/cmd/genutils/genutils.go
|
||||
|
||||
// OutDir creates the absolute path name from path and checks path exists.
|
||||
// Returns absolute path including trailing '/' or error if path does not exist.
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.25/cmd/genutils/genutils_test.go
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/cmd/genutils/genutils_test.go
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -24,7 +24,7 @@ import (
|
|||
"testing"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.25/cmd/genutils/genutils_test.go#L23-L28
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/cmd/genutils/genutils_test.go#L23-L28
|
||||
|
||||
func TestValidDir(t *testing.T) {
|
||||
_, err := OutDir("./")
|
||||
|
@ -33,7 +33,7 @@ func TestValidDir(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.25/cmd/genutils/genutils_test.go#L30-L35
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/cmd/genutils/genutils_test.go#L30-L35
|
||||
|
||||
func TestInvalidDir(t *testing.T) {
|
||||
_, err := OutDir("./nondir")
|
||||
|
@ -42,7 +42,7 @@ func TestInvalidDir(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.25/cmd/genutils/genutils_test.go#L37-L42
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/cmd/genutils/genutils_test.go#L37-L42
|
||||
|
||||
func TestNotDir(t *testing.T) {
|
||||
_, err := OutDir("./genutils_test.go")
|
||||
|
|
|
@ -170,21 +170,22 @@ func (fs *flagScanner) Next() (byte, bool) {
|
|||
fs.AppendString(fs.end)
|
||||
}
|
||||
return c, true
|
||||
}
|
||||
c = fs.str[fs.Pos]
|
||||
if c == fs.flag {
|
||||
if fs.Pos < (fs.Length-1) && fs.str[fs.Pos+1] == fs.flag {
|
||||
fs.HasFlag = false
|
||||
fs.AppendChar(fs.flag)
|
||||
fs.Pos += 2
|
||||
return fs.Next()
|
||||
} else if fs.Pos != fs.Length-1 {
|
||||
if fs.HasFlag {
|
||||
fs.AppendString(fs.end)
|
||||
} else {
|
||||
c = fs.str[fs.Pos]
|
||||
if c == fs.flag {
|
||||
if fs.Pos < (fs.Length-1) && fs.str[fs.Pos+1] == fs.flag {
|
||||
fs.HasFlag = false
|
||||
fs.AppendChar(fs.flag)
|
||||
fs.Pos += 2
|
||||
return fs.Next()
|
||||
} else if fs.Pos != fs.Length-1 {
|
||||
if fs.HasFlag {
|
||||
fs.AppendString(fs.end)
|
||||
}
|
||||
fs.AppendString(fs.start)
|
||||
fs.ChangeFlag = true
|
||||
fs.HasFlag = true
|
||||
}
|
||||
fs.AppendString(fs.start)
|
||||
fs.ChangeFlag = true
|
||||
fs.HasFlag = true
|
||||
}
|
||||
}
|
||||
fs.Pos++
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L365-L397
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/component-helpers/scheduling/corev1/nodeaffinity/nodeaffinity.go#L203-L242
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -28,14 +28,16 @@ import (
|
|||
"k8s.io/apimachinery/pkg/selection"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L365-L397
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/component-helpers/scheduling/corev1/nodeaffinity/nodeaffinity.go#L203-L242
|
||||
// +lifted:changed
|
||||
|
||||
// NodeSelectorRequirementsAsSelector converts the []NodeSelectorRequirement core type into a struct that implements
|
||||
// labels.Selector.
|
||||
func NodeSelectorRequirementsAsSelector(nsm []corev1.NodeSelectorRequirement) (labels.Selector, error) {
|
||||
func NodeSelectorRequirementsAsSelector(nsm []corev1.NodeSelectorRequirement) (labels.Selector, []error) {
|
||||
if len(nsm) == 0 {
|
||||
return labels.Nothing(), nil
|
||||
}
|
||||
var errs []error
|
||||
selector := labels.NewSelector()
|
||||
for _, expr := range nsm {
|
||||
var op selection.Operator
|
||||
|
@ -53,13 +55,17 @@ func NodeSelectorRequirementsAsSelector(nsm []corev1.NodeSelectorRequirement) (l
|
|||
case corev1.NodeSelectorOpLt:
|
||||
op = selection.LessThan
|
||||
default:
|
||||
return nil, fmt.Errorf("%q is not a valid node selector operator", expr.Operator)
|
||||
errs = append(errs, fmt.Errorf("%q is not a valid node selector operator", expr.Operator))
|
||||
continue
|
||||
}
|
||||
r, err := labels.NewRequirement(expr.Key, op, expr.Values)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
errs = append(errs, err)
|
||||
}
|
||||
selector = selector.Add(*r)
|
||||
}
|
||||
if len(errs) != 0 {
|
||||
return nil, errs
|
||||
}
|
||||
return selector, nil
|
||||
}
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers_test.go#L138-L200
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/component-helpers/scheduling/corev1/nodeaffinity/nodeaffinity_test.go#L297-L360
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -28,7 +28,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/labels"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers_test.go#L138-L200
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/component-helpers/scheduling/corev1/nodeaffinity/nodeaffinity_test.go#L297-L360
|
||||
|
||||
func TestNodeSelectorRequirementsAsSelector(t *testing.T) {
|
||||
matchExpressions := []corev1.NodeSelectorRequirement{{
|
|
@ -16,8 +16,8 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/controller_utils.go#L466-L495
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/controller_utils.go#L539-L562
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/controller_utils.go#L466-L495
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/controller_utils.go#L539-L562
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -31,7 +31,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/controller_utils.go#L466-L472
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/controller_utils.go#L466-L472
|
||||
func getPodsLabelSet(template *corev1.PodTemplateSpec) labels.Set {
|
||||
desiredLabels := make(labels.Set)
|
||||
for k, v := range template.Labels {
|
||||
|
@ -40,14 +40,14 @@ func getPodsLabelSet(template *corev1.PodTemplateSpec) labels.Set {
|
|||
return desiredLabels
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/controller_utils.go#L474-L478
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/controller_utils.go#L474-L478
|
||||
func getPodsFinalizers(template *corev1.PodTemplateSpec) []string {
|
||||
desiredFinalizers := make([]string, len(template.Finalizers))
|
||||
copy(desiredFinalizers, template.Finalizers)
|
||||
return desiredFinalizers
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/controller_utils.go#L480-L486
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/controller_utils.go#L480-L486
|
||||
func getPodsAnnotationSet(template *corev1.PodTemplateSpec) labels.Set {
|
||||
desiredAnnotations := make(labels.Set)
|
||||
for k, v := range template.Annotations {
|
||||
|
@ -56,7 +56,7 @@ func getPodsAnnotationSet(template *corev1.PodTemplateSpec) labels.Set {
|
|||
return desiredAnnotations
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/controller_utils.go#L488-L495
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/controller_utils.go#L488-L495
|
||||
func getPodsPrefix(controllerName string) string {
|
||||
// use the dash (if the name isn't too long) to make the pod name a bit prettier
|
||||
prefix := fmt.Sprintf("%s-", controllerName)
|
||||
|
@ -66,7 +66,7 @@ func getPodsPrefix(controllerName string) string {
|
|||
return prefix
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/controller_utils.go#L539-L562
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/controller/controller_utils.go#L539-L562
|
||||
// +lifted:changed
|
||||
|
||||
// GetPodFromTemplate generates pod object from a template.
|
||||
|
|
|
@ -19,7 +19,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.24/cmd/kubeadm/app/util/pubkeypin/pubkeypin.go
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/cmd/kubeadm/app/util/pubkeypin/pubkeypin.go
|
||||
|
||||
package pubkeypin
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/apiserver/blob/release-1.23/pkg/endpoints/request/requestinfo_test.go#L30-L184
|
||||
// https://github.com/kubernetes/apiserver/blob/release-1.26/pkg/endpoints/request/requestinfo_test.go#L30-L184
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -28,7 +28,7 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/apiserver/blob/release-1.23/pkg/endpoints/request/requestinfo_test.go#L30-L148
|
||||
// +lifted:source=https://github.com/kubernetes/apiserver/blob/release-1.26/pkg/endpoints/request/requestinfo_test.go#L30-L148
|
||||
// +lifted:changed
|
||||
|
||||
func TestGetAPIRequestInfo(t *testing.T) {
|
||||
|
@ -143,7 +143,7 @@ func TestGetAPIRequestInfo(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/apiserver/blob/release-1.23/pkg/endpoints/request/requestinfo_test.go#L150-L184
|
||||
// +lifted:source=https://github.com/kubernetes/apiserver/blob/release-1.26/pkg/endpoints/request/requestinfo_test.go#L150-L184
|
||||
// +lifted:changed
|
||||
|
||||
func TestGetNonAPIRequestInfo(t *testing.T) {
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/scheduler/util/utils.go#L144-L148
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/util/utils.go#L144-L148
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -24,7 +24,7 @@ import (
|
|||
corev1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/scheduler/util/utils.go#L144-L148
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/util/utils.go#L157-L161
|
||||
// +lifted:changed
|
||||
|
||||
// IsScalarResourceName validates the resource for Extended, Hugepages, Native and AttachableVolume resources
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.25/pkg/scheduler/internal/cache/cache.go
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/internal/cache/cache.go
|
||||
|
||||
package cache
|
||||
|
||||
|
@ -489,6 +489,7 @@ func (cache *cacheImpl) removePod(pod *corev1.Pod) error {
|
|||
n, ok := cache.nodes[pod.Spec.NodeName]
|
||||
if !ok {
|
||||
klog.ErrorS(nil, "Node not found when trying to remove pod", "node", klog.KRef("", pod.Spec.NodeName), "podKey", key, "pod", klog.KObj(pod))
|
||||
|
||||
} else {
|
||||
if err := n.info.RemovePod(pod); err != nil {
|
||||
return err
|
||||
|
@ -746,6 +747,9 @@ func (cache *cacheImpl) cleanupExpiredAssumedPods() {
|
|||
cache.cleanupAssumedPods(time.Now())
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/internal/cache/cache.go#L738-L763
|
||||
// +lifted:changed
|
||||
|
||||
// cleanupAssumedPods exists for making test deterministic by taking time as input argument.
|
||||
// It also reports metrics on the cache size for nodes, pods, and assumed pods.
|
||||
func (cache *cacheImpl) cleanupAssumedPods(now time.Time) {
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.25/pkg/scheduler/internal/cache/interface.go
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/internal/cache/interface.go
|
||||
|
||||
package cache
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.25/pkg/scheduler/internal/cache/node_tree.go
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/internal/cache/node_tree.go
|
||||
|
||||
package cache
|
||||
|
||||
|
@ -114,7 +114,7 @@ func (nt *nodeTree) updateNode(old, new *corev1.Node) {
|
|||
if oldZone == newZone {
|
||||
return
|
||||
}
|
||||
_ = nt.removeNode(old) // No error checking. We ignore whether the old node exists or not.
|
||||
nt.removeNode(old) // No error checking. We ignore whether the old node exists or not.
|
||||
nt.addNode(new)
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.25/pkg/scheduler/internal/cache/snapshot.go
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/internal/cache/snapshot.go
|
||||
|
||||
package cache
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.25/pkg/scheduler/framework/listers.go
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/framework/listers.go
|
||||
|
||||
package framework
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/scheduler/framework/parallelize/parallelism.go
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/framework/parallelize/parallelism.go
|
||||
|
||||
package parallelize
|
||||
|
||||
|
@ -35,6 +35,9 @@ type Parallelizer struct {
|
|||
parallelism int
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/framework/parallelize/parallelism.go#L35-L38
|
||||
// +lifted:changed
|
||||
|
||||
// NewParallelizer returns an object holding the parallelism.
|
||||
func NewParallelizer(p int) Parallelizer {
|
||||
if p <= 0 {
|
||||
|
@ -57,7 +60,11 @@ func chunkSizeFor(n, parallelism int) int {
|
|||
return s
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/framework/parallelize/parallelism.go#L54-L65
|
||||
// +lifted:changed
|
||||
|
||||
// Until is a wrapper around workqueue.ParallelizeUntil to use in scheduling algorithms.
|
||||
// A given operation will be a label that is recorded in the goroutine metric.
|
||||
func (p Parallelizer) Until(ctx context.Context, pieces int, doWorkPiece workqueue.DoWorkPieceFunc) {
|
||||
workqueue.ParallelizeUntil(ctx, p.parallelism, pieces, doWorkPiece, workqueue.WithChunkSize(chunkSizeFor(pieces, p.parallelism)))
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/scheduler/framework/parallelize/parallelism_test.go
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/framework/parallelize/parallelism_test.go
|
||||
|
||||
package parallelize
|
||||
|
||||
|
@ -25,7 +25,7 @@ import (
|
|||
"testing"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/scheduler/framework/parallelize/parallelism_test.go
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/framework/parallelize/parallelism_test.go
|
||||
|
||||
func TestChunkSize(t *testing.T) {
|
||||
tests := []struct {
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.25/pkg/scheduler/framework/types.go
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/framework/types.go
|
||||
|
||||
package framework
|
||||
|
||||
|
@ -68,6 +68,8 @@ const (
|
|||
Node GVK = "Node"
|
||||
PersistentVolume GVK = "PersistentVolume"
|
||||
PersistentVolumeClaim GVK = "PersistentVolumeClaim"
|
||||
PodScheduling GVK = "PodScheduling"
|
||||
ResourceClaim GVK = "ResourceClaim"
|
||||
StorageClass GVK = "storage.k8s.io/StorageClass"
|
||||
CSINode GVK = "storage.k8s.io/CSINode"
|
||||
CSIDriver GVK = "storage.k8s.io/CSIDriver"
|
||||
|
@ -108,6 +110,8 @@ type QueuedPodInfo struct {
|
|||
//nolint:staticcheck
|
||||
// disable `deprecation` check for lifted code.
|
||||
UnschedulablePlugins sets.String
|
||||
// Whether the Pod is scheduling gated (by PreEnqueuePlugins) or not.
|
||||
Gated bool
|
||||
}
|
||||
|
||||
// DeepCopy returns a deep copy of the QueuedPodInfo object.
|
||||
|
@ -117,6 +121,8 @@ func (pqi *QueuedPodInfo) DeepCopy() *QueuedPodInfo {
|
|||
Timestamp: pqi.Timestamp,
|
||||
Attempts: pqi.Attempts,
|
||||
InitialAttemptTimestamp: pqi.InitialAttemptTimestamp,
|
||||
UnschedulablePlugins: pqi.UnschedulablePlugins.Clone(),
|
||||
Gated: pqi.Gated,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,7 +135,6 @@ type PodInfo struct {
|
|||
RequiredAntiAffinityTerms []AffinityTerm
|
||||
PreferredAffinityTerms []WeightedAffinityTerm
|
||||
PreferredAntiAffinityTerms []WeightedAffinityTerm
|
||||
ParseError error
|
||||
}
|
||||
|
||||
// DeepCopy returns a deep copy of the PodInfo object.
|
||||
|
@ -140,18 +145,17 @@ func (pi *PodInfo) DeepCopy() *PodInfo {
|
|||
RequiredAntiAffinityTerms: pi.RequiredAntiAffinityTerms,
|
||||
PreferredAffinityTerms: pi.PreferredAffinityTerms,
|
||||
PreferredAntiAffinityTerms: pi.PreferredAntiAffinityTerms,
|
||||
ParseError: pi.ParseError,
|
||||
}
|
||||
}
|
||||
|
||||
// Update creates a full new PodInfo by default. And only updates the pod when the PodInfo
|
||||
// has been instantiated and the passed pod is the exact same one as the original pod.
|
||||
func (pi *PodInfo) Update(pod *corev1.Pod) {
|
||||
func (pi *PodInfo) Update(pod *corev1.Pod) error {
|
||||
if pod != nil && pi.Pod != nil && pi.Pod.UID == pod.UID {
|
||||
// PodInfo includes immutable information, and so it is safe to update the pod in place if it is
|
||||
// the exact same pod
|
||||
pi.Pod = pod
|
||||
return
|
||||
return nil
|
||||
}
|
||||
var preferredAffinityTerms []corev1.WeightedPodAffinityTerm
|
||||
var preferredAntiAffinityTerms []corev1.WeightedPodAffinityTerm
|
||||
|
@ -189,10 +193,10 @@ func (pi *PodInfo) Update(pod *corev1.Pod) {
|
|||
pi.RequiredAntiAffinityTerms = requiredAntiAffinityTerms
|
||||
pi.PreferredAffinityTerms = weightedAffinityTerms
|
||||
pi.PreferredAntiAffinityTerms = weightedAntiAffinityTerms
|
||||
pi.ParseError = utilerrors.NewAggregate(parseErrs)
|
||||
return utilerrors.NewAggregate(parseErrs)
|
||||
}
|
||||
|
||||
// AffinityTerm is a processed version of v1.PodAffinityTerm.
|
||||
// AffinityTerm is a processed version of corev1.PodAffinityTerm.
|
||||
type AffinityTerm struct {
|
||||
//nolint:staticcheck
|
||||
// disable `deprecation` check for lifted code.
|
||||
|
@ -210,7 +214,7 @@ func (at *AffinityTerm) Matches(pod *corev1.Pod, nsLabels labels.Set) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// WeightedAffinityTerm is a "processed" representation of v1.WeightedAffinityTerm.
|
||||
// WeightedAffinityTerm is a "processed" representation of corev1.WeightedAffinityTerm.
|
||||
type WeightedAffinityTerm struct {
|
||||
AffinityTerm
|
||||
Weight int32
|
||||
|
@ -269,10 +273,10 @@ func getWeightedAffinityTerms(pod *corev1.Pod, v1Terms []corev1.WeightedPodAffin
|
|||
}
|
||||
|
||||
// NewPodInfo returns a new PodInfo.
|
||||
func NewPodInfo(pod *corev1.Pod) *PodInfo {
|
||||
func NewPodInfo(pod *corev1.Pod) (*PodInfo, error) {
|
||||
pInfo := &PodInfo{}
|
||||
pInfo.Update(pod)
|
||||
return pInfo
|
||||
err := pInfo.Update(pod)
|
||||
return pInfo, err
|
||||
}
|
||||
|
||||
func getPodAffinityTerms(affinity *corev1.Affinity) (terms []corev1.PodAffinityTerm) {
|
||||
|
@ -281,9 +285,9 @@ func getPodAffinityTerms(affinity *corev1.Affinity) (terms []corev1.PodAffinityT
|
|||
terms = affinity.PodAffinity.RequiredDuringSchedulingIgnoredDuringExecution
|
||||
}
|
||||
// TODO: Uncomment this block when implement RequiredDuringSchedulingRequiredDuringExecution.
|
||||
//if len(affinity.PodAffinity.RequiredDuringSchedulingRequiredDuringExecution) != 0 {
|
||||
// if len(affinity.PodAffinity.RequiredDuringSchedulingRequiredDuringExecution) != 0 {
|
||||
// terms = append(terms, affinity.PodAffinity.RequiredDuringSchedulingRequiredDuringExecution...)
|
||||
//}
|
||||
// }
|
||||
}
|
||||
return terms
|
||||
}
|
||||
|
@ -294,9 +298,9 @@ func getPodAntiAffinityTerms(affinity *corev1.Affinity) (terms []corev1.PodAffin
|
|||
terms = affinity.PodAntiAffinity.RequiredDuringSchedulingIgnoredDuringExecution
|
||||
}
|
||||
// TODO: Uncomment this block when implement RequiredDuringSchedulingRequiredDuringExecution.
|
||||
//if len(affinity.PodAntiAffinity.RequiredDuringSchedulingRequiredDuringExecution) != 0 {
|
||||
// if len(affinity.PodAntiAffinity.RequiredDuringSchedulingRequiredDuringExecution) != 0 {
|
||||
// terms = append(terms, affinity.PodAntiAffinity.RequiredDuringSchedulingRequiredDuringExecution...)
|
||||
//}
|
||||
// }
|
||||
}
|
||||
return terms
|
||||
}
|
||||
|
@ -464,7 +468,10 @@ func (n *NodeInfo) AddPodInfo(podInfo *PodInfo) {
|
|||
|
||||
// AddPod is a wrapper around AddPodInfo.
|
||||
func (n *NodeInfo) AddPod(pod *corev1.Pod) {
|
||||
n.AddPodInfo(NewPodInfo(pod))
|
||||
// ignore this err since apiserver doesn't properly validate affinity terms
|
||||
// and we can't fix the validation for backwards compatibility.
|
||||
podInfo, _ := NewPodInfo(pod)
|
||||
n.AddPodInfo(podInfo)
|
||||
}
|
||||
|
||||
func podWithAffinity(p *corev1.Pod) bool {
|
||||
|
@ -529,6 +536,7 @@ func (n *NodeInfo) RemovePod(pod *corev1.Pod) error {
|
|||
|
||||
// update node info based on the pod and sign.
|
||||
// The sign will be set to `+1` when AddPod and to `-1` when RemovePod.
|
||||
|
||||
func (n *NodeInfo) update(pod *corev1.Pod, sign int64) {
|
||||
res, non0CPU, non0Mem := calculateResource(pod)
|
||||
n.Requested.MilliCPU += sign * res.MilliCPU
|
||||
|
@ -625,9 +633,9 @@ func (n *NodeInfo) updatePVCRefCounts(pod *corev1.Pod, add bool) {
|
|||
|
||||
key := GetNamespacedName(pod.Namespace, v.PersistentVolumeClaim.ClaimName)
|
||||
if add {
|
||||
n.PVCRefCounts[key]++
|
||||
n.PVCRefCounts[key] += 1
|
||||
} else {
|
||||
n.PVCRefCounts[key]--
|
||||
n.PVCRefCounts[key] -= 1
|
||||
if n.PVCRefCounts[key] <= 0 {
|
||||
delete(n.PVCRefCounts, key)
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.25/pkg/scheduler/util/pod_resources.go
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/util/pod_resources.go
|
||||
|
||||
package util
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L37-L126
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L37-L126
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -29,7 +29,8 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/validation"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L37-L73
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L37-L73
|
||||
// +lifted:changed
|
||||
|
||||
// ParseTaints takes a spec which is an array and creates slices for new taints to be added, taints to be deleted.
|
||||
// It also validates the spec. For example, the form `<key>` may be used to remove a taint, but not to add one.
|
||||
|
@ -73,7 +74,7 @@ func ParseTaints(spec []string) ([]corev1.Taint, []corev1.Taint, error) {
|
|||
return taints, taintsToRemove, nil
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L75-L118
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L75-L118
|
||||
|
||||
// parseTaint parses a taint from a string, whose form must be either
|
||||
// '<key>=<value>:<effect>', '<key>:<effect>', or '<key>'.
|
||||
|
@ -120,7 +121,8 @@ func parseTaint(st string) (corev1.Taint, error) {
|
|||
return taint, nil
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L120-L126
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L120-L126
|
||||
|
||||
func validateTaintEffect(effect corev1.TaintEffect) error {
|
||||
if effect != corev1.TaintEffectNoSchedule && effect != corev1.TaintEffectPreferNoSchedule && effect != corev1.TaintEffectNoExecute {
|
||||
return fmt.Errorf("invalid taint effect: %v, unsupported taint effect", effect)
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils_test.go#L372-L533
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils_test.go#L372-L533
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -27,6 +27,8 @@ import (
|
|||
corev1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils_test.go#L372-L533
|
||||
|
||||
func TestParseTaints(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
|
|
|
@ -16,8 +16,8 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/validation/validation.go#L5001-L5033
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/validation/validation.go#L3305-L3326
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L3497-L3518
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L5227-L5259
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -31,10 +31,32 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/validation/validation.go#L5001-L5033
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L3497-L3518
|
||||
// +lifted:changed
|
||||
|
||||
// ValidateClusterTaints tests if given taints have valid data.
|
||||
// Original func name: validateTaintEffect
|
||||
func validateClusterTaintEffect(effect *corev1.TaintEffect, allowEmpty bool, fldPath *field.Path) field.ErrorList {
|
||||
if !allowEmpty && len(*effect) == 0 {
|
||||
return field.ErrorList{field.Required(fldPath, "")}
|
||||
}
|
||||
|
||||
allErrors := field.ErrorList{}
|
||||
switch *effect {
|
||||
case corev1.TaintEffectNoSchedule, corev1.TaintEffectNoExecute:
|
||||
default:
|
||||
validValues := []string{
|
||||
string(corev1.TaintEffectNoSchedule),
|
||||
string(corev1.TaintEffectNoExecute),
|
||||
}
|
||||
allErrors = append(allErrors, field.NotSupported(fldPath, *effect, validValues))
|
||||
}
|
||||
return allErrors
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/apis/core/validation/validation.go#L5227-L5259
|
||||
// +lifted:changed
|
||||
|
||||
// ValidateClusterTaints tests if given taints have valid data. Original func name: validateNodeTaints
|
||||
func ValidateClusterTaints(taints []corev1.Taint, fldPath *field.Path) field.ErrorList {
|
||||
allErrors := field.ErrorList{}
|
||||
|
||||
|
@ -71,23 +93,3 @@ func ValidateClusterTaints(taints []corev1.Taint, fldPath *field.Path) field.Err
|
|||
}
|
||||
return allErrors
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/validation/validation.go#L3305-L3326
|
||||
// +lifted:changed
|
||||
func validateClusterTaintEffect(effect *corev1.TaintEffect, allowEmpty bool, fldPath *field.Path) field.ErrorList {
|
||||
if !allowEmpty && len(*effect) == 0 {
|
||||
return field.ErrorList{field.Required(fldPath, "")}
|
||||
}
|
||||
|
||||
allErrors := field.ErrorList{}
|
||||
switch *effect {
|
||||
case corev1.TaintEffectNoSchedule, corev1.TaintEffectNoExecute:
|
||||
default:
|
||||
validValues := []string{
|
||||
string(corev1.TaintEffectNoSchedule),
|
||||
string(corev1.TaintEffectNoExecute),
|
||||
}
|
||||
allErrors = append(allErrors, field.NotSupported(fldPath, *effect, validValues))
|
||||
}
|
||||
return allErrors
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
networkingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation_test.go
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation_test.go#L591-L824
|
||||
// +lifted:changed
|
||||
|
||||
func TestValidateIngress(t *testing.T) {
|
||||
|
@ -244,7 +244,7 @@ func TestValidateIngress(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation_test.go
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation_test.go#L1747-L1836
|
||||
|
||||
func TestValidateIngressTLS(t *testing.T) {
|
||||
pathTypeImplementationSpecific := networkingv1.PathTypeImplementationSpecific
|
||||
|
@ -329,7 +329,7 @@ func TestValidateIngressTLS(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation_test.go
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation_test.go#L1838-L1897
|
||||
|
||||
// TestValidateEmptyIngressTLS verifies that an empty TLS configuration can be
|
||||
// specified, which ingress controllers may interpret to mean that TLS should be
|
||||
|
@ -386,7 +386,7 @@ func TestValidateEmptyIngressTLS(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation_test.go
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.27/pkg/apis/networking/validation/validation_test.go#L1899-L1991
|
||||
// +lifted:changed
|
||||
|
||||
func TestValidateIngressStatusUpdate(t *testing.T) {
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -24,7 +24,7 @@ import (
|
|||
corev1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L53-L63
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L51-L61
|
||||
|
||||
// ContainerType signifies container type
|
||||
type ContainerType int
|
||||
|
@ -38,23 +38,24 @@ const (
|
|||
EphemeralContainers
|
||||
)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L65-L66
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L63-L64
|
||||
|
||||
// AllContainers specifies that all containers be visited
|
||||
const AllContainers ContainerType = (InitContainers | Containers | EphemeralContainers)
|
||||
const AllContainers ContainerType = InitContainers | Containers | EphemeralContainers
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L78-L80
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L72-L74
|
||||
|
||||
// ContainerVisitor is called with each container spec, and returns true
|
||||
// if visiting should continue.
|
||||
type ContainerVisitor func(container *corev1.Container, containerType ContainerType) (shouldContinue bool)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L82-L83
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L76-L77
|
||||
|
||||
// Visitor is called with each object name, and returns true if visiting should continue
|
||||
type Visitor func(name string) (shouldContinue bool)
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L85-L94
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L79-L88
|
||||
|
||||
func skipEmptyNames(visitor Visitor) Visitor {
|
||||
return func(name string) bool {
|
||||
if len(name) == 0 {
|
||||
|
@ -66,7 +67,7 @@ func skipEmptyNames(visitor Visitor) Visitor {
|
|||
}
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L96-L123
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L79-L88
|
||||
|
||||
// VisitContainers invokes the visitor function with a pointer to every container
|
||||
// spec in the given pod spec with type set in mask. If visitor returns false,
|
||||
|
@ -97,7 +98,7 @@ func VisitContainers(podSpec *corev1.PodSpec, mask ContainerType, visitor Contai
|
|||
return true
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L125-L195
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L119-L189
|
||||
|
||||
// VisitPodSecretNames invokes the visitor function with the name of every secret
|
||||
// referenced by the pod spec. If visitor returns false, visiting is short-circuited.
|
||||
|
@ -173,7 +174,8 @@ func VisitPodSecretNames(pod *corev1.Pod, visitor Visitor) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L197-L213
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L191-L208
|
||||
|
||||
func visitContainerSecretNames(container *corev1.Container, visitor Visitor) bool {
|
||||
for _, env := range container.EnvFrom {
|
||||
if env.SecretRef != nil {
|
||||
|
@ -192,7 +194,7 @@ func visitContainerSecretNames(container *corev1.Container, visitor Visitor) boo
|
|||
return true
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L215-L243
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L210-L238
|
||||
|
||||
// VisitPodConfigmapNames invokes the visitor function with the name of every configmap
|
||||
// referenced by the pod spec. If visitor returns false, visiting is short-circuited.
|
||||
|
@ -224,7 +226,9 @@ func VisitPodConfigmapNames(pod *corev1.Pod, visitor Visitor) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L245-L261
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L240-L257
|
||||
|
||||
// visitContainerConfigmapNames returns true unless the visitor returned false when invoked with a configmap reference
|
||||
func visitContainerConfigmapNames(container *corev1.Container, visitor Visitor) bool {
|
||||
for _, env := range container.EnvFrom {
|
||||
if env.ConfigMapRef != nil {
|
||||
|
|
|
@ -16,7 +16,12 @@ limitations under the License.
|
|||
|
||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||
// For reference:
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util_test.go#L205-L695
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L66-L70
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util_test.go#L202-L366
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util_test.go#L368-L523
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util_test.go#L525-L563
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util_test.go#L565-L665
|
||||
// https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/component-base/featuregate/testing/feature_gate.go#L26-L44
|
||||
|
||||
package lifted
|
||||
|
||||
|
@ -47,7 +52,8 @@ func init() {
|
|||
runtime.Must(utilfeature.DefaultMutableFeatureGate.Add(testKubernetesFeatureGates))
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L68-L76
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util.go#L66-L70
|
||||
// +lifted:changed
|
||||
|
||||
// AllFeatureEnabledContainers returns a ContainerType mask which includes all container
|
||||
// types except for the ones guarded by feature gate.
|
||||
|
@ -59,7 +65,7 @@ func AllFeatureEnabledContainers() ContainerType {
|
|||
return containerType
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/staging/src/k8s.io/component-base/featuregate/testing/feature_gate.go#L26-L44
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/staging/src/k8s.io/component-base/featuregate/testing/feature_gate.go#L26-L44
|
||||
|
||||
// SetFeatureGateDuringTest sets the specified gate to the specified value, and returns a function that restores the original value.
|
||||
// Failures to set or restore cause the test to fail.
|
||||
|
@ -81,7 +87,7 @@ func SetFeatureGateDuringTest(tb testing.TB, gate featuregate.FeatureGate, f fea
|
|||
}
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util_test.go#L205-L392
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util_test.go#L202-L366
|
||||
// +lifted:changed
|
||||
|
||||
func TestVisitContainers(t *testing.T) {
|
||||
|
@ -273,7 +279,7 @@ func TestVisitContainers(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util_test.go#L394-L551
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util_test.go#L368-L523
|
||||
// +lifted:changed
|
||||
|
||||
func TestPodSecrets(t *testing.T) {
|
||||
|
@ -435,7 +441,7 @@ func TestPodSecrets(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util_test.go#L553-L591
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util_test.go#L525-L563
|
||||
|
||||
// collectResourcePaths traverses the object, computing all the struct paths that lead to fields with resourcename in the name.
|
||||
// disable `deprecation` check for lifted code.
|
||||
|
@ -480,7 +486,7 @@ func collectResourcePaths(t *testing.T, resourcename string, path *field.Path, n
|
|||
return resourcePaths
|
||||
}
|
||||
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util_test.go#L593-L695
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/api/v1/pod/util_test.go#L565-L665
|
||||
// +lifted:changed
|
||||
|
||||
func TestPodConfigmaps(t *testing.T) {
|
||||
|
|
|
@ -106,8 +106,8 @@ func ClusterMatches(cluster *clusterv1alpha1.Cluster, affinity policyv1alpha1.Cl
|
|||
|
||||
if affinity.FieldSelector != nil {
|
||||
var matchFields labels.Selector
|
||||
var err error
|
||||
if matchFields, err = lifted.NodeSelectorRequirementsAsSelector(affinity.FieldSelector.MatchExpressions); err != nil {
|
||||
var errs []error
|
||||
if matchFields, errs = lifted.NodeSelectorRequirementsAsSelector(affinity.FieldSelector.MatchExpressions); errs != nil {
|
||||
return false
|
||||
}
|
||||
clusterFields := extractClusterFields(cluster)
|
||||
|
|
Loading…
Reference in New Issue