util

package module
v0.0.0-...-ebefeed Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2025 License: Apache-2.0 Imports: 78 Imported by: 0

README

OpenShift Origin Utility Library

This repository contains a Go library with utility functions for interacting with OpenShift and Kubernetes clusters. It provides a convenient client for managing cluster resources, with a particular focus on simplifying end-to-end (e2e) testing.

Goal

Avoid being able to directly pull an entire oversized origin along with the corresponding complex dependencies, as this can easily contaminating our project and cause conflicts with the new OpenShift/K8s version. And every time, GOSUMDB has to be turned off, which is not very user-friendly for CI/CD. The future might be even more troublesome. Therefore consider from origin/test/extended/util alone cut out to be a lightweight repo (such as the origin - util), multiple repo when using, go to get github.com/wangke19/origin-util@v0.x. Version is controllable.

Prerequisites

Before using this library, you will need:

  1. A running OpenShift Cluster.
  2. A kubeconfig file that points to your cluster. The library will search for the config file based on the KUBECONFIG environment variable or in the default ~/.kube/config location.
  3. Cluster-admin privileges for the user context in your kubeconfig, as many of the utility functions interact with cluster-level resources.

Usage

To use this library in your Go project, you can import it as follows:

import (
    "fmt"
    "context"

    "github.com/wangke19/origin-util"
    "k8s.io/kubernetes/test/e2e/framework"
)

func main() {
    // This library is designed to be used within a testing framework like Ginkgo.
    // The following is a simplified conceptual example.

    // 1. Initialize the CLI helper
    // The second argument to NewCLI is the Pod Security level.
    // For more details, refer to the implementation in `client.go`.
    cli := util.NewCLI("my-test-project", admissionapi.LevelRestricted)

    // 2. Get the cluster version
    clusterVersion, err := util.GetClusterVersion(context.Background(), cli.AdminConfig())
    if err != nil {
        panic(err)
    }

    fmt.Printf("Cluster version: %s\n", clusterVersion.Status.Desired.Version)

    // 3. Use the client to interact with the cluster
    // For example, to get a list of pods in the current project:
    pods, err := cli.KubeClient().CoreV1().Pods(cli.Namespace()).List(context.Background(), metav1.ListOptions{})
    if err != nil {
        panic(err)
    }

    fmt.Printf("Found %d pods in project %s\n", len(pods.Items), cli.Namespace())
}

Key Features

  • CLI Wrapper: A CLI struct that simplifies running oc commands and interacting with the cluster's APIs.
  • Client Management: Easy creation of clients for various Kubernetes and OpenShift API groups.
  • Project/Namespace Setup: Helper functions to create and tear down projects/namespaces for tests.
  • Cluster Information: Functions to retrieve cluster version and operator status.
  • Testing Focused: Designed to be used within a testing framework like Ginkgo, with integration with the Kubernetes e2e test framework.

This library is primarily intended for internal OpenShift e2e testing and may not be suitable for general-purpose applications.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TestContext = &e2e.TestContext
)

Functions

func AddAnnotationsToSpecificResource

func AddAnnotationsToSpecificResource(oc *CLI, resourceKindAndName, resourceNamespace string, annotations ...string) (string, error)

AddAnnotationsToSpecificResource adds the custom annotations to the specific resource

func AddLabelsToSpecificResource

func AddLabelsToSpecificResource(oc *CLI, resourceKindAndName, resourceNamespace string, labels ...string) (string, error)

AddLabelsToSpecificResource adds the custom labels to the specific resource

func ApplyClusterResourceFromTemplate

func ApplyClusterResourceFromTemplate(oc *CLI, parameters ...string)

ApplyClusterResourceFromTemplate apply resource from the template. For ex: ApplyClusterResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", "TEMPLATE LOCATION")

func ApplyClusterResourceFromTemplateWithError

func ApplyClusterResourceFromTemplateWithError(oc *CLI, parameters ...string) error

ApplyClusterResourceFromTemplateWithError apply resource from the template and return error if happened. For ex: ApplyClusterResourceFromTemplateWithError(oc, "--ignore-unknown-parameters=true", "-f", "TEMPLATE LOCATION")

func AssertAllPodsToBeReady

func AssertAllPodsToBeReady(oc *CLI, namespace string)

AssertAllPodsToBeReady assert all pods in NS are in ready state until timeout in a given namespace

func AssertAllPodsToBeReadyWithPollerParams

