Documentation ¶
Overview ¶
Package usercmd provides Epinio CLI commands for users
Index ¶
- func ClearMemoization()
- type EpinioClient
- func (c *EpinioClient) AppCreate(appName string, appConfig models.ApplicationUpdateRequest) error
- func (c *EpinioClient) AppLogs(appName, stageID string, follow bool, interrupt chan bool) error
- func (c *EpinioClient) AppManifest(appName, manifestPath string) error
- func (c *EpinioClient) AppShow(appName string) error
- func (c *EpinioClient) AppStageID(appName string) (string, error)
- func (c *EpinioClient) AppUpdate(appName string, appConfig models.ApplicationUpdateRequest) error
- func (c *EpinioClient) Apps(all bool) error
- func (c *EpinioClient) AppsMatching(ctx context.Context, prefix string) []string
- func (c *EpinioClient) BindService(serviceName, appName string) error
- func (c *EpinioClient) CreateNamespace(namespace string) error
- func (c *EpinioClient) CreateService(name string, dict []string) error
- func (c *EpinioClient) Delete(ctx context.Context, appname string) error
- func (c *EpinioClient) DeleteNamespace(namespace string) error
- func (c *EpinioClient) DeleteService(name string, unbind bool) error
- func (c *EpinioClient) EnvList(ctx context.Context, appName string) error
- func (c *EpinioClient) EnvMatching(ctx context.Context, appName, prefix string) []string
- func (c *EpinioClient) EnvSet(ctx context.Context, appName, envName, envValue string) error
- func (c *EpinioClient) EnvShow(ctx context.Context, appName, envName string) error
- func (c *EpinioClient) EnvUnset(ctx context.Context, appName, envName string) error
- func (c *EpinioClient) Info() error
- func (c *EpinioClient) Namespaces() error
- func (c *EpinioClient) NamespacesMatching(prefix string) []string
- func (c *EpinioClient) Push(ctx context.Context, params PushParams) error
- func (c *EpinioClient) ServiceDetails(name string) error
- func (c *EpinioClient) ServiceMatching(ctx context.Context, prefix string) []string
- func (c *EpinioClient) Services(all bool) error
- func (c *EpinioClient) ShowNamespace(namespace string) error
- func (c *EpinioClient) Target(namespace string) error
- func (c *EpinioClient) TargetOk() error
- func (c *EpinioClient) UnbindService(serviceName, appName string) error
- func (c *EpinioClient) UpdateService(name string, removedKeys []string, assignments map[string]string) error
- type PushParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearMemoization ¶
func ClearMemoization()
ClearMemoization clears the memo, so a new call to getEpinioAPIClient does not return a cached value
Types ¶
type EpinioClient ¶
type EpinioClient struct { Config *config.Config Log logr.Logger API *epinioapi.Client // contains filtered or unexported fields }
EpinioClient provides functionality for talking to a Epinio installation on Kubernetes
func New ¶
func New() (*EpinioClient, error)
func (*EpinioClient) AppCreate ¶
func (c *EpinioClient) AppCreate(appName string, appConfig models.ApplicationUpdateRequest) error
AppCreate creates an app without a workload
func (*EpinioClient) AppLogs ¶
func (c *EpinioClient) AppLogs(appName, stageID string, follow bool, interrupt chan bool) error
AppLogs streams the logs of all the application instances, in the targeted namespace If stageID is an empty string, runtime application logs are streamed. If stageID is set, then the matching staging logs are streamed. There are 2 ways of stopping this method: 1. The websocket connection closes. 2. Something is sent to the interrupt channel The interrupt channel is used by the caller when printing of logs should be stopped. To make sure everything is properly stopped (both the main thread and the go routine) no matter what caused the stop (number 1 or 2 above):
- The go routines closes the connection on interrupt. This causes the main loop to stop as well.
- The main thread sends a signal to the `done` channel when it returns. This causes the go routine to stop.
- The main thread waits for the go routine to stop before finally returning (by calling `wg.Wait()`.
This is what happens when `interrupt` receives something:
- The go routine closes the connection
- The loop in the main thread is stopped because the connection was closed
- The main thread sends to the `done` chan (as a "defer" function), and then calls wg.Wait() to wait for the go routine to exit.
- The go routine receives the `done` message, calls wg.Done() and returns
- The main thread returns
When the connection is closed (e.g. from the server side), the process is the same but starts from #2 above. TODO move into transport package
func (*EpinioClient) AppManifest ¶ added in v0.1.2
func (c *EpinioClient) AppManifest(appName, manifestPath string) error
AppManifest saves the information of the named app, in the targeted namespace, into a manifest file
func (*EpinioClient) AppShow ¶
func (c *EpinioClient) AppShow(appName string) error
AppShow displays the information of the named app, in the targeted namespace
func (*EpinioClient) AppStageID ¶
func (c *EpinioClient) AppStageID(appName string) (string, error)
AppStageID returns the stage id of the named app, in the targeted namespace
func (*EpinioClient) AppUpdate ¶
func (c *EpinioClient) AppUpdate(appName string, appConfig models.ApplicationUpdateRequest) error
AppUpdate updates the specified running application's attributes (e.g. instances)
func (*EpinioClient) Apps ¶
func (c *EpinioClient) Apps(all bool) error
Apps gets all Epinio apps in the targeted namespace, or all apps in all namespaces
func (*EpinioClient) AppsMatching ¶
func (c *EpinioClient) AppsMatching(ctx context.Context, prefix string) []string
AppsMatching returns all Epinio apps having the specified prefix in their name.
func (*EpinioClient) BindService ¶
func (c *EpinioClient) BindService(serviceName, appName string) error
BindService attaches a service specified by name to the named application, both in the targeted namespace.
func (*EpinioClient) CreateNamespace ¶ added in v0.2.1
func (c *EpinioClient) CreateNamespace(namespace string) error
CreateNamespace creates a namespace
func (*EpinioClient) CreateService ¶
func (c *EpinioClient) CreateService(name string, dict []string) error
CreateService creates a service specified by name and key/value dictionary TODO: Allow underscores in service names (right now they fail because of kubernetes naming rules for secrets)
func (*EpinioClient) Delete ¶
func (c *EpinioClient) Delete(ctx context.Context, appname string) error
Delete removes the named application from the cluster
func (*EpinioClient) DeleteNamespace ¶ added in v0.2.1
func (c *EpinioClient) DeleteNamespace(namespace string) error
DeleteNamespace deletes a Namespace
func (*EpinioClient) DeleteService ¶
func (c *EpinioClient) DeleteService(name string, unbind bool) error
DeleteService deletes a service specified by name
func (*EpinioClient) EnvList ¶
func (c *EpinioClient) EnvList(ctx context.Context, appName string) error
EnvList displays a table of all environment variables and their values for the named application.
func (*EpinioClient) EnvMatching ¶
func (c *EpinioClient) EnvMatching(ctx context.Context, appName, prefix string) []string
EnvMatching retrieves all environment variables in the cluster, for the specified application, and the given prefix
func (*EpinioClient) EnvSet ¶
func (c *EpinioClient) EnvSet(ctx context.Context, appName, envName, envValue string) error
EnvSet adds or modifies the specified environment variable in the named application, with the given value. A workload is restarted.
func (*EpinioClient) EnvShow ¶
func (c *EpinioClient) EnvShow(ctx context.Context, appName, envName string) error
EnvShow shows the value of the specified environment variable in the named application.
func (*EpinioClient) EnvUnset ¶
func (c *EpinioClient) EnvUnset(ctx context.Context, appName, envName string) error
EnvUnset removes the specified environment variable from the named application. A workload is restarted.
func (*EpinioClient) Info ¶
func (c *EpinioClient) Info() error
Info displays information about environment
func (*EpinioClient) Namespaces ¶ added in v0.2.1
func (c *EpinioClient) Namespaces() error
func (*EpinioClient) NamespacesMatching ¶ added in v0.2.1
func (c *EpinioClient) NamespacesMatching(prefix string) []string
NamespacesMatching returns all Epinio namespaces having the specified prefix in their name
func (*EpinioClient) Push ¶
func (c *EpinioClient) Push(ctx context.Context, params PushParams) error
Push pushes an app * validate * upload * stage * (tail logs) * wait for pipelinerun * deploy * wait for app
func (*EpinioClient) ServiceDetails ¶
func (c *EpinioClient) ServiceDetails(name string) error
ServiceDetails shows the information of a service specified by name
func (*EpinioClient) ServiceMatching ¶
func (c *EpinioClient) ServiceMatching(ctx context.Context, prefix string) []string
ServiceMatching returns all Epinio services having the specified prefix in their name.
func (*EpinioClient) Services ¶
func (c *EpinioClient) Services(all bool) error
Services gets all Epinio services in the targeted namespace
func (*EpinioClient) ShowNamespace ¶ added in v0.2.1
func (c *EpinioClient) ShowNamespace(namespace string) error
ShowNamepsace shows a Namespace
func (*EpinioClient) Target ¶
func (c *EpinioClient) Target(namespace string) error
Target targets a namespace
func (*EpinioClient) TargetOk ¶
func (c *EpinioClient) TargetOk() error
func (*EpinioClient) UnbindService ¶
func (c *EpinioClient) UnbindService(serviceName, appName string) error
UnbindService detaches the service specified by name from the named application, both in the targeted namespace.
func (*EpinioClient) UpdateService ¶ added in v0.3.0
func (c *EpinioClient) UpdateService(name string, removedKeys []string, assignments map[string]string) error
UpdateService updates a service specified by name and information about removed keys and changed assignments. TODO: Allow underscores in service names (right now they fail because of kubernetes naming rules for secrets)
type PushParams ¶
type PushParams struct {
models.ApplicationManifest
}