clusters

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clusters

type Clusters struct {
	clustersProto.UnimplementedClustersServer
	// contains filtered or unexported fields
}

Clusters contains all fields and methods to interact with the configured Kubernetes clusters. It must implement the Clusters service from the protocol buffers definition.

func Load

func Load(config Config) (*Clusters, error)

Load loads all clusters for the given configuration. The clusters can be retrieved from different providers. Currently we are supporting incluster configuration and kubeconfig files. In the future it is planning to directly support GKE, EKS, AKS, etc.

func (*Clusters) GetApplication

func (c *Clusters) GetApplication(ctx context.Context, getApplicationRequest *clustersProto.GetApplicationRequest) (*clustersProto.GetApplicationResponse, error)

GetApplication returns a single application with the given name in the given cluster and namespace. If there isn't, such an application an error is returned.

func (*Clusters) GetApplications

func (c *Clusters) GetApplications(ctx context.Context, getApplicationsRequest *clustersProto.GetApplicationsRequest) (*clustersProto.GetApplicationsResponse, error)

GetApplications returns a list of applications for the given clusters and namespaces. To generate this list, we loop over every cluster and namespace and try to get the applications for this.

func (*Clusters) GetCRDs

GetCRDs returns all CRDs for all clusters. Instead of only returning the CRDs for a list of specified clusters, we return all CRDs, so that we only have to call this function once from the React app. The CRDs form all loaded clusters are merged and then deduplicated.

func (*Clusters) GetClusters

func (c *Clusters) GetClusters(ctx context.Context, getClustersRequest *clustersProto.GetClustersRequest) (*clustersProto.GetClustersResponse, error)

GetClusters returns all loaded Kubernetes clusters. We are not returning the complete cluster structure. Instead we are returning just the names of the clusters. We are also sorting the clusters alphabetically, to improve the user experience in the frontend. NOTE: Maybe we can also save the cluster names slice, since the name of a cluster couldn't change during runtime.

func (*Clusters) GetNamespaces

func (c *Clusters) GetNamespaces(ctx context.Context, getNamespacesRequest *clustersProto.GetNamespacesRequest) (*clustersProto.GetNamespacesResponse, error)

GetNamespaces returns all namespaces for the given clusters. As we did it for the clusters, we are also just returning the names of all namespaces. After we retrieved all namespaces we have to depulicate them, so that our frontend logic can handle them properly. We are also sorting the namespaces alphabetically.

func (*Clusters) GetResources

func (c *Clusters) GetResources(ctx context.Context, getResourcesRequest *clustersProto.GetResourcesRequest) (*clustersProto.GetResourcesResponse, error)

GetResources returns a list of resources for the given clusters and namespaces. To generate this list, we loop over every cluster and namespace and try to get the resources for this. A resource is identified by it's Kubernetes API path and name.

type Config

type Config struct {
	Providers []provider.Config `yaml:"providers"`
}

Config is the configuration required to load all clusters.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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