cluster

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: MIT Imports: 18 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) 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) 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 string, since 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, 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 name of the resource.

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.

Jump to

Keyboard shortcuts

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