cluster

package
Version: v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CRD

type CRD struct {
	Path        string      `json:"path"`
	Resource    string      `json:"resource"`
	Title       string      `json:"title"`
	Description string      `json:"description"`
	Scope       string      `json:"scope"`
	Columns     []CRDColumn `json:"columns,omitempty"`
}

CRD is the format of a Custom Resource Definition. Each CRD must contain a path and resource, which are used for the API request to retrieve all CRs for a CRD. It also must contain a title (kind), an optional description, the scope of the CRs (namespaced vs. cluster) and an optional list of columns with the fields, which should be shown in the frontend table.

type CRDColumn

type CRDColumn struct {
	Description string `json:"description"`
	JSONPath    string `json:"jsonPath"`
	Name        string `json:"name"`
	Type        string `json:"type"`
}

CRDColumn is a single column for the CRD. A column has the same fields as the additionalPrinterColumns from the CRD specs. This means each column contains a description, name, a type to formate the value returned by the given jsonPath.

type Cache

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

Cache implements a simple caching layer, for the loaded manifest files. The goal of the caching layer is to return the manifests faster to the user.

type Cluster

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

Cluster is a Kubernetes cluster. It contains all required fields to interact with the cluster and it's services.

func NewCluster

func NewCluster(name string, restConfig *rest.Config) (*Cluster, error)

NewCluster returns a new cluster. Each cluster must have a unique name and a client to make requests against the Kubernetes API server of this cluster. When a cluster was successfully created we call the loadCRDs function to get all CRDs for this cluster.

func (*Cluster) CopyFileFromPod added in v0.7.0

func (c *Cluster) CopyFileFromPod(w http.ResponseWriter, namespace, name, container, srcPath string) error

CopyFileFromPod creates the request URL for downloading a file from the specified container.

func (*Cluster) CopyFileToPod added in v0.7.0

func (c *Cluster) CopyFileToPod(namespace, name, container string, srcFile multipart.File, destPath string) error

CopyFileToPod creates the request URL for uploading a file to the specified container.

func (*Cluster) CreateResource added in v0.5.0

func (c *Cluster) CreateResource(ctx context.Context, namespace, name, path, resource, subResource string, body []byte) error

CreateResource can be used to create the given resource. The resource is identified by the Kubernetes API path and the name of the resource.

func (*Cluster) DeleteResource added in v0.5.0

func (c *Cluster) DeleteResource(ctx context.Context, namespace, name, path, resource string, body []byte) error

DeleteResource can be used to delete the given resource. The resource is identified by the Kubernetes API path and the name of the resource.

func (*Cluster) GetApplication

func (c *Cluster) GetApplication(ctx context.Context, namespace, name string) (*application.ApplicationSpec, error)

GetApplication returns a application for the given namespace and name. After the application is retrieved we replace, the cluster, namespace and name in the spec of the Application CR. This is needed, so that the user doesn't have to, provide these fields.

func (*Cluster) GetApplications

func (c *Cluster) GetApplications(ctx context.Context, namespace string) ([]application.ApplicationSpec, error)

GetApplications returns a list of applications gor the given namespace. It also adds the cluster, namespace and application name to the Application CR, so that this information must not be specified by the user in the CR.

func (*Cluster) GetCRDs

func (c *Cluster) GetCRDs() []CRD

GetCRDs returns all CRDs of the cluster.

func (*Cluster) GetClient added in v0.6.0

func (c *Cluster) GetClient(schema *apiruntime.Scheme) (client.Client, error)

GetClient returns a new client to perform CRUD operations on Kubernetes objects.

func (*Cluster) GetDashboard

func (c *Cluster) GetDashboard(ctx context.Context, namespace, name string) (*dashboard.DashboardSpec, error)

GetDashboard returns a dashboard for the given namespace and name. After the dashboard is retrieved we replace, the cluster, namespace and name in the spec of the Dashboard CR. This is needed, so that the user doesn't have to, provide these fields.

