model

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2020 License: Apache-2.0 Imports: 16 Imported by: 14

Documentation

Index

Constants

View Source
const (
	// InstallationAffinityIsolated means that no peer installations are allowed in the same cluster.
	InstallationAffinityIsolated = "isolated"
	// InstallationAffinityMultiTenant means peer installations are allowed in the same cluster.
	InstallationAffinityMultiTenant = "multitenant"
)
View Source
const (
	// ClusterInstallationStateCreationRequested is a cluster installation in the process of being created.
	ClusterInstallationStateCreationRequested = "creation-requested"
	// ClusterInstallationStateCreationFailed is a cluster installation that failed creation.
	ClusterInstallationStateCreationFailed = "creation-failed"
	// ClusterInstallationStateDeletionRequested is a cluster installation in the process of being deleted.
	ClusterInstallationStateDeletionRequested = "deletion-requested"
	// ClusterInstallationStateDeletionFailed is a cluster installation that failed deletion.
	ClusterInstallationStateDeletionFailed = "deletion-failed"
	// ClusterInstallationStateDeleted is a cluster installation that has been deleted
	ClusterInstallationStateDeleted = "deleted"
	// ClusterInstallationStateReconciling is a cluster installation that in undergoing changes and is not yet stable.
	ClusterInstallationStateReconciling = "reconciling"
	// ClusterInstallationStateStable is a cluster installation in a stable state and undergoing no changes.
	ClusterInstallationStateStable = "stable"
)
View Source
const (
	// ClusterStateStable is a cluster in a stable state and undergoing no changes.
	ClusterStateStable = "stable"
	// ClusterStateCreationRequested is a cluster in the process of being created.
	ClusterStateCreationRequested = "creation-requested"
	// ClusterStateCreationFailed is a cluster that failed creation.
	ClusterStateCreationFailed = "creation-failed"
	// ClusterStateProvisioningRequested is a cluster in the process of being
	// provisioned with operators.
	ClusterStateProvisioningRequested = "provisioning-requested"
	// ClusterStateProvisioningFailed is a cluster that failed provisioning.
	ClusterStateProvisioningFailed = "provisioning-failed"
	// ClusterStateUpgradeRequested is a cluster in the process of upgrading.
	ClusterStateUpgradeRequested = "upgrade-requested"
	// ClusterStateUpgradeFailed is a cluster that failed to upgrade.
	ClusterStateUpgradeFailed = "upgrade-failed"
	// ClusterStateDeletionRequested is a cluster in the process of being deleted.
	ClusterStateDeletionRequested = "deletion-requested"
	// ClusterStateDeletionFailed is a cluster that failed deletion.
	ClusterStateDeletionFailed = "deletion-failed"
	// ClusterStateDeleted is a cluster that has been deleted
	ClusterStateDeleted = "deleted"
)
View Source
const (
	// PrometheusCanonicalName is the canonical string representation of prometheus
	PrometheusCanonicalName = "prometheus"
	// NginxCanonicalName is the canonical string representation of nginx
	NginxCanonicalName = "nginx"
	// FluentbitCanonicalName is the canonical string representation of fluentbit
	FluentbitCanonicalName = "fluentbit"
)
View Source
const (
	// PrometheusDefaultVersion defines the default version for the Helm chart
	PrometheusDefaultVersion = "10.4.0"
	// NginxDefaultVersion defines the default version for the Helm chart
	NginxDefaultVersion = "1.30.0"
	// FluentbitDefaultVersion defines the default version for the Helm chart
	FluentbitDefaultVersion = "2.8.7"
)
View Source
const (
	// InstallationDatabaseMysqlOperator is a database hosted in kubernetes via the operator.
	InstallationDatabaseMysqlOperator = "mysql-operator"
	// InstallationDatabaseAwsRDS is a database hosted via Amazon RDS.
	InstallationDatabaseAwsRDS = "aws-rds"
)
View Source
const (
	// InstallationFilestoreMinioOperator is a filestore hosted in kubernetes via the operator.
	InstallationFilestoreMinioOperator = "minio-operator"
	// InstallationFilestoreAwsS3 is a filestore hosted via Amazon S3.
	InstallationFilestoreAwsS3 = "aws-s3"
)
View Source
const (
	// InstallationStateStable is an installation in a stable state and undergoing no changes.
	InstallationStateStable = "stable"
	// InstallationStateCreationRequested is an installation waiting to be created.
	InstallationStateCreationRequested = "creation-requested"
	// InstallationStateCreationPreProvisioning in an installation in the process
	// of having managed services created along with any other preparation.
	InstallationStateCreationPreProvisioning = "creation-pre-provisioning"
	// InstallationStateCreationInProgress is an installation in the process of
	// being created.
	InstallationStateCreationInProgress = "creation-in-progress"
	// InstallationStateCreationDNS is an installation in the process having configuring DNS.
	InstallationStateCreationDNS = "creation-configuring-dns"
	// InstallationStateCreationFailed is an installation that failed creation.
	InstallationStateCreationFailed = "creation-failed"
	// InstallationStateCreationNoCompatibleClusters is an installation that
	// can't be fully created because there are no compatible clusters.
	InstallationStateCreationNoCompatibleClusters = "creation-no-compatible-clusters"
	// InstallationStateUpgradeRequested is an installation that is about to undergo a version change.
	InstallationStateUpgradeRequested = "upgrade-requested"
	// InstallationStateUpgradeInProgress is an installation that is undergoing a version change.
	InstallationStateUpgradeInProgress = "upgrade-in-progress"
	// InstallationStateUpgradeFailed is an installation that failed to change versions.
	InstallationStateUpgradeFailed = "upgrade-failed"
	// InstallationStateDeletionRequested is an installation to be deleted.
	InstallationStateDeletionRequested = "deletion-requested"
	// InstallationStateDeletionInProgress is an installation being deleted.
	InstallationStateDeletionInProgress = "deletion-in-progress"
	// InstallationStateDeletionFinalCleanup is the final step of installation deletion.
	InstallationStateDeletionFinalCleanup = "deletion-final-cleanup"
	// InstallationStateDeletionFailed is an installation that failed deletion.
	InstallationStateDeletionFailed = "deletion-failed"
	// InstallationStateDeleted is an installation that has been deleted
	InstallationStateDeleted = "deleted"
)
View Source
const (
	// SizeAlefDev is the definition of a cluster supporting dev purposes.
	SizeAlefDev = "SizeAlefDev"
	// SizeAlef500 is the key representing a cluster supporting 500 users.
	SizeAlef500 = "SizeAlef500"
	// SizeAlef1000 is the key representing a cluster supporting 1000 users.
	SizeAlef1000 = "SizeAlef1000"
	// SizeAlef5000 is the key representing a cluster supporting 5000 users.
	SizeAlef5000 = "SizeAlef5000"
	// SizeAlef10000 is the key representing a cluster supporting 10000 users.
	SizeAlef10000 = "SizeAlef10000"
)
View Source
const (
	// TypeCluster is the string value that represents a cluster.
	TypeCluster = "cluster"
	// TypeInstallation is the string value that represents an installation.
	TypeInstallation = "installation"
	// TypeClusterInstallation is the string value that represents a cluster
	// installation.
	TypeClusterInstallation = "cluster_installaton"
)
View Source
const (
	// AllPerPage signals the store to return all results, avoid pagination of any kind.
	AllPerPage = -1
)
View Source
const (
	// InstallationDefaultSize is the default size for an installation.
	InstallationDefaultSize = mmv1alpha1.Size100String
)
View Source
const (
	// ProviderAWS is the cloud provider AWS.
	ProviderAWS = "aws"
)

