utils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterDomain = "cluster.local"
	ClusterDNS    = "10.96.0.10"

	NodeName = "dummy-node"
)

Variables

View Source
var MockResponse interface{} = map[string]interface{}{
	"kubeletconfig": map[string]interface{}{
		"clusterDomain": ClusterDomain,
		"clusterDNS":    []string{ClusterDNS},
	},
}
View Source
var MockServer = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
	if r.URL.Path == fmt.Sprintf("/api/v1/nodes/%s/proxy/configz", NodeName) {
		w.Header().Set("Content-Type", "application/json")
		if MockResponse == nil {
			MockResponse = map[string]interface{}{
				"kubeletconfig": map[string]interface{}{
					"clusterDomain": ClusterDomain,
					"clusterDNS":    []string{ClusterDNS},
				},
			}
		}
		_ = json.NewEncoder(w).Encode(MockResponse)
	} else {
		http.NotFound(w, r)
	}
}))

Starts a mock server to simulate the kubelet /configz endpoint

Functions

func AddNode added in v0.3.0

func AddNode(ctx context.Context, k8sClient client.Client) error

func CreateDNSClass added in v0.2.0

func CreateDNSClass(ctx context.Context, k8sClient client.Client, dnsclass client.Object) error

func DeleteDNSClass added in v0.2.0

func DeleteDNSClass(ctx context.Context, k8sClient client.Client, dnsclass client.Object) error

func DeleteNode added in v0.3.0

func DeleteNode(ctx context.Context, k8sClient client.Client) error

func GetDNSClass added in v0.2.0

func GetDNSClass(ctx context.Context, k8sClient client.Client, dnsclass client.Object) error

func GetDummyConfig added in v0.3.0

func GetDummyConfig(url string, k8sManager manager.Manager) *rest.Config

func GetNonEmptyLines

func GetNonEmptyLines(output string) []string

GetNonEmptyLines converts given command output string into individual objects according to line breakers, and ignores the empty elements in it.

func GetProjectDir

func GetProjectDir() (string, error)

GetProjectDir will return the directory where the project is

func InstallCertManager

func InstallCertManager() error

InstallCertManager installs the cert manager bundle.

func InstallPrometheusOperator

func InstallPrometheusOperator() error

InstallPrometheusOperator installs the prometheus Operator to be used to export the enabled metrics.

func LoadImageToKindClusterWithName

func LoadImageToKindClusterWithName(name string) error

LoadImageToKindCluster loads a local docker image to the kind cluster

func Run

func Run(cmd *exec.Cmd) ([]byte, error)

Run executes the provided command within this context

func UninstallCertManager

func UninstallCertManager()

UninstallCertManager uninstalls the cert manager

func UninstallPrometheusOperator

func UninstallPrometheusOperator()

UninstallPrometheusOperator uninstalls the prometheus

Types

This section is empty.

Jump to

Keyboard shortcuts

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