func (*Cluster) GetDashboards

func (c *Cluster) GetDashboards(ctx context.Context, namespace string) ([]dashboard.DashboardSpec, error)

GetDashboards returns a list of dashboards gor the given namespace. It also adds the cluster, namespace and dashboard name to the Dashboard CR, so that this information must not be specified by the user in the CR.

func (*Cluster) GetLogs

func (c *Cluster) GetLogs(ctx context.Context, namespace, name, container, regex string, since, tail int64, previous bool) (string, error)

GetLogs returns the logs for a Container. The Container is identified by the namespace and pod name and the container name. Is is also possible to set the time since when the logs should be received and with the previous flag the logs for the last container can be received.

func (*Cluster) GetName

func (c *Cluster) GetName() string

GetName returns the name of the cluster.

func (*Cluster) GetNamespaces

func (c *Cluster) GetNamespaces(ctx context.Context, cacheDuration time.Duration) ([]string, error)

GetNamespaces returns all namespaces for the cluster. To reduce the latency and the number of API calls, we are "caching" the namespaces. This means that if a new namespace is created in a cluster, this namespaces is only shown after the configured cache duration.

func (*Cluster) GetResources

func (c *Cluster) GetResources(ctx context.Context, namespace, name, path, resource, paramName, param string) ([]byte, error)

GetResources returns a list for the given resource in the given namespace. The resource is identified by the Kubernetes API path and the resource. The name is optional and can be used to get a single resource, instead of a list of resources.

func (*Cluster) GetTeam

func (c *Cluster) GetTeam(ctx context.Context, namespace, name string) (*team.TeamSpec, error)

GetTeam returns a team for the given namespace and name. After the team is retrieved we replace, the cluster, namespace and name in the spec of the Team CR. This is needed, so that the user doesn't have to, provide these fields.

func (*Cluster) GetTeams

func (c *Cluster) GetTeams(ctx context.Context, namespace string) ([]team.TeamSpec, error)

GetTeams returns a list of teams gor the given namespace. It also adds the cluster, namespace and team name to the Team CR, so that this information must not be specified by the user in the CR.

func (*Cluster) GetTerminal added in v0.5.0

func (c *Cluster) GetTerminal(conn *websocket.Conn, namespace, name, container, shell string) error

GetTerminal starts a new terminal session via the given WebSocket connection.

func (*Cluster) GetUser added in v0.6.0

func (c *Cluster) GetUser(ctx context.Context, namespace, name string) (*user.UserSpec, error)

GetUser returns a user for the given namespace and name. After the user is retrieved we replace, the cluster, namespace and name in the spec of the User CR. This is needed, so that the user doesn't have to, provide these fields.

func (*Cluster) GetUsers added in v0.6.0

func (c *Cluster) GetUsers(ctx context.Context, namespace string) ([]user.UserSpec, error)

GetUsers returns a list of users for the given namespace. It also adds the cluster, namespace and user name to the User CR, so that this information must not be specified by the user in the CR.

func (*Cluster) PatchResource added in v0.5.0

func (c *Cluster) PatchResource(ctx context.Context, namespace, name, path, resource string, body []byte) error

PatchResource can be used to edit the given resource. The resource is identified by the Kubernetes API path and the name of the resource.

func (*Cluster) StreamLogs added in v0.6.0

func (c *Cluster) StreamLogs(ctx context.Context, conn *websocket.Conn, namespace, name, container string, since, tail int64, follow bool) error

StreamLogs can be used to stream the logs of the selected Container. For that we are using the passed in WebSocket connection an write each line returned by the Kubernetes API to this connection.

Source Files

Directories

Path Synopsis
Package terminal implements the functions for all terminal interactions in the frontend.
Package terminal implements the functions for all terminal interactions in the frontend.

Jump to

Keyboard shortcuts

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