Variables

AllClusterInstallationStates is a list of all states a cluster installation can be in. Warning: When creating a new cluster installation state, it must be added to this list.

AllClusterInstallationStatesPendingWork is a list of all cluster installation states that the supervisor will attempt to transition towards stable on the next "tick". Warning: When creating a new cluster installation state, it must be added to this list if the cloud installation supervisor should perform some action on its next work cycle.

AllClusterRequestStates is a list of all states that a cluster can be put in via the API. Warning: When creating a new cluster state, it must be added to this list if an API endpoint should put the cluster in this state.

AllClusterStates is a list of all states a cluster can be in. Warning: When creating a new cluster state, it must be added to this list.

AllClusterStatesPendingWork is a list of all cluster states that the supervisor will attempt to transition towards stable on the next "tick". Warning: When creating a new cluster state, it must be added to this list if the cloud cluster supervisor should perform some action on its next work cycle.

AllInstallationRequestStates is a list of all states that an installation can be put in via the API. Warning: When creating a new installation state, it must be added to this list if an API endpoint should put the installation in this state.

AllInstallationStates is a list of all states an installation can be in. Warning: When creating a new installation state, it must be added to this list.

AllInstallationStatesPendingWork is a list of all installation states that the supervisor will attempt to transition towards stable on the next "tick". Warning: When creating a new installation state, it must be added to this list if the cloud installation supervisor should perform some action on its next work cycle.

Functions

func CheckProvider

func CheckProvider(provider string) (string, error)

CheckProvider normalizes the given provider, returning an error if invalid.

func ClusterInstallationConfigFromReader

func ClusterInstallationConfigFromReader(reader io.Reader) (map[string]interface{}, error)

ClusterInstallationConfigFromReader decodes a json-encoded config from the config io.Reader.

func IsSupportedAffinity

func IsSupportedAffinity(affinity string) bool

IsSupportedAffinity returns true if the given affinity string is supported.

func IsSupportedClusterSize added in v0.7.0

func IsSupportedClusterSize(size string) bool

IsSupportedClusterSize returns true if the given size string is supported.

func IsSupportedDatabase added in v0.7.0

