Documentation
¶
Index ¶
- Constants
- func IsAllowedTaskStatus(status string) bool
- type Application
- func (app *Application) GetRolloutMessage(status string, rolloutImages []string) string
- func (app *Application) GetRolloutStatus(rolloutImages []string, registryProxyUrl string, acceptSuspended bool) string
- func (app *Application) IsFireAndForgetModeActive() bool
- func (app *Application) IsManagedByWatcher() bool
- func (app *Application) ListSyncResultResources() []string
- func (app *Application) ListUnhealthyResources() []string
- func (app *Application) UpdateGitImageTag(task *Task, gitopsRepo *GitopsRepo, gitHandler updater.GitHandler) error
- type ApplicationMetadata
- type ApplicationOperationResource
- type ApplicationResource
- type ApplicationSource
- type ApplicationSpec
- type ApplicationStatus
- type ApplicationStatusOperationState
- type ArgoApiErrorResponse
- type GitopsRepo
- type HealthStatus
- type Image
- type LockdownSchedule
- type SavedAppStatus
- type Task
- type TaskStatus
- type TasksResponse
- type Userinfo
Constants ¶
const ( ArgoRolloutAppSuccess = "success" ArgoRolloutAppNotSynced = "not synced" ArgoRolloutAppNotAvailable = "not available" ArgoRolloutAppNotHealthy = "not healthy" ArgoRolloutAppDegraded = "degraded" )
const ( StatusAppNotFoundMessage = "app not found" StatusInProgressMessage = "in progress" StatusFailedMessage = "failed" StatusAborted = "aborted" StatusArgoCDFailedLogin = "failed to login to argocd" StatusDeployedMessage = "deployed" StatusAccepted = "accepted" )
Variables ¶
This section is empty.
Functions ¶
func IsAllowedTaskStatus ¶ added in v0.10.2
IsAllowedTaskStatus reports whether the given status string is accepted as a value for the `/api/v1/tasks` `status` query parameter.
Types ¶
type Application ¶
type Application struct {
Metadata ApplicationMetadata `json:"metadata"`
Spec ApplicationSpec `json:"spec"`
Status ApplicationStatus `json:"status"`
}
func (*Application) GetRolloutMessage ¶ added in v0.6.0
func (app *Application) GetRolloutMessage(status string, rolloutImages []string) string
GetRolloutMessage generates rollout failure message.
func (*Application) GetRolloutStatus ¶ added in v0.6.0
func (app *Application) GetRolloutStatus(rolloutImages []string, registryProxyUrl string, acceptSuspended bool) string
GetRolloutStatus calculates application rollout status depending on the expected images and proxy configuration.
func (*Application) IsFireAndForgetModeActive ¶ added in v0.9.0
func (app *Application) IsFireAndForgetModeActive() bool
IsFireAndForgetModeActive checks if 'fire-and-forget' mode is enabled in Application's annotations.
func (*Application) IsManagedByWatcher ¶ added in v0.6.0
func (app *Application) IsManagedByWatcher() bool
IsManagedByWatcher checks if the application is managed by the watcher. It checks if the application's metadata contains the "argo-watcher/managed" annotation with the value "true".
func (*Application) ListSyncResultResources ¶ added in v0.3.0
func (app *Application) ListSyncResultResources() []string
ListSyncResultResources returns a list of strings representing the sync result resources of the application. Each string in the list contains information about the resource's kind, name, hook type, hook phase, and message. The information is formatted as "{kind}({name}) {hookType} {hookPhase} with message {message}". The list is generated based on the Application's status and its operation state's sync result resources.
func (*Application) ListUnhealthyResources ¶ added in v0.3.0
func (app *Application) ListUnhealthyResources() []string
ListUnhealthyResources returns a list of strings representing the unhealthy resources of the application. Each string in the list contains information about the resource's kind, name, and health status. If available, the resource's health message is also included in the string. The format of each string is "{kind}({name}) {status}" or "{kind}({name}) {status} with message {message}". The list is generated based on the Application's status and its resources with non-empty health status.
func (*Application) UpdateGitImageTag ¶ added in v0.6.0
func (app *Application) UpdateGitImageTag(task *Task, gitopsRepo *GitopsRepo, gitHandler updater.GitHandler) error
UpdateGitImageTag writes the new image tag for app into the GitOps repository. gitHandler is injected to enable testing; production callers pass updater.GitClient{}.
type ApplicationMetadata ¶ added in v0.8.0
type ApplicationOperationResource ¶ added in v0.6.0
type ApplicationOperationResource struct {
HookPhase string `json:"hookPhase"` // example: Failed
HookType string `json:"hookType"` // example: PreSync
Kind string `json:"kind"` // example: Pod | Job
Message string `json:"message"` // example: Job has reached the specified backoff limit
Status string `json:"status"` // example: Synced
SyncPhase string `json:"syncPhase"` // example: PreSync
Name string `json:"name"` // example: app-migrations
Namespace string `json:"namespace"` // example: app
}
type ApplicationResource ¶ added in v0.6.0
type ApplicationResource struct {
Kind string `json:"kind"` // example: Pod | Job
Name string `json:"name"` // example: app-migrations
Namespace string `json:"namespace"` // example: app
Health struct {
Message string `json:"message"` // example: Job has reached the specified backoff limit
Status string `json:"status"` // example: Synced
} `json:"health"`
}
type ApplicationSource ¶ added in v0.8.0
type ApplicationSpec ¶ added in v0.8.0
type ApplicationSpec struct {
Source ApplicationSource `json:"source"`
Sources []ApplicationSource `json:"sources"`
}
type ApplicationStatus ¶ added in v0.8.0
type ApplicationStatus struct {
Health struct {
Status string `json:"status"`
}
OperationState ApplicationStatusOperationState `json:"operationState"`
Resources []ApplicationResource `json:"resources"`
Summary struct {
Images []string `json:"images"`
}
Sync struct {
Status string `json:"status"`
}
}
type ApplicationStatusOperationState ¶ added in v0.8.0
type ApplicationStatusOperationState struct {
Phase string `json:"phase"`
Message string `json:"message"`
SyncResult struct {
Resources []ApplicationOperationResource `json:"resources"`
} `json:"syncResult"`
}
type ArgoApiErrorResponse ¶ added in v0.3.0
type GitopsRepo ¶ added in v0.8.0
type GitopsRepo struct {
RepoUrl string `validate:"required"`
BranchName string `validate:"required"`
Path string `validate:"required"`
Filename string
RepoCachePath string
}
func NewGitopsRepo ¶ added in v0.8.0
func NewGitopsRepo(app *Application, repoCachePath string) (GitopsRepo, error)
type HealthStatus ¶
type HealthStatus struct {
Status string `json:"status"`
}
type LockdownSchedule ¶ added in v0.8.0
type SavedAppStatus ¶ added in v0.6.6
type Task ¶
type Task struct {
Id string `json:"id,omitempty"`
Created float64 `json:"created,omitempty"`
Updated float64 `json:"updated,omitempty"`
App string `json:"app" binding:"required" example:"argo-watcher"`
Author string `json:"author" binding:"required" example:"John Doe"`
Project string `json:"project" binding:"required" example:"Demo"`
Images []Image `json:"images" binding:"required"`
Status string `json:"status,omitempty"`
StatusReason string `json:"status_reason,omitempty"`
Validated bool `json:"validated,omitempty"`
Timeout int `json:"timeout,omitempty"`
SavedAppStatus SavedAppStatus `json:"-"`
}
func (*Task) IsAppNotFoundError ¶ added in v0.6.0
IsAppNotFoundError check if app not found error.
func (*Task) ListImages ¶ added in v0.3.0
ListImages returns a list of strings representing the images of the task. Each string in the list is in the format "{image}:{tag}". The list is generated based on the Task's Images field.
type TaskStatus ¶
type TaskStatus struct {
Id string `json:"id,omitempty"`
Created float64 `json:"created,omitempty"`
Updated float64 `json:"updated,omitempty"`
App string `json:"app,omitempty" binding:"required" example:"argo-watcher"`
Author string `json:"author,omitempty" binding:"required" example:"John Doe"`
Project string `json:"project,omitempty" binding:"required" example:"Demo"`
Images []Image `json:"images,omitempty" binding:"required"`
Status string `json:"status,omitempty"`
StatusReason string `json:"status_reason,omitempty"`
Error string `json:"error,omitempty"`
}