Documentation
¶
Index ¶
- func CleanUnstruct(unstruct *unstructured.Unstructured, opts CleanUnstructOptions) *unstructured.Unstructured
- func FindAnnotationOrLabelByKeyPattern(annotationsOrLabels map[string]string, pattern *regexp.Regexp) (key, value string, found bool)
- func FindAnnotationsOrLabelsByKeyPattern(annotationsOrLabels map[string]string, pattern *regexp.Regexp) (result map[string]string, found bool)
- func GVKtoGVR(gvk schema.GroupVersionKind, mapper meta.RESTMapper) (gvr schema.GroupVersionResource, namespaced bool, err error)
- func GVRtoGVK(gvr schema.GroupVersionResource, restMapper meta.RESTMapper) (schema.GroupVersionKind, error)
- func ID(name, namespace, group, kind string) string
- func IDHuman(name, namespace, group, kind string) string
- func IDWithVersion(name, namespace, group, version, kind string) string
- func IsCRD(groupKind schema.GroupKind) bool
- func IsCRDFromGR(groupKind schema.GroupResource) bool
- func IsHook(annotations map[string]string) bool
- func IsReleaseNamespace(resourceName string, resourceGVK schema.GroupVersionKind, ...) bool
- func IsWebhook(groupKind schema.GroupKind) bool
- func Namespaced(gvk schema.GroupVersionKind, mapper meta.RESTMapper) (bool, error)
- func ParseKubectlResourceStringToGVR(resource string) schema.GroupVersionResource
- func ParseKubectlResourceStringtoGVK(resource string, restMapper meta.RESTMapper) (schema.GroupVersionKind, error)
- func ResourceMetaSortHandler(r1, r2 *ResourceMeta) bool
- func ResourceSpecSortHandler(r1, r2 *ResourceSpec) bool
- type CleanUnstructOptions
- type DropInvalidAnnotationsAndLabelsTransformer
- func (t *DropInvalidAnnotationsAndLabelsTransformer) Match(ctx context.Context, info *ResourceTransformerResourceInfo) (matched bool, err error)
- func (t *DropInvalidAnnotationsAndLabelsTransformer) Transform(ctx context.Context, info *ResourceTransformerResourceInfo) ([]*unstructured.Unstructured, error)
- func (t *DropInvalidAnnotationsAndLabelsTransformer) Type() ResourceTransformerType
- type ExtraMetadataPatcher
- type ReleaseMetadataPatcher
- type ResourceListsTransformer
- func (t *ResourceListsTransformer) Match(ctx context.Context, info *ResourceTransformerResourceInfo) (matched bool, err error)
- func (t *ResourceListsTransformer) Transform(ctx context.Context, info *ResourceTransformerResourceInfo) ([]*unstructured.Unstructured, error)
- func (t *ResourceListsTransformer) Type() ResourceTransformerType
- type ResourceMatcher
- type ResourceMeta
- func NewResourceMeta(name, namespace, releaseNamespace, filePath string, ...) *ResourceMeta
- func NewResourceMetaFromManifest(manifest, releaseNamespace string) (*ResourceMeta, error)
- func NewResourceMetaFromPartialMetadata(meta *v1.PartialObjectMetadata, releaseNamespace, filePath string) *ResourceMeta
- func NewResourceMetaFromUnstructured(unstruct *unstructured.Unstructured, releaseNamespace, filePath string) *ResourceMeta
- type ResourcePatcher
- type ResourcePatcherResourceInfo
- type ResourcePatcherType
- type ResourceSpec
- func BuildReleasableResourceSpecs(ctx context.Context, releaseNamespace string, ...) ([]*ResourceSpec, error)
- func BuildTransformedResourceSpecs(ctx context.Context, releaseNamespace string, resources []*ResourceSpec, ...) ([]*ResourceSpec, error)
- func NewResourceSpec(unstruct *unstructured.Unstructured, releaseNamespace string, ...) *ResourceSpec
- func NewResourceSpecFromManifest(manifest, releaseNamespace string, opts ResourceSpecOptions) (*ResourceSpec, error)
- type ResourceSpecOptions
- type ResourceTransformer
- type ResourceTransformerResourceInfo
- type ResourceTransformerType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanUnstruct ¶ added in v1.17.1
func CleanUnstruct(unstruct *unstructured.Unstructured, opts CleanUnstructOptions) *unstructured.Unstructured
func GVKtoGVR ¶
func GVKtoGVR(gvk schema.GroupVersionKind, mapper meta.RESTMapper) (gvr schema.GroupVersionResource, namespaced bool, err error)
func GVRtoGVK ¶
func GVRtoGVK(gvr schema.GroupVersionResource, restMapper meta.RESTMapper) (schema.GroupVersionKind, error)
func IDWithVersion ¶
func IsCRDFromGR ¶
func IsCRDFromGR(groupKind schema.GroupResource) bool
func IsReleaseNamespace ¶
func IsReleaseNamespace(resourceName string, resourceGVK schema.GroupVersionKind, releaseNamespace string) bool
func Namespaced ¶
func Namespaced(gvk schema.GroupVersionKind, mapper meta.RESTMapper) (bool, error)
func ParseKubectlResourceStringToGVR ¶
func ParseKubectlResourceStringToGVR(resource string) schema.GroupVersionResource
func ParseKubectlResourceStringtoGVK ¶
func ParseKubectlResourceStringtoGVK(resource string, restMapper meta.RESTMapper) (schema.GroupVersionKind, error)
func ResourceMetaSortHandler ¶
func ResourceMetaSortHandler(r1, r2 *ResourceMeta) bool
func ResourceSpecSortHandler ¶
func ResourceSpecSortHandler(r1, r2 *ResourceSpec) bool
Types ¶
type CleanUnstructOptions ¶ added in v1.17.1
type DropInvalidAnnotationsAndLabelsTransformer ¶
type DropInvalidAnnotationsAndLabelsTransformer struct{}
TODO(v2): remove this transformer. Replace it with proper early validation of resource Heads.
func NewDropInvalidAnnotationsAndLabelsTransformer ¶
func NewDropInvalidAnnotationsAndLabelsTransformer() *DropInvalidAnnotationsAndLabelsTransformer
func (*DropInvalidAnnotationsAndLabelsTransformer) Match ¶
func (t *DropInvalidAnnotationsAndLabelsTransformer) Match(ctx context.Context, info *ResourceTransformerResourceInfo) (matched bool, err error)
func (*DropInvalidAnnotationsAndLabelsTransformer) Transform ¶
func (t *DropInvalidAnnotationsAndLabelsTransformer) Transform(ctx context.Context, info *ResourceTransformerResourceInfo) ([]*unstructured.Unstructured, error)
func (*DropInvalidAnnotationsAndLabelsTransformer) Type ¶
func (t *DropInvalidAnnotationsAndLabelsTransformer) Type() ResourceTransformerType
type ExtraMetadataPatcher ¶
type ExtraMetadataPatcher struct {
// contains filtered or unexported fields
}
func NewExtraMetadataPatcher ¶
func NewExtraMetadataPatcher(annotations, labels map[string]string) *ExtraMetadataPatcher
func (*ExtraMetadataPatcher) Match ¶
func (p *ExtraMetadataPatcher) Match(ctx context.Context, info *ResourcePatcherResourceInfo) (bool, error)
func (*ExtraMetadataPatcher) Patch ¶
func (p *ExtraMetadataPatcher) Patch(ctx context.Context, info *ResourcePatcherResourceInfo) (*unstructured.Unstructured, error)
func (*ExtraMetadataPatcher) Type ¶
func (p *ExtraMetadataPatcher) Type() ResourcePatcherType
type ReleaseMetadataPatcher ¶
type ReleaseMetadataPatcher struct {
// contains filtered or unexported fields
}
func NewReleaseMetadataPatcher ¶
func NewReleaseMetadataPatcher(releaseName, releaseNamespace string) *ReleaseMetadataPatcher
func (*ReleaseMetadataPatcher) Match ¶
func (p *ReleaseMetadataPatcher) Match(ctx context.Context, info *ResourcePatcherResourceInfo) (bool, error)
func (*ReleaseMetadataPatcher) Patch ¶
func (p *ReleaseMetadataPatcher) Patch(ctx context.Context, info *ResourcePatcherResourceInfo) (*unstructured.Unstructured, error)
func (*ReleaseMetadataPatcher) Type ¶
func (p *ReleaseMetadataPatcher) Type() ResourcePatcherType
type ResourceListsTransformer ¶
type ResourceListsTransformer struct{}
func NewResourceListsTransformer ¶
func NewResourceListsTransformer() *ResourceListsTransformer
func (*ResourceListsTransformer) Match ¶
func (t *ResourceListsTransformer) Match(ctx context.Context, info *ResourceTransformerResourceInfo) (matched bool, err error)
func (*ResourceListsTransformer) Transform ¶
func (t *ResourceListsTransformer) Transform(ctx context.Context, info *ResourceTransformerResourceInfo) ([]*unstructured.Unstructured, error)
func (*ResourceListsTransformer) Type ¶
func (t *ResourceListsTransformer) Type() ResourceTransformerType
type ResourceMatcher ¶
type ResourceMatcher struct {
Names []string
Namespaces []string
Groups []string
Versions []string
Kinds []string
}
func (*ResourceMatcher) Match ¶
func (s *ResourceMatcher) Match(resMeta *ResourceMeta) bool
type ResourceMeta ¶
type ResourceMeta struct {
Name string
Namespace string
GroupVersionKind schema.GroupVersionKind
FilePath string
Annotations map[string]string
Labels map[string]string
}
func NewResourceMeta ¶
func NewResourceMeta(name, namespace, releaseNamespace, filePath string, gvk schema.GroupVersionKind, annotations, labels map[string]string) *ResourceMeta
func NewResourceMetaFromManifest ¶
func NewResourceMetaFromManifest(manifest, releaseNamespace string) (*ResourceMeta, error)
func NewResourceMetaFromPartialMetadata ¶
func NewResourceMetaFromPartialMetadata(meta *v1.PartialObjectMetadata, releaseNamespace, filePath string) *ResourceMeta
func NewResourceMetaFromUnstructured ¶
func NewResourceMetaFromUnstructured(unstruct *unstructured.Unstructured, releaseNamespace, filePath string) *ResourceMeta
func (*ResourceMeta) ID ¶
func (m *ResourceMeta) ID() string
func (*ResourceMeta) IDHuman ¶
func (m *ResourceMeta) IDHuman() string
func (*ResourceMeta) IDWithVersion ¶
func (m *ResourceMeta) IDWithVersion() string
type ResourcePatcher ¶
type ResourcePatcher interface {
Match(ctx context.Context, resourceInfo *ResourcePatcherResourceInfo) (matched bool, err error)
Patch(ctx context.Context, matchedResourceInfo *ResourcePatcherResourceInfo) (output *unstructured.Unstructured, err error)
Type() ResourcePatcherType
}
type ResourcePatcherResourceInfo ¶
type ResourcePatcherResourceInfo struct {
Obj *unstructured.Unstructured
Ownership common.Ownership
}
type ResourcePatcherType ¶
type ResourcePatcherType string
const ( TypeExtraMetadataPatcher ResourcePatcherType = "extra-metadata-patcher" TypeReleaseMetadataPatcher ResourcePatcherType = "release-metadata-patcher" )
type ResourceSpec ¶
type ResourceSpec struct {
*ResourceMeta
Unstruct *unstructured.Unstructured
StoreAs common.StoreAs
}
func BuildReleasableResourceSpecs ¶
func BuildReleasableResourceSpecs(ctx context.Context, releaseNamespace string, transformedResources []*ResourceSpec, patchers []ResourcePatcher) ([]*ResourceSpec, error)
func BuildTransformedResourceSpecs ¶
func BuildTransformedResourceSpecs(ctx context.Context, releaseNamespace string, resources []*ResourceSpec, transformers []ResourceTransformer) ([]*ResourceSpec, error)
func NewResourceSpec ¶
func NewResourceSpec(unstruct *unstructured.Unstructured, releaseNamespace string, opts ResourceSpecOptions) *ResourceSpec
func NewResourceSpecFromManifest ¶
func NewResourceSpecFromManifest(manifest, releaseNamespace string, opts ResourceSpecOptions) (*ResourceSpec, error)
func (*ResourceSpec) SetAnnotations ¶
func (s *ResourceSpec) SetAnnotations(annotations map[string]string)
func (*ResourceSpec) SetLabels ¶
func (s *ResourceSpec) SetLabels(labels map[string]string)
type ResourceSpecOptions ¶
type ResourceTransformer ¶
type ResourceTransformer interface {
Match(ctx context.Context, resourceInfo *ResourceTransformerResourceInfo) (matched bool, err error)
Transform(ctx context.Context, matchedResourceInfo *ResourceTransformerResourceInfo) (output []*unstructured.Unstructured, err error)
Type() ResourceTransformerType
}
type ResourceTransformerResourceInfo ¶
type ResourceTransformerResourceInfo struct {
Obj *unstructured.Unstructured
}
type ResourceTransformerType ¶
type ResourceTransformerType string
const ( TypeDropInvalidAnnotationsAndLabelsTransformer ResourceTransformerType = "drop-invalid-annotations-and-labels-transformer" TypeResourceListsTransformer ResourceTransformerType = "resource-lists-transformer" )
Click to show internal directories.
Click to hide internal directories.