func AssertAllPodsToBeReadyWithPollerParams(oc *CLI, namespace string, interval, timeout time.Duration, selector string)

AssertAllPodsToBeReadyWithPollerParams assert all pods in NS are in ready state until timeout in a given namespace Pros: allow user to customize poller parameters

func AssertAllPodsToBeReadyWithSelector

func AssertAllPodsToBeReadyWithSelector(oc *CLI, namespace, selector string)

AssertAllPodsToBeReadyWithSelector assert all pods in NS are in ready state until timeout in a given namespace The selector parameter follows the regular oc/kubectl format for the --selector option.

func AssertPodToBeReady

func AssertPodToBeReady(oc *CLI, podName, namespace string)

AssertPodToBeReady poll pod status to determine it is ready

func AssertWaitPollNoErr

func AssertWaitPollNoErr(e error, msg string)

func By

func By(text string)

when 4.14 synch with k1.27, there is gingkgo upgrade from 2.4 to 26 By method changes and it does not print "STEP:" information. some tester want to use it. so, make this wrapper to print if you want to get "STEP:", you need to change g.By to exutil. By text is the string you want to describe the step.

func CreateClusterResourceFromTemplate

func CreateClusterResourceFromTemplate(oc *CLI, parameters ...string)

CreateClusterResourceFromTemplate create resource from the template. For ex: CreateClusterResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", "TEMPLATE LOCATION")

func CreateClusterResourceFromTemplateWithError

func CreateClusterResourceFromTemplateWithError(oc *CLI, parameters ...string) error

CreateClusterResourceFromTemplateWithError create resource from the template and return error if happened. For ex: CreateClusterResourceFromTemplateWithError(oc, "--ignore-unknown-parameters=true", "-f", "TEMPLATE LOCATION")

func CreateNsResourceFromTemplate

func CreateNsResourceFromTemplate(oc *CLI, namespace string, parameters ...string)

CreateNsResourceFromTemplate create ns resource from the template. No need to add a namespace parameter in the template file as it can be provided as a function argument. For ex: CreateNsResourceFromTemplate(oc, "NAMESPACE", "--ignore-unknown-parameters=true", "-f", "TEMPLATE LOCATION")

func DebugNodeWithChroot

func DebugNodeWithChroot(oc *CLI, nodeName string, cmd ...string) (string, error)

DebugNodeWithChroot creates a debugging session of the node with chroot

func DeleteLabelsFromSpecificResource

func DeleteLabelsFromSpecificResource(oc *CLI, resourceKindAndName, resourceNamespace string, labelNames ...string) (string, error)

DeleteLabelsFromSpecificResource deletes the custom labels from the specific resource

func FixturePath

func FixturePath(elem ...string) string

FixturePath returns an absolute path to a local copy of a fixture file This is a simplified version that doesn't depend on embedded testdata

func GenerateOAuthTokenPair

func GenerateOAuthTokenPair() (privToken, pubToken string)

GenerateOAuthTokenPair returns two tokens to use with OpenShift OAuth-based authentication. The first token is a private token meant to be used as a Bearer token to send queries to the API, the second token is a hashed token meant to be stored in the database.

func GetAnnotationsFromSpecificResource

func GetAnnotationsFromSpecificResource(oc *CLI, resourceKindAndName, resourceNamespace string) ([]string, error)

GetAnnotationsFromSpecificResource gets the annotations from the specific resource

func GetInfraID

func GetInfraID(oc *CLI) (string, error)

GetInfraID returns the infra id

func GetNodeListByLabel

func GetNodeListByLabel(oc *CLI, labelKey string) []string

GetNodeListByLabel gets the node list by label

func GetPodName

func GetPodName(oc *CLI, namespace, podLabel, node string) (string, error)

GetPodName returns the pod name

func GetRandomString

func GetRandomString() string

GetRandomString to create random string

func GetResourceSpecificLabelValue

func GetResourceSpecificLabelValue(oc *CLI, resourceKindAndName, resourceNamespace, labelName string) (string, error)

GetResourceSpecificLabelValue gets the specified label value from the resource and label name

func GetSpecificPodLogs

func GetSpecificPodLogs(oc *CLI, namespace, container, podName, filter string) (string, error)

GetSpecificPodLogs returns the pod logs by the specific filter

func GetSpecificPodLogsCombinedOrNot