func IsSupportedDatabase(database string) bool

IsSupportedDatabase returns true if the given database string is supported.

func IsSupportedFilestore added in v0.7.0

func IsSupportedFilestore(filestore string) bool

IsSupportedFilestore returns true if the given filestore string is supported.

func NewID

func NewID() string

NewID is a globally unique identifier. It is a [A-Z0-9] string 26 characters long. It is a UUID version 4 Guid that is zbased32 encoded with the padding stripped off.

func ValidClusterVersion added in v0.9.0

func ValidClusterVersion(name string) bool

ValidClusterVersion returns true if the provided version is either "latest" or a valid k8s version number.

Types

type AWSMetadata

type AWSMetadata struct {
	Zones []string
}

AWSMetadata is the provider metadata stored in a model.Cluster.

func NewAWSMetadata

func NewAWSMetadata(providerMetadata []byte) (*AWSMetadata, error)

NewAWSMetadata creates an instance of AWSMetadata given the raw provider metadata.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the programmatic interface to the provisioning server API.

func NewClient

func NewClient(address string) *Client

NewClient creates a client to the provisioning server at the given address.

func NewClientWithHeaders added in v0.7.0

func NewClientWithHeaders(address string, headers map[string]string) *Client

NewClientWithHeaders creates a client to the provisioning server at the given address and uses the provided headers.

func (*Client) CreateCluster

func (c *Client) CreateCluster(request *CreateClusterRequest) (*Cluster, error)

CreateCluster requests the creation of a cluster from the configured provisioning server.

func (*Client) CreateGroup

func (c *Client) CreateGroup(request *CreateGroupRequest) (*Group, error)

CreateGroup requests the creation of a group from the configured provisioning server.

func (*Client) CreateInstallation

func (c *Client) CreateInstallation(request *CreateInstallationRequest) (*Installation, error)

CreateInstallation requests the creation of a installation from the configured provisioning server.

func (*Client) CreateWebhook added in v0.3.0

func (c *Client) CreateWebhook(request *CreateWebhookRequest) (*Webhook, error)

CreateWebhook requests the creation of a webhook from the configured provisioning server.

func (*Client) DeleteCluster

func (c *Client) DeleteCluster(clusterID string) error

DeleteCluster deletes the given cluster and all resources contained therein.

func (*Client) DeleteGroup

func (c *Client) DeleteGroup(groupID string) error

DeleteGroup deletes the given group and all resources contained therein.

func (*Client) DeleteInstallation

func (c *Client) DeleteInstallation(installationID string) error

DeleteInstallation deletes the given installation and all resources contained therein.

func (*Client) DeleteWebhook added in v0.3.0

func (c *Client) DeleteWebhook(webhookID string) error

DeleteWebhook deletes the given webhook.

func (*Client) GetCluster

func (c *Client) GetCluster(clusterID string) (*Cluster, error)

GetCluster fetches the specified cluster from the configured provisioning server.

func (*Client) GetClusterInstallation

func (c *Client) GetClusterInstallation(clusterInstallationID string) (*ClusterInstallation, error)

GetClusterInstallation fetches the specified cluster installation from the configured provisioning server.

func (*Client) GetClusterInstallationConfig

func (c *Client) GetClusterInstallationConfig(clusterInstallationID string) (map[string]interface{}, error)

GetClusterInstallationConfig fetches the specified cluster installation's Mattermost config.

func (*Client) GetClusterInstallations

func (c *Client) GetClusterInstallations(request *GetClusterInstallationsRequest) ([]*ClusterInstallation, error)

GetClusterInstallations fetches the list of cluster installations from the configured provisioning server.

func (*Client) GetClusterUtilities added in v0.14.0

func (c *Client) GetClusterUtilities(clusterID string) (*UtilityMetadata, error)

GetClusterUtilities returns the metadata for all utilities running in the given cluster.

func (*Client) GetClusters

func (c *Client) GetClusters(request *GetClustersRequest) ([]*Cluster, error)

GetClusters fetches the list of clusters from the configured provisioning server.

func (*Client) GetGroup

func (c *Client) GetGroup(groupID string) (*Group, error)

GetGroup fetches the specified group from the configured provisioning server.

func (*Client) GetGroups

func (c *Client) GetGroups(request *GetGroupsRequest) ([]*Group, error)

GetGroups fetches the list of groups from the configured provisioning server.

func (*Client) GetInstallation

func (c *Client) GetInstallation(installationID string) (*Installation, error)

GetInstallation fetches the specified installation from the configured provisioning server.

func (*Client) GetInstallations

func (c *Client) GetInstallations(request *GetInstallationsRequest) ([]*Installation, error)

GetInstallations fetches the list of installations from the configured provisioning server.

func (*Client) GetWebhook added in v0.3.0

func (c *Client) GetWebhook(webhookID string) (*Webhook, error)

GetWebhook fetches the webhook from the configured provisioning server.

