Merge pull request #1453 from XiShanYongYe-Chang/record-lifted-details
[docs] Add doc for recording lifted details
This commit is contained in:
commit
914cb67f82
|
@ -16,61 +16,17 @@ limitations under the License.
|
||||||
|
|
||||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||||
// For reference:
|
// For reference:
|
||||||
// https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/v1/helper/helpers.go
|
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go
|
||||||
|
|
||||||
package lifted
|
package lifted
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
"k8s.io/apimachinery/pkg/util/validation"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// IsExtendedResourceName returns true if:
|
|
||||||
// 1. the resource name is not in the default namespace;
|
|
||||||
// 2. resource name does not have "requests." prefix,
|
|
||||||
// to avoid confusion with the convention in quota
|
|
||||||
// 3. it satisfies the rules in IsQualifiedName() after converted into quota resource name
|
|
||||||
func IsExtendedResourceName(name corev1.ResourceName) bool {
|
|
||||||
if IsNativeResource(name) || strings.HasPrefix(string(name), corev1.DefaultResourceRequestsPrefix) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
// Ensure it satisfies the rules in IsQualifiedName() after converted into quota resource name
|
|
||||||
nameForQuota := fmt.Sprintf("%s%s", corev1.DefaultResourceRequestsPrefix, string(name))
|
|
||||||
if errs := validation.IsQualifiedName(string(nameForQuota)); len(errs) != 0 {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsPrefixedNativeResource returns true if the resource name is in the
|
|
||||||
// *kubernetes.io/ namespace.
|
|
||||||
func IsPrefixedNativeResource(name corev1.ResourceName) bool {
|
|
||||||
return strings.Contains(string(name), corev1.ResourceDefaultNamespacePrefix)
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsNativeResource returns true if the resource name is in the
|
|
||||||
// *kubernetes.io/ namespace. Partially-qualified (unprefixed) names are
|
|
||||||
// implicitly in the kubernetes.io/ namespace.
|
|
||||||
func IsNativeResource(name corev1.ResourceName) bool {
|
|
||||||
return !strings.Contains(string(name), "/") ||
|
|
||||||
IsPrefixedNativeResource(name)
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsHugePageResourceName returns true if the resource name has the huge page
|
|
||||||
// resource prefix.
|
|
||||||
func IsHugePageResourceName(name corev1.ResourceName) bool {
|
|
||||||
return strings.HasPrefix(string(name), corev1.ResourceHugePagesPrefix)
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsAttachableVolumeResourceName returns true when the resource name is prefixed in attachable volume
|
|
||||||
func IsAttachableVolumeResourceName(name corev1.ResourceName) bool {
|
|
||||||
return strings.HasPrefix(string(name), corev1.ResourceAttachableVolumesPrefix)
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsQuotaHugePageResourceName returns true if the resource name has the quota
|
// IsQuotaHugePageResourceName returns true if the resource name has the quota
|
||||||
// related huge page resource prefix.
|
// related huge page resource prefix.
|
||||||
func IsQuotaHugePageResourceName(name corev1.ResourceName) bool {
|
func IsQuotaHugePageResourceName(name corev1.ResourceName) bool {
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2014 The Kubernetes Authors.
|
Copyright 2015 The Kubernetes Authors.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -16,13 +16,30 @@ limitations under the License.
|
||||||
|
|
||||||
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||||
// For reference:
|
// For reference:
|
||||||
// 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.23/pkg/apis/core/helper/helpers_test.go
|
||||||
|
|
||||||
package lifted
|
package lifted
|
||||||
|
|
||||||
import apimachineryvalidation "k8s.io/apimachinery/pkg/api/validation"
|
import (
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
// ValidatePodName can be used to check whether the given pod name is valid.
|
func TestIsStandardResource(t *testing.T) {
|
||||||
// Prefix indicates this name will be used as part of generation, in which case
|
testCases := []struct {
|
||||||
// trailing dashes are allowed.
|
input string
|
||||||
var ValidatePodName = apimachineryvalidation.NameIsDNSSubdomain
|
output bool
|
||||||
|
}{
|
||||||
|
{"cpu", true},
|
||||||
|
{"memory", true},
|
||||||
|
{"disk", false},
|
||||||
|
{"blah", false},
|
||||||
|
{"x.y.z", false},
|
||||||
|
{"hugepages-2Mi", true},
|
||||||
|
{"requests.hugepages-2Mi", true},
|
||||||
|
}
|
||||||
|
for i, tc := range testCases {
|
||||||
|
if IsStandardResourceName(tc.input) != tc.output {
|
||||||
|
t.Errorf("case[%d], input: %s, expected: %t, got: %t", i, tc.input, tc.output, !tc.output)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
Copyright 2014 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
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
|
||||||
|
|
||||||
|
package lifted
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/util/validation"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IsExtendedResourceName returns true if:
|
||||||
|
// 1. the resource name is not in the default namespace;
|
||||||
|
// 2. resource name does not have "requests." prefix,
|
||||||
|
// to avoid confusion with the convention in quota
|
||||||
|
// 3. it satisfies the rules in IsQualifiedName() after converted into quota resource name
|
||||||
|
func IsExtendedResourceName(name corev1.ResourceName) bool {
|
||||||
|
if IsNativeResource(name) || strings.HasPrefix(string(name), corev1.DefaultResourceRequestsPrefix) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// Ensure it satisfies the rules in IsQualifiedName() after converted into quota resource name
|
||||||
|
nameForQuota := fmt.Sprintf("%s%s", corev1.DefaultResourceRequestsPrefix, string(name))
|
||||||
|
if errs := validation.IsQualifiedName(string(nameForQuota)); len(errs) != 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsPrefixedNativeResource returns true if the resource name is in the
|
||||||
|
// *kubernetes.io/ namespace.
|
||||||
|
func IsPrefixedNativeResource(name corev1.ResourceName) bool {
|
||||||
|
return strings.Contains(string(name), corev1.ResourceDefaultNamespacePrefix)
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsNativeResource returns true if the resource name is in the
|
||||||
|
// *kubernetes.io/ namespace. Partially-qualified (unprefixed) names are
|
||||||
|
// implicitly in the kubernetes.io/ namespace.
|
||||||
|
func IsNativeResource(name corev1.ResourceName) bool {
|
||||||
|
return !strings.Contains(string(name), "/") ||
|
||||||
|
IsPrefixedNativeResource(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsHugePageResourceName returns true if the resource name has the huge page
|
||||||
|
// resource prefix.
|
||||||
|
func IsHugePageResourceName(name corev1.ResourceName) bool {
|
||||||
|
return strings.HasPrefix(string(name), corev1.ResourceHugePagesPrefix)
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsAttachableVolumeResourceName returns true when the resource name is prefixed in attachable volume
|
||||||
|
func IsAttachableVolumeResourceName(name corev1.ResourceName) bool {
|
||||||
|
return strings.HasPrefix(string(name), corev1.ResourceAttachableVolumesPrefix)
|
||||||
|
}
|
|
@ -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.
|
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||||
// For reference:
|
// 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.23/pkg/apis/core/v1/helper/helpers_test.go
|
||||||
|
|
||||||
package lifted
|
package lifted
|
||||||
|
|
||||||
|
@ -64,23 +64,3 @@ func TestIsNativeResource(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIsStandardResource(t *testing.T) {
|
|
||||||
testCases := []struct {
|
|
||||||
input string
|
|
||||||
output bool
|
|
||||||
}{
|
|
||||||
{"cpu", true},
|
|
||||||
{"memory", true},
|
|
||||||
{"disk", false},
|
|
||||||
{"blah", false},
|
|
||||||
{"x.y.z", false},
|
|
||||||
{"hugepages-2Mi", true},
|
|
||||||
{"requests.hugepages-2Mi", true},
|
|
||||||
}
|
|
||||||
for i, tc := range testCases {
|
|
||||||
if IsStandardResourceName(tc.input) != tc.output {
|
|
||||||
t.Errorf("case[%d], input: %s, expected: %t, got: %t", i, tc.input, tc.output, !tc.output)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -18,6 +18,7 @@ limitations under the License.
|
||||||
// For reference:
|
// 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#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#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#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#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#L5073-L5084
|
||||||
|
@ -38,15 +39,16 @@ const isNegativeErrorMsg string = apimachineryvalidation.IsNegativeErrorMsg
|
||||||
const isInvalidQuotaResource string = `must be a standard resource for quota`
|
const isInvalidQuotaResource string = `must be a standard resource for quota`
|
||||||
const isNotIntegerErrorMsg string = `must be an integer`
|
const isNotIntegerErrorMsg string = `must be an integer`
|
||||||
|
|
||||||
// ValidateResourceQuotaResourceName Validate resource names that can go in a resource quota
|
// ValidatePodName can be used to check whether the given pod name is valid.
|
||||||
// Refer to docs/design/resources.md for more details.
|
// Prefix indicates this name will be used as part of generation, in which case
|
||||||
func ValidateResourceQuotaResourceName(value string, fldPath *field.Path) field.ErrorList {
|
// trailing dashes are allowed.
|
||||||
allErrs := validateResourceName(value, fldPath)
|
var ValidatePodName = apimachineryvalidation.NameIsDNSSubdomain
|
||||||
|
|
||||||
if len(strings.Split(value, "/")) == 1 {
|
// ValidateNonnegativeQuantity Validates that a Quantity is not negative
|
||||||
if !IsStandardQuotaResourceName(value) {
|
func ValidateNonnegativeQuantity(value resource.Quantity, fldPath *field.Path) field.ErrorList {
|
||||||
return append(allErrs, field.Invalid(fldPath, value, isInvalidQuotaResource))
|
allErrs := field.ErrorList{}
|
||||||
}
|
if value.Cmp(resource.Quantity{}) < 0 {
|
||||||
|
allErrs = append(allErrs, field.Invalid(fldPath, value.String(), isNegativeErrorMsg))
|
||||||
}
|
}
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
@ -71,6 +73,19 @@ func validateResourceName(value string, fldPath *field.Path) field.ErrorList {
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ValidateResourceQuotaResourceName Validate resource names that can go in a resource quota
|
||||||
|
// Refer to docs/design/resources.md for more details.
|
||||||
|
func ValidateResourceQuotaResourceName(value string, fldPath *field.Path) field.ErrorList {
|
||||||
|
allErrs := validateResourceName(value, fldPath)
|
||||||
|
|
||||||
|
if len(strings.Split(value, "/")) == 1 {
|
||||||
|
if !IsStandardQuotaResourceName(value) {
|
||||||
|
return append(allErrs, field.Invalid(fldPath, value, isInvalidQuotaResource))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return allErrs
|
||||||
|
}
|
||||||
|
|
||||||
// ValidateResourceQuantityValue enforces that specified quantity is valid for specified resource
|
// ValidateResourceQuantityValue enforces that specified quantity is valid for specified resource
|
||||||
func ValidateResourceQuantityValue(resource string, value resource.Quantity, fldPath *field.Path) field.ErrorList {
|
func ValidateResourceQuantityValue(resource string, value resource.Quantity, fldPath *field.Path) field.ErrorList {
|
||||||
allErrs := field.ErrorList{}
|
allErrs := field.ErrorList{}
|
||||||
|
@ -82,12 +97,3 @@ func ValidateResourceQuantityValue(resource string, value resource.Quantity, fld
|
||||||
}
|
}
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateNonnegativeQuantity Validates that a Quantity is not negative
|
|
||||||
func ValidateNonnegativeQuantity(value resource.Quantity, fldPath *field.Path) field.ErrorList {
|
|
||||||
allErrs := field.ErrorList{}
|
|
||||||
if value.Cmp(resource.Quantity{}) < 0 {
|
|
||||||
allErrs = append(allErrs, field.Invalid(fldPath, value.String(), isNegativeErrorMsg))
|
|
||||||
}
|
|
||||||
return allErrs
|
|
||||||
}
|
|
|
@ -16,7 +16,9 @@ limitations under the License.
|
||||||
|
|
||||||
// This code is lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
// 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.
|
// 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/deployment/util/deployment_util.go
|
// 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
|
package lifted
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,23 @@
|
||||||
|
/*
|
||||||
|
Copyright 2016 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
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
|
||||||
|
|
||||||
package lifted
|
package lifted
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -6,15 +26,13 @@ import (
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetDeletableResources returns all resources from discoveryClient.
|
// GetDeletableResources returns all resources from discoveryClient that the
|
||||||
// More specifically, all preferred resources which support the 'delete', 'list', and 'watch' verbs.
|
// garbage collector should recognize and work with. More specifically, all
|
||||||
|
// preferred resources which support the 'delete', 'list', and 'watch' verbs.
|
||||||
//
|
//
|
||||||
// All discovery errors are considered temporary. Upon encountering any error,
|
// All discovery errors are considered temporary. Upon encountering any error,
|
||||||
// GetDeletableResources will log and return any discovered resources it was
|
// GetDeletableResources will log and return any discovered resources it was
|
||||||
// able to process (which may be none).
|
// able to process (which may be none).
|
||||||
//
|
|
||||||
// This code is directly lifted from the Kubernetes codebase.
|
|
||||||
// For reference: https://github.com/kubernetes/kubernetes/blob/1e11e4a2108024935ecfcb2912226cedeafd99df/pkg/controller/garbagecollector/garbagecollector.go#L638-L667
|
|
||||||
func GetDeletableResources(discoveryClient discovery.ServerResourcesInterface) map[schema.GroupVersionResource]struct{} {
|
func GetDeletableResources(discoveryClient discovery.ServerResourcesInterface) map[schema.GroupVersionResource]struct{} {
|
||||||
preferredResources, err := discoveryClient.ServerPreferredResources()
|
preferredResources, err := discoveryClient.ServerPreferredResources()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
// Package lifted contains the files lifted from other projects.
|
||||||
|
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 |
|
||||||
|
| corev1helpers.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/v1/helper/helpers.go#L31-L46 | func IsExtendedResourceName | N |
|
||||||
|
| 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 | var 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 |
|
||||||
|
| discovery.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/garbagecollector/garbagecollector.go#L696-L732 | func GetDeletableResources | N |
|
||||||
|
| nodeselector.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L365-L397 | func NodeSelectorRequirementsAsSelector | 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-sigs/kubefed/blob/master/pkg/controller/util/meta.go#L63-L80 | 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 |
|
||||||
|
| 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 |
|
||||||
|
| 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 |
|
||||||
|
| 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 |
|
||||||
|
*/
|
|
@ -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.
|
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||||
// For reference:
|
// For reference:
|
||||||
// https://github.com/kubernetes/kubernetes/blob/release-1.20/staging/src/k8s.io/component-helpers/scheduling/corev1/nodeaffinity/nodeaffinity.go#L193-L225
|
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L365-L397
|
||||||
|
|
||||||
package lifted
|
package lifted
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ import (
|
||||||
"k8s.io/apimachinery/pkg/selection"
|
"k8s.io/apimachinery/pkg/selection"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NodeSelectorRequirementsAsSelector converts the []NodeSelectorRequirement api type into a struct that implements
|
// NodeSelectorRequirementsAsSelector converts the []NodeSelectorRequirement core type into a struct that implements
|
||||||
// labels.Selector.
|
// labels.Selector.
|
||||||
func NodeSelectorRequirementsAsSelector(nsm []corev1.NodeSelectorRequirement) (labels.Selector, error) {
|
func NodeSelectorRequirementsAsSelector(nsm []corev1.NodeSelectorRequirement) (labels.Selector, error) {
|
||||||
if len(nsm) == 0 {
|
if len(nsm) == 0 {
|
||||||
|
|
|
@ -16,7 +16,9 @@ limitations under the License.
|
||||||
|
|
||||||
// This code is lifted from the kubefed codebase. It's a list of functions to determine whether the provided cluster
|
// This code is lifted from the kubefed codebase. It's a list of functions to determine whether the provided cluster
|
||||||
// object needs to be updated according to the desired object and the recorded version.
|
// object needs to be updated according to the desired object and the recorded version.
|
||||||
// For reference: https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/util/propagatedversion.go#L30-L59
|
// For reference:
|
||||||
|
// https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/util/propagatedversion.go#L30-L59
|
||||||
|
// https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/util/meta.go#L63-L80
|
||||||
|
|
||||||
package lifted
|
package lifted
|
||||||
|
|
||||||
|
|
|
@ -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.
|
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||||
// For reference:
|
// For reference:
|
||||||
// https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/controller_utils.go#L466-L495
|
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/controller_utils.go#L466-L495
|
||||||
// https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/controller_utils.go#L539-L562
|
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/controller_utils.go#L539-L562
|
||||||
|
|
||||||
package lifted
|
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.
|
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||||
// For reference:
|
// For reference:
|
||||||
// https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/scheduler/util/utils.go#L144-L148
|
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/scheduler/util/utils.go#L144-L148
|
||||||
|
|
||||||
package lifted
|
package lifted
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||||
|
|
||||||
// This code is directly lifted from the Kubernetes codebase.
|
// This code is directly lifted from the Kubernetes codebase.
|
||||||
// For reference:
|
// For reference:
|
||||||
// https://github.com/kubernetes/kubernetes/blob/ed42bbd722a14640f8b5315a521745e7526ff31b/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L37-L126
|
// https://github.com/kubernetes/kubernetes/blob/release-1.23/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L37-L126
|
||||||
|
|
||||||
package lifted
|
package lifted
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||||
|
|
||||||
// This code is directly lifted from the Kubernetes codebase.
|
// This code is directly lifted from the Kubernetes codebase.
|
||||||
// For reference:
|
// For reference:
|
||||||
// https://github.com/kubernetes/kubernetes/blob/ed42bbd722a14640f8b5315a521745e7526ff31b/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils_test.go#L372-L533
|
// https://github.com/kubernetes/kubernetes/blob/release-1.23/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils_test.go#L372-L533
|
||||||
|
|
||||||
package lifted
|
package lifted
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2014 The Kubernetes Authors.
|
Copyright 2014 The Kubernetes Authors.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -11,6 +14,11 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
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
|
||||||
|
|
||||||
package lifted
|
package lifted
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -23,8 +31,6 @@ import (
|
||||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This code logic is lifted from https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/core/validation/validation.go#L5003
|
|
||||||
|
|
||||||
// ValidateClusterTaints tests if given taints have valid data.
|
// ValidateClusterTaints tests if given taints have valid data.
|
||||||
func ValidateClusterTaints(taints []corev1.Taint, fldPath *field.Path) field.ErrorList {
|
func ValidateClusterTaints(taints []corev1.Taint, fldPath *field.Path) field.ErrorList {
|
||||||
allErrors := field.ErrorList{}
|
allErrors := field.ErrorList{}
|
||||||
|
|
|
@ -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.
|
// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
|
||||||
// For reference:
|
// For reference:
|
||||||
// https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/api/v1/pod/util.go
|
// https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go
|
||||||
|
|
||||||
package lifted
|
package lifted
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue