Documentation ¶
Index ¶
- Constants
- func ConfigDocLink() string
- func GetKubeClient(kubeconfig string) (client kubernetes.Interface, config *rest.Config, err error)
- func GetKubeNamespace(kubeconfigPath, namespace string) string
- func LoadConfig(configFilePath string) (v1alpha3.Configuration, error)
- func UntarFile(tarName, target string) (err error)
- func WritePathsToTar(tw *tar.Writer, paths []string) (err error)
- func WriteToTar(tw *tar.Writer, r io.Reader, hdr *tar.Header) error
- type FakeTestRunner
- type PodTestRunner
- func (r PodTestRunner) Cleanup(ctx context.Context) (err error)
- func (r PodTestRunner) CreateConfigMap(ctx context.Context, bundleData []byte) (configMapName string, err error)
- func (r *PodTestRunner) Initialize(ctx context.Context) error
- func (r PodTestRunner) RunTest(ctx context.Context, test v1alpha3.TestConfiguration, podSec bool) (*v1alpha3.TestStatus, error)
- type Scorecard
- type TestRunner
Constants ¶
const ( // ConfigFileName is the scorecard's hard-coded config file name. ConfigFileName = "config.yaml" // DefaultConfigDir is the default scorecard path within a bundle. DefaultConfigDir = "tests/scorecard/" )
const (
// PodBundleRoot is the directory containing all bundle data within a test pod.
PodBundleRoot = "/bundle"
)
const (
StorageSidecarContainer = "scorecard-gather"
)
Variables ¶
This section is empty.
Functions ¶
func ConfigDocLink ¶ added in v0.15.0
func ConfigDocLink() string
func GetKubeClient ¶ added in v1.0.0
GetKubeClient will get a kubernetes client from the following sources:
- a path to the kubeconfig file passed on the command line (--kubeconfig)
- an environment variable that specifies the path (export KUBECONFIG)
- the user's $HOME/.kube/config file
- in-cluster connection for when the sdk is run within a cluster instead of the command line
TODO(joelanford): migrate scorecard use `internal/operator.Configuration`
func GetKubeNamespace ¶ added in v1.0.0
GetKubeNamespace returns the kubernetes namespace to use for scorecard pod creation the order of how the namespace is determined is as follows: - a namespace command line argument - a namespace determined from the kubeconfig file - the kubeconfig file is determined in the following order:
- from the kubeconfig flag if set
- from the KUBECONFIG env var if set
- from the $HOME/.kube/config path if exists
- returns 'default' as the namespace if not set in the kubeconfig
TODO(joelanford): migrate scorecard to use `internal/operator.Configuration`
func LoadConfig ¶ added in v1.0.0
func LoadConfig(configFilePath string) (v1alpha3.Configuration, error)
LoadConfig will find and return the scorecard config, the config file is found from a bundle location (TODO bundle image) scorecard config.yaml is expected to be in the bundle at the following location: tests/scorecard/config.yaml the user can override this location using the --config CLI flag TODO: version this.
func WritePathsToTar ¶ added in v1.0.0
WritePathsToTar walks paths to create tar file tarName
Types ¶
type FakeTestRunner ¶ added in v1.0.0
type FakeTestRunner struct { Sleep time.Duration TestStatus *v1alpha3.TestStatus Error error }
func (FakeTestRunner) Cleanup ¶ added in v1.0.0
func (r FakeTestRunner) Cleanup(ctx context.Context) error
func (FakeTestRunner) Initialize ¶ added in v1.0.0
func (r FakeTestRunner) Initialize(ctx context.Context) error
func (FakeTestRunner) RunTest ¶ added in v1.0.0
func (r FakeTestRunner) RunTest(ctx context.Context, _ v1alpha3.TestConfiguration, _ bool) (result *v1alpha3.TestStatus, err error)
RunTest executes a single test
type PodTestRunner ¶ added in v1.0.0
type PodTestRunner struct { Namespace string ServiceAccount string BundlePath string TestOutput string BundleMetadata registryutil.LabelsMap Client kubernetes.Interface RESTConfig *rest.Config StorageImage string UntarImage string PodSecurity bool // contains filtered or unexported fields }
func (PodTestRunner) Cleanup ¶ added in v1.0.0
func (r PodTestRunner) Cleanup(ctx context.Context) (err error)
Cleanup deletes pods and configmap resources from this test run
func (PodTestRunner) CreateConfigMap ¶ added in v1.0.0
func (r PodTestRunner) CreateConfigMap(ctx context.Context, bundleData []byte) (configMapName string, err error)
CreateConfigMap creates a ConfigMap that will hold the bundle contents to be mounted into the test Pods
func (*PodTestRunner) Initialize ¶ added in v1.0.0
func (r *PodTestRunner) Initialize(ctx context.Context) error
Initialize sets up the bundle configmap for tests
func (PodTestRunner) RunTest ¶ added in v1.0.0
func (r PodTestRunner) RunTest(ctx context.Context, test v1alpha3.TestConfiguration, podSec bool) (*v1alpha3.TestStatus, error)
RunTest executes a single test