func GetSpecificPodLogsCombinedOrNot(oc *CLI, namespace, container, podName, filter string, combined bool) (string, error)

GetSpecificPodLogsCombinedOrNot returns the pod logs by the specific filter with combining stderr or not

func InitDefaultEnvironmentVariables

func InitDefaultEnvironmentVariables()

ProwGCPSetup makes sure certain required env vars are available in the case that extended tests are invoked directly via calls to ginkgo/extended.test

func InitStandardFlags

func InitStandardFlags()

func InitTest

func InitTest(dryRun bool) error

func IsDefaultNodeSelectorEnabled

func IsDefaultNodeSelectorEnabled(oc *CLI) bool

IsDefaultNodeSelectorEnabled judges whether the test cluster enabled the defaultNodeSelector

func IsNamespacePrivileged

func IsNamespacePrivileged(oc *CLI, namespace string) (bool, error)

IsNamespacePrivileged returns bool Judge whether the input namespace has the privileged label Privileged label: "pod-security.kubernetes.io/enforce=privileged"

func IsSpecifiedAnnotationKeyExist

func IsSpecifiedAnnotationKeyExist(oc *CLI, resourceKindAndName, resourceNamespace, annotationKey string) bool

IsSpecifiedAnnotationKeyExist judges whether the specified annotationKey exist on the resource

func IsWorkerNode

func IsWorkerNode(oc *CLI, nodeName string) bool

IsWorkerNode judges whether the node has the worker role

func KubeConfigPath

func KubeConfigPath() string

KubeConfigPath returns the value of KUBECONFIG environment variable

func OrFail

func OrFail[T any](vals ...any) T

OrFail function will process another function's return values and fail if any of those returned values is ane error != nil and returns the first value example: if we have: func getValued() (string, error)

we can do:  value := OrFail[string](getValue())

func RecoverNamespaceRestricted

func RecoverNamespaceRestricted(oc *CLI, namespace string) error

RecoverNamespaceRestricted removes the privileged labels from the input namespace

func RemoveAnnotationFromSpecificResource

func RemoveAnnotationFromSpecificResource(oc *CLI, resourceKindAndName, resourceNamespace, annotationName string) (string, error)

RemoveAnnotationFromSpecificResource removes the specified annotation from the resource

func SetNamespacePrivileged

func SetNamespacePrivileged(oc *CLI, namespace string) error

SetNamespacePrivileged adds the privileged labels to the input namespace Privileged labels: "security.openshift.io/scc.podSecurityLabelSync=false", "pod-security.kubernetes.io/enforce=privileged", "pod-security.kubernetes.io/audit=privileged", "pod-security.kubernetes.io/warn=privileged" Without audit label "pod-security.kubernetes.io/audit=privileged", an important alert will fire on cluster after pod created https://github.com/openshift/cluster-kube-apiserver-operator/pull/1362 The warn label "pod-security.kubernetes.io/warn=privileged" is optional, it could make the warning info output gone.

func StringsSliceContains

func StringsSliceContains(stringsSlice []string, element string) (bool, int)

StringsSliceContains judges whether the strings Slice contains specific element, return bool and the first matched index If no matched return (false, 0)

func StringsSliceElementsAddSuffix

func StringsSliceElementsAddSuffix(stringsSlice []string, suffix string) []string

StringsSliceElementsAddSuffix returns a new string slice all elements with the specific suffix added

func StringsSliceElementsHasPrefix

func StringsSliceElementsHasPrefix(stringsSlice []string, elementPrefix string, sequentialFlag bool) (bool, int)

StringsSliceElementsHasPrefix judges whether the strings Slice contains an element which has the specific prefix returns bool and the first matched index sequential order: -> sequentialFlag: "true" reverse order: -> sequentialFlag: "false" If no matched return (false, 0)

func WaitForSelfSAR

func WaitForSelfSAR(interval, timeout time.Duration, c kclientset.Interface, selfSAR authorizationapiv1.SelfSubjectAccessReviewSpec) error

func WaitForServiceAccount

func WaitForServiceAccount(c corev1client.ServiceAccountInterface, name string, checkSecret bool) error

WaitForServiceAccount waits until the named service account gets fully provisioned

Types

type CLI

type CLI struct {
	// contains filtered or unexported fields
}

CLI provides function to call the OpenShift CLI and Kubernetes and OpenShift clients.

func NewCLI

func NewCLI(project, adminConfigPath string) *CLI

