Documentation ¶
Overview ¶
Copyright 2024 Defense Unicorns SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial Package k8s contains k8s client logic
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GetCurrentContext = func() (string, string, error) { rules := clientcmd.NewDefaultClientConfigLoadingRules() config, err := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(rules, &clientcmd.ConfigOverrides{}).RawConfig() if err != nil { return "", "", err } contextName := config.CurrentContext context := config.Contexts[contextName] if context == nil { return "", "", fmt.Errorf("context not found") } return contextName, context.Cluster, nil }
Declare GetCurrentContext as a variable so it can be mocked
Functions ¶
func IsRunningInCluster ¶
IsRunningInCluster checks if the application is running in cluster
Types ¶
Click to show internal directories.
Click to hide internal directories.