Documentation
¶
Overview ¶
Copyright 2023.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func ApplyNamespacedSecret(ctx context.Context, namespaceClient v1.NamespaceInterface, ...) error
- func ExtractKubeconfig(path string, targetContext string) ([]byte, error)
- func GenerateConfigFile(path string, cluster string) error
- func GeneratePrimaryConfig(clientset *kubernetes.Clientset, restConfig *rest.Config) ([]byte, error)
- func MargeKubeconfig(source clientcmdapi.Config, target clientcmdapi.Config) ([]byte, error)
- func ReadKubeconfigFromByte(config []byte) (*clientcmdapi.Config, error)
- func ReadKubeconfigFromClient(cli client.Client) (*clientcmdapi.Config, error)
- func ReadKubeconfigFromFile(path string) (*clientcmdapi.Config, error)
- func RemoveContext(config *corev1.Secret, removeTarget string) ([]byte, error)
- func ViewContext(config *corev1.Secret) ([][]string, error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyNamespacedSecret ¶
func ApplyNamespacedSecret( ctx context.Context, namespaceClient v1.NamespaceInterface, secretClinet v1.SecretInterface, config []byte, ) error
Generate a secret resource for the kubeconfig file.
func ExtractKubeconfig ¶
Extract the kubeconfig file for the specified context.
func GenerateConfigFile ¶
Generate a toml file that stores the path and cluster name of the kubeconfig file.
func GeneratePrimaryConfig ¶
func GeneratePrimaryConfig(clientset *kubernetes.Clientset, restConfig *rest.Config) ([]byte, error)
Generate a kubeconfig file for the primary cluster.
func MargeKubeconfig ¶
func MargeKubeconfig(source clientcmdapi.Config, target clientcmdapi.Config) ([]byte, error)
Merge the kubeconfig.
func ReadKubeconfigFromByte ¶
func ReadKubeconfigFromByte(config []byte) (*clientcmdapi.Config, error)
Read the kubeconfig file.
func ReadKubeconfigFromClient ¶
func ReadKubeconfigFromClient(cli client.Client) (*clientcmdapi.Config, error)
Read the kubeconfig file registered for the Secret Resource and register the necessary information for apiServers and clusters, respectively. At this time, a slice element is created for each Kubernetes cluster. kubeconfig must be created in advance as a secret resource.
func ReadKubeconfigFromFile ¶
func ReadKubeconfigFromFile(path string) (*clientcmdapi.Config, error)
Read the kubeconfig file.