-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
area/featureNew feature or requestNew feature or request
Description
Problem statement
KTF provides several functions which allow to interact with kubectl (and kustomize via kubetl -k
) in
kubernetes-testing-framework/pkg/clusters/utils.go
Lines 211 to 239 in efb08ea
// KustomizeDeployForCluster applies a given kustomizeURL to the provided cluster | |
func KustomizeDeployForCluster(ctx context.Context, cluster Cluster, kustomizeURL string, flags ...string) error { | |
return kubectlWithArgs(ctx, cluster, append([]string{"-v9", "apply", "-k", kustomizeURL}, flags...)...) | |
} | |
// KustomizeDeleteForCluster deletes the provided kustomize manafests from the cluster | |
func KustomizeDeleteForCluster(ctx context.Context, cluster Cluster, kustomizeURL string, flags ...string) error { | |
return kubectlWithArgs(ctx, cluster, append([]string{"-v9", "delete", "-k", kustomizeURL}, flags...)...) | |
} | |
// ApplyManifestByURL applies a given manifest URL to the cluster provided | |
func ApplyManifestByURL(ctx context.Context, cluster Cluster, url string) error { | |
return kubectlWithArgs(ctx, cluster, "apply", "-f", url) | |
} | |
// DeleteManifestByURL deletes a given manifest URL on the cluster provided | |
func DeleteManifestByURL(ctx context.Context, cluster Cluster, url string) error { | |
return kubectlWithArgs(ctx, cluster, "delete", "-f", url) | |
} | |
// ApplyManifestByYAML applies a given YAML manifest to the cluster provided | |
func ApplyManifestByYAML(ctx context.Context, cluster Cluster, yaml string) error { | |
return kubectlSubcommandWithYAML(ctx, cluster, "apply", yaml) | |
} | |
// DeleteManifestByYAML deletes a given YAML manifest on the cluster provided | |
func DeleteManifestByYAML(ctx context.Context, cluster Cluster, yaml string) error { | |
return kubectlSubcommandWithYAML(ctx, cluster, "delete", yaml) | |
} |
These functions access cluster.Cluster
which is an interface with numerous methods which not all clusters might provide
In several projects like KIC or KGO, envtest is used to create clusters on the fly. These clusters are not yet supported.
This task tracks the effort to:
- narrow down the interface accepted by kustomize and kubectl helper funcs linked above
- provide a wrapper type for
envtest
so that these funcs can be utilized withenvtest
clusters
Acceptance criteria
- ktf kustomize and kubectl helpers funcs can be used with
envtest
clusters
programmer04
Metadata
Metadata
Assignees
Labels
area/featureNew feature or requestNew feature or request