Documentation
¶
Index ¶
- Constants
- func CheckProvider(provider string) (string, error)
- func ClusterInstallationConfigFromReader(reader io.Reader) (map[string]interface{}, error)
- func IsSupportedAffinity(affinity string) bool
- func IsSupportedSize(size string) bool
- func NewID() string
- type AWSMetadata
- type Client
- func (c *Client) CreateCluster(request *CreateClusterRequest) (*Cluster, error)
- func (c *Client) CreateGroup(request *CreateGroupRequest) (*Group, error)
- func (c *Client) CreateInstallation(request *CreateInstallationRequest) (*Installation, error)
- func (c *Client) CreateWebhook(request *CreateWebhookRequest) (*Webhook, error)
- func (c *Client) DeleteCluster(clusterID string) error
- func (c *Client) DeleteGroup(groupID string) error
- func (c *Client) DeleteInstallation(installationID string) error
- func (c *Client) DeleteWebhook(webhookID string) error
- func (c *Client) GetCluster(clusterID string) (*Cluster, error)
- func (c *Client) GetClusterInstallation(clusterInstallationID string) (*ClusterInstallation, error)
- func (c *Client) GetClusterInstallationConfig(clusterInstallationID string) (map[string]interface{}, error)
- func (c *Client) GetClusterInstallations(request *GetClusterInstallationsRequest) ([]*ClusterInstallation, error)
- func (c *Client) GetClusters(request *GetClustersRequest) ([]*Cluster, error)
- func (c *Client) GetGroup(groupID string) (*Group, error)
- func (c *Client) GetGroups(request *GetGroupsRequest) ([]*Group, error)
- func (c *Client) GetInstallation(installationID string) (*Installation, error)
- func (c *Client) GetInstallations(request *GetInstallationsRequest) ([]*Installation, error)
- func (c *Client) GetWebhook(webhookID string) (*Webhook, error)
- func (c *Client) GetWebhooks(request *GetWebhooksRequest) ([]*Webhook, error)
- func (c *Client) JoinGroup(groupID, installationID string) error
- func (c *Client) LeaveGroup(installationID string) error
- func (c *Client) ProvisionCluster(clusterID string) error
- func (c *Client) RetryCreateCluster(clusterID string) error
- func (c *Client) RetryCreateInstallation(installationID string) error
- func (c *Client) RunMattermostCLICommandOnClusterInstallation(clusterInstallationID string, subcommand []string) ([]byte, error)
- func (c *Client) SetClusterInstallationConfig(clusterInstallationID string, config map[string]interface{}) error
- func (c *Client) UpdateGroup(request *PatchGroupRequest) error
- func (c *Client) UpgradeCluster(clusterID, version string) error
- func (c *Client) UpgradeInstallation(installationID string, request *UpgradeInstallationRequest) error
- type Cluster
- type ClusterFilter
- type ClusterInstallation
- type ClusterInstallationConfigRequest
- type ClusterInstallationFilter
- type ClusterInstallationMattermostCLISubcommand
- type CreateClusterRequest
- type CreateGroupRequest
- type CreateInstallationRequest
- type CreateWebhookRequest
- type GetClusterInstallationsRequest
- type GetClustersRequest
- type GetGroupsRequest
- type GetInstallationsRequest
- type GetWebhooksRequest
- type Group
- type GroupFilter
- type Installation
- type InstallationFilter
- type KopsMetadata
- type PatchGroupRequest
- type UpgradeInstallationRequest
- type Webhook
- type WebhookFilter
- type WebhookPayload
Constants ¶
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" )
const ( // 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" // 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" // ClusterStateUpgradeRequested is a cluster in the process of upgrading. ClusterStateUpgradeRequested = "upgrade-requested" // ClusterStateUpgradeFailed is a cluster that failed to upgrade. ClusterStateUpgradeFailed = "upgrade-failed" // ClusterStateStable is a cluster in a stable state and undergoing no changes. ClusterStateStable = "stable" )
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" )
const ( // InstallationStateCreationRequested is an installation in the process of being created. InstallationStateCreationRequested = "creation-requested" // 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" // InstallationStateDeletionRequested is an installation to be deleted. InstallationStateDeletionRequested = "deletion-requested" // InstallationStateDeletionInProgress is an installation being deleted. InstallationStateDeletionInProgress = "deletion-in-progress" // InstallationStateDeletionFailed is an installation that failed deletion. InstallationStateDeletionFailed = "deletion-failed" // InstallationStateDeleted is an installation that has been deleted InstallationStateDeleted = "deleted" // 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" // InstallationStateStable is an installation in a stable state and undergoing no changes. InstallationStateStable = "stable" // InstallationDefaultSize is the default size for an installation. InstallationDefaultSize = mmv1alpha1.Size100String )
const ( // SizeAlef500 is the first definition of a cluster supporting 500 users. SizeAlef500 = "SizeAlef500" // SizeAlef1000 is the second definition of a cluster supporting 1000 users. SizeAlef1000 = "SizeAlef1000" )
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" )
const (
// AllPerPage signals the store to return all results, avoid pagination of any kind.
AllPerPage = -1
)
const (
// ProviderAWS is the cloud provider AWS.
ProviderAWS = "aws"
)
Variables ¶
This section is empty.
Functions ¶
func CheckProvider ¶
CheckProvider normalizes the given provider, returning an error if invalid.
func ClusterInstallationConfigFromReader ¶
ClusterInstallationConfigFromReader decodes a json-encoded config from the config io.Reader.
func IsSupportedAffinity ¶
IsSupportedAffinity returns true if the given affinity string is supported.
func IsSupportedSize ¶
IsSupportedSize returns true if the given size string is supported.
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 (*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 ¶
DeleteCluster deletes the given cluster and all resources contained therein.
func (*Client) DeleteGroup ¶
DeleteGroup deletes the given group and all resources contained therein.
func (*Client) DeleteInstallation ¶
DeleteInstallation deletes the given installation and all resources contained therein.
func (*Client) DeleteWebhook ¶ added in v0.3.0
DeleteWebhook deletes the given webhook.
func (*Client) GetCluster ¶
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) GetClusters ¶
func (c *Client) GetClusters(request *GetClustersRequest) ([]*Cluster, error)
GetClusters fetches the list of clusters from the configured provisioning server.
func (*Client) GetGroup ¶
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
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 ¶
JoinGroup joins an installation to the given group, leaving any existing group.
func (*Client) LeaveGroup ¶
LeaveGroup removes an installation from its group, if any.
func (*Client) ProvisionCluster ¶
ProvisionCluster provisions k8s operators on a cluster from the configured provisioning server.
func (*Client) RetryCreateCluster ¶
RetryCreateCluster retries the creation of a cluster from the configured provisioning server.
func (*Client) RetryCreateInstallation ¶
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) UpdateGroup ¶
func (c *Client) UpdateGroup(request *PatchGroupRequest) error
UpdateGroup updates the installation group.
func (*Client) UpgradeCluster ¶
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 Size string State string CreateAt int64 DeleteAt int64 LockAcquiredBy *string LockAcquiredAt int64 }
Cluster represents a Kubernetes cluster.
func ClusterFromReader ¶
ClusterFromReader decodes a json-encoded cluster from the given io.Reader.
func ClustersFromReader ¶
ClustersFromReader decodes a json-encoded list of clusters from the given io.Reader.
func (*Cluster) SetProviderMetadata ¶
SetProviderMetadata is a helper method to encode an interface{} as the corresponding bytes.
func (*Cluster) SetProvisionerMetadata ¶
SetProvisionerMetadata is a helper method to encode an interface{} as the corresponding bytes.
type ClusterFilter ¶
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 ¶
func (c *ClusterInstallation) Clone() *ClusterInstallation
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 CreateClusterRequest ¶
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.
type CreateGroupRequest ¶
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 }
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.
type CreateWebhookRequest ¶ added in v0.3.0
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 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 ¶
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 ¶
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 ¶
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
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 ¶
GroupFromReader decodes a json-encoded group from the given io.Reader.
func GroupsFromReader ¶
GroupsFromReader decodes a json-encoded list of groups from the given io.Reader.
type GroupFilter ¶
GroupFilter describes the parameters used to constrain a set of groups.
type Installation ¶
type Installation struct { ID string OwnerID string Version string DNS 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.
type InstallationFilter ¶
InstallationFilter describes the parameters used to constrain a set of installations.
type KopsMetadata ¶
type KopsMetadata struct {
Name 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 PatchGroupRequest ¶
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 UpgradeInstallationRequest ¶
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 Webhook ¶ added in v0.3.0
Webhook is
func WebhookFromReader ¶ added in v0.3.0
WebhookFromReader decodes a json-encoded webhook from the given io.Reader.
func WebhooksFromReader ¶ added in v0.3.0
WebhooksFromReader decodes a json-encoded list of webhooks from the given io.Reader.
type WebhookFilter ¶ added in v0.3.0
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"` }
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.