Documentation ¶
Index ¶
- func IsClusterGroupAlreadyExistsError(err error) bool
- func IsClusterGroupNotFoundError(err error) bool
- func IsClusterGroupUpdateRejectedError(err error) bool
- func IsFeatureReconcileError(err error) bool
- func IsFeatureRecordNotFoundError(err error) bool
- func IsInvalidClusterGroupCreateRequestError(err error) bool
- func IsMemberClusterNotFoundError(err error) (*memberClusterNotFoundError, bool)
- func IsMemberClusterPartOfAClusterGroupError(err error) (*memberClusterPartOfAClusterGroupError, bool)
- func IsRecordNotFoundError(err error) bool
- func IsUnableToJoinMemberClusterError(err error) bool
- func IsUnknownFeatureError(err error) bool
- func Migrate(db *gorm.DB, logger logrus.FieldLogger) error
- type ClusterGroupFeatureModel
- type ClusterGroupModel
- type ClusterGroupRepository
- func (g *ClusterGroupRepository) Create(name string, orgID uint, memberClusterModels []MemberClusterModel) (*uint, error)
- func (g *ClusterGroupRepository) Delete(cgroup *ClusterGroupModel) error
- func (g *ClusterGroupRepository) FindAll(orgID uint) ([]*ClusterGroupModel, error)
- func (g *ClusterGroupRepository) FindMemberClusterByID(clusterID uint) (*MemberClusterModel, error)
- func (g *ClusterGroupRepository) FindOne(cg ClusterGroupModel) (*ClusterGroupModel, error)
- func (g *ClusterGroupRepository) GetAllFeatures(clusterGroupID uint) ([]ClusterGroupFeatureModel, error)
- func (g *ClusterGroupRepository) GetFeature(clusterGroupID uint, featureName string) (*ClusterGroupFeatureModel, error)
- func (g *ClusterGroupRepository) SaveFeature(feature *ClusterGroupFeatureModel) error
- func (g *ClusterGroupRepository) UpdateMembers(cgroup *api.ClusterGroup, newMembers map[uint]api.Cluster) error
- type Manager
- func (g *Manager) CreateClusterGroup(ctx context.Context, name string, orgID uint, members []uint) (*uint, error)
- func (g *Manager) DeleteClusterGroupByID(ctx context.Context, orgID uint, clusterGroupID uint) error
- func (g *Manager) DisableFeature(featureName string, clusterGroup *api.ClusterGroup) error
- func (g *Manager) DisableFeatures(clusterGroup api.ClusterGroup) error
- func (g *Manager) EnableFeature(featureName string, clusterGroup *api.ClusterGroup, properties interface{}) error
- func (g *Manager) GetAllClusterGroups(ctx context.Context, orgID uint) ([]api.ClusterGroup, error)
- func (g *Manager) GetClusterGroupByID(ctx context.Context, clusterGroupID uint, orgID uint) (*api.ClusterGroup, error)
- func (g *Manager) GetClusterGroupByIDWithStatus(ctx context.Context, clusterGroupID uint, orgID uint, withStatus bool) (*api.ClusterGroup, error)
- func (g *Manager) GetClusterGroupFromModel(ctx context.Context, cg *ClusterGroupModel, withStatus bool) *api.ClusterGroup
- func (g *Manager) GetClusterGroupNameForCluster(clusterID uint, orgID uint) (*string, error)
- func (g *Manager) GetEnabledFeatures(clusterGroup api.ClusterGroup) (map[string]api.Feature, error)
- func (g *Manager) GetFeature(clusterGroup api.ClusterGroup, featureName string) (*api.Feature, error)
- func (g *Manager) GetFeatureHandler(featureName string) (api.FeatureHandler, error)
- func (g *Manager) GetFeatureStatus(feature api.Feature) (map[uint]string, error)
- func (g *Manager) GetFeatures(clusterGroup api.ClusterGroup) (map[string]api.Feature, error)
- func (g *Manager) ReconcileFeature(clusterGroup api.ClusterGroup, featureName string) error
- func (g *Manager) ReconcileFeatures(clusterGroup api.ClusterGroup, onlyEnabledHandlers bool) error
- func (g *Manager) RegisterFeatureHandler(featureName string, handler api.FeatureHandler)
- func (g *Manager) RemoveClusterFromGroup(ctx context.Context, clusterID uint) error
- func (g *Manager) UpdateClusterGroup(ctx context.Context, clusterGroupID uint, orgID uint, name string, ...) error
- func (g *Manager) UpdateFeature(featureName string, clusterGroup *api.ClusterGroup, properties interface{}) error
- func (g *Manager) ValidateClusterRemoval(ctx context.Context, clusterID uint) error
- type MemberClusterModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsClusterGroupAlreadyExistsError ¶
IsClusterGroupAlreadyExistsError returns true if the passed in error designates a cluster group already exists error
func IsClusterGroupNotFoundError ¶
IsClusterGroupNotFoundError returns true if the passed in error designates a cluster group not found error
func IsClusterGroupUpdateRejectedError ¶
IsClusterGroupUpdateRejectedError returns true if the passed in error designates that a cluster group update is denied
func IsFeatureReconcileError ¶
IsFeatureReconcileError returns true if the passed in error designates a feature reconciliation error
func IsFeatureRecordNotFoundError ¶
IsFeatureRecordNotFoundError returns true if the passed in error designates that a feature DB record not found
func IsInvalidClusterGroupCreateRequestError ¶
IsInvalidClusterGroupCreateRequestError returns true if the passed in error designates invalid cluster group create request
func IsMemberClusterNotFoundError ¶
IsMemberClusterNotFoundError returns true if the passed in error designates a cluster group member is not found
func IsMemberClusterPartOfAClusterGroupError ¶
func IsMemberClusterPartOfAClusterGroupError(err error) (*memberClusterPartOfAClusterGroupError, bool)
IsMemberClusterPartOfAClusterGroupError returns true if the passed in error designates a cluster group member is already part of a cluster group
func IsRecordNotFoundError ¶
IsRecordNotFoundError returns true if the passed in error designates that a DB record not found
func IsUnableToJoinMemberClusterError ¶
IsUnableToJoinMemberClusterError returns true if the passed in error is IsUnableToJoinMemberClusterError
func IsUnknownFeatureError ¶
IsUnknownFeatureError returns true if the passed in error designates an unknown feature (no registered handler) error
Types ¶
type ClusterGroupFeatureModel ¶
type ClusterGroupFeatureModel struct { ID uint `gorm:"primary_key"` Name string ClusterGroupID uint Enabled bool Properties []byte `sql:"type:json"` ReconcileState string LastReconcileError string `sql:"type:text"` }
ClusterGroupFeature describes a feature of a cluster group.
func (ClusterGroupFeatureModel) TableName ¶
func (ClusterGroupFeatureModel) TableName() string
TableName changes the default table name.
type ClusterGroupModel ¶
type ClusterGroupModel struct { ID uint `gorm:"primary_key"` UID string `gorm:"unique_index:idx_uid"` CreatedAt time.Time UpdatedAt time.Time DeletedAt *time.Time `gorm:"unique_index:idx_unique_id" sql:"index"` CreatedBy uint Name string `gorm:"unique_index:idx_unique_id"` OrganizationID uint `gorm:"unique_index:idx_unique_id"` Members []MemberClusterModel `gorm:"foreignkey:ClusterGroupID"` FeatureParams []ClusterGroupFeatureModel `gorm:"foreignkey:ClusterGroupID"` }
ClusterGroupModel describes the cluster group model.
func (*ClusterGroupModel) BeforeCreate ¶
func (g *ClusterGroupModel) BeforeCreate() (err error)
func (ClusterGroupModel) String ¶
func (g ClusterGroupModel) String() string
String method prints formatted cluster fields.
func (ClusterGroupModel) TableName ¶
func (ClusterGroupModel) TableName() string
TableName changes the default table name.
type ClusterGroupRepository ¶
type ClusterGroupRepository struct {
// contains filtered or unexported fields
}
ClusterGroupRepository
func NewClusterGroupRepository ¶
func NewClusterGroupRepository( db *gorm.DB, logger logrus.FieldLogger, ) *ClusterGroupRepository
NewClusterGroupRepository returns a new ClusterGroupRepository instance.
func (*ClusterGroupRepository) Create ¶
func (g *ClusterGroupRepository) Create(name string, orgID uint, memberClusterModels []MemberClusterModel) (*uint, error)
Create persists a cluster group
func (*ClusterGroupRepository) Delete ¶
func (g *ClusterGroupRepository) Delete(cgroup *ClusterGroupModel) error
Delete deletes a cluster group
func (*ClusterGroupRepository) FindAll ¶
func (g *ClusterGroupRepository) FindAll(orgID uint) ([]*ClusterGroupModel, error)
FindAll returns all cluster groups
func (*ClusterGroupRepository) FindMemberClusterByID ¶
func (g *ClusterGroupRepository) FindMemberClusterByID(clusterID uint) (*MemberClusterModel, error)
FindMemberClusterByID returns a MemberClusterModel for a cluster ID
func (*ClusterGroupRepository) FindOne ¶
func (g *ClusterGroupRepository) FindOne(cg ClusterGroupModel) (*ClusterGroupModel, error)
FindOne returns a cluster group instance for an organization by clusterGroupID.
func (*ClusterGroupRepository) GetAllFeatures ¶
func (g *ClusterGroupRepository) GetAllFeatures(clusterGroupID uint) ([]ClusterGroupFeatureModel, error)
GetAllFeatures gets all features for a cluster group
func (*ClusterGroupRepository) GetFeature ¶
func (g *ClusterGroupRepository) GetFeature(clusterGroupID uint, featureName string) (*ClusterGroupFeatureModel, error)
GetFeature gets a feature for a cluster
func (*ClusterGroupRepository) SaveFeature ¶
func (g *ClusterGroupRepository) SaveFeature(feature *ClusterGroupFeatureModel) error
SaveFeature persists a cluster group feature
func (*ClusterGroupRepository) UpdateMembers ¶
func (g *ClusterGroupRepository) UpdateMembers(cgroup *api.ClusterGroup, newMembers map[uint]api.Cluster) error
UpdateMembers updates cluster group members
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager
func NewManager ¶
func NewManager( clusterGetter api.ClusterGetter, repository *ClusterGroupRepository, logger logrus.FieldLogger, errorHandler emperror.Handler, ) *Manager
NewManager returns a new Manager instance.
func (*Manager) CreateClusterGroup ¶
func (g *Manager) CreateClusterGroup(ctx context.Context, name string, orgID uint, members []uint) (*uint, error)
CreateClusterGroup creates a cluster group
func (*Manager) DeleteClusterGroupByID ¶
func (g *Manager) DeleteClusterGroupByID(ctx context.Context, orgID uint, clusterGroupID uint) error
DeleteClusterGroup deletes a cluster group by id
func (*Manager) DisableFeature ¶
func (g *Manager) DisableFeature(featureName string, clusterGroup *api.ClusterGroup) error
DisableFeature disable a cluster group feature
func (*Manager) DisableFeatures ¶
func (g *Manager) DisableFeatures(clusterGroup api.ClusterGroup) error
func (*Manager) EnableFeature ¶
func (g *Manager) EnableFeature(featureName string, clusterGroup *api.ClusterGroup, properties interface{}) error
func (*Manager) GetAllClusterGroups ¶
GetAllClusterGroups returns every cluster groups
func (*Manager) GetClusterGroupByID ¶
func (g *Manager) GetClusterGroupByID(ctx context.Context, clusterGroupID uint, orgID uint) (*api.ClusterGroup, error)
GetClusterGroupByID gets a cluster group by id
func (*Manager) GetClusterGroupByIDWithStatus ¶
func (g *Manager) GetClusterGroupByIDWithStatus(ctx context.Context, clusterGroupID uint, orgID uint, withStatus bool) (*api.ClusterGroup, error)
GetClusterGroupByIDWithStatus gets a cluster group by id - optionally with a status info
func (*Manager) GetClusterGroupFromModel ¶
func (g *Manager) GetClusterGroupFromModel(ctx context.Context, cg *ClusterGroupModel, withStatus bool) *api.ClusterGroup
GetClusterGroupFromModel converts a ClusterGroupModel to api.ClusterGroup
func (*Manager) GetClusterGroupNameForCluster ¶
func (*Manager) GetEnabledFeatures ¶
func (*Manager) GetFeature ¶
func (g *Manager) GetFeature(clusterGroup api.ClusterGroup, featureName string) (*api.Feature, error)
GetFeature returns params of a cluster group feature by clusterGroupId and feature name
func (*Manager) GetFeatureHandler ¶
func (g *Manager) GetFeatureHandler(featureName string) (api.FeatureHandler, error)
func (*Manager) GetFeatureStatus ¶
func (*Manager) GetFeatures ¶
func (*Manager) ReconcileFeature ¶
func (g *Manager) ReconcileFeature(clusterGroup api.ClusterGroup, featureName string) error
func (*Manager) ReconcileFeatures ¶
func (g *Manager) ReconcileFeatures(clusterGroup api.ClusterGroup, onlyEnabledHandlers bool) error
func (*Manager) RegisterFeatureHandler ¶
func (g *Manager) RegisterFeatureHandler(featureName string, handler api.FeatureHandler)
func (*Manager) RemoveClusterFromGroup ¶
RemoveClusterFromGroup removes a cluster from group
func (*Manager) UpdateClusterGroup ¶
func (g *Manager) UpdateClusterGroup(ctx context.Context, clusterGroupID uint, orgID uint, name string, members []uint) error
UpdateClusterGroup updates a cluster group
func (*Manager) UpdateFeature ¶
func (g *Manager) UpdateFeature(featureName string, clusterGroup *api.ClusterGroup, properties interface{}) error
type MemberClusterModel ¶
MemberClusterModel describes a member of a cluster group.
func (MemberClusterModel) TableName ¶
func (MemberClusterModel) TableName() string
TableName changes the default table name.