func (*Client) GetWebhooks added in v0.3.0

func (c *Client) GetWebhooks(request *GetWebhooksRequest) ([]*Webhook, error)

GetWebhooks fetches the list of webhooks from the configured provisioning server.

func (*Client) JoinGroup

func (c *Client) JoinGroup(groupID, installationID string) error

JoinGroup joins an installation to the given group, leaving any existing group.

func (*Client) LeaveGroup

func (c *Client) LeaveGroup(installationID string) error

LeaveGroup removes an installation from its group, if any.

func (*Client) ProvisionCluster

func (c *Client) ProvisionCluster(clusterID string, request *ProvisionClusterRequest) error

ProvisionCluster provisions k8s operators and Helm charts on a cluster from the configured provisioning server.

func (*Client) RetryCreateCluster

func (c *Client) RetryCreateCluster(clusterID string) error

RetryCreateCluster retries the creation of a cluster from the configured provisioning server.

func (*Client) RetryCreateInstallation

func (c *Client) RetryCreateInstallation(installationID string) error

RetryCreateInstallation retries the creation of a installation from the configured provisioning server.

func (*Client) RunMattermostCLICommandOnClusterInstallation added in v0.3.0

func (c *Client) RunMattermostCLICommandOnClusterInstallation(clusterInstallationID string, subcommand []string) ([]byte, error)

RunMattermostCLICommandOnClusterInstallation runs a Mattermost CLI command against a cluster installation.

func (*Client) SetClusterInstallationConfig

func (c *Client) SetClusterInstallationConfig(clusterInstallationID string, config map[string]interface{}) error

SetClusterInstallationConfig modifies an cluster installation's Mattermost configuration.

The operation is applied as a patch, preserving existing values if they are not specified.

func (*Client) UpdateCluster added in v0.8.0

func (c *Client) UpdateCluster(clusterID string, request *UpdateClusterRequest) (*Cluster, error)

UpdateCluster updates a cluster's configuration.

func (*Client) UpdateGroup

func (c *Client) UpdateGroup(request *PatchGroupRequest) error

UpdateGroup updates the installation group.

func (*Client) UpgradeCluster

func (c *Client) UpgradeCluster(clusterID, version string) error

UpgradeCluster upgrades a cluster to the latest recommended production ready k8s version.

func (*Client) UpgradeInstallation

func (c *Client) UpgradeInstallation(installationID string, request *UpgradeInstallationRequest) error

UpgradeInstallation upgrades an installation.

type Cluster

type Cluster struct {
	ID                  string
	Provider            string
	Provisioner         string
	ProviderMetadata    []byte `json:",omitempty"`
	ProvisionerMetadata []byte `json:",omitempty"`
	AllowInstallations  bool
	Version             string
	Size                string
	State               string
	CreateAt            int64
	DeleteAt            int64
	LockAcquiredBy      *string
	LockAcquiredAt      int64
	UtilityMetadata     []byte `json:",omitempty"`
}

Cluster represents a Kubernetes cluster.

func ClusterFromReader

func ClusterFromReader(reader io.Reader) (*Cluster, error)

ClusterFromReader decodes a json-encoded cluster from the given io.Reader.

func ClustersFromReader

func ClustersFromReader(reader io.Reader) ([]*Cluster, error)

ClustersFromReader decodes a json-encoded list of clusters from the given io.Reader.

func (*Cluster) ActualUtilityVersion added in v0.14.0

func (c *Cluster) ActualUtilityVersion(utility string) (string, error)

ActualUtilityVersion fetches the desired version of a utility from the Cluster object

func (*Cluster) Clone

func (c *Cluster) Clone() *Cluster

Clone returns a deep copy the cluster.

func (*Cluster) DesiredUtilityVersion added in v0.14.0

func (c *Cluster) DesiredUtilityVersion(utility string) (string, error)

DesiredUtilityVersion fetches the desired version of a utility from the Cluster object

func (*Cluster) SetProviderMetadata

func (c *Cluster) SetProviderMetadata(data interface{}) error

SetProviderMetadata is a helper method to encode an interface{} as the corresponding bytes.

func (*Cluster) SetProvisionerMetadata

func (c *Cluster) SetProvisionerMetadata(data interface{}) error

SetProvisionerMetadata is a helper method to encode an interface{} as the corresponding bytes.

func (*Cluster) SetUtilityActualVersion added in v0.14.0

func (c *Cluster) SetUtilityActualVersion(utility string, version string) error

SetUtilityActualVersion stores the provided version for the provided utility in the UtilityMetadata JSON []byte in this Cluster

func (*Cluster) SetUtilityDesiredVersions added in v0.14.0

func (c *Cluster) SetUtilityDesiredVersions(versions map[string]string) error

SetUtilityDesiredVersions takes a map of string to string representing any metadata related to the utility group and stores it as a []byte in Cluster so that it can be inserted into the database

func (*Cluster) ValidTransitionState added in v0.8.0

