resource

package
v2.0.0-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const HideAll = "$$HIDE_ALL$$"

Variables

View Source
var (
	ErrResourceDuplicatesFound = errors.New("validate for no duplicated resources")
)

Functions

func BuildResources

func BuildResources(ctx context.Context, deployType common.DeployType, releaseNamespace string, prevRelResSpecs, newRelResSpecs []*spec.ResourceSpec, patchers []spec.ResourcePatcher, opts BuildResourcesOptions) ([]*InstallableResource, []*DeletableResource, error)

Build Installable/DeletableResources from ResourceSpecs. Resulting Resources can be used to construct Installable/DeletableResourceInfos later. Must never contact the cluster, because this is called even when no cluster access allowed.

func InstallableResourceSortByWeightHandler

func InstallableResourceSortByWeightHandler(r1, r2 *InstallableResource) bool

func NewResourceMetaFromDependency

func NewResourceMetaFromDependency(dep *Dependency, releaseNamespace string) *spec.ResourceMeta

func ParseSensitivePaths

func ParseSensitivePaths(value string) []string

func RedactSensitiveData

func RedactSensitiveData(unstruct *unstructured.Unstructured, sensitivePaths []string) *unstructured.Unstructured

func ResourcePolicies

func ResourcePolicies(meta *spec.ResourceMeta, releaseNamespace string) []common.ResourcePolicy

func ValidateLocal

func ValidateLocal(ctx context.Context, releaseNamespace string, transformedResources []*InstallableResource, opts common.ResourceValidationOptions) error

Can be called even without cluster access.

func ValidateResourcePolicy

func ValidateResourcePolicy(meta *spec.ResourceMeta) error

Types

type BuildResourcesOptions

type BuildResourcesOptions struct {
	DefaultDeletePropagation metav1.DeletionPropagation
	NoPodLogs                bool
}

type DeletableResource

type DeletableResource struct {
	*spec.ResourceMeta

	AutoInternalDependencies []*Dependency
	DeletePropagation        metav1.DeletionPropagation
	ManualDependencies       []*Dependency
	Ownership                common.Ownership
	ResourcePolicies         []common.ResourcePolicy
}

Represent a Kubernetes resource that can be deleted. Higher level than ResourceMeta, but lower level than DeletableResourceInfo. If something can be computed on this level instead of doing this on higher levels, it's better to do it here.

func NewDeletableResource

func NewDeletableResource(resourceSpec *spec.ResourceSpec, otherResourceSpecs []*spec.ResourceSpec, releaseNamespace string, opts DeletableResourceOptions) (*DeletableResource, error)

Construct a DeletableResource from a ResourceSpec. Must never contact the cluster, because this is called even when no cluster access allowed.

type DeletableResourceOptions

type DeletableResourceOptions struct {
	DefaultDeletePropagation metav1.DeletionPropagation
}

type Dependency

type Dependency struct {
	*spec.ResourceMatcher `json:"resourceMatcher"`

	ResourceState common.ResourceState `json:"resourceState"`
	External      bool                 `json:"external"`
	MinMatches    int                  `json:"minMatches"`
	MaxMatches    int                  `json:"maxMatches"`
}

Represents a dependency on a Kubernetes resource in the Helm release.

type InstallableResource

type InstallableResource struct {
	*spec.ResourceSpec `json:"resourceSpec"`

	Ownership                              common.Ownership                `json:"ownership"`
	Recreate                               bool                            `json:"recreate"`
	RecreateOnImmutable                    bool                            `json:"recreateOnImmutable"`
	ResourcePolicies                       []common.ResourcePolicy         `json:"resourcePolicies"`
	DefaultReplicasOnCreation              *int                            `json:"defaultReplicasOnCreation,omitempty"`
	DeleteOnSucceeded                      bool                            `json:"deleteOnSucceeded"`
	DeleteOnFailed                         bool                            `json:"deleteOnFailed"`
	FailMode                               statestore.FailMode             `json:"failMode"`
	FailuresAllowed                        int                             `json:"failuresAllowed"`
	IgnoreReadinessProbeFailsForContainers map[string]time.Duration        `json:"ignoreReadinessProbeFailsForContainers,omitempty"`
	LogRegex                               *regexp.Regexp                  `json:"logRegex"`
	LogRegexesForContainers                map[string]*regexp.Regexp       `json:"logRegexesForContainers"`
	NoActivityTimeout                      time.Duration                   `json:"noActivityTimeout"`
	ShowLogsOnlyForContainers              []string                        `json:"showLogsOnlyForContainers,omitempty"`
	ShowServiceMessages                    bool                            `json:"showServiceMessages"`
	ShowLogsOnlyForNumberOfReplicas        int                             `json:"showLogsOnlyForNumberOfReplicas"`
	SkipLogs                               bool                            `json:"skipLogs"`
	SkipLogsForContainers                  []string                        `json:"skipLogsForContainers,omitempty"`
	SkipLogsRegex                          *regexp.Regexp                  `json:"skipLogsRegex"`
	SkipLogsRegexForContainers             map[string]*regexp.Regexp       `json:"skipLogsRegexForContainers"`
	TrackTerminationMode                   statestore.TrackTerminationMode `json:"trackTerminationMode"`
	Weight                                 *int                            `json:"weight,omitempty"`
	ManualDependencies                     []*Dependency                   `json:"manualDependencies,omitempty"`
	AutoInternalDependencies               []*Dependency                   `json:"autoInternalDependencies,omitempty"`
	DeployConditions                       map[common.On][]common.Stage    `json:"deployConditions"`
	DeletePropagation                      metav1.DeletionPropagation      `json:"deletePropagation"`
}

Represent a Kubernetes resource that can be installed. Higher level than ResourceSpec, but lower level than InstallableResourceInfo. If something can be computed on this level instead of doing this on higher levels, it's better to do it here.

func NewInstallableResource

func NewInstallableResource(ctx context.Context, res *spec.ResourceSpec, otherResSpecs []*spec.ResourceSpec, releaseNamespace string, opts InstallableResourceOptions) (*InstallableResource, error)

Construct an InstallableResource from a ResourceSpec. Must never contact the cluster, because this is called even when no cluster access allowed.

type InstallableResourceOptions

type InstallableResourceOptions struct {
	DefaultDeletePropagation metav1.DeletionPropagation
	NoPodLogs                bool
}

type SensitiveInfo

type SensitiveInfo struct {
	IsSensitive    bool
	SensitivePaths []string
}

func GetSensitiveInfo

func GetSensitiveInfo(groupKind schema.GroupKind, annotations map[string]string) SensitiveInfo

Directories

Path Synopsis
Package schemas provides the JSON schemas embedded into the nelm binary, so that resources can be validated without network access.
Package schemas provides the JSON schemas embedded into the nelm binary, so that resources can be validated without network access.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL