status

package
v0.0.0-...-c804474 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RunningReason - Condition is running
	RunningReason = "Running"
	// SuccessfulReason - Condition is running due to reconcile being successful
	SuccessfulReason = "Successful"
	// FailedReason - Condition is failed due to ansible failure
	FailedReason = "Failed"
	// UnknownFailedReason - Condition is unknown
	UnknownFailedReason = "Unknown"
)
View Source
const (
	// RunningMessage - message for running reason.
	RunningMessage = "Running reconciliation"
	// SuccessfulMessage - message for successful reason.
	AwaitingMessage = "Awaiting next reconciliation"
	// SuccessfulMessage - message for successful condition.
	SuccessfulMessage = "Last reconciliation succeeded"
)

Variables

This section is empty.

Functions

func RemoveCondition

func RemoveCondition(status *Status, condType ConditionType)

RemoveCondition removes the scheduledReport condition with the provided type.

func SetCondition

func SetCondition(status *Status, condition Condition)

SetCondition updates the scheduledReport to include the provided condition. If the condition that we are about to add already exists and has the same status and reason then we are not going to update.

Types

type AnsibleResult

type AnsibleResult struct {
	Ok               int                `json:"ok"`
	Changed          int                `json:"changed"`
	Skipped          int                `json:"skipped"`
	Failures         int                `json:"failures"`
	TimeOfCompletion eventapi.EventTime `json:"completion"`
}

AnsibleResult - encapsulation of the ansible result.

func NewAnsibleResultFromMap

func NewAnsibleResultFromMap(sm map[string]interface{}) *AnsibleResult

NewAnsibleResultFromMap - creates a Ansible status from a job event.

func NewAnsibleResultFromStatusJobEvent

func NewAnsibleResultFromStatusJobEvent(je eventapi.StatusJobEvent) *AnsibleResult

NewAnsibleResultFromStatusJobEvent - creates a Ansible status from job event.

type Condition

type Condition struct {
	Type               ConditionType      `json:"type"`
	Status             v1.ConditionStatus `json:"status"`
	LastTransitionTime metav1.Time        `json:"lastTransitionTime"`
	AnsibleResult      *AnsibleResult     `json:"ansibleResult,omitempty"`
	Reason             string             `json:"reason"`
	Message            string             `json:"message"`
}

Condition - the condition for the ansible operator.

func GetCondition

func GetCondition(status Status, condType ConditionType) *Condition

GetCondition returns the condition with the provided type.

func NewCondition

func NewCondition(condType ConditionType, status v1.ConditionStatus, ansibleResult *AnsibleResult, reason,
	message string) *Condition

NewCondition - condition

type ConditionType

type ConditionType string

ConditionType - type of condition

const (
	// RunningConditionType - condition type of running.
	RunningConditionType ConditionType = "Running"
	// FailureConditionType - condition type of failure.
	FailureConditionType ConditionType = "Failure"
	// SuccessfulConditionType - condition type of success.
	SuccessfulConditionType ConditionType = "Successful"
)

type Status

type Status struct {
	Conditions   []Condition            `json:"conditions"`
	CustomStatus map[string]interface{} `json:"-"`
}

Status - The status for custom resources managed by the operator-sdk.

func CreateFromMap

func CreateFromMap(statusMap map[string]interface{}) Status

CreateFromMap - create a status from the map

func (*Status) GetJSONMap

func (status *Status) GetJSONMap() map[string]interface{}

GetJSONMap - gets the map value for the status object. This is used to set the status on the CR. This is needed because the unstructured type has special rules around DeepCopy. If you do not convert the status to the map, then DeepCopy for the unstructured will fail and throw runtime exceptions. Please note that this will return an empty map on error.

Jump to

Keyboard shortcuts

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