k3s

package
v0.7.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Copyright © 2020-2021 The k3d Author(s)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildKubeConfigFromFlags

func BuildKubeConfigFromFlags(context string) (*rest.Config, error)

func ExecuteMaster

func ExecuteMaster(runCommand string, node *k3sv1alpha1.ContrelPlanNodes, dryRun bool) (result string, err error)

ExecuteMaster TODO: delete

func GetClusterConfig

func GetClusterConfig(context string) (*kubernetes.Clientset, error)

GetClusterConfig generate kube config.

func GetKubeconfig

func GetKubeconfig(masters []k3sv1alpha1.ContrelPlanNodes, dryRun bool) (kubeconfig string, err error)

GetKubeconfig подключаемся к мастеру и скачиваем kubeconfig

func KubeconfigGetDefaultFile

func KubeconfigGetDefaultFile() (string, *clientcmdapi.Config, error)

KubeconfigGetDefaultFile loads the default KubeConfig file

func KubeconfigGetDefaultPath

func KubeconfigGetDefaultPath() (string, error)

KubeconfigGetDefaultPath returns the path of the default kubeconfig, but errors if the KUBECONFIG env var specifies more than one file

func KubeconfigMerge

func KubeconfigMerge(newKubeConfig *clientcmdapi.Config, existingKubeConfig *clientcmdapi.Config, outPath string, opts WriteKubeConfigOptions) error

KubeconfigMerge merges a new kubeconfig into an existing kubeconfig and returns the result

func KubeconfigTmpWrite

func KubeconfigTmpWrite(kubeconfig *clientcmdapi.Config) (path string, err error)

KubeconfigTmpWrite write kubeconfig to tmp file

func KubeconfigWrite

func KubeconfigWrite(kubeconfig *clientcmdapi.Config, path string) error

KubeconfigWrite writes a kubeconfig to a path atomically

func LoadKubeconfig

func LoadKubeconfig(cfg, ip, context string, opts WriteKubeConfigOptions) (kubeconfig *clientcmdapi.Config, err error)

LoadKubeconfig

func RemoveCfg

func RemoveCfg(context string) (err error)

RemoveCfg removes kubectl config file.

func RunExampleCommand2

func RunExampleCommand2()

func RunLocalCommand

func RunLocalCommand(myCommand string, sudo bool, dryRun bool) (stdOut []byte, stdErr []byte, err error)

RunLocalCommand выполнение комманд на локальном хосте TODO: tranclate

func RunLocalCommandOld

func RunLocalCommandOld(myCommand string, saveKubeconfig bool, dryRun bool) (stdOut []byte, stdErr []byte, err error)

func RunSshCommand

func RunSshCommand(myCommand string, bastion *k3sv1alpha1.BastionNode, saveKubeconfig bool, dryRun bool) error

RunSshCommand выполнение комманд на удаленном хосте по ssh TODO: tranclate

func SaveCfg

func SaveCfg(cfg, ip, context string, opts WriteKubeConfigOptions) (pathKubeConfig string, err error)

/ SaveCfg save kube config file.

func SaveKubeconfig

func SaveKubeconfig(kubeconfig *clientcmdapi.Config, opts WriteKubeConfigOptions) (pathKubeConfig string, err error)

func SwitchContext

func SwitchContext(ctx, kubeconfig string) (err error)

Types

type WriteKubeConfigOptions

type WriteKubeConfigOptions struct {
	UpdateExisting       bool
	UpdateCurrentContext bool
	OverwriteExisting    bool
}

WriteKubeConfigOptions provide a set of options for writing a KubeConfig file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL