Upgrade k8s package verison (#5358)

* upgrade k8s package version

Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>

* Script upgrade and code formatting.

Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>

Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>
This commit is contained in:
hongzhouzi
2022-11-15 14:56:38 +08:00
committed by GitHub
parent 5f91c1663a
commit 44167aa47a
3106 changed files with 321340 additions and 172080 deletions

View File

@@ -7,9 +7,10 @@ package resmap
import (
"sigs.k8s.io/kustomize/api/ifc"
"sigs.k8s.io/kustomize/api/resid"
"sigs.k8s.io/kustomize/api/resource"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kyaml/kio"
"sigs.k8s.io/kustomize/kyaml/resid"
"sigs.k8s.io/kustomize/kyaml/yaml"
)
@@ -20,11 +21,25 @@ type Transformer interface {
Transform(m ResMap) error
}
// A TransformerWithProperties contains a Transformer and stores
// some of its properties
type TransformerWithProperties struct {
Transformer
Origin *resource.Origin
}
// A Generator creates an instance of ResMap.
type Generator interface {
Generate() (ResMap, error)
}
// A GeneratorWithProperties contains a Generator and stores
// some of its properties
type GeneratorWithProperties struct {
Generator
Origin *resource.Origin
}
// Something that's configurable accepts an
// instance of PluginHelpers and a raw config
// object (YAML in []byte form).
@@ -135,6 +150,29 @@ type ResMap interface {
// self, then its behavior _cannot_ be merge or replace.
AbsorbAll(ResMap) error
// AddOriginAnnotation will add the provided origin as
// an origin annotation to all resources in the ResMap, if
// the origin is not nil.
AddOriginAnnotation(origin *resource.Origin) error
// RemoveOriginAnnotation will remove the origin annotation
// from all resources in the ResMap
RemoveOriginAnnotations() error
// AddTransformerAnnotation will add the provided origin as
// an origin annotation if the resource doesn't have one; a
// transformer annotation otherwise; to all resources in
// ResMap
AddTransformerAnnotation(origin *resource.Origin) error
// RemoveTransformerAnnotation will remove the transformer annotation
// from all resources in the ResMap
RemoveTransformerAnnotations() error
// AnnotateAll annotates all resources in the ResMap with
// the provided key value pair.
AnnotateAll(key string, value string) error
// AsYaml returns the yaml form of resources.
AsYaml() ([]byte, error)
@@ -168,21 +206,20 @@ type ResMap interface {
// GroupedByCurrentNamespace returns a map of namespace
// to a slice of *Resource in that namespace.
// Resources for whom IsNamespaceableKind is false are
// are not included at all (see NonNamespaceable).
// Cluster-scoped Resources are not included (see ClusterScoped).
// Resources with an empty namespace are placed
// in the resid.DefaultNamespace entry.
GroupedByCurrentNamespace() map[string][]*resource.Resource
// GroupByOrginalNamespace performs as GroupByNamespace
// GroupedByOriginalNamespace performs as GroupByNamespace
// but use the original namespace instead of the current
// one to perform the grouping.
GroupedByOriginalNamespace() map[string][]*resource.Resource
// NonNamespaceable returns a slice of resources that
// ClusterScoped returns a slice of resources that
// cannot be placed in a namespace, e.g.
// Node, ClusterRole, Namespace itself, etc.
NonNamespaceable() []*resource.Resource
ClusterScoped() []*resource.Resource
// AllIds returns all CurrentIds.
AllIds() []resid.ResId
@@ -208,7 +245,36 @@ type ResMap interface {
// This is a filter; it excludes things that cannot be
// referenced by the resource, e.g. objects in other
// namespaces. Cluster wide objects are never excluded.
SubsetThatCouldBeReferencedByResource(*resource.Resource) ResMap
SubsetThatCouldBeReferencedByResource(*resource.Resource) (ResMap, error)
// DeAnchor replaces YAML aliases with structured data copied from anchors.
// This cannot be undone; if desired, call DeepCopy first.
// Subsequent marshalling to YAML will no longer have anchor
// definitions ('&') or aliases ('*').
//
// Anchors are not expected to work across YAML 'documents'.
// If three resources are loaded from one file containing three YAML docs:
//
// {resourceA}
// ---
// {resourceB}
// ---
// {resourceC}
//
// then anchors defined in A cannot be seen from B and C and vice versa.
// OTOH, cross-resource links (a field in B referencing fields in A) will
// work if the resources are gathered in a ResourceList:
//
// apiVersion: config.kubernetes.io/v1
// kind: ResourceList
// metadata:
// name: someList
// items:
// - {resourceA}
// - {resourceB}
// - {resourceC}
//
DeAnchor() error
// DeepCopy copies the ResMap and underlying resources.
DeepCopy() ResMap
@@ -254,4 +320,14 @@ type ResMap interface {
// RemoveBuildAnnotations removes annotations created by the build process.
RemoveBuildAnnotations()
// ApplyFilter applies an RNode filter to all Resources in the ResMap.
// TODO: Send/recover ancillary Resource data to/from subprocesses.
// Assure that the ancillary data in Resource (everything not in the RNode)
// is sent to and re-captured from transformer subprocess (as the process
// might edit that information). One way to do this would be to solely use
// RNode metadata annotation reading and writing instead of using Resource
// struct data members, i.e. the Resource struct is replaced by RNode
// and use of (slow) k8s metadata annotations inside the RNode.
ApplyFilter(f kio.Filter) error
}