deployutil

package
v0.0.0-...-9940484 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ReasonSuccessDeployment        = "SuccessDeployment"
	ReasonFailedFetchingObject     = "FailedFetchingObject"
	ReasonFailedClusterUnreachable = "FailedClusterUnreachable"
	ReasonFailedDeployment         = "FailedDeployment"
	ReasonFailedJob                = "FailedJob"
	ReasonFailedWriteState         = "FailedWriteState"
)

Variables

This section is empty.

Functions

func AcceptAllFilter

func AcceptAllFilter(obj *BasicKubernetesObject) bool

func ComputeReadinessForResourceReadyRequirements

func ComputeReadinessForResourceReadyRequirements(resourceReadyRequirements []hubv1.Resource,
	resultReadiness string, dynamicClient *DynamicTargetClient, logger logr.Logger) string

func ContextWithEventWriter

func ContextWithEventWriter(ctx context.Context, eventWriter *EventWriter) context.Context

func DoesTargetClusterExist

func DoesTargetClusterExist(ctx context.Context, crAndSecretClient client.Client, secretKey types.NamespacedName) (bool, error)

func GetTargetClient

func GetTargetClient(ctx context.Context, crAndSecretClient client.Client, secretKey types.NamespacedName) (client.Client, error)

func GetTargetConfig

func GetTargetConfig(ctx context.Context, crAndSecretClient client.Client, secretKey types.NamespacedName) ([]byte, error)

func GetTargetSecret

func GetTargetSecret(ctx context.Context, crAndSecretClient client.Client, secretKey types.NamespacedName) (*corev1.Secret, error)

func LogApplicationFailure

func LogApplicationFailure(ctx context.Context, reason, message string)

func LogHubFailure

func LogHubFailure(ctx context.Context, reason, message string, err error)

func LogSuccess

func LogSuccess(ctx context.Context, reason, message string)

func MergeMaps

func MergeMaps(a, b map[string]interface{}) map[string]interface{}

func ReadinessFilter

func ReadinessFilter(obj *BasicKubernetesObject) bool

func WorseState

func WorseState(state1, state2 string) string

Types

type BasicKubernetesObject

type BasicKubernetesObject struct {
	APIVersion string               `yaml:"apiVersion"`
	Kind       string               `yaml:"kind"`
	ObjectMeta types.NamespacedName `yaml:"metadata"`
}

type ClusterUnreachableError

type ClusterUnreachableError struct {
	Err error
}

func (*ClusterUnreachableError) Error

func (e *ClusterUnreachableError) Error() string

type DeployData

type DeployData struct {
	Configuration  *hubv1.HubDeployItemConfiguration
	ProviderStatus *hubv1.HubDeployItemProviderStatus
	ExportValues   map[string]interface{}
	// contains filtered or unexported fields
}

func NewDeployData

func NewDeployData(deployItem *v1alpha1.DeployItem) (*DeployData, error)

func (*DeployData) ComputeReadiness

func (d *DeployData) ComputeReadiness(ctx context.Context, basicKubernetesObjects []BasicKubernetesObject,
	targetClient client.Client, dynamicClient *DynamicTargetClient, namespace string) string

func (*DeployData) GetConfigID

func (d *DeployData) GetConfigID() string

func (*DeployData) GetDeployItem

func (d *DeployData) GetDeployItem() *v1alpha1.DeployItem

func (*DeployData) GetDeployItemCondition

func (d *DeployData) GetDeployItemCondition(conditionType hubv1.HubDeploymentConditionType) *v1alpha1.Condition

func (*DeployData) GetDeployItemKey

func (d *DeployData) GetDeployItemKey() *types.NamespacedName

func (*DeployData) GetExportReference

func (d *DeployData) GetExportReference() *v1alpha1.ObjectReference

func (*DeployData) GetGeneration

func (d *DeployData) GetGeneration() int64

func (*DeployData) GetNamespace

func (d *DeployData) GetNamespace() string

func (*DeployData) GetObservedGeneration

func (d *DeployData) GetObservedGeneration() int64

func (*DeployData) GetSecretKey

func (d *DeployData) GetSecretKey() *types.NamespacedName

func (*DeployData) GetStatus

func (d *DeployData) GetStatus() (*v1alpha1.DeployItemStatus, error)

func (*DeployData) IsConditionTrue

