k8s_service

package
v0.0.0-...-e71a76f Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptsAll

func OptsAll(deploymentID string, overwriteOps ...opts.ExtraOpts) *opts.Opts

func OptsNoGenerator

func OptsNoGenerator(deploymentID string, overwriteOps ...opts.ExtraOpts) *opts.Opts

func OptsOnlyClient

func OptsOnlyClient(zone *configModels.Zone) *opts.Opts

Types

type Client

type Client struct {
	client.BaseClient[Client]
}

Client is the client for the Harbor service. It contains a BaseClient, which is used to lazy-load and cache data.

func New

func New(cache ...*core.Cache) *Client

New creates a new Client and injects the cache. If a cache is not supplied it will create a new one.

func (*Client) Client

func (c *Client) Client(zone *configModels.Zone) (*k8s.Client, error)

Client returns the K8s service client.

func (*Client) Create

func (c *Client) Create(id string, params *model.DeploymentCreateParams) error

Create sets up K8s for the deployment.

It creates all necessary resources in K8s, such as namespaces, deployments, services, etc.

func (*Client) Delete

func (c *Client) Delete(id string, overwriteUserID ...string) error

Delete deletes all K8s resources for the deployment.

It deletes all K8s resources, such as namespaces, deployments, services, etc.

func (*Client) EnsureOwner

func (c *Client) EnsureOwner(id string, oldOwnerID string) error

EnsureOwner ensures the owner of the K8s setup, by deleting and then trigger a call to Repair.

func (*Client) Generator

func (c *Client) Generator(deployment *model.Deployment, client *k8s.Client, zone *configModels.Zone) generators.K8sGenerator

Generator returns the K8s generator.

func (*Client) Get

Get returns the deployment, client, and generator.

Depending on the options specified, some return values may be nil. This is useful when you don't always need all the resources.

func (*Client) ListDeploymentStatus

func (c *Client) ListDeploymentStatus(zone *configModels.Zone) ([]model.DeploymentStatus, error)

ListDeploymentStatus lists the status of all deployments in the cluster.

func (*Client) PodExists

func (c *Client) PodExists(zone *configModels.Zone, podName string) (bool, error)

PodExists checks if a pod exists in the cluster.

func (*Client) Pods

func (c *Client) Pods(zone *configModels.Zone) ([]k8sModels.PodPublic, error)

Pods lists all pods in the cluster.

func (*Client) Repair

func (c *Client) Repair(id string) error

Repair repairs the deployment.

It repairs all K8s resources for the deployment.

func (*Client) Restart

func (c *Client) Restart(id string) error

Restart restarts the deployment.

func (*Client) SetupPodLogStream

func (c *Client) SetupPodLogStream(ctx context.Context, zone *configModels.Zone, podName string, from time.Time, onLog func(deploymentName string, lines []model.Log)) error

SetupPodLogStream sets up a log stream for a pod.

func (*Client) SetupPodWatcher

func (c *Client) SetupPodWatcher(ctx context.Context, zone *configModels.Zone, callback func(podName, event string)) error

SetupPodWatcher sets up a pod watcher for the deployment. For every pod change, it triggers the callback.

func (*Client) SetupStatusWatcher

func (c *Client) SetupStatusWatcher(ctx context.Context, zone *configModels.Zone, resourceType string, callback func(name string, status interface{})) error

SetupStatusWatcher sets up a status watcher for a zone. For every status change, it triggers the callback.

func (*Client) Update

func (c *Client) Update(id string, params *model.DeploymentUpdateParams) error

Update updates K8s resources for the deployment.

It updates all K8s resources tied to the fields in the deployment.UpdateParams.

Jump to

Keyboard shortcuts

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