Documentation
¶
Index ¶
- Variables
- func SanitizeUnstructuredCluster(ctx context.Context, cluster *unstructured.Unstructured) (*unstructured.Unstructured, error)
- func SortUnstructuredList(unList *unstructured.UnstructuredList, criteria SortCriteria, descending bool) (*unstructured.UnstructuredList, error)
- type Cluster
- type ClusterEntry
- type ClusterManager
- func (c *ClusterManager) CountCluster(ctx context.Context, client *multicluster.MultiClusterClient, ...) (*ClusterSummary, error)
- func (c *ClusterManager) CreateCluster(ctx context.Context, client *multicluster.MultiClusterClient, ...) (*unstructured.Unstructured, error)
- func (c *ClusterManager) DeleteCluster(ctx context.Context, client *multicluster.MultiClusterClient, name string) error
- func (c *ClusterManager) GetCluster(ctx context.Context, client *multicluster.MultiClusterClient, name string) (*unstructured.Unstructured, error)
- func (c *ClusterManager) GetNamespace(ctx context.Context, client *multicluster.MultiClusterClient, namespace string) (*unstructured.Unstructured, error)
- func (c *ClusterManager) GetNamespaceYAML(ctx context.Context, client *multicluster.MultiClusterClient, namespace string) ([]byte, error)
- func (c *ClusterManager) GetYAMLForCluster(ctx context.Context, client *multicluster.MultiClusterClient, name string) ([]byte, error)
- func (c *ClusterManager) ListCluster(ctx context.Context, client *multicluster.MultiClusterClient, ...) (*unstructured.UnstructuredList, error)
- func (c *ClusterManager) SanitizeKubeConfigFor(config *KubeConfig)
- func (c *ClusterManager) SanitizeKubeConfigWithYAML(ctx context.Context, plain string) (sanitize string, err error)
- func (c *ClusterManager) UpdateCredential(ctx context.Context, client *multicluster.MultiClusterClient, ...) (*unstructured.Unstructured, error)
- func (c *ClusterManager) UpdateMetadata(ctx context.Context, client *multicluster.MultiClusterClient, ...) (*unstructured.Unstructured, error)
- func (c *ClusterManager) ValidateKubeConfigFor(ctx context.Context, config *KubeConfig) (string, error)
- func (c *ClusterManager) ValidateKubeConfigWithYAML(ctx context.Context, plain string) (string, error)
- type ClusterSummary
- type Context
- type ContextEntry
- type KubeConfig
- type SortCriteria
- type User
- type UserEntry
Constants ¶
This section is empty.
Variables ¶
var ( ErrMissingAPIVersion = errors.New("apiVersion is required") ErrMissingKind = errors.New("kind is required") ErrMissingClusterEntry = errors.New("at least one cluster entry is required") ErrMissingUserEntry = errors.New("at least one user entry is required") ErrMissingClusterName = errors.New("cluster name is required") ErrMissingClusterServer = errors.New("cluster server is required") ErrMissingCertificateAuthority = errors.New("certificate-authority-data is required") ErrInvalidCertificateAuthority = errors.New("certificate-authority-data is invalid") ErrClusterServerConnectivity = errors.New("cannot connect to the cluster server") ErrBuildClientConfig = errors.New("failed to create client config from provided KubeConfig") ErrCreateClientSet = errors.New("failed to create clientset") ErrGetServerVersion = errors.New("failed to connect to the cluster") )
Functions ¶
func SanitizeUnstructuredCluster ¶ added in v0.2.11
func SanitizeUnstructuredCluster(ctx context.Context, cluster *unstructured.Unstructured) (*unstructured.Unstructured, error)
SanitizeUnstructuredCluster masks sensitive information within a Unstructured cluster object, such as user credentials and certificate data.
func SortUnstructuredList ¶ added in v0.2.12
func SortUnstructuredList(unList *unstructured.UnstructuredList, criteria SortCriteria, descending bool) (*unstructured.UnstructuredList, error)
SortUnstructuredList returns a sorted unstructured.UnstructuredList based on criteria
Types ¶
type Cluster ¶ added in v0.2.6
type Cluster struct {
Server string `yaml:"server"`
CertificateAuthorityData string `yaml:"certificate-authority-data,omitempty"`
}
Cluster contains the cluster information
type ClusterEntry ¶ added in v0.2.6
ClusterEntry represents each cluster entry in kubeconfig
type ClusterManager ¶
type ClusterManager struct{}
func NewClusterManager ¶
func NewClusterManager() *ClusterManager
NewClusterManager returns a new ClusterManager object
func (*ClusterManager) CountCluster ¶ added in v0.2.12
func (c *ClusterManager) CountCluster(ctx context.Context, client *multicluster.MultiClusterClient, config *rest.Config) (*ClusterSummary, error)
CountCluster returns the summary of clusters by their health status
func (*ClusterManager) CreateCluster ¶ added in v0.2.8
func (c *ClusterManager) CreateCluster(ctx context.Context, client *multicluster.MultiClusterClient, name, displayName, description, kubeconfig string) (*unstructured.Unstructured, error)
CreateCluster creates a new Cluster resource in the hub cluster and returns the created unstructured Cluster object
func (*ClusterManager) DeleteCluster ¶ added in v0.2.8
func (c *ClusterManager) DeleteCluster(ctx context.Context, client *multicluster.MultiClusterClient, name string) error
DeleteCluster deletes the cluster by name
func (*ClusterManager) GetCluster ¶
func (c *ClusterManager) GetCluster(ctx context.Context, client *multicluster.MultiClusterClient, name string) (*unstructured.Unstructured, error)
GetCluster returns the unstructured Cluster object for a given cluster
func (*ClusterManager) GetNamespace ¶ added in v0.3.0
func (c *ClusterManager) GetNamespace(ctx context.Context, client *multicluster.MultiClusterClient, namespace string) (*unstructured.Unstructured, error)
GetNamespaceForCluster returns the yaml byte array for a given cluster
func (*ClusterManager) GetNamespaceYAML ¶ added in v0.3.0
func (c *ClusterManager) GetNamespaceYAML(ctx context.Context, client *multicluster.MultiClusterClient, namespace string) ([]byte, error)
GetNamespaceForCluster returns the yaml byte array for a given cluster
func (*ClusterManager) GetYAMLForCluster ¶
func (c *ClusterManager) GetYAMLForCluster(ctx context.Context, client *multicluster.MultiClusterClient, name string) ([]byte, error)
GetYAMLForCluster returns the yaml byte array for a given cluster
func (*ClusterManager) ListCluster ¶ added in v0.2.9
func (c *ClusterManager) ListCluster(ctx context.Context, client *multicluster.MultiClusterClient, orderBy SortCriteria, descending bool) (*unstructured.UnstructuredList, error)
List returns the full list of clusters in a specific order
func (*ClusterManager) SanitizeKubeConfigFor ¶ added in v0.2.6
func (c *ClusterManager) SanitizeKubeConfigFor(config *KubeConfig)
SanitizeKubeConfigFor masks sensitive information within a KubeConfig object, such as user credentials and certificate data.
func (*ClusterManager) SanitizeKubeConfigWithYAML ¶ added in v0.2.6
func (c *ClusterManager) SanitizeKubeConfigWithYAML(ctx context.Context, plain string) (sanitize string, err error)
SanitizeKubeConfigWithYAML takes a plain KubeConfig YAML string and returns a sanitized version with sensitive information masked.
func (*ClusterManager) UpdateCredential ¶ added in v0.2.8
func (c *ClusterManager) UpdateCredential(ctx context.Context, client *multicluster.MultiClusterClient, name, kubeconfig string) (*unstructured.Unstructured, error)
UpdateCredential updates cluster credential by name and a new kubeconfig
func (*ClusterManager) UpdateMetadata ¶ added in v0.2.8
func (c *ClusterManager) UpdateMetadata(ctx context.Context, client *multicluster.MultiClusterClient, name, displayName, description string) (*unstructured.Unstructured, error)
UpdateCluster updates cluster by name with a full payload
func (*ClusterManager) ValidateKubeConfigFor ¶ added in v0.2.8
func (c *ClusterManager) ValidateKubeConfigFor(ctx context.Context, config *KubeConfig) (string, error)
ValidateKubeConfigFor validates the provided KubeConfig.
func (*ClusterManager) ValidateKubeConfigWithYAML ¶ added in v0.2.8
func (c *ClusterManager) ValidateKubeConfigWithYAML(ctx context.Context, plain string) (string, error)
ValidateKubeConfigWithYAML unmarshals YAML content into KubeConfig and validates it.
type ClusterSummary ¶ added in v0.2.12
type ContextEntry ¶ added in v0.2.6
ContextEntry represents each context entry in kubeconfig
type KubeConfig ¶ added in v0.2.6
type KubeConfig struct {
APIVersion string `yaml:"apiVersion"`
Kind string `yaml:"kind"`
Clusters []ClusterEntry `yaml:"clusters"`
Contexts []ContextEntry `yaml:"contexts"`
CurrentContext string `yaml:"current-context"`
Users []UserEntry `yaml:"users"`
}
KubeConfig represents the structure of a kubeconfig file
type SortCriteria ¶ added in v0.2.12
type SortCriteria int
const ( ByTimestamp SortCriteria = iota ByName )
type User ¶ added in v0.2.6
type User struct {
ClientCertificateData string `yaml:"client-certificate-data,omitempty"`
ClientKeyData string `yaml:"client-key-data,omitempty"`
Token string `yaml:"token,omitempty"`
Username string `yaml:"username,omitempty"`
Password string `yaml:"password,omitempty"`
}
User contains the user information