controller-runtime: sigs.k8s.io/controller-runtime/pkg/internal/testing/integration/internal Index | Files | Directories

package internal

import "sigs.k8s.io/controller-runtime/pkg/internal/testing/integration/internal"

Index

Package Files

apiserver.go arguments.go bin_path_finder.go etcd.go process.go tinyca.go

Variables

var APIServerDefaultArgs = []string{
    "--advertise-address=127.0.0.1",
    "--etcd-servers={{ if .EtcdURL }}{{ .EtcdURL.String }}{{ end }}",
    "--cert-dir={{ .CertDir }}",
    "--insecure-port={{ if .URL }}{{ .URL.Port }}{{ end }}",
    "--insecure-bind-address={{ if .URL }}{{ .URL.Hostname }}{{ end }}",
    "--secure-port={{ if .SecurePort }}{{ .SecurePort }}{{ end }}",

    "--disable-admission-plugins=ServiceAccount",
    "--service-cluster-ip-range=10.0.0.0/24",
    "--allow-privileged=true",
}

APIServerDefaultArgs allow tests to run offline, by preventing API server from attempting to use default route to determine its --advertise-address.

var EtcdDefaultArgs = []string{
    "--listen-peer-urls=http://localhost:0",
    "--advertise-client-urls={{ if .URL }}{{ .URL.String }}{{ end }}",
    "--listen-client-urls={{ if .URL }}{{ .URL.String }}{{ end }}",
    "--data-dir={{ .DataDir }}",
}

EtcdDefaultArgs allow tests to run offline, by preventing API server from attempting to use default route to determine its urls.

func BinPathFinder Uses

func BinPathFinder(symbolicName string) (binPath string)

BinPathFinder checks the an environment variable, derived from the symbolic name, and falls back to a default assets location when this variable is not set

func DoAPIServerArgDefaulting Uses

func DoAPIServerArgDefaulting(args []string) []string

DoAPIServerArgDefaulting will set default values to allow tests to run offline when the args are not informed. Otherwise, it will return the same []string arg passed as param.

func DoEtcdArgDefaulting Uses

func DoEtcdArgDefaulting(args []string) []string

DoEtcdArgDefaulting will set default values to allow tests to run offline when the args are not informed. Otherwise, it will return the same []string arg passed as param.

func GetEtcdStartMessage Uses

func GetEtcdStartMessage(listenURL url.URL) string

GetEtcdStartMessage returns an start message to inform if the client is or not insecure. It will return true when the URL informed has the scheme == "https" || scheme == "unixs"

func RenderTemplates Uses

func RenderTemplates(argTemplates []string, data interface{}) (args []string, err error)

RenderTemplates returns an []string to render the templates

type CertPair Uses

type CertPair struct {
    Key  crypto.Signer
    Cert *x509.Certificate
}

CertPair is a private key and certificate for use for client auth, as a CA, or serving.

func (CertPair) AsBytes Uses

func (k CertPair) AsBytes() (cert []byte, key []byte, err error)

AsBytes encodes keypair in the appropriate formats for on-disk storage (PEM and PKCS8, respectively).

func (CertPair) CertBytes Uses

func (k CertPair) CertBytes() []byte

CertBytes returns the PEM-encoded version of the certificate for this pair.

type DefaultedProcessInput Uses

type DefaultedProcessInput struct {
    URL              url.URL
    Dir              string
    DirNeedsCleaning bool
    Path             string
    StopTimeout      time.Duration
    StartTimeout     time.Duration
}

DefaultedProcessInput defines the default process input required to perform the test.

func DoDefaulting Uses

func DoDefaulting(
    name string,
    listenURL *url.URL,
    dir string,
    path string,
    startTimeout time.Duration,
    stopTimeout time.Duration,
) (DefaultedProcessInput, error)

DoDefaulting sets the default configuration according to the data informed and return an DefaultedProcessInput and an error if some requirement was not informed.

type ProcessState Uses

type ProcessState struct {
    DefaultedProcessInput
    Session *gexec.Session
    // Healthcheck Endpoint. If we get http.StatusOK from this endpoint, we
    // assume the process is ready to operate. E.g. "/healthz". If this is set,
    // we ignore StartMessage.
    HealthCheckEndpoint string
    // HealthCheckPollInterval is the interval which will be used for polling the
    // HealthCheckEndpoint.
    // If left empty it will default to 100 Milliseconds.
    HealthCheckPollInterval time.Duration
    // StartMessage is the message to wait for on stderr. If we receive this
    // message, we assume the process is ready to operate. Ignored if
    // HealthCheckEndpoint is specified.
    //
    // The usage of StartMessage is discouraged, favour HealthCheckEndpoint
    // instead!
    //
    // Deprecated: Use HealthCheckEndpoint in favour of StartMessage
    StartMessage string
    Args         []string
    // contains filtered or unexported fields
}

ProcessState define the state of the process.

func (*ProcessState) Start Uses

func (ps *ProcessState) Start(stdout, stderr io.Writer) (err error)

Start starts the apiserver, waits for it to come up, and returns an error, if occurred.

func (*ProcessState) Stop Uses

func (ps *ProcessState) Stop() error

Stop stops this process gracefully, waits for its termination, and cleans up the CertDir if necessary.

type TinyCA Uses

type TinyCA struct {
    CA CertPair
    // contains filtered or unexported fields
}

TinyCA supports signing serving certs and client-certs, and can be used as an auth mechanism with envtest.

func NewTinyCA Uses

func NewTinyCA() (*TinyCA, error)

NewTinyCA creates a new a tiny CA utility for provisioning serving certs and client certs FOR TESTING ONLY. Don't use this for anything else!

func (*TinyCA) NewServingCert Uses

func (c *TinyCA) NewServingCert() (CertPair, error)

NewServingCert returns a new CertPair for a serving HTTPS on localhost.

Directories

PathSynopsis
integration_testsPackage integrationtests holds the integration tests to run against the framework.

Package internal imports 28 packages (graph) and is imported by 2 packages. Updated 2020-08-04. Refresh now. Tools for package owners.