func (c *Cluster) ValidTransitionState(newState string) bool

ValidTransitionState returns whether a cluster can be transitioned into the new state or not based on its current state.

type ClusterFilter

type ClusterFilter struct {
	Page           int
	PerPage        int
	IncludeDeleted bool
}

ClusterFilter describes the parameters used to constrain a set of clusters.

type ClusterInstallation

type ClusterInstallation struct {
	ID             string
	ClusterID      string
	InstallationID string
	Namespace      string
	State          string
	CreateAt       int64
	DeleteAt       int64
	LockAcquiredBy *string
	LockAcquiredAt int64
}

ClusterInstallation is a single namespace within a cluster composing a potentially larger installation.

func ClusterInstallationFromReader

func ClusterInstallationFromReader(reader io.Reader) (*ClusterInstallation, error)

ClusterInstallationFromReader decodes a json-encoded cluster installation from the given io.Reader.

func ClusterInstallationsFromReader

func ClusterInstallationsFromReader(reader io.Reader) ([]*ClusterInstallation, error)

ClusterInstallationsFromReader decodes a json-encoded list of cluster installations from the given io.Reader.

func (*ClusterInstallation) Clone

Clone returns a deep copy the cluster installation.

func (*ClusterInstallation) IsDeleted added in v0.4.0

func (c *ClusterInstallation) IsDeleted() bool

IsDeleted returns whether the cluster installation was marked as deleted or not.

type ClusterInstallationConfigRequest

type ClusterInstallationConfigRequest map[string]interface{}

ClusterInstallationConfigRequest describes the payload for updating an cluster installation's configuration.

func NewClusterInstallationConfigRequestFromReader

func NewClusterInstallationConfigRequestFromReader(reader io.Reader) (ClusterInstallationConfigRequest, error)

NewClusterInstallationConfigRequestFromReader will create a ClusterInstallationConfigRequest from an io.Reader with JSON data.

type ClusterInstallationFilter

type ClusterInstallationFilter struct {
	IDs            []string
	InstallationID string
	ClusterID      string
	Page           int
	PerPage        int
	IncludeDeleted bool
}

ClusterInstallationFilter describes the parameters used to constrain a set of cluster installations.

type ClusterInstallationMattermostCLISubcommand added in v0.3.0

type ClusterInstallationMattermostCLISubcommand []string

ClusterInstallationMattermostCLISubcommand describes the payload necessary to run Mattermost CLI on a cluster installation.

func NewClusterInstallationMattermostCLISubcommandFromReader added in v0.3.0

func NewClusterInstallationMattermostCLISubcommandFromReader(reader io.Reader) (ClusterInstallationMattermostCLISubcommand, error)

NewClusterInstallationMattermostCLISubcommandFromReader will create a ClusterInstallationMattermostCLISubcommand from an io.Reader.

type ClusterStateReport added in v0.8.0

type ClusterStateReport []StateReportEntry

ClusterStateReport is a report of all cluster requests states.

func GetClusterRequestStateReport added in v0.8.0

func GetClusterRequestStateReport() ClusterStateReport

GetClusterRequestStateReport returns a ClusterStateReport based on the current model of cluster states.

type CreateClusterRequest

type CreateClusterRequest struct {
	Provider               string            `json:"provider,omitempty"`
	Version                string            `json:"version,omitempty"`
	KopsAMI                string            `json:"kops-ami,omitempty"`
	Size                   string            `json:"size,omitempty"`
	Zones                  []string          `json:"zones,omitempty"`
	AllowInstallations     bool              `json:"allow-installations,omitempty"`
	DesiredUtilityVersions map[string]string `json:"utility-versions,omitempty"`
}

CreateClusterRequest specifies the parameters for a new cluster.

func NewCreateClusterRequestFromReader

func NewCreateClusterRequestFromReader(reader io.Reader) (*CreateClusterRequest, error)

NewCreateClusterRequestFromReader will create a CreateClusterRequest from an io.Reader with JSON data.

func (*CreateClusterRequest) SetDefaults added in v0.10.0

func (request *CreateClusterRequest) SetDefaults()

SetDefaults sets the default values for a cluster create request.

func (*CreateClusterRequest) Validate added in v0.10.0

func (request *CreateClusterRequest) Validate() error

Validate validates the values of a cluster create request.

type CreateGroupRequest

type CreateGroupRequest struct {
	Name        string
	Description string
	Version     string
}

CreateGroupRequest specifies the parameters for a new group.

func NewCreateGroupRequestFromReader

func NewCreateGroupRequestFromReader(reader io.Reader) (*CreateGroupRequest, error)

NewCreateGroupRequestFromReader will create a CreateGroupRequest from an io.Reader with JSON data.

type CreateInstallationRequest

type CreateInstallationRequest struct {
	OwnerID   string
	Version   string
	DNS       string
	License   string
	Size      string
	Affinity  string
	Database  string
	Filestore string
}

