utils

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAppsByHealthStatusCode

func GetAppsByHealthStatusCode(apps []argov1alpha1.Application, code health.HealthStatusCode) []argov1alpha1.Application

GetAppsByHealthStatusCode returns the Applications matching the specified health status code

func GetAppsBySyncStatusCode

func GetAppsBySyncStatusCode(apps []argov1alpha1.Application, code argov1alpha1.SyncStatusCode) []argov1alpha1.Application

GetAppsBySyncStatusCode returns the Applications matching the specified sync status code

func GetAppsName

func GetAppsName(apps []argov1alpha1.Application) string

GetAppsName returns a string containing a comma-separated list of names of the given apps

func GetClustersName

func GetClustersName(clusters []corev1.Secret) string

GetClustersName returns a string containing a comma-separated list of names of the given clusters

func GetSyncedAppsByStage

GetSyncedAppsByStage returns the Applications that synced during the given stage

func IsArgoCDCluster

func IsArgoCDCluster(labels map[string]string) bool

IsArgoCDCluster returns true if one of the labels is the ArgoCD secret label with the secret type cluster as value

func SortAppsByName

func SortAppsByName(apps []argov1alpha1.Application)

SortAppsByName sort the Application slice in place by the app name

func SortSecretsByName

func SortSecretsByName(secrets *corev1.SecretList)

SortSecretsByName sort the SecretList in place by the secrets name

Types

type ArgoCDAppClient

type ArgoCDAppClient interface {
	Sync(ctx context.Context, in *applicationpkg.ApplicationSyncRequest, opts ...grpc.CallOption) (*v1alpha1.Application, error)
}

func GetArgoCDAppClient

func GetArgoCDAppClient(c Configuration) ArgoCDAppClient

GetArgoCDAppClient builds an Argo CD application client with the provided configuration

type Configuration

type Configuration struct {
	ArgoCDAuthToken  string
	ArgoCDServerAddr string
	ArgoCDInsecure   bool
}

Configuration holds the configuration to connect to the Argo CD server

func ReadConfiguration

func ReadConfiguration() (Configuration, error)

ReadConfiguration returns a Configuration, reading it from environment variables if present, or from files in the configuration directory otherwise

type InMemorySyncState

type InMemorySyncState struct {
	Name                string
	SyncedAtStage       map[string]string // Key: App name, Value: Stage name
	SyncedAppsPerStage  map[string]int    // Key: Stage name, Value: Number of Apps synced in this stage
	MaxTargetsPerStage  map[string]int
	MaxParallelPerStage map[string]int
	Mutex               *sync.Mutex
}

func (*InMemorySyncState) GetMaxParallel

func (s *InMemorySyncState) GetMaxParallel(stage syncv1alpha1.ProgressiveSyncStage) int

GetMaxParallel gets the maximum level of parallelism to be applied when syncing/scheduling apps in the specified stage

func (*InMemorySyncState) GetMaxTargets

func (s *InMemorySyncState) GetMaxTargets(stage syncv1alpha1.ProgressiveSyncStage) int

GetMaxTargets gets the maximum number of targets to be synced in the specified stage

func (*InMemorySyncState) IsAppMarkedInStage

IsAppMarkedInStage returns whether the application is marked in the specified stage

func (*InMemorySyncState) MarkAppAsSynced

MarkAppAsSynced marks the specified app as synced in the specified stage

func (*InMemorySyncState) RefreshState

RefreshState makes sure that we update our representation of the state of the world to match the latest observation

type ProgressiveSyncState

type ProgressiveSyncState interface {
	MarkAppAsSynced(app argov1alpha1.Application, stage syncv1alpha1.ProgressiveSyncStage)
	RefreshState(apps []argov1alpha1.Application, stage syncv1alpha1.ProgressiveSyncStage)
	IsAppMarkedInStage(app argov1alpha1.Application, stage syncv1alpha1.ProgressiveSyncStage) bool
	GetMaxTargets(stage syncv1alpha1.ProgressiveSyncStage) int
	GetMaxParallel(stage syncv1alpha1.ProgressiveSyncStage) int
}

type ProgressiveSyncStateManager

type ProgressiveSyncStateManager interface {
	Get(name string) (ProgressiveSyncState, error)
}

func NewProgressiveSyncManager

func NewProgressiveSyncManager() ProgressiveSyncStateManager

NewProgressiveSyncManager returns a ProgressiveSync stage manager

type ProgressiveSyncStateManagerImpl

type ProgressiveSyncStateManagerImpl struct {
	Mutex *sync.Mutex
	// contains filtered or unexported fields
}

func (*ProgressiveSyncStateManagerImpl) Get

Get returns the progressive sync state object for the specified progresive sync

Jump to

Keyboard shortcuts

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