Documentation
¶
Index ¶
- Variables
- func SanitizeUnstructuredCluster(ctx context.Context, cluster *unstructured.Unstructured) (*unstructured.Unstructured, error)
- type Cluster
- type ClusterDetail
- type ClusterEntry
- type ClusterManager
- func (c *ClusterManager) ConvertGraphToMap(rg *relationship.RelationshipGraph) map[string]ClusterTopology
- 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) GetDetailsForCluster(ctx context.Context, client *multicluster.MultiClusterClient, name string) (*ClusterDetail, error)
- func (c *ClusterManager) GetNamespaceForCluster(ctx context.Context, client *multicluster.MultiClusterClient, ...) (*v1.Namespace, error)
- func (c *ClusterManager) GetTopologyForCluster(ctx context.Context, client *multicluster.MultiClusterClient, name string) (map[string]ClusterTopology, error)
- func (c *ClusterManager) GetTopologyForClusterNamespace(ctx context.Context, client *multicluster.MultiClusterClient, ...) (map[string]ClusterTopology, 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 ClusterTopology
- type Config
- type Context
- type ContextEntry
- type KubeConfig
- 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.
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 ClusterDetail ¶
type ClusterEntry ¶ added in v0.2.6
ClusterEntry represents each cluster entry in kubeconfig
type ClusterManager ¶
type ClusterManager struct {
// contains filtered or unexported fields
}
func NewClusterManager ¶
func NewClusterManager(config *Config) *ClusterManager
NewClusterManager returns a new ClusterManager object
func (*ClusterManager) ConvertGraphToMap ¶
func (c *ClusterManager) ConvertGraphToMap(rg *relationship.RelationshipGraph) map[string]ClusterTopology
ConvertGraphToMap returns a map[string]ClusterTopology for a given relationship.RelationshipGraph
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) GetDetailsForCluster ¶
func (c *ClusterManager) GetDetailsForCluster(ctx context.Context, client *multicluster.MultiClusterClient, name string) (*ClusterDetail, error)
GetDetailsForCluster returns ClusterDetail object for a given cluster
func (*ClusterManager) GetNamespaceForCluster ¶
func (c *ClusterManager) GetNamespaceForCluster(ctx context.Context, client *multicluster.MultiClusterClient, cluster, namespace string) (*v1.Namespace, error)
GetYAMLForCluster returns the yaml byte array for a given cluster
func (*ClusterManager) GetTopologyForCluster ¶
func (c *ClusterManager) GetTopologyForCluster(ctx context.Context, client *multicluster.MultiClusterClient, name string) (map[string]ClusterTopology, error)
GetTopologyForCluster returns a map that describes topology for a given cluster
func (*ClusterManager) GetTopologyForClusterNamespace ¶
func (c *ClusterManager) GetTopologyForClusterNamespace(ctx context.Context, client *multicluster.MultiClusterClient, cluster, namespace string) (map[string]ClusterTopology, error)
GetTopologyForClusterNamespace returns a map that describes topology for a given namespace in 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) (*unstructured.UnstructuredList, error)
DeleteCluster deletes the cluster by name
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, displayName, description, 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 ClusterTopology ¶
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 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