CreateInstallationRequest specifies the parameters for a new installation.

func NewCreateInstallationRequestFromReader

func NewCreateInstallationRequestFromReader(reader io.Reader) (*CreateInstallationRequest, error)

NewCreateInstallationRequestFromReader will create a CreateInstallationRequest from an io.Reader with JSON data.

func (*CreateInstallationRequest) SetDefaults added in v0.7.0

func (request *CreateInstallationRequest) SetDefaults()

SetDefaults sets the default values for an installation create request.

func (*CreateInstallationRequest) Validate added in v0.7.0

func (request *CreateInstallationRequest) Validate() error

Validate validates the values of an installation create request.

type CreateWebhookRequest added in v0.3.0

type CreateWebhookRequest struct {
	OwnerID string
	URL     string
}

CreateWebhookRequest specifies the parameters for a new webhook.

func NewCreateWebhookRequestFromReader added in v0.3.0

func NewCreateWebhookRequestFromReader(reader io.Reader) (*CreateWebhookRequest, error)

NewCreateWebhookRequestFromReader will create a CreateWebhookRequest from an io.Reader with JSON data.

type Database added in v0.8.0

type Database interface {
	Provision(store InstallationDatabaseStoreInterface, logger log.FieldLogger) error
	Teardown(keepData bool, logger log.FieldLogger) error
	GenerateDatabaseSpecAndSecret(logger log.FieldLogger) (*mmv1alpha1.Database, *corev1.Secret, error)
}

Database is the interface for managing Mattermost databases.

type Filestore added in v0.7.0

type Filestore interface {
	Provision(logger log.FieldLogger) error
	Teardown(keepData bool, logger log.FieldLogger) error
	GenerateFilestoreSpecAndSecret(logger log.FieldLogger) (*mmv1alpha1.Minio, *corev1.Secret, error)
}

Filestore is the interface for managing Mattermost filestores.

type GetClusterInstallationsRequest

type GetClusterInstallationsRequest struct {
	ClusterID      string
	InstallationID string
	Page           int
	PerPage        int
	IncludeDeleted bool
}

GetClusterInstallationsRequest describes the parameters to request a list of cluster installations.

func (*GetClusterInstallationsRequest) ApplyToURL

func (request *GetClusterInstallationsRequest) ApplyToURL(u *url.URL)

ApplyToURL modifies the given url to include query string parameters for the request.

type GetClustersRequest

type GetClustersRequest struct {
	Page           int
	PerPage        int
	IncludeDeleted bool
}

GetClustersRequest describes the parameters to request a list of clusters.

func (*GetClustersRequest) ApplyToURL

func (request *GetClustersRequest) ApplyToURL(u *url.URL)

ApplyToURL modifies the given url to include query string parameters for the request.

type GetGroupsRequest

type GetGroupsRequest struct {
	Page           int
	PerPage        int
	IncludeDeleted bool
}

GetGroupsRequest describes the parameters to request a list of groups.

func (*GetGroupsRequest) ApplyToURL

func (request *GetGroupsRequest) ApplyToURL(u *url.URL)

ApplyToURL modifies the given url to include query string parameters for the request.

type GetInstallationsRequest

type GetInstallationsRequest struct {
	OwnerID        string
	Page           int
	PerPage        int
	IncludeDeleted bool
}

GetInstallationsRequest describes the parameters to request a list of installations.

func (*GetInstallationsRequest) ApplyToURL

func (request *GetInstallationsRequest) ApplyToURL(u *url.URL)

ApplyToURL modifies the given url to include query string parameters for the request.

type GetWebhooksRequest added in v0.3.0

type GetWebhooksRequest struct {
	OwnerID        string
	Page           int
	PerPage        int
	IncludeDeleted bool
}

GetWebhooksRequest describes the parameters to request a list of webhooks.

func (*GetWebhooksRequest) ApplyToURL added in v0.3.0

func (request *GetWebhooksRequest) ApplyToURL(u *url.URL)

ApplyToURL modifies the given url to include query string parameters for the request.

type Group

type Group struct {
	ID          string
	Name        string
	Description string
	Version     string
	CreateAt    int64
	DeleteAt    int64
}

Group represents a group of Mattermost installations.

func GroupFromReader

func GroupFromReader(reader io.Reader) (*Group, error)

GroupFromReader decodes a json-encoded group from the given io.Reader.

func GroupsFromReader

func GroupsFromReader(reader io.Reader) ([]*Group, error)

GroupsFromReader decodes a json-encoded list of groups from the given io.Reader.

func (*Group) Clone

func (c *Group) Clone() *Group

Clone returns a deep copy the group.

type GroupFilter

type GroupFilter struct {
	Page           int
	PerPage        int
	IncludeDeleted bool
}

GroupFilter describes the parameters used to constrain a set of groups.

type Installation

