kptfile

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BoolToConditionStatus = map[bool]kptfileapi.ConditionStatus{
		// contains filtered or unexported fields
	}
)

Functions

func DecodeKptfile

func DecodeKptfile(kf string) (*kptfileapi.KptFile, error)

DecodeKptfile decodes a KptFile from a YAML string.

Types

type KptfileKubeObject

type KptfileKubeObject struct {
	kubeobject.KubeObject
}

KptfileKubeObject provides additional API to manipulate the Kptfile of a kpt package as a KubeObject

func NewFromKubeObjectList

func NewFromKubeObjectList(objs kubeobject.KubeObjects) (*KptfileKubeObject, error)

NewFromKubeObjectList creates a KptfileKubeObject by finding it in the given KubeObjects list

func NewFromPackage

func NewFromPackage(resources map[string]string) (*KptfileKubeObject, error)

NewFromPackage creates a KptfileKubeObject from the resource (YAML) files of a package

func NewFromString

func NewFromString(str string) (*KptfileKubeObject, error)

func (*KptfileKubeObject) ApplyDefaultCondition

func (kf *KptfileKubeObject) ApplyDefaultCondition(condition kptfileapi.Condition) error

ApplyDefaultCondition adds the given condition to the KptfileKubeObject if a condition with the same type doesn't exist yet.

func (*KptfileKubeObject) ClearStatus

func (kf *KptfileKubeObject) ClearStatus() error

ClearStatus removes the status field from the KptfileKubeObject.

func (*KptfileKubeObject) Conditions

func (kf *KptfileKubeObject) Conditions() kubeobject.SliceSubObjects

func (*KptfileKubeObject) DeleteConditionByType

func (kf *KptfileKubeObject) DeleteConditionByType(conditionType string) error

DeleteConditionByType deletes all conditions with the given type

func (*KptfileKubeObject) EnsureReadinessGates

func (kf *KptfileKubeObject) EnsureReadinessGates(gates []kptfileapi.ReadinessGate) error

EnsureReadinessGates ensures that the given readiness gates are present in the KptfileKubeObject.

func (*KptfileKubeObject) GetCondition

func (kf *KptfileKubeObject) GetCondition(conditionType string) *kubeobject.SubObject

func (*KptfileKubeObject) GetTypedCondition

func (kf *KptfileKubeObject) GetTypedCondition(conditionType string) (kptfileapi.Condition, error)

GetTypedCondition returns with the condition whose type is `conditionType` as its first return value, or nil if the condition is missing.

func (*KptfileKubeObject) IsStatusConditionFalse

func (kf *KptfileKubeObject) IsStatusConditionFalse(conditionType string) bool

IsStatusConditionFalse returns true when the conditionType is present and set to kptfileapi.ConditionFalse Inspired by https://pkg.go.dev/k8s.io/apimachinery/pkg/api/meta#IsStatusConditionFalse

func (*KptfileKubeObject) IsStatusConditionPresentAndEqual

func (kf *KptfileKubeObject) IsStatusConditionPresentAndEqual(conditionType string, status kptfileapi.ConditionStatus) bool

IsStatusConditionPresentAndEqual returns true when conditionType is present and equal to status. Inspired by https://pkg.go.dev/k8s.io/apimachinery/pkg/api/meta#IsStatusConditionPresentAndEqual

func (*KptfileKubeObject) IsStatusConditionTrue

func (kf *KptfileKubeObject) IsStatusConditionTrue(conditionType string) bool

IsStatusConditionTrue returns true when the conditionType is present and set to kptfileapi.ConditionTrue Inspired by https://pkg.go.dev/k8s.io/apimachinery/pkg/api/meta#IsStatusConditionTrue

func (*KptfileKubeObject) ReadinessGates

func (kf *KptfileKubeObject) ReadinessGates() kubeobject.SliceSubObjects

func (*KptfileKubeObject) SetAnnotations

func (kf *KptfileKubeObject) SetAnnotations(annotations map[string]string)

SetAnnotations sets the annotations in the Kptfile

func (*KptfileKubeObject) SetConditions

func (kf *KptfileKubeObject) SetConditions(conditions kubeobject.SliceSubObjects) error

func (*KptfileKubeObject) SetLabels

func (kf *KptfileKubeObject) SetLabels(labels map[string]string)

SetLabels sets the labels in the Kptfile

func (*KptfileKubeObject) SetReadinessGates

func (kf *KptfileKubeObject) SetReadinessGates(gates kubeobject.SliceSubObjects) error

func (*KptfileKubeObject) SetTypedCondition

func (kf *KptfileKubeObject) SetTypedCondition(condition kptfileapi.Condition) error

SetTypedCondition creates or updates the given condition using the Type field as the primary key

func (*KptfileKubeObject) Status

func (kf *KptfileKubeObject) Status() *kubeobject.SubObject

Status returns with the Status field of the KptfileKubeObject as a SubObject If the Status field doesn't exist, it is added.

func (*KptfileKubeObject) String

func (kf *KptfileKubeObject) String() string

func (*KptfileKubeObject) UpsertMutatorFunctions

func (kf *KptfileKubeObject) UpsertMutatorFunctions(fns []kptfileapi.Function, insertPosition int) error

UpsertMutatorFunctions ensures that the given KRM functions are added to or updated in the Kptfile's mutators list. If the function already exists, it is updated. If it doesn't exist, it is added at the specified position. If insertPosition is negative, the insert position is counted backwards from the end of the list (i.e. -1 will append to the list).

func (*KptfileKubeObject) UpsertPipelineFunctions

func (kf *KptfileKubeObject) UpsertPipelineFunctions(fns []kptfileapi.Function, fieldName string, insertPosition int) error

UpsertPipelineFunctions ensures that the given KRM functions are added to or updated in the Kptfile pipeline's given field (`fieldname`). `fieldName` should be either "mutators" or "validators". If the function already exists, it is updated. If it doesn't exist, it is added at the specified position. If insertPosition is negative, the insert position is counted backwards from the end of the list (i.e. -1 will append to the list).

func (*KptfileKubeObject) UpsertValidatorFunctions

func (kf *KptfileKubeObject) UpsertValidatorFunctions(fns []kptfileapi.Function, insertPosition int) error

UpsertValidatorFunctions ensures that the given KRM functions are added to or updated in the Kptfile's validators list. If the function already exists, it is updated. If it doesn't exist, it is added at the specified position. If insertPosition is negative, the insert position is counted backwards from the end of the list (i.e. -1 will append to the list).

func (*KptfileKubeObject) WriteToPackage

func (kf *KptfileKubeObject) WriteToPackage(resources map[string]string) error

type SubObjectMatcher

type SubObjectMatcher func(obj *kubeobject.SubObject) bool

func IsConditionType

func IsConditionType(expectedType string) SubObjectMatcher

IsConditionType returns with a predicate that if the "conditionType" field of the given object is equal to the given expectedType

func IsType

func IsType(expectedType string) SubObjectMatcher

IsType returns with a predicate that is true if the "type" field of the given object is equal to the given expectedType

func IsTypeAndStatus

func IsTypeAndStatus(expectedType string, expectedStatus kptfileapi.ConditionStatus) SubObjectMatcher

IsTypeAndStatus returns with a predicate that is true if the "type" and "status" fields ob the status condition SubObject matches with the given expected values

Jump to

Keyboard shortcuts

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