Documentation ¶
Index ¶
- type Cache
- type Cluster
- func (c *Cluster) GetApplication(ctx context.Context, namespace, name string) (*applicationProto.Application, error)
- func (c *Cluster) GetApplications(ctx context.Context, namespace string) ([]*applicationProto.Application, error)
- func (c *Cluster) GetCRDs() []*clustersProto.CRD
- func (c *Cluster) GetLogs(ctx context.Context, namespace, name, container, regex string, since int64, ...) ([]string, error)
- func (c *Cluster) GetName() string
- func (c *Cluster) GetNamespaces(ctx context.Context) ([]string, error)
- func (c *Cluster) GetResources(ctx context.Context, namespace, path, resource, paramName, param string) (string, error)
- func (c *Cluster) GetTeam(ctx context.Context, namespace, name string) (*teamProto.Team, error)
- func (c *Cluster) GetTeams(ctx context.Context) ([]*teamProto.Team, error)
- func (c *Cluster) SetOptions(cacheDuration time.Duration)
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 ¶
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) (*applicationProto.Application, 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) ([]*applicationProto.Application, 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() []*clustersProto.CRD
GetCRDs returns all CRDs of the cluster.
func (*Cluster) GetLogs ¶ added in v0.2.0
func (c *Cluster) GetLogs(ctx context.Context, namespace, name, container, regex string, since int64, previous bool) ([]string, error)
GetLogs returns the logs for a Pod. The Pod is identified by the namespace and name. Before we return the logs, we filter them by the provided regular expression. Before we check each log line against the regular expression provided by a user, we check that a regular expression was provided. If not we just return the logs from the Kubernetes API request splitted by the newline character. If a regular expression was provided, we compile it and then loop through all lines and check each line against the regex. When a line matches the regex it is added to the slice of log lines, which are returned then.
func (*Cluster) GetNamespaces ¶
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) (string, 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 ¶ added in v0.2.0
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 the name field and we can find the team later again.
func (*Cluster) GetTeams ¶ added in v0.2.0
GetTeams returns a list of teams. Since teams must be unique accross clusters and namespace, we ignore the namespace parameter in the request and always request all teams in the cluster.
func (*Cluster) SetOptions ¶
SetOptions is used to set the options for a cluster. The options are not set during the creation of a cluster, so that we do not have to pass around the options through different functions. We also do not know the datasources befor the cluster name is determined, so that we loop through all loaded clusters and connect the datasource names with the correct cluster.