Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 add condition and reason definition in operator #325

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions operator/v1/types_clustermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,54 @@ type ClusterManagerList struct {
// Items is a list of deployment configurations for registration and work distribution controllers.
Items []ClusterManager `json:"items"`
}

const (
// The types of ClusterManager condition status.
// ConditionClusterManagerApplied is the ClusterManager condition status which means all components have been applied on the hub.
ConditionClusterManagerApplied = "Applied"
// ConditionHubRegistrationDegraded is the ClusterManager condition status which means the registration is not ready to serve on the hub.
ConditionHubRegistrationDegraded = "HubRegistrationDegraded"
// ConditionHubPlacementDegraded is the ClusterManager condition status which means the placement is not ready to serve on the hub.
ConditionHubPlacementDegraded = "HubPlacementDegraded"
// ConditionProgressing is the ClusterManager condition status which means the ClusterManager are in upgrading phase.
ConditionProgressing = "Progressing"
// ConditionMigrationSucceeded is the ClusterManager condition status which means the API migration is succeeded on the hub.
ConditionMigrationSucceeded = "MigrationSucceeded"

// ReasonClusterManagerApplied is the reason of the ConditionClusterManagerApplied condition to show all resources are applied.
ReasonClusterManagerApplied = "ClusterManagerApplied"
// ReasonRuntimeResourceApplyFailed is the reason of the ConditionClusterManagerApplied condition to show it is failed to apply deployments.
ReasonRuntimeResourceApplyFailed = "RuntimeResourceApplyFailed"
// ReasonServiceAccountSyncFailed is the reason of the ConditionClusterManagerApplied condition to show it is failed to apply serviceAccounts.
ReasonServiceAccountSyncFailed = "ServiceAccountSyncFailed"
// ReasonClusterManagerCRDApplyFailed is the reason of the ConditionClusterManagerApplied condition to show it is failed to apply CRDs.
ReasonClusterManagerCRDApplyFailed = "CRDApplyFailed"
// ReasonWebhookApplyFailed is the reason of the ConditionClusterManagerApplied condition to show it is failed to apply webhooks.
ReasonWebhookApplyFailed = "WebhookApplyFailed"

// ReasonDeploymentRolling is the reason of the ConditionProgressing condition to show the deployed deployments are rolling.
ReasonDeploymentRolling = "ClusterManagerDeploymentRolling"
// ReasonUpToDate is the reason of the ConditionProgressing condition to show the deployed deployments are up-to-date.
ReasonUpToDate = "ClusterManagerUpToDate"

// ReasonStorageVersionMigrationFailed is the reason of the ConditionMigrationSucceeded condition to show the API storageVersion migration is failed.
ReasonStorageVersionMigrationFailed = "StorageVersionMigrationFailed"
// ReasonStorageVersionMigrationProcessing is the reason of the ConditionMigrationSucceeded condition to show the API storageVersion migration is not completed.
ReasonStorageVersionMigrationProcessing = "StorageVersionMigrationProcessing"
// ReasonStorageVersionMigrationSucceed is the reason of the ConditionMigrationSucceeded condition to show the API storageVersion migration is succeeded.
ReasonStorageVersionMigrationSucceed = "StorageVersionMigrationSucceed"

// ReasonGetRegistrationDeploymentFailed is the reason of the ConditionRegistrationDegraded condition to show getting registration deployment failed.
ReasonGetRegistrationDeploymentFailed = "GetRegistrationDeploymentFailed"
// ReasonUnavailableRegistrationPod is the reason of the ConditionRegistrationDegraded condition to show the registration pods are unavailable.
ReasonUnavailableRegistrationPod = "UnavailableRegistrationPod"
// ReasonRegistrationFunctional is the reason of the ConditionRegistrationDegraded condition to show registration is functional.
ReasonRegistrationFunctional = "RegistrationFunctional"

// ReasonGetPlacementDeploymentFailed is the reason of the ConditionPlacementDegraded condition to show it is failed get placement deployment.
ReasonGetPlacementDeploymentFailed = "GetPlacementDeploymentFailed"
// ReasonUnavailablePlacementPod is the reason of the ConditionPlacementDegraded condition to show the registration pods are unavailable.
ReasonUnavailablePlacementPod = "UnavailablePlacementPod"
// ReasonPlacementFunctional is the reason of the ConditionPlacementDegraded condition to show placement is functional.
ReasonPlacementFunctional = "PlacementFunctional"
)
63 changes: 63 additions & 0 deletions operator/v1/types_klusterlet.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,66 @@ type KlusterletList struct {
// Items is a list of Klusterlet agents.
Items []Klusterlet `json:"items"`
}