type Installation struct {
	ID             string
	OwnerID        string
	Version        string
	DNS            string
	Database       string
	Filestore      string
	License        string
	Size           string
	Affinity       string
	GroupID        *string
	State          string
	CreateAt       int64
	DeleteAt       int64
	LockAcquiredBy *string
	LockAcquiredAt int64
}

Installation represents a Mattermost installation.

func InstallationFromReader

func InstallationFromReader(reader io.Reader) (*Installation, error)

InstallationFromReader decodes a json-encoded installation from the given io.Reader.

func InstallationsFromReader

func InstallationsFromReader(reader io.Reader) ([]*Installation, error)

InstallationsFromReader decodes a json-encoded list of installations from the given io.Reader.

func (*Installation) Clone

func (c *Installation) Clone() *Installation

Clone returns a deep copy the installation.

func (*Installation) InternalDatabase added in v0.8.0

func (i *Installation) InternalDatabase() bool

InternalDatabase returns true if the installation's database is internal to the kubernetes cluster it is running on.

func (*Installation) InternalFilestore added in v0.7.0

func (i *Installation) InternalFilestore() bool

InternalFilestore returns true if the installation's filestore is internal to the kubernetes cluster it is running on.

func (*Installation) ValidTransitionState added in v0.8.0

func (i *Installation) ValidTransitionState(newState string) bool

ValidTransitionState returns whether an installation can be transitioned into the new state or not based on its current state.

type InstallationDatabaseStoreInterface added in v0.10.0

type InstallationDatabaseStoreInterface interface {
	GetClusterInstallations(filter *ClusterInstallationFilter) ([]*ClusterInstallation, error)
}

InstallationDatabaseStoreInterface is the interface necessary for SQLStore functionality to correlate an installation to a cluster for database creation.

type InstallationFilter

type InstallationFilter struct {
	OwnerID        string
	GroupID        string
	Page           int
	PerPage        int
	IncludeDeleted bool
}

InstallationFilter describes the parameters used to constrain a set of installations.

type InstallationStateReport added in v0.8.0

type InstallationStateReport []StateReportEntry

InstallationStateReport is a report of all installation requests states.

func GetInstallationRequestStateReport added in v0.8.0

func GetInstallationRequestStateReport() InstallationStateReport

GetInstallationRequestStateReport returns a InstallationStateReport based on the current model of installation states.

type KopsMetadata

type KopsMetadata struct {
	Name    string
	Version string
	AMI     string
}

KopsMetadata is the provisioner metadata stored in a model.Cluster.

func NewKopsMetadata

func NewKopsMetadata(provisionerMetadata []byte) (*KopsMetadata, error)

NewKopsMetadata creates an instance of KopsMetadata given the raw provisioner metadata.

type MinioOperatorFilestore added in v0.7.0

type MinioOperatorFilestore struct{}

MinioOperatorFilestore is a filestore backed by the MinIO operator.

func NewMinioOperatorFilestore added in v0.7.0

func NewMinioOperatorFilestore() *MinioOperatorFilestore

NewMinioOperatorFilestore returns a new NewMinioOperatorFilestore interface.

func (*MinioOperatorFilestore) GenerateFilestoreSpecAndSecret added in v0.7.0

func (f *MinioOperatorFilestore) GenerateFilestoreSpecAndSecret(logger log.FieldLogger) (*mmv1alpha1.Minio, *corev1.Secret, error)

GenerateFilestoreSpecAndSecret creates the k8s filestore spec and secret for accessing the MinIO operator filestore.

func (*MinioOperatorFilestore) Provision added in v0.7.0

func (f *MinioOperatorFilestore) Provision(logger log.FieldLogger) error

Provision completes all the steps necessary to provision a MinIO operator filestore.

func (*MinioOperatorFilestore) Teardown added in v0.7.0

func (f *MinioOperatorFilestore) Teardown(keepData bool, logger log.FieldLogger) error

Teardown removes all MinIO operator resources related to a given installation.

type MysqlOperatorDatabase added in v0.8.0

type MysqlOperatorDatabase struct{}

MysqlOperatorDatabase is a database backed by the MySQL operator.

func NewMysqlOperatorDatabase added in v0.8.0

func NewMysqlOperatorDatabase() *MysqlOperatorDatabase

NewMysqlOperatorDatabase returns a new MysqlOperatorDatabase interface.

func (*MysqlOperatorDatabase) GenerateDatabaseSpecAndSecret added in v0.8.0

func (d *MysqlOperatorDatabase) GenerateDatabaseSpecAndSecret(logger log.FieldLogger) (*mmv1alpha1.Database, *corev1.Secret, error)

GenerateDatabaseSpecAndSecret creates the k8s database spec and secret for accessing the MySQL operator database.

func (*MysqlOperatorDatabase) Provision added in v0.8.0

Provision completes all the steps necessary to provision a MySQL operator database.

func (*MysqlOperatorDatabase) Teardown added in v0.8.0

func (d *MysqlOperatorDatabase) Teardown(keepData bool, logger log.FieldLogger) error