NewCLI initialize the upstream E2E framework and set the namespace to match with the project name. Note that this function does not initialize the project role bindings for the namespace.

func (*CLI) AddExplicitResourceToDelete

func (c *CLI) AddExplicitResourceToDelete(resource schema.GroupVersionResource, namespace, name string)

AddExplicitResourceToDelete method

func (*CLI) AddPathsToDelete

func (c *CLI) AddPathsToDelete(dir string)

AddPathsToDelete method

func (*CLI) AddResourceToDelete

func (c *CLI) AddResourceToDelete(resource schema.GroupVersionResource, metadata metav1.Object)

AddResourceToDelete method

func (*CLI) AdminAPIExtensionsV1Client

func (c *CLI) AdminAPIExtensionsV1Client() crdv1.ApiextensionsV1Interface

AdminAPIExtensionsV1Client returns a ClientSet for the APIExtensionsV1Beta1 API

func (*CLI) AdminAppsClient

func (c *CLI) AdminAppsClient() appsv1client.Interface

AdminAppsClient method

func (*CLI) AdminAuthorizationClient

func (c *CLI) AdminAuthorizationClient() authorizationv1client.Interface

AdminAuthorizationClient method

func (*CLI) AdminBuildClient

func (c *CLI) AdminBuildClient() buildv1client.Interface

AdminBuildClient method

func (*CLI) AdminConfig

func (c *CLI) AdminConfig() *rest.Config

AdminConfig method

func (*CLI) AdminConfigClient

func (c *CLI) AdminConfigClient() configv1client.Interface

AdminConfigClient method

func (*CLI) AdminDynamicClient

func (c *CLI) AdminDynamicClient() dynamic.Interface

AdminDynamicClient method

func (*CLI) AdminImageClient

func (c *CLI) AdminImageClient() imagev1client.Interface

AdminImageClient method

func (*CLI) AdminKubeClient

func (c *CLI) AdminKubeClient() kubernetes.Interface

AdminKubeClient provides a Kubernetes client for the cluster admin user.

func (*CLI) AdminOAuthClient

func (c *CLI) AdminOAuthClient() oauthv1client.Interface

AdminOAuthClient method

func (*CLI) AdminOauthClient

func (c *CLI) AdminOauthClient() oauthv1client.Interface

AdminOauthClient method

func (*CLI) AdminOperatorClient

func (c *CLI) AdminOperatorClient() operatorv1client.Interface

AdminOperatorClient method

func (*CLI) AdminProjectClient

func (c *CLI) AdminProjectClient() projectv1client.Interface

AdminProjectClient method

func (*CLI) AdminQuotaClient

func (c *CLI) AdminQuotaClient() quotav1client.Interface

AdminQuotaClient method

func (*CLI) AdminRouteClient

func (c *CLI) AdminRouteClient() routev1client.Interface

AdminRouteClient method

func (*CLI) AdminSecurityClient

func (c *CLI) AdminSecurityClient() securityv1client.Interface

AdminSecurityClient method

func (*CLI) AdminTemplateClient

func (c *CLI) AdminTemplateClient() templatev1client.Interface

AdminTemplateClient method

func (*CLI) AdminUserClient

func (c *CLI) AdminUserClient() userv1client.Interface

AdminUserClient method

func (*CLI) AppsClient

func (c *CLI) AppsClient() appsv1client.Interface

AppsClient method

func (*CLI) Args

func (c *CLI) Args(args ...string) *CLI

Args sets the additional arguments for the OpenShift CLI command

func (*CLI) AsAdmin

func (c *CLI) AsAdmin() *CLI

AsAdmin changes current config file path to the admin config.

func (CLI) AsGuestKubeconf

func (c CLI) AsGuestKubeconf() *CLI

AsGuestKubeconf instructs the command should take kubeconfig of guest cluster

func (*CLI) AuthorizationClient

func (c *CLI) AuthorizationClient() authorizationv1client.Interface

AuthorizationClient method

func (*CLI) Background

func (c *CLI) Background() (*exec.Cmd, *bytes.Buffer, *bytes.Buffer, error)

Background executes the command in the background and returns the Cmd object which may be killed later via cmd.Process.Kill(). It also returns buffers holding the stdout & stderr of the command, which may be read from only after calling cmd.Wait().

func (*CLI) BackgroundRC

func (c *CLI) BackgroundRC() (*exec.Cmd, io.ReadCloser, error)

