Documentation
¶
Index ¶
- Constants
- func DeploymentAvailableCondition() appsv1.DeploymentCondition
- func DeploymentNotAvailableCondition() appsv1.DeploymentCondition
- func DeploymentNotProgressingCondition() appsv1.DeploymentCondition
- func DeploymentProgressingCondition() appsv1.DeploymentCondition
- func GetDeploymentStatusConditions(ctx context.Context, client client.Client, name, namespace string) []toolchainv1alpha1.Condition
- func GetToolchainClusterConditions(logger logr.Logger, attrs ToolchainClusterAttributes) []toolchainv1alpha1.Condition
- func NewComponentErrorCondition(reason, msg string) *toolchainv1alpha1.Condition
- func NewComponentReadyCondition(reason string) *toolchainv1alpha1.Condition
- func ValidateComponentConditionReady(conditions ...toolchainv1alpha1.Condition) error
- type Health
- type ToolchainClusterAttributes
- type VersionCheckManager
Constants ¶
const ( // ErrMsgCannotGetDeployment deployment not found ErrMsgCannotGetDeployment = "unable to get the deployment" // ErrMsgDeploymentConditionNotReady deployment not ready ErrMsgDeploymentConditionNotReady = "deployment has unready status conditions" )
const ( ErrMsgClusterConnectionNotFound = "the cluster connection was not found" ErrMsgClusterConnectionLastProbeTimeExceeded = "exceeded the maximum duration since the last probe" )
error messages related to cluster connection
const ( // ErrMsgDeploymentIsNotUpToDate means that deployment version is not aligned with source code version ErrMsgDeploymentIsNotUpToDate = "deployment version is not up to date with latest github commit SHA" // DeploymentThreshold is the threshold after which we can be almost sure the deployment was not updated on the cluster with the latest version/commit, // in this case some issue is preventing the new deployment to happen. DeploymentThreshold = 30 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func DeploymentAvailableCondition ¶
func DeploymentAvailableCondition() appsv1.DeploymentCondition
func DeploymentNotAvailableCondition ¶
func DeploymentNotAvailableCondition() appsv1.DeploymentCondition
func DeploymentNotProgressingCondition ¶
func DeploymentNotProgressingCondition() appsv1.DeploymentCondition
func DeploymentProgressingCondition ¶
func DeploymentProgressingCondition() appsv1.DeploymentCondition
func GetDeploymentStatusConditions ¶
func GetDeploymentStatusConditions(ctx context.Context, client client.Client, name, namespace string) []toolchainv1alpha1.Condition
GetDeploymentStatusConditions looks up a deployment with the given name within the given namespace and checks its status and finally returns a condition summarizing the status
func GetToolchainClusterConditions ¶
func GetToolchainClusterConditions(logger logr.Logger, attrs ToolchainClusterAttributes) []toolchainv1alpha1.Condition
GetToolchainClusterConditions uses the provided ToolchainCluster attributes to determine status conditions
func NewComponentErrorCondition ¶
func NewComponentErrorCondition(reason, msg string) *toolchainv1alpha1.Condition
func NewComponentReadyCondition ¶
func NewComponentReadyCondition(reason string) *toolchainv1alpha1.Condition
func ValidateComponentConditionReady ¶
func ValidateComponentConditionReady(conditions ...toolchainv1alpha1.Condition) error
ValidateComponentConditionReady checks whether the provided conditions signal that the component is ready, returns an error otherwise
Types ¶
type Health ¶
type Health struct { Alive bool `json:"alive"` Environment string `json:"environment"` Revision string `json:"revision"` BuildTime string `json:"buildTime"` StartTime string `json:"startTime"` }
Health payload
type ToolchainClusterAttributes ¶
type ToolchainClusterAttributes struct { GetClusterFunc func() (*cluster.CachedToolchainCluster, bool) Period time.Duration Timeout time.Duration }
ToolchainClusterAttributes required attributes for obtaining ToolchainCluster status
type VersionCheckManager ¶
type VersionCheckManager struct { GetGithubClientFunc client.GetGitHubClientFunc LastGHCallsPerRepo map[string]time.Time }
func (*VersionCheckManager) CheckDeployedVersionIsUpToDate ¶
func (m *VersionCheckManager) CheckDeployedVersionIsUpToDate(ctx context.Context, isProd bool, accessTokenKey string, alreadyExistingConditions []toolchainv1alpha1.Condition, githubRepo client.GitHubRepository) *toolchainv1alpha1.Condition
CheckDeployedVersionIsUpToDate verifies if there is a match between the latest commit in GitHub for a given repo and branch matches the provided commit SHA. There is some preconfigured delay/threshold that we keep in account before returning an `error condition`.