Teardown removes all MySQL operator resources for a given installation.

type PatchGroupRequest

type PatchGroupRequest struct {
	ID          string
	Name        *string
	Description *string
	Version     *string
}

PatchGroupRequest specifies the parameters for an updated group.

func NewPatchGroupRequestFromReader

func NewPatchGroupRequestFromReader(reader io.Reader) (*PatchGroupRequest, error)

NewPatchGroupRequestFromReader will create a PatchGroupRequest from an io.Reader with JSON data.

func (*PatchGroupRequest) Apply

func (p *PatchGroupRequest) Apply(group *Group) bool

Apply applies the patch to the given group.

type ProvisionClusterRequest added in v0.14.0

type ProvisionClusterRequest struct {
	DesiredUtilityVersions map[string]string `json:"utility-versions,omitempty"`
}

ProvisionClusterRequest contains metadata related to changing the installed cluster state.

func NewProvisionClusterRequestFromReader added in v0.14.0

func NewProvisionClusterRequestFromReader(reader io.Reader) (*ProvisionClusterRequest, error)

NewProvisionClusterRequestFromReader will create an UpdateClusterRequest from an io.Reader with JSON data.

type StateList added in v0.8.0

type StateList []string

StateList is a list of states

func (*StateList) Count added in v0.8.0

func (sl *StateList) Count() int

Count provides the number of states in a StateList.

type StateReportEntry added in v0.8.0

type StateReportEntry struct {
	RequestedState string
	ValidStates    StateList
	InvalidStates  StateList
}

StateReportEntry is a report entry of a given request state.

type UpdateClusterRequest added in v0.8.0

type UpdateClusterRequest struct {
	AllowInstallations bool
}

UpdateClusterRequest specifies the parameters available for updating a cluster.

func NewUpdateClusterRequestFromReader added in v0.8.0

func NewUpdateClusterRequestFromReader(reader io.Reader) (*UpdateClusterRequest, error)

NewUpdateClusterRequestFromReader will create an UpdateClusterRequest from an io.Reader with JSON data.

type UpgradeInstallationRequest

type UpgradeInstallationRequest struct {
	Version string
	License string
}

UpgradeInstallationRequest specifies the parameters for an upgraded installation.

func NewUpgradeInstallationRequestFromReader

func NewUpgradeInstallationRequestFromReader(reader io.Reader) (*UpgradeInstallationRequest, error)

NewUpgradeInstallationRequestFromReader will create a UpgradeInstallationRequest from an io.Reader with JSON data.

type UtilityMetadata added in v0.14.0

type UtilityMetadata struct {
	DesiredVersions utilityVersions `json:"desiredVersions"`
	ActualVersions  utilityVersions `json:"actualVersions"`
}

UtilityMetadata is a container struct for any metadata related to cluster utilities that needs to be persisted in the database

func UtilityMetadataFromReader added in v0.14.0

func UtilityMetadataFromReader(reader io.Reader) (*UtilityMetadata, error)

UtilityMetadataFromReader produces a UtilityMetadata object from the JSON representation embedded in a io.Reader

type Webhook added in v0.3.0

type Webhook struct {
	ID       string
	OwnerID  string
	URL      string
	CreateAt int64
	DeleteAt int64
}

Webhook is

func WebhookFromReader added in v0.3.0

func WebhookFromReader(reader io.Reader) (*Webhook, error)

WebhookFromReader decodes a json-encoded webhook from the given io.Reader.

func WebhooksFromReader added in v0.3.0

func WebhooksFromReader(reader io.Reader) ([]*Webhook, error)

WebhooksFromReader decodes a json-encoded list of webhooks from the given io.Reader.

func (*Webhook) IsDeleted added in v0.3.0

func (w *Webhook) IsDeleted() bool

IsDeleted returns whether the webhook was marked as deleted or not.

type WebhookFilter added in v0.3.0

type WebhookFilter struct {
	OwnerID        string
	Page           int
	PerPage        int
	IncludeDeleted bool
}

WebhookFilter describes the parameters used to constrain a set of webhooks.

type WebhookPayload added in v0.3.0

type WebhookPayload struct {
	Timestamp int64             `json:"timestamp"`
	ID        string            `json:"id"`
	Type      string            `json:"type"`
	NewState  string            `json:"new_state"`
	OldState  string            `json:"old_state"`
	ExtraData map[string]string `json:"extra_data,omitempty"`
}

WebhookPayload is the payload sent in every webhook.

func WebhookPayloadFromReader added in v0.3.0

func WebhookPayloadFromReader(reader io.Reader) (*WebhookPayload, error)

WebhookPayloadFromReader decodes a json-encoded webhook payload from the given io.Reader.

func (*WebhookPayload) ToJSON added in v0.3.0

func (p *WebhookPayload) ToJSON() (string, error)

ToJSON returns a JSON string representation of the webhook payload.

Jump to

Keyboard shortcuts

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