sdk

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: Apache-2.0 Imports: 20 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// AppKubernetesPartOfLabel is the Kubernetes recommended part-of label
	AppKubernetesPartOfLabel = "app.kubernetes.io/part-of"
	// AppKubernetesVersionLabel is the Kubernetes recommended version label
	AppKubernetesVersionLabel = "app.kubernetes.io/version"
)
View Source
const LeaderElectionAnnotation = "control-plane.alpha.kubernetes.io/leader"

LeaderElectionAnnotation is the annotatation used on resources for leader election

Variables

This section is empty.

Functions

func CheckDeploymentReady

func CheckDeploymentReady(deployment *appsv1.Deployment) bool

func ConditionsChanged

func ConditionsChanged(originalValues, newValues map[v1.ConditionType]corev1.ConditionStatus) bool

ConditionsChanged compares condition maps and return true if any of the conditions changed, false otherwise.

func ContainsStringValue

func ContainsStringValue(values []string, value string) bool

func DeployClusterResources

func DeployClusterResources() bool

func GetConditionValues

func GetConditionValues(conditionList []v1.Condition) map[v1.ConditionType]corev1.ConditionStatus

GetConditionValues gets the conditions and put them into a map for easy comparison

func GetOperatorToplevel

func GetOperatorToplevel() string

GetOperatorToplevel returns the top level source directory of the operator. Can be overridden using the environment variable "OPERATOR_DIR".

func GetRecommendedLabelsFromCr added in v0.2.1

func GetRecommendedLabelsFromCr(cr client.Object) map[string]string

GetRecommendedLabelsFromCr returns the recommended labels to set on CDI resources

func IsMutable

func IsMutable(obj client.Object) bool

func IsUpgrading

func IsUpgrading(crStatus *api.Status) bool

IsUpgrading checks whether cr status represents upgrade in progress

func LogJSONDiff

func LogJSONDiff(logger logr.Logger, objA, objB interface{})

func MarkCrDeploying

func MarkCrDeploying(cr runtime.Object, crStatus *api.Status, reason, message string, recorder record.EventRecorder)

MarkCrDeploying marks the passed CR as currently deploying. The CR object needs to be updated by the caller afterwards. Deploying means the following status conditions are set: ApplicationAvailable: false Progressing: true Degraded: false

func MarkCrFailed

func MarkCrFailed(cr client.Object, crStatus *api.Status, reason, message string, recorder record.EventRecorder)

MarkCrFailed marks the passed CR as failed and requiring human intervention. The CR object needs to be updated by the caller afterwards. Failed means the following status conditions are set: ApplicationAvailable: false Progressing: false Degraded: true

func MarkCrFailedHealing

func MarkCrFailedHealing(cr client.Object, crStatus *api.Status, reason, message string, recorder record.EventRecorder)

MarkCrFailedHealing marks the passed CR as failed and healing. The CR object needs to be updated by the caller afterwards. FailedAndHealing means the following status conditions are set: ApplicationAvailable: false Progressing: true Degraded: true

func MarkCrHealthyMessage

func MarkCrHealthyMessage(cr client.Object, crStatus *api.Status, reason, message string, recorder record.EventRecorder)

MarkCrHealthyMessage marks the passed in CR as healthy. The CR object needs to be updated by the caller afterwards. Healthy means the following status conditions are set: ApplicationAvailable: true Progressing: false Degraded: false

func MarkCrUpgradeHealingDegraded

func MarkCrUpgradeHealingDegraded(cr client.Object, crStatus *api.Status, reason, message string, recorder record.EventRecorder)

MarkCrUpgradeHealingDegraded marks the passed CR as upgrading and degraded. The CR object needs to be updated by the caller afterwards. Failed means the following status conditions are set: ApplicationAvailable: true Progressing: true Degraded: true

func MergeLabelsAndAnnotations

func MergeLabelsAndAnnotations(src, dest metav1.Object)

func MergeObject

func MergeObject(desiredObj, currentObj client.Object, lastAppliedConfigAnnotation string) (client.Object, error)

func NewDefaultInstance

func NewDefaultInstance(obj client.Object) client.Object

func NewIgnoreLeaderElectionPredicate

func NewIgnoreLeaderElectionPredicate() predicate.Predicate

NewIgnoreLeaderElectionPredicate returns a predicate used for ignoring leader election resources

func SameResource

func SameResource(obj1, obj2 runtime.Object) bool

func SetLabel

func SetLabel(key, value string, obj metav1.Object)

func SetLastAppliedConfiguration

func SetLastAppliedConfiguration(obj metav1.Object, lastAppliedConfigAnnotation string) error

SetLastAppliedConfiguration writes last applied configuration to given annotation

func StripStatusByte

func StripStatusByte(in []byte) ([]byte, error)

func StripStatusFromObject

func StripStatusFromObject(obj client.Object) (client.Object, error)

Types

type IgnoreWithMeta

type IgnoreWithMeta struct {
	LabelKeys      []string
	AnnotationKeys []string
}

IgnoreWithMeta ignores resources with specified labels/annotations

func (*IgnoreWithMeta) Create

func (p *IgnoreWithMeta) Create(e event.CreateEvent) bool

Create implements Predicate

func (*IgnoreWithMeta) Delete

func (p *IgnoreWithMeta) Delete(e event.DeleteEvent) bool

Delete implements Predicate

func (*IgnoreWithMeta) Generic

func (p *IgnoreWithMeta) Generic(e event.GenericEvent) bool

Generic implements Predicate

func (*IgnoreWithMeta) Update

func (p *IgnoreWithMeta) Update(e event.UpdateEvent) bool

Update implements Predicate

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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