Documentation
¶
Index ¶
- Constants
- Variables
- func AddFlags(flags *flag.FlagSet)
- func CreateKotsadmIDConfigMap(clientset kubernetes.Interface, kotsadmID string) error
- func DeleteKotsadm(ctx context.Context, clientset *kubernetes.Clientset, namespace string, ...) error
- func FindFreePort(clientset kubernetes.Interface) (int, error)
- func FindKotsadm(clientset *kubernetes.Clientset, namespace string) (string, error)
- func FindKotsadmImage(clientset kubernetes.Interface, namespace string) (string, error)
- func GenerateBootstrapToken(client kubernetes.Interface, ttl time.Duration) (string, error)
- func GenerateK0sBootstrapToken(client kbclient.Client, ttl time.Duration, role string) (string, error)
- func GetClientset() (*kubernetes.Clientset, error)
- func GetClusterCaCert(ctx context.Context, client kbclient.Client) (string, error)
- func GetClusterConfig() (*rest.Config, error)
- func GetCurrentRules(deployOptions kotsadmtypes.DeployOptions, clientset *kubernetes.Clientset) ([]rbacv1.PolicyRule, error)
- func GetDynamicClient() (dynamic.Interface, error)
- func GetDynamicResourceInterface(gvk *schema.GroupVersionKind, namespace string) (dynamic.ResourceInterface, error)
- func GetK8sMinorVersion(clientset kubernetes.Interface) (int, error)
- func GetK8sVersion(clientset kubernetes.Interface) (string, error)
- func GetKotsadmID(clientset kubernetes.Interface) string
- func GetKotsadmIDConfigMap(clientset kubernetes.Interface) (*corev1.ConfigMap, error)
- func GetKubeClient(ctx context.Context) (kbclient.WithWatch, error)
- func GetOpenShiftPodSecurityContext(kotsadmNamespace string, strictSecurityContext bool) (*corev1.PodSecurityContext, error)
- func GetPodLogs(ctx context.Context, clientset kubernetes.Interface, pod *corev1.Pod, ...) ([]byte, error)
- func InitHelmCapabilities() error
- func IsGKEAutopilot(clientset kubernetes.Interface) bool
- func IsKotsadmClusterScoped(ctx context.Context, clientset kubernetes.Interface, namespace string) bool
- func IsKotsadmIDConfigMapPresent() (bool, error)
- func IsOpenShift(clientset kubernetes.Interface) bool
- func IsPortAvailable(clientset kubernetes.Interface, port int) (bool, error)
- func MergeEnvVars(desired []corev1.EnvVar, existing []corev1.EnvVar, override bool) []corev1.EnvVar
- func MergeImagePullSecrets(desired []corev1.LocalObjectReference, existing []corev1.LocalObjectReference, ...) []corev1.LocalObjectReference
- func MergeVolumeMounts(desired []corev1.VolumeMount, existing []corev1.VolumeMount, override bool) []corev1.VolumeMount
- func MergeVolumes(desired []corev1.Volume, existing []corev1.Volume, override bool) []corev1.Volume
- func PodsHaveTheSameOwner(pods []corev1.Pod) bool
- func PortForward(localPort int, remotePort int, namespace string, ...) (int, chan error, error)
- func ReadKustomizationFromFile(file string) (*kustomizetypes.Kustomization, error)
- func RestartKotsadm(ctx context.Context, clientset *kubernetes.Clientset, namespace string, ...) error
- func ScaleDownDeployment(ctx context.Context, clientset kubernetes.Interface, namespace string, ...) error
- func SecureContainerContext(isStrict bool) *corev1.SecurityContext
- func SecurePodContext(user int64, group int64, isStrict bool) *corev1.PodSecurityContext
- func ServiceForward(clientset *kubernetes.Clientset, cfg *rest.Config, localPort int, ...) (chan struct{}, error)
- func SetClusterIDProvider(fn func() string)
- func UpdateKotsadmIDConfigMap(clientset kubernetes.Interface, kotsadmID string) error
- func WaitForDeploymentReady(ctx context.Context, clientset kubernetes.Interface, namespace string, ...) error
- func WaitForKotsadm(clientset kubernetes.Interface, namespace string, ...) (string, error)
- func WaitForPod(ctx context.Context, clientset kubernetes.Interface, namespace string, ...) error
- func WaitForStatefulSetReady(ctx context.Context, clientset kubernetes.Interface, namespace string, ...) error
- func WriteKustomizationToFile(kustomization kustomizetypes.Kustomization, file string) error
Constants ¶
const ( DEFAULT_K8S_CLIENT_QPS = 100 DEFAULT_K8S_CLIENT_BURST = 100 )
const (
KotsadmIDConfigMapName = "kotsadm-id"
)
Variables ¶
var (
ErrWaitForPodTimeout = errors.New("timeout waiting for pod")
)
Functions ¶
func CreateKotsadmIDConfigMap ¶
func CreateKotsadmIDConfigMap(clientset kubernetes.Interface, kotsadmID string) error
func DeleteKotsadm ¶
func FindFreePort ¶ added in v1.85.0
func FindFreePort(clientset kubernetes.Interface) (int, error)
func FindKotsadm ¶
func FindKotsadm(clientset *kubernetes.Clientset, namespace string) (string, error)
func FindKotsadmImage ¶
func FindKotsadmImage(clientset kubernetes.Interface, namespace string) (string, error)
func GenerateBootstrapToken ¶
GenerateBootstrapToken will generate a node join token for kubeadm. ttl defines the time to live for this token.
func GenerateK0sBootstrapToken ¶ added in v1.105.0
func GetClientset ¶
func GetClientset() (*kubernetes.Clientset, error)
func GetClusterCaCert ¶ added in v1.105.0
func GetClusterConfig ¶
func GetCurrentRules ¶
func GetCurrentRules(deployOptions kotsadmtypes.DeployOptions, clientset *kubernetes.Clientset) ([]rbacv1.PolicyRule, error)
func GetDynamicClient ¶ added in v1.98.3
func GetDynamicResourceInterface ¶ added in v1.100.0
func GetDynamicResourceInterface(gvk *schema.GroupVersionKind, namespace string) (dynamic.ResourceInterface, error)
func GetK8sMinorVersion ¶ added in v1.101.1
func GetK8sMinorVersion(clientset kubernetes.Interface) (int, error)
func GetK8sVersion ¶
func GetK8sVersion(clientset kubernetes.Interface) (string, error)
func GetKotsadmID ¶ added in v1.103.2
func GetKotsadmID(clientset kubernetes.Interface) string
GetKotsadmID retrieves the stable cluster ID. Priority order: 1. ConfigMap value (if available and readable) 2. Database cluster_id (if store is initialized) 3. Generate new KSUID only if both are unavailable
This function works in both CLI and server contexts by checking if the store is available before attempting to access it.
func GetKotsadmIDConfigMap ¶
func GetKotsadmIDConfigMap(clientset kubernetes.Interface) (*corev1.ConfigMap, error)
func GetKubeClient ¶ added in v1.109.10
func GetOpenShiftPodSecurityContext ¶
func GetOpenShiftPodSecurityContext(kotsadmNamespace string, strictSecurityContext bool) (*corev1.PodSecurityContext, error)
GetOpenShiftPodSecurityContext returns a PodSecurityContext object that has: User set to the minimum value in the "openshift.io/sa.scc.uid-range" annotation. Group set to the minimum value in the "openshift.io/sa.scc.supplemental-groups" annotation if exists, else falls back to the minimum value in the "openshift.io/sa.scc.uid-range" annotation.
func GetPodLogs ¶
func InitHelmCapabilities ¶
func InitHelmCapabilities() error
func IsGKEAutopilot ¶ added in v1.91.1
func IsGKEAutopilot(clientset kubernetes.Interface) bool
IsGKEAutopilot returns true if the cluster is positively identified as being an autopilot cluster in GKE
func IsKotsadmClusterScoped ¶
func IsKotsadmClusterScoped(ctx context.Context, clientset kubernetes.Interface, namespace string) bool
IsKotsadmClusterScoped will check if kotsadm has cluster scope access or not
func IsOpenShift ¶
func IsOpenShift(clientset kubernetes.Interface) bool
IsOpenShift returns true if the cluster is positively identified as being an openshift cluster
func IsPortAvailable ¶
func IsPortAvailable(clientset kubernetes.Interface, port int) (bool, error)
func MergeEnvVars ¶
func MergeImagePullSecrets ¶ added in v1.94.0
func MergeImagePullSecrets(desired []corev1.LocalObjectReference, existing []corev1.LocalObjectReference, override bool) []corev1.LocalObjectReference
func MergeVolumeMounts ¶ added in v1.94.0
func MergeVolumeMounts(desired []corev1.VolumeMount, existing []corev1.VolumeMount, override bool) []corev1.VolumeMount
func MergeVolumes ¶ added in v1.94.0
func PodsHaveTheSameOwner ¶
func PortForward ¶
func PortForward(localPort int, remotePort int, namespace string, getPodName func() (string, error), pollForAdditionalPorts bool, stopCh <-chan struct{}, log *logger.CLILogger) (int, chan error, error)
PortForward starts a local port forward to a pod in the cluster if localport is set, it will attempt to use that port locally. always check the port number returned though, because a port conflict could cause a different port to be used
func ReadKustomizationFromFile ¶
func ReadKustomizationFromFile(file string) (*kustomizetypes.Kustomization, error)
func RestartKotsadm ¶ added in v1.89.0
func ScaleDownDeployment ¶
func SecureContainerContext ¶ added in v1.98.0
func SecureContainerContext(isStrict bool) *corev1.SecurityContext
func SecurePodContext ¶ added in v1.98.0
func SecurePodContext(user int64, group int64, isStrict bool) *corev1.PodSecurityContext
func ServiceForward ¶
func SetClusterIDProvider ¶ added in v1.129.4
func SetClusterIDProvider(fn func() string)
SetClusterIDProvider allows the store package to register a function that provides the cluster ID without creating an import cycle
func UpdateKotsadmIDConfigMap ¶
func UpdateKotsadmIDConfigMap(clientset kubernetes.Interface, kotsadmID string) error
func WaitForDeploymentReady ¶
func WaitForKotsadm ¶
func WaitForPod ¶
func WaitForStatefulSetReady ¶
func WriteKustomizationToFile ¶
func WriteKustomizationToFile(kustomization kustomizetypes.Kustomization, file string) error
Types ¶
This section is empty.