BackgroundRC executes the command in the background and returns the Cmd object which may be killed later via cmd.Process.Kill(). It returns a ReadCloser for stdout. If in doubt, use Background(). Consult the os/exec documentation.

func (*CLI) BuildClient

func (c *CLI) BuildClient() buildv1client.Interface

BuildClient method

func (*CLI) ChangeUser

func (c *CLI) ChangeUser(name string) *CLI

ChangeUser changes the user used by the current CLI session.

func (*CLI) CreateNamespace

func (c *CLI) CreateNamespace(ctx context.Context, labels map[string]string) (*corev1.Namespace, error)

CreateNamespace creates and returns a test namespace, automatically torn down after the test.

func (*CLI) CreateSpecifiedNamespaceAsAdmin

func (c *CLI) CreateSpecifiedNamespaceAsAdmin(namespace string)

CreateSpecifiedNamespaceAsAdmin creates specified name namespace.

func (*CLI) CreateUser

func (c *CLI) CreateUser(prefix string) *userv1.User

CreateUser method

func (*CLI) DeleteSpecifiedNamespaceAsAdmin

func (c *CLI) DeleteSpecifiedNamespaceAsAdmin(namespace string)

DeleteSpecifiedNamespaceAsAdmin deletes specified name namespace.

func (*CLI) DynamicClient

func (c *CLI) DynamicClient() dynamic.Interface

DynamicClient method

func (*CLI) Execute

func (c *CLI) Execute() error

Execute executes the current command and return error if the execution failed This function will set the default output to Ginkgo writer.

func (*CLI) GetClientConfigForUser

func (c *CLI) GetClientConfigForUser(username string) *rest.Config

GetClientConfigForUser method

func (*CLI) GetGuestKubeconf

func (c *CLI) GetGuestKubeconf() string

GetGuestKubeconf gets the guest cluster kubeconf file

func (*CLI) GetKubeconf

func (c *CLI) GetKubeconf() string

func (*CLI) GuestConfig

func (c *CLI) GuestConfig() *rest.Config

GuestConfig method

func (*CLI) GuestKubeClient

func (c *CLI) GuestKubeClient() kubernetes.Interface

GuestKubeClient provides a Kubernetes client for the guest cluster user.

func (*CLI) ImageClient

func (c *CLI) ImageClient() imagev1client.Interface

ImageClient method

func (*CLI) InputString

func (c *CLI) InputString(input string) *CLI

InputString adds expected input to the command

func (*CLI) KubeClient

func (c *CLI) KubeClient() kubernetes.Interface

KubeClient provides a Kubernetes client for the current namespace

func (*CLI) KubeFramework

func (c *CLI) KubeFramework() *e2e.Framework

KubeFramework returns Kubernetes framework which contains helper functions specific for Kubernetes resources

func (*CLI) MustCreateNamespace

func (c *CLI) MustCreateNamespace(ctx context.Context, labels map[string]string) *corev1.Namespace

MustCreateNamespace creates a test namespace and fails the test if creation fails.

func (*CLI) Namespace

func (c *CLI) Namespace() string

Namespace returns the name of the namespace used in the current test case. If the namespace is not set, an empty string is returned.

func (*CLI) NotShowInfo

func (c *CLI) NotShowInfo() *CLI

NotShowInfo instructs the command will not be logged

func (*CLI) Output

func (c *CLI) Output() (string, error)

Output executes the command and returns stdout/stderr combined into one string

func (*CLI) OutputToFile

func (c *CLI) OutputToFile(filename string) (string, error)

OutputToFile executes the command and store output to a file

func (*CLI) Outputs

func (c *CLI) Outputs() (string, string, error)

Outputs executes the command and returns the stdout/stderr output as separate strings

func (*CLI) OutputsToFiles

func (c *CLI) OutputsToFiles(fileName string) (string, string, error)

OutputsToFiles executes the command and store the stdout in one file and stderr in another one The stdout output will be written to fileName+'.stdout' The stderr output will be written to fileName+'.stderr'

func (*CLI) ProjectClient

func (c *CLI) ProjectClient() projectv1client.Interface

ProjectClient method

func (*CLI) QuotaClient

func (c *CLI) QuotaClient() quotav1client.Interface

QuotaClient method

func (*CLI) RESTMapper

func (c *CLI) RESTMapper() meta.RESTMapper

