Documentation
¶
Index ¶
- type Application
- type Cache
- type Clusters
- func (c *Clusters) GetApplication(ctx context.Context, ...) (*clustersProto.GetApplicationResponse, error)
- func (c *Clusters) GetApplications(ctx context.Context, ...) (*clustersProto.GetApplicationsResponse, error)
- func (c *Clusters) GetApplicationsTopology(ctx context.Context, ...) (*clustersProto.GetApplicationsTopologyResponse, error)
- func (c *Clusters) GetCRDs(ctx context.Context, getCRDsRequest *clustersProto.GetCRDsRequest) (*clustersProto.GetCRDsResponse, error)
- func (c *Clusters) GetClusters(ctx context.Context, getClustersRequest *clustersProto.GetClustersRequest) (*clustersProto.GetClustersResponse, error)
- func (c *Clusters) GetLogs(ctx context.Context, getLogsRequest *clustersProto.GetLogsRequest) (*clustersProto.GetLogsResponse, error)
- func (c *Clusters) GetNamespaces(ctx context.Context, getNamespacesRequest *clustersProto.GetNamespacesRequest) (*clustersProto.GetNamespacesResponse, error)
- func (c *Clusters) GetResources(ctx context.Context, getResourcesRequest *clustersProto.GetResourcesRequest) (*clustersProto.GetResourcesResponse, error)
- func (c *Clusters) GetTeam(ctx context.Context, getTeamRequest *clustersProto.GetTeamRequest) (*clustersProto.GetTeamResponse, error)
- func (c *Clusters) GetTeams(ctx context.Context, getTeamsRequest *clustersProto.GetTeamsRequest) (*clustersProto.GetTeamsResponse, error)
- func (c *Clusters) GetTemplates(ctx context.Context, getTemplatesRequest *clustersProto.GetTemplatesRequest) (*clustersProto.GetTemplatesResponse, error)
- type Config
- type Team
- type Topology
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶ added in v0.2.0
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 ¶
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) GetApplicationsTopology ¶ added in v0.2.0
func (c *Clusters) GetApplicationsTopology(ctx context.Context, getApplicationsTopologyRequest *clustersProto.GetApplicationsTopologyRequest) (*clustersProto.GetApplicationsTopologyResponse, error)
GetApplicationsTopology returns the topology for the given list of clusters and namespaces. We add an additional node for each cluster and namespace. These nodes are used to group the applications by the cluster and namespace.
func (*Clusters) GetCRDs ¶
func (c *Clusters) GetCRDs(ctx context.Context, getCRDsRequest *clustersProto.GetCRDsRequest) (*clustersProto.GetCRDsResponse, error)
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) GetLogs ¶ added in v0.2.0
func (c *Clusters) GetLogs(ctx context.Context, getLogsRequest *clustersProto.GetLogsRequest) (*clustersProto.GetLogsResponse, error)
GetLogs returns the log line for the given pod, which is identified by the cluster, namespace and name.
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.
func (*Clusters) GetTeam ¶ added in v0.2.0
func (c *Clusters) GetTeam(ctx context.Context, getTeamRequest *clustersProto.GetTeamRequest) (*clustersProto.GetTeamResponse, error)
GetTeam returns a single team. Each team is identified by his name. This also means that each team name must be unique across clusters and namespaces.We use the generated list of teams to identify where we find the Team CR for the given team name. Then we return the CR. We also use the list of teams, to get all applications, which can be associated with the team and return them within the team. Since we are using the generated list of teams, it is possible that a team can not be found directly after it is created. The reason for this is that we cache the teams for the specified cache duration via the --clusters.cache-duration.teams flag (default 60m). We do this because it can become expensive to generate the list of teams, when the number of teams and applications grows.
func (*Clusters) GetTeams ¶ added in v0.2.0
func (c *Clusters) GetTeams(ctx context.Context, getTeamsRequest *clustersProto.GetTeamsRequest) (*clustersProto.GetTeamsResponse, error)
GetTeams returns all teams. Since this is only used to render the page which shows all teams, we just return the name, description and logo of each team.
func (*Clusters) GetTemplates ¶ added in v0.3.0
func (c *Clusters) GetTemplates(ctx context.Context, getTemplatesRequest *clustersProto.GetTemplatesRequest) (*clustersProto.GetTemplatesResponse, error)
GetTemplates returns a list of templates. The name of a template must be unique accross all clusters and namespace, because we only use the name in the CRs and resources to identify a template. If the last fetch was before the request time + the cache duration we return the cached templates. If this isn't the case and the lenght of the templates slice is 0 we fetch the templates and return them to the user. If the length of the slice is larger then 0, we return the cached templates, but trigger a refectch in the background.