commit
578961ea11
|
@ -0,0 +1,114 @@
|
|||
# Overview
|
||||
This document explains how lifted code is managed.
|
||||
A common user case for this task is developer lifting code from other repositories to `pkg/util/lifted` directory.
|
||||
|
||||
- [Steps of lifting code](#steps-of-lifting-code)
|
||||
- [How to write lifted comments](#how-to-write-lifted-comments)
|
||||
- [Examples](#examples)
|
||||
|
||||
## Steps of lifting code
|
||||
- Copy code from another repository and save it to a go file under `pkg/util/lifted`.
|
||||
- Optionally change the lifted code.
|
||||
- Add lifted comments for the code [as guided](#how-to-write-lifted-comments).
|
||||
- Run `hack/update-lifted.sh` to update the lifted doc `pkg/util/lifted/doc.go`.
|
||||
|
||||
## How to write lifted comments
|
||||
Lifted comments shall be placed just before the lifted code (could be a func, type, var or const). Only empty lines and comments are allowed between lifted comments and lifted code.
|
||||
|
||||
Lifted comments are composed by one or multi comment lines, each in the format of `+lifted:KEY[=VALUE]`. Value is optional for some keys.
|
||||
|
||||
Valid keys are as follow:
|
||||
|
||||
- source:
|
||||
|
||||
Key `source` is required. Its value indicates where the code is lifted from.
|
||||
|
||||
- changed:
|
||||
|
||||
Key `changed` is optional. It indicates whether the code is changed. Value is optional (`true` or `false`, defaults to `true`). Not adding this key or setting it to `false` means no code change.
|
||||
|
||||
## Examples
|
||||
### Lifting function
|
||||
|
||||
Lift function `IsQuotaHugePageResourceName` to `corehelpers.go`:
|
||||
|
||||
```go
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/helper/helpers.go#L57-L61
|
||||
|
||||
// IsQuotaHugePageResourceName returns true if the resource name has the quota
|
||||
// related huge page resource prefix.
|
||||
func IsQuotaHugePageResourceName(name corev1.ResourceName) bool {
|
||||
return strings.HasPrefix(string(name), corev1.ResourceHugePagesPrefix) || strings.HasPrefix(string(name), corev1.ResourceRequestsHugePagesPrefix)
|
||||
}
|
||||
```
|
||||
|
||||
Added in `doc.go`:
|
||||
|
||||
```markdown
|
||||
| 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 |
|
||||
```
|
||||
|
||||
### Changed lifting function
|
||||
|
||||
Lift and change function `GetNewReplicaSet` to `deployment.go`
|
||||
|
||||
```go
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util.go#L536-L544
|
||||
// +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) {
|
||||
rsList, err := ListReplicaSetsByDeployment(deployment, f)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return FindNewReplicaSet(deployment, rsList), nil
|
||||
}
|
||||
```
|
||||
|
||||
Added in `doc.go`:
|
||||
|
||||
```markdown
|
||||
| lifted file | source file | const/var/type/func | changed |
|
||||
|--------------------------|-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------|---------|
|
||||
| deployment.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util.go#L536-L544 | func GetNewReplicaSet | Y |
|
||||
```
|
||||
|
||||
### Lifting const
|
||||
|
||||
Lift const `isNegativeErrorMsg` to `corevalidation.go `:
|
||||
|
||||
```go
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L59
|
||||
const isNegativeErrorMsg string = apimachineryvalidation.IsNegativeErrorMsg
|
||||
```
|
||||
|
||||
Added in `doc.go`:
|
||||
|
||||
```markdown
|
||||
| lifted file | source file | const/var/type/func | changed |
|
||||
|--------------------------|-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------|---------|
|
||||
| corevalidation.go | https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L59 | const isNegativeErrorMsg | N |
|
||||
```
|
||||
|
||||
### Lifting type
|
||||
|
||||
Lift type `Visitor` to `visitpod.go`:
|
||||
|
||||
```go
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L82-L83
|
||||
|
||||
// Visitor is called with each object name, and returns true if visiting should continue
|
||||
type Visitor func(name string) (shouldContinue bool)
|
||||
```
|
||||
|
||||
Added in `doc.go`:
|
||||
|
||||
```markdown
|
||||
| lifted file | source file | const/var/type/func | changed |
|
||||
|--------------------------|-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------|---------|
|
||||
| visitpod.go | https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/api/v1/pod/util.go#L82-L83 | type Visitor | N |
|
||||
```
|
|
@ -16,8 +16,12 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
liftedPrefixSource = "+lifted-source:"
|
||||
liftedPrefixChanged = "+lifted-changed"
|
||||
// a lifted comment line shall be like `+lifted:key=value`
|
||||
liftedPrefix = "+lifted:"
|
||||
liftedKeyValueSeparator = "="
|
||||
|
||||
liftedKeySource = "source"
|
||||
liftedKeyChanged = "changed"
|
||||
|
||||
docPrefix = "// Code generated by hack/update-lifted. DO NOT EDIT.\n\n" +
|
||||
"// Package lifted contains the files lifted from other projects.\n" +
|
||||
|
@ -163,18 +167,17 @@ func (a *analyzer) collectFuncDecl(cmap ast.CommentMap, file string, decl *ast.F
|
|||
func (a *analyzer) parseComments(comments []*ast.CommentGroup) (item item, ok bool) {
|
||||
for _, comment := range comments {
|
||||
for _, c := range comment.List {
|
||||
line := c.Text
|
||||
line = strings.TrimSpace(line)
|
||||
line = strings.TrimPrefix(line, "//")
|
||||
line = strings.TrimSpace(line)
|
||||
key, value, isLifted := parseLiftedLine(c.Text)
|
||||
if !isLifted {
|
||||
continue
|
||||
}
|
||||
|
||||
switch {
|
||||
case strings.HasPrefix(line, liftedPrefixSource):
|
||||
item.source = strings.TrimPrefix(line, liftedPrefixSource)
|
||||
item.source = strings.TrimSpace(item.source)
|
||||
switch key {
|
||||
case liftedKeySource:
|
||||
item.source = value
|
||||
ok = true
|
||||
case line == liftedPrefixChanged:
|
||||
item.changed = true
|
||||
case liftedKeyChanged:
|
||||
item.changed = parseBool(value, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,3 +229,36 @@ type item struct {
|
|||
kindName string
|
||||
changed bool
|
||||
}
|
||||
|
||||
func parseLiftedLine(line string) (key, value string, isLifted bool) {
|
||||
// a lifted lie is like: `// +lifted:key=value`
|
||||
line = strings.TrimSpace(line)
|
||||
line = strings.TrimPrefix(line, "//")
|
||||
line = strings.TrimSpace(line)
|
||||
|
||||
isLifted = strings.HasPrefix(line, liftedPrefix)
|
||||
if !isLifted {
|
||||
return
|
||||
}
|
||||
line = strings.TrimPrefix(line, liftedPrefix)
|
||||
parts := strings.SplitN(line, liftedKeyValueSeparator, 2)
|
||||
if len(parts) > 0 {
|
||||
key = strings.TrimSpace(parts[0])
|
||||
}
|
||||
if len(parts) > 1 {
|
||||
value = strings.TrimSpace(parts[1])
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func parseBool(s string, defaultValue bool) bool {
|
||||
s = strings.ToLower(s)
|
||||
switch s {
|
||||
case "true":
|
||||
return true
|
||||
case "false":
|
||||
return false
|
||||
default:
|
||||
return defaultValue
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
)
|
||||
|
||||
// +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.23/pkg/apis/core/helper/helpers.go#L57-L61
|
||||
|
||||
// IsQuotaHugePageResourceName returns true if the resource name has the quota
|
||||
// related huge page resource prefix.
|
||||
|
@ -35,7 +35,7 @@ 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.23/pkg/apis/core/helper/helpers.go#L212-L232
|
||||
var standardQuotaResources = sets.NewString(
|
||||
string(corev1.ResourceCPU),
|
||||
string(corev1.ResourceMemory),
|
||||
|
@ -58,7 +58,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.23/pkg/apis/core/helper/helpers.go#L234-L238
|
||||
|
||||
// IsStandardQuotaResourceName returns true if the resource is known to
|
||||
// the quota tracking system
|
||||
|
@ -66,7 +66,7 @@ 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.23/pkg/apis/core/helper/helpers.go#L240-L261
|
||||
var standardResources = sets.NewString(
|
||||
string(corev1.ResourceCPU),
|
||||
string(corev1.ResourceMemory),
|
||||
|
@ -90,14 +90,14 @@ 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.23/pkg/apis/core/helper/helpers.go#L263-L266
|
||||
|
||||
// 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.23/pkg/apis/core/helper/helpers.go#L268-L278
|
||||
var integerResources = sets.NewString(
|
||||
string(corev1.ResourcePods),
|
||||
string(corev1.ResourceQuotas),
|
||||
|
@ -110,7 +110,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.23/pkg/apis/core/helper/helpers.go#L280-L283
|
||||
|
||||
// IsIntegerResourceName returns true if the resource is measured in integer values
|
||||
func IsIntegerResourceName(str string) bool {
|
||||
|
|
|
@ -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.23/pkg/apis/core/v1/helper/helpers.go#L31-L46
|
||||
|
||||
// IsExtendedResourceName returns true if:
|
||||
// 1. the resource name is not in the default namespace;
|
||||
|
@ -47,7 +47,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.23/pkg/apis/core/v1/helper/helpers.go#L48-L51
|
||||
|
||||
// IsPrefixedNativeResource returns true if the resource name is in the
|
||||
// *kubernetes.io/ namespace.
|
||||
|
@ -55,7 +55,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.23/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
|
||||
|
@ -65,7 +65,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.23/pkg/apis/core/v1/helper/helpers.go#L62-L66
|
||||
|
||||
// IsHugePageResourceName returns true if the resource name has the huge page
|
||||
// resource prefix.
|
||||
|
@ -73,7 +73,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.23/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 {
|
||||
|
|
|
@ -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.22/pkg/apis/core/validation/validation.go#L59
|
||||
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.22/pkg/apis/core/validation/validation.go#L60
|
||||
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.22/pkg/apis/core/validation/validation.go#L62
|
||||
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.22/pkg/apis/core/validation/validation.go#L225-L228
|
||||
|
||||
// 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.22/pkg/apis/core/validation/validation.go#L311-L318
|
||||
|
||||
// ValidateNonnegativeQuantity Validates that a Quantity is not negative
|
||||
func ValidateNonnegativeQuantity(value resource.Quantity, fldPath *field.Path) field.ErrorList {
|
||||
|
@ -62,8 +62,8 @@ 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-changed
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L5036-L5054
|
||||
// +lifted:changed
|
||||
|
||||
// Validate compute resource typename.
|
||||
// Refer to docs/design/resources.md for more details.
|
||||
|
@ -85,8 +85,8 @@ 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-changed
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L5073-L5084
|
||||
// +lifted:changed
|
||||
|
||||
// ValidateResourceQuotaResourceName Validate resource names that can go in a resource quota
|
||||
// Refer to docs/design/resources.md for more details.
|
||||
|
@ -101,8 +101,8 @@ 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-changed
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/apis/core/validation/validation.go#L5651-L5661
|
||||
// +lifted:changed
|
||||
|
||||
// ValidateResourceQuantityValue enforces that specified quantity is valid for specified resource
|
||||
func ValidateResourceQuantityValue(resource string, value resource.Quantity, fldPath *field.Path) field.ErrorList {
|
||||
|
|
|
@ -39,7 +39,7 @@ 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)
|
||||
|
||||
// +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.22/pkg/controller/controller_utils.go#L1003-L1012
|
||||
|
||||
// ReplicaSetsByCreationTimestamp sorts a list of ReplicaSet by creation timestamp, using their names as a tie breaker.
|
||||
type ReplicaSetsByCreationTimestamp []*appsv1.ReplicaSet
|
||||
|
@ -53,8 +53,8 @@ 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-changed
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util.go#L569-L594
|
||||
// +lifted:changed
|
||||
|
||||
// ListReplicaSetsByDeployment returns a slice of RSes the given deployment targets.
|
||||
// Note that this does NOT attempt to reconcile ControllerRef (adopt/orphan),
|
||||
|
@ -82,8 +82,8 @@ 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-changed
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util.go#L596-L628
|
||||
// +lifted:changed
|
||||
|
||||
// ListPodsByRS returns a list of pods the given deployment targets.
|
||||
// This needs a list of ReplicaSets for the Deployment,
|
||||
|
@ -120,7 +120,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.22/pkg/controller/deployment/util/deployment_util.go#L630-L642
|
||||
|
||||
// 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:
|
||||
|
@ -136,8 +136,8 @@ func EqualIgnoreHash(template1, template2 *corev1.PodTemplateSpec) bool {
|
|||
return equality.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-changed
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.22/pkg/controller/deployment/util/deployment_util.go#L536-L544
|
||||
// +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.
|
||||
|
@ -149,7 +149,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.22/pkg/controller/deployment/util/deployment_util.go#L644-L658
|
||||
|
||||
// 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 {
|
||||
|
|
|
@ -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.23/pkg/controller/garbagecollector/garbagecollector.go#L696-L732
|
||||
|
||||
// GetDeletableResources returns all resources from discoveryClient that the
|
||||
// garbage collector should recognize and work with. More specifically, all
|
||||
|
|
|
@ -29,7 +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
|
||||
// +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
|
||||
|
@ -61,7 +61,7 @@ func (*fakeServerResources) ServerPreferredNamespacedResources() ([]*metav1.APIR
|
|||
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.23/pkg/controller/garbagecollector/garbagecollector_test.go#L707-L797
|
||||
|
||||
// TestGetDeletableResources ensures GetDeletableResources always returns
|
||||
// something usable regardless of discovery output.
|
||||
|
|
|
@ -31,7 +31,7 @@ import (
|
|||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// +lifted-source: https://github.com/kubernetes/kubernetes/blob/release-1.23/staging/src/k8s.io/kubectl/pkg/cmd/logs/logs.go#L411-L440
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/staging/src/k8s.io/kubectl/pkg/cmd/logs/logs.go#L411-L440
|
||||
|
||||
// DefaultConsumeRequest reads the data from request and writes into
|
||||
// the out writer. It buffers data from requests until the newline or io.EOF
|
||||
|
@ -64,7 +64,7 @@ func DefaultConsumeRequest(request rest.ResponseWrapper, out io.Writer) error {
|
|||
}
|
||||
}
|
||||
|
||||
// +lifted-source: https://github.com/kubernetes/kubernetes/blob/release-1.23/staging/src/k8s.io/kubectl/pkg/util/util.go#L32-L42
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/staging/src/k8s.io/kubectl/pkg/util/util.go#L32-L42
|
||||
|
||||
// ParseRFC3339 parses an RFC3339 date in either RFC3339Nano or RFC3339 format.
|
||||
func ParseRFC3339(s string, nowFn func() metav1.Time) (metav1.Time, error) {
|
||||
|
|
|
@ -28,7 +28,7 @@ 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.23/pkg/apis/core/helper/helpers.go#L365-L397
|
||||
|
||||
// NodeSelectorRequirementsAsSelector converts the []NodeSelectorRequirement core type into a struct that implements
|
||||
// labels.Selector.
|
||||
|
|
|
@ -36,7 +36,7 @@ const (
|
|||
resourceVersionPrefix = "rv:"
|
||||
)
|
||||
|
||||
// +lifted-source: https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/util/propagatedversion.go#L35-L43
|
||||
// +lifted:source=https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/util/propagatedversion.go#L35-L43
|
||||
|
||||
// ObjectVersion retrieves the field type-prefixed value used for
|
||||
// determining currency of the given cluster object.
|
||||
|
@ -48,7 +48,7 @@ func ObjectVersion(clusterObj *unstructured.Unstructured) string {
|
|||
return fmt.Sprintf("%s%s", resourceVersionPrefix, clusterObj.GetResourceVersion())
|
||||
}
|
||||
|
||||
// +lifted-source: https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/util/propagatedversion.go#L45-L59
|
||||
// +lifted:source=https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/util/propagatedversion.go#L45-L59
|
||||
|
||||
// ObjectNeedsUpdate determines whether the 2 objects provided cluster
|
||||
// object needs to be updated according to the desired object and the
|
||||
|
@ -66,8 +66,8 @@ func ObjectNeedsUpdate(desiredObj, clusterObj *unstructured.Unstructured, record
|
|||
return strings.HasPrefix(targetVersion, generationPrefix) && !objectMetaObjEquivalent(desiredObj, clusterObj)
|
||||
}
|
||||
|
||||
// +lifted-source: https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/util/meta.go#L63-L80
|
||||
// +lifted-changed
|
||||
// +lifted:source=https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/util/meta.go#L63-L80
|
||||
// +lifted:changed
|
||||
|
||||
// objectMetaObjEquivalent checks if cluster-independent, user provided data in two given ObjectMeta are equal. If in
|
||||
// the future the ObjectMeta structure is expanded then any field that is not populated
|
||||
|
|
|
@ -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.23/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.23/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.23/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.23/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,8 +66,8 @@ 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-changed
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/controller/controller_utils.go#L539-L562
|
||||
// +lifted:changed
|
||||
|
||||
// GetPodFromTemplate generates pod object from a template.
|
||||
func GetPodFromTemplate(template *corev1.PodTemplateSpec, parentObject runtime.Object, controllerRef *metav1.OwnerReference) (*corev1.Pod, error) {
|
||||
|
|
|
@ -30,8 +30,8 @@ import (
|
|||
var apiPrefixes = sets.NewString("apis", "api")
|
||||
var grouplessAPIPrefixes = sets.NewString("api")
|
||||
|
||||
// +lifted-source: https://github.com/kubernetes/apiserver/blob/release-1.23/pkg/endpoints/request/requestinfo.go#L88-L247
|
||||
// +lifted-changed
|
||||
// +lifted:source=https://github.com/kubernetes/apiserver/blob/release-1.23/pkg/endpoints/request/requestinfo.go#L88-L247
|
||||
// +lifted:changed
|
||||
|
||||
// TODO write an integration test against the swagger doc to test the RequestInfo and match up behavior to responses
|
||||
|
||||
|
@ -179,8 +179,8 @@ func NewRequestInfo(req *http.Request) *apirequest.RequestInfo {
|
|||
return &requestInfo
|
||||
}
|
||||
|
||||
// +lifted-source: https://github.com/kubernetes/apiserver/blob/release-1.23/pkg/endpoints/request/requestinfo.go#L267-L274
|
||||
// +lifted-changed
|
||||
// +lifted:source=https://github.com/kubernetes/apiserver/blob/release-1.23/pkg/endpoints/request/requestinfo.go#L267-L274
|
||||
// +lifted:changed
|
||||
|
||||
// SplitPath returns the segments for a URL path.
|
||||
func SplitPath(path string) []string {
|
||||
|
@ -191,18 +191,18 @@ func SplitPath(path string) []string {
|
|||
return strings.Split(path, "/")
|
||||
}
|
||||
|
||||
// +lifted-source: https://github.com/kubernetes/apiserver/blob/release-1.23/pkg/endpoints/request/requestinfo.go#L73-L74
|
||||
// +lifted:source=https://github.com/kubernetes/apiserver/blob/release-1.23/pkg/endpoints/request/requestinfo.go#L73-L74
|
||||
|
||||
// specialVerbsNoSubresources contains root verbs which do not allow subresources
|
||||
var specialVerbsNoSubresources = sets.NewString("proxy")
|
||||
|
||||
// +lifted-source: https://github.com/kubernetes/apiserver/blob/release-1.23/pkg/endpoints/request/requestinfo.go#L76-L78
|
||||
// +lifted:source=https://github.com/kubernetes/apiserver/blob/release-1.23/pkg/endpoints/request/requestinfo.go#L76-L78
|
||||
|
||||
// namespaceSubresources contains subresources of namespace
|
||||
// this list allows the parser to distinguish between a namespace subresource, and a namespaced resource
|
||||
var namespaceSubresources = sets.NewString("status", "finalize")
|
||||
|
||||
// +lifted-source: https://github.com/kubernetes/apiserver/blob/release-1.23/pkg/endpoints/request/requestinfo.go#L67-L71
|
||||
// +lifted:source=https://github.com/kubernetes/apiserver/blob/release-1.23/pkg/endpoints/request/requestinfo.go#L67-L71
|
||||
|
||||
// specialVerbs contains just strings which are used in REST paths for special actions that don't fall under the normal
|
||||
// CRUDdy GET/POST/PUT/DELETE actions on REST objects.
|
||||
|
|
|
@ -24,8 +24,8 @@ 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-changed
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/scheduler/util/utils.go#L144-L148
|
||||
// +lifted:changed
|
||||
|
||||
// IsScalarResourceName validates the resource for Extended, Hugepages, Native and AttachableVolume resources
|
||||
func IsScalarResourceName(name corev1.ResourceName) bool {
|
||||
|
|
|
@ -31,8 +31,8 @@ const (
|
|||
SecretsField = "secrets"
|
||||
)
|
||||
|
||||
// +lifted-source: https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain.go
|
||||
// +lifted-changed
|
||||
// +lifted:source=https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain.go
|
||||
// +lifted:changed
|
||||
|
||||
// RetainServiceFields updates the desired service object with values retained from the cluster object.
|
||||
func RetainServiceFields(desired, observed *unstructured.Unstructured) (*unstructured.Unstructured, error) {
|
||||
|
@ -49,8 +49,8 @@ func RetainServiceFields(desired, observed *unstructured.Unstructured) (*unstruc
|
|||
return desired, nil
|
||||
}
|
||||
|
||||
// +lifted-source: https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain.go
|
||||
// +lifted-changed
|
||||
// +lifted:source=https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain.go
|
||||
// +lifted:changed
|
||||
func retainServiceHealthCheckNodePort(desired, observed *unstructured.Unstructured) error {
|
||||
healthCheckNodePort, ok, err := unstructured.NestedInt64(observed.Object, "spec", "healthCheckNodePort")
|
||||
if err != nil {
|
||||
|
@ -64,8 +64,8 @@ func retainServiceHealthCheckNodePort(desired, observed *unstructured.Unstructur
|
|||
return nil
|
||||
}
|
||||
|
||||
// +lifted-source: https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain.go
|
||||
// +lifted-changed
|
||||
// +lifted:source=https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain.go
|
||||
// +lifted:changed
|
||||
func retainServiceClusterIP(desired, observed *unstructured.Unstructured) error {
|
||||
clusterIP, ok, err := unstructured.NestedString(observed.Object, "spec", "clusterIP")
|
||||
if err != nil {
|
||||
|
@ -81,8 +81,8 @@ func retainServiceClusterIP(desired, observed *unstructured.Unstructured) error
|
|||
return nil
|
||||
}
|
||||
|
||||
// +lifted-source: https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain.go
|
||||
// +lifted-changed
|
||||
// +lifted:source=https://github.com/kubernetes-sigs/kubefed/blob/master/pkg/controller/sync/dispatch/retain.go
|
||||
// +lifted:changed
|
||||
|
||||
// RetainServiceAccountFields retains the 'secrets' field of a service account
|
||||
// if the desired representation does not include a value for the field. This
|
||||
|
|
|
@ -29,7 +29,7 @@ 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.23/staging/src/k8s.io/kubectl/pkg/cmd/taint/utils.go#L37-L73
|
||||
|
||||
// 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.
|
||||
|
@ -69,7 +69,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.23/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>'.
|
||||
|
@ -116,7 +116,7 @@ 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.23/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)
|
||||
|
|
|
@ -31,8 +31,8 @@ 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-changed
|
||||
// +lifted:source=https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/apis/core/validation/validation.go#L5001-L5033
|
||||
// +lifted:changed
|
||||
|
||||
// ValidateClusterTaints tests if given taints have valid data.
|
||||
func ValidateClusterTaints(taints []corev1.Taint, fldPath *field.Path) field.ErrorList {
|
||||
|
@ -68,8 +68,8 @@ 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
|
||||
// +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, "")}
|
||||
|
|
|
@ -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.23/pkg/api/v1/pod/util.go#L53-L63
|
||||
|
||||
// ContainerType signifies container type
|
||||
type ContainerType int
|
||||
|
@ -38,23 +38,23 @@ 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.23/pkg/api/v1/pod/util.go#L65-L66
|
||||
|
||||
// AllContainers specifies that all containers be visited
|
||||
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.23/pkg/api/v1/pod/util.go#L78-L80
|
||||
|
||||
// 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.23/pkg/api/v1/pod/util.go#L82-L83
|
||||
|
||||
// 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.23/pkg/api/v1/pod/util.go#L85-L94
|
||||
func skipEmptyNames(visitor Visitor) Visitor {
|
||||
return func(name string) bool {
|
||||
if len(name) == 0 {
|
||||
|
@ -66,7 +66,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.23/pkg/api/v1/pod/util.go#L96-L123
|
||||
|
||||
// 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 +97,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.23/pkg/api/v1/pod/util.go#L125-L195
|
||||
|
||||
// VisitPodSecretNames invokes the visitor function with the name of every secret
|
||||
// referenced by the pod spec. If visitor returns false, visiting is short-circuited.
|
||||
|
@ -172,7 +172,7 @@ 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.23/pkg/api/v1/pod/util.go#L197-L213
|
||||
func visitContainerSecretNames(container *corev1.Container, visitor Visitor) bool {
|
||||
for _, env := range container.EnvFrom {
|
||||
if env.SecretRef != nil {
|
||||
|
@ -191,7 +191,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.23/pkg/api/v1/pod/util.go#L215-L243
|
||||
|
||||
// VisitPodConfigmapNames invokes the visitor function with the name of every configmap
|
||||
// referenced by the pod spec. If visitor returns false, visiting is short-circuited.
|
||||
|
@ -223,7 +223,7 @@ 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.23/pkg/api/v1/pod/util.go#L245-L261
|
||||
func visitContainerConfigmapNames(container *corev1.Container, visitor Visitor) bool {
|
||||
for _, env := range container.EnvFrom {
|
||||
if env.ConfigMapRef != nil {
|
||||
|
|
Loading…
Reference in New Issue