RESTMapper method

func (*CLI) RouteClient

func (c *CLI) RouteClient() routev1client.Interface

RouteClient method

func (*CLI) Run

func (c *CLI) Run(commands ...string) *CLI

Run executes given OpenShift CLI command verb (iow. "oc <verb>"). This function also override the default 'stdout' to redirect all output to a buffer and prepare the global flags such as namespace and config path.

func (*CLI) SetAdminKubeconf

func (c *CLI) SetAdminKubeconf(adminKubeconf string) *CLI

SetAdminKubeconf instructs the admin cluster kubeconf file is set

func (*CLI) SetGuestKubeconf

func (c *CLI) SetGuestKubeconf(guestKubeconf string) *CLI

SetGuestKubeconf instructs the guest cluster kubeconf file is set

func (*CLI) SetKubeconf

func (c *CLI) SetKubeconf(kubeconf string) *CLI

SetKubeconf instructs the cluster kubeconf file is set

func (*CLI) SetNamespace

func (c *CLI) SetNamespace(ns string) *CLI

SetNamespace sets a new namespace

func (*CLI) SetShowInfo

func (c *CLI) SetShowInfo() *CLI

SetShowInfo instructs the command will not be logged

func (*CLI) SetupProject

func (c *CLI) SetupProject()

SetupProject initializes and transitions to a new project. All resources created henceforth will reside within this project. For clusters that are not using external OIDC, it also generates and switches to a random temporary user.

func (*CLI) SilentOutput

func (c *CLI) SilentOutput() (string, error)

SilentOutput executes the command and returns stdout/stderr combined into one string

func (*CLI) TeardownProject

func (c *CLI) TeardownProject()

TeardownProject removes projects created by this test.

func (*CLI) Template

func (c *CLI) Template(t string) *CLI

Template sets a Go template for the OpenShift CLI command. This is equivalent of running "oc get foo -o template --template='{{ .spec }}'"

func (*CLI) TemplateClient

func (c *CLI) TemplateClient() templatev1client.Interface

TemplateClient method

func (*CLI) User

func (c *CLI) User() string

User returns the name of currently logged user. If there is no user assigned for the current session, it returns 'admin'.

func (*CLI) UserConfig

func (c *CLI) UserConfig() *rest.Config

UserConfig method

func (*CLI) Verbose

func (c *CLI) Verbose() *CLI

Verbose turns on printing verbose messages when executing OpenShift commands

func (CLI) WithKubectl

func (c CLI) WithKubectl() *CLI

WithKubectl instructs the command should be invoked with binary kubectl, not oc.

func (CLI) WithoutKubeconf

func (c CLI) WithoutKubeconf() *CLI

WithoutKubeconf instructs the command should be invoked without adding --kubeconfig parameter

func (CLI) WithoutNamespace

func (c CLI) WithoutNamespace() *CLI

WithoutNamespace instructs the command should be invoked without adding --namespace parameter

type ExitError

type ExitError struct {
	Cmd    string
	StdErr string
	*exec.ExitError
}

ExitError struct

type Pod

type Pod struct {
	Name       string
	Namespace  string
	Template   string
	Parameters []string
}

Pod Parameters can be used to set the template parameters except PodName as PodName can be provided using pod.Name

func (*Pod) Create

func (pod *Pod) Create(oc *CLI)

Create creates a pod on the basis of Pod struct For Ex: pod := Pod{Name: "PodName", Namespace: "NSName", Template: "PodTemplateLocation", Parameters: []string{"HOSTNAME=NODE_IP"}} pod.Create(oc) The pod name parameter must be NAME in the template file

func (*Pod) Delete

func (pod *Pod) Delete(oc *CLI) error

Delete pod

type SecureMatcher

type SecureMatcher struct {
	// contains filtered or unexported fields
}

SecureMatcher it will not print the compared values when the matcher fails

func (*SecureMatcher) FailureMessage

func (matcher *SecureMatcher) FailureMessage(actual interface{}) (message string)

FailureMessage returns the message in case of successful match

func (*SecureMatcher) Match

func (matcher *SecureMatcher) Match(actual interface{}) (success bool, err error)

Match checks it the condition with the given type has the right value in the given field.

func (*SecureMatcher) NegatedFailureMessage

func (matcher *SecureMatcher) NegatedFailureMessage(actual interface{}) (message string)

NegatedFailureMessage returns the message in case of failed match

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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