const (
// The types of klusterlet condition status.
// ConditionKlusterletApplied is the klusterlet condition status which means all components have been applied on the managed cluster.
ConditionKlusterletApplied = "Applied"
// ConditionReadyToApply is a klusterlet condition status which means it is ready to apply the resources on the managed cluster.
ConditionReadyToApply = "ReadyToApply"
// ConditionKlusterletAvailable is the klusterlet condition status which means all components are available and ready to serve.
ConditionKlusterletAvailable = "Available"
// ConditionHubConnectionDegraded is the klusterlet condition status which means the agent on the managed cluster cannot access the hub cluster.
ConditionHubConnectionDegraded = "HubConnectionDegraded"
// ConditionRegistrationDesiredDegraded is the klusterlet condition status which means the registration agent on the managed cluster is not ready to serve.
ConditionRegistrationDesiredDegraded = "RegistrationDesiredDegraded"
// ConditionWorkDesiredDegraded is the klusterlet condition status which means the work agent on the managed cluster is not ready to serve.
ConditionWorkDesiredDegraded = "WorkDesiredDegraded"

// ReasonKlusterletApplied is the reason of ConditionKlusterletApplied condition to show resources are applied.
ReasonKlusterletApplied = "KlusterletApplied"
// ReasonKlusterletApplyFailed is the reason of ConditionKlusterletApplied condition to show it is failed to apply resources.
ReasonKlusterletApplyFailed = "KlusterletApplyFailed"
// ReasonKlusterletCRDApplyFailed is the reason of ConditionKlusterletApplied condition to show it is failed to apply CRDs.
ReasonKlusterletCRDApplyFailed = "CRDApplyFailed"
// ReasonManagedClusterResourceApplyFailed is the reason of ConditionKlusterletApplied condition to show it is failed to apply resources on managed cluster.
ReasonManagedClusterResourceApplyFailed = "ManagedClusterResourceApplyFailed"
// ReasonManagementClusterResourceApplyFailed is the reason of ConditionKlusterletApplied condition to show it is failed to apply resources on management cluster.
ReasonManagementClusterResourceApplyFailed = "ManagementClusterResourceApplyFailed"

// ReasonKlusterletPrepareFailed is the reason of ConditionReadyToApply condition to show it is failed to get the kubeConfig
// of managed cluster from the external-managed-kubeconfig secret in the hosted mode.
ReasonKlusterletPrepareFailed = "KlusterletPrepareFailed"
// ReasonKlusterletPrepared is the reason of ConditionReadyToApply condition to show the kubeConfig of managed cluster is
// validated from the external-managed-kubeconfig secret in the hosted mode.
ReasonKlusterletPrepared = "KlusterletPrepared"

// ReasonKlusterletGetDeploymentFailed is the reason of ConditionKlusterletAvailable/ConditionRegistrationDesiredDegraded/ConditionWorkDesiredDegraded
// condition to show it is failed to get deployments.
ReasonKlusterletGetDeploymentFailed = "GetDeploymentFailed"
// ReasonKlusterletUnavailablePods is the reason of ConditionKlusterletAvailable/ConditionRegistrationDesiredDegraded/ConditionWorkDesiredDegraded
// condition to show there is unavailable pod.
ReasonKlusterletUnavailablePods = "UnavailablePods"
// ReasonKlusterletDeploymentsFunctional is the reason of ConditionKlusterletAvailable/ConditionRegistrationDesiredDegraded/ConditionWorkDesiredDegraded
// condition to show all deployments are functional.
ReasonKlusterletDeploymentsFunctional = "DeploymentsFunctional"
// ReasonKlusterletNoAvailablePods is the reason of ConditionKlusterletAvailable/ConditionRegistrationDesiredDegraded/ConditionWorkDesiredDegraded
// condition to show there is no available pod.
ReasonKlusterletNoAvailablePods = "NoAvailablePods"

// ReasonKlusterletAvailable is the reason of ConditionKlusterletAvailable condition to show all deployed resources are available.
ReasonKlusterletAvailable = "KlusterletAvailable"

// ReasonHubConnectionFunctional is the reason of ConditionHubConnectionDegraded condition to show spoke cluster connects hub cluster.
ReasonHubConnectionFunctional = "HubConnectionFunctional"
// ReasonHubKubeConfigSecretMissing is the reason of ConditionHubConnectionDegraded condition to show hubKubeConfigSecret is missing.
ReasonHubKubeConfigSecretMissing = "HubKubeConfigSecretMissing"
// ReasonHubKubeConfigMissing is the reason of ConditionHubConnectionDegraded condition to show hubKubeConfig in hubKubeConfigSecret is missing.
ReasonHubKubeConfigMissing = "HubKubeConfigMissing"
// ReasonHubKubeConfigError is the reason of ConditionHubConnectionDegraded condition to show it is failed to get hubKubeConfig.
ReasonHubKubeConfigError = "HubKubeConfigError"
// ReasonClusterNameMissing is the reason of ConditionHubConnectionDegraded condition to show the cluster-name is missing in the hubKubeConfigSecret.
ReasonClusterNameMissing = "ClusterNameMissing"
// ReasonHubKubeConfigUnauthorized is the reason of ConditionHubConnectionDegraded condition to show there is no permission to access hub using the hubKubeConfigSecret.
ReasonHubKubeConfigUnauthorized = "HubKubeConfigUnauthorized"
)
Loading