func (d *DeployData) IsConditionTrue(conditionType hubv1.HubDeploymentConditionType) bool

func (*DeployData) IsDeleteOperation

func (d *DeployData) IsDeleteOperation() bool

func (*DeployData) IsFinallyFailed

func (d *DeployData) IsFinallyFailed() bool

func (*DeployData) IsInstallButNotReady

func (d *DeployData) IsInstallButNotReady() bool

func (*DeployData) IsInstallOperation

func (d *DeployData) IsInstallOperation() bool

func (*DeployData) IsLastDeployFailed

func (d *DeployData) IsLastDeployFailed() bool

func (*DeployData) IsNewOperation

func (d *DeployData) IsNewOperation() bool

func (*DeployData) IsReconcile

func (d *DeployData) IsReconcile() bool

func (*DeployData) MarshalProviderStatus

func (d *DeployData) MarshalProviderStatus() error

func (*DeployData) ReplaceDeployItemCondition

func (d *DeployData) ReplaceDeployItemCondition(conditionType hubv1.HubDeploymentConditionType,
	status v1.ConditionStatus, now metav1.Time, reason hubv1.HubDeploymentConditionReason, message string)

func (*DeployData) SetExportSecretName

func (d *DeployData) SetExportSecretName(secretName string)

func (*DeployData) SetPhase

func (d *DeployData) SetPhase(phase v1alpha1.ExecutionPhase)

func (*DeployData) SetStatus

func (d *DeployData) SetStatus(lastState, description string, numberOfTries int32, currentTime metav1.Time)

func (*DeployData) SetStatusForReachableCluster

func (d *DeployData) SetStatusForReachableCluster()

func (*DeployData) SetStatusForUnreachableCluster

func (d *DeployData) SetStatusForUnreachableCluster()

func (*DeployData) WorsifyDeployItemCondition

func (d *DeployData) WorsifyDeployItemCondition(conditionType hubv1.HubDeploymentConditionType,
	status v1.ConditionStatus, now metav1.Time, reason hubv1.HubDeploymentConditionReason, message string)

type DeployItemDeployer

type DeployItemDeployer interface {
	ProcessNewOperation(ctx context.Context, deployData *DeployData)
	RetryFailedOperation(ctx context.Context, deployData *DeployData)
	ReconcileOperation(ctx context.Context, deployData *DeployData)
	ProcessPendingOperation(ctx context.Context, deployData *DeployData)
	Cleanup(ctx context.Context, deployData *DeployData, clusterExists bool) error
	Preprocess(ctx context.Context, deployData *DeployData)
}

type DynamicTargetClient

type DynamicTargetClient struct {
	// contains filtered or unexported fields
}

func NewDynamicTargetClient

func NewDynamicTargetClient(ctx context.Context, crAndSecretClient client.Client, secretKey types.NamespacedName) (*DynamicTargetClient, error)

func (*DynamicTargetClient) GetResource

func (d *DynamicTargetClient) GetResource(apiVersion, resource, namespace, name string) (*unstructured.Unstructured, error)

func (*DynamicTargetClient) GetResourceData

func (d *DynamicTargetClient) GetResourceData(apiVersion, resource, namespace, name, fieldPath string) (interface{}, error)

type EventWriter

type EventWriter struct {
	// contains filtered or unexported fields
}

func GetEventWriterFromContext

func GetEventWriterFromContext(ctx context.Context) *EventWriter

func NewEventWriter

func NewEventWriter(clusterBom *hubv1.ClusterBom, eventRecorder record.EventRecorder) *EventWriter

func (*EventWriter) WriteEvent

func (w *EventWriter) WriteEvent(eventtype, reason, message string)

type EventWriterKey

type EventWriterKey struct{}

type SecretHandler

type SecretHandler struct {
	// contains filtered or unexported fields
}

func NewSecretHandler

func NewSecretHandler(secretClient client.Client) *SecretHandler

func (*SecretHandler) CreateExportSecretForDi

func (r *SecretHandler) CreateExportSecretForDi(ctx context.Context, deployData *DeployData,
	exportData []byte) (secretName string, err error)

func (*SecretHandler) RemoveUnreferencedExportSecrets

func (r *SecretHandler) RemoveUnreferencedExportSecrets(ctx context.Context, deployItem *v1alpha1.DeployItem,
	referencedSecret *v1alpha1.ObjectReference) error

Jump to

Keyboard shortcuts

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