fixture

package
v1.27.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CERTIFICATE generated by
	// openssl genrsa -out example-key.pem 2048
	// openssl req -new -x509 -days 18250 -key example-key.pem -sha256 -subj "/CN=www.example.com" -out example.pem
	CERTIFICATE = `` /* 1130-byte string literal not displayed */

	CERTIFICATE_WITH_TEXT = CERTIFICATE + "\t\r\n"

	RSA_PRIVATE_KEY = `` /* 1674-byte string literal not displayed */

	// EC_CERTIFICATE sample elliptical curve data generated
	// openssl ecparam -name prime256v1 -genkey -out ec_key.pem
	// openssl req -new -x509 -key ec_key.pem -out ec_crt.pem -days 3650 \
	//     -subj "/C=US/ST=CA/O=Acme" \
	//     -reqexts SAN -extensions SAN -config <(ca t /etc/ssl/openssl.cnf \
	//     <(printf "\n[SAN]\nsubjectAltName=DNS:example.com,DNS:www.example.com"))
	EC_CERTIFICATE = `` /* 578-byte string literal not displayed */

	EC_PRIVATE_KEY = `` /* 301-byte string literal not displayed */

	EC_PARAMETERS = `-----BEGIN EC PARAMETERS-----
BggqhkjOPQMBBw==
-----END EC PARAMETERS-----`

	// MISSING_CN_CERT issue #1965
	// certificate with no CN field.
	// openssl req -new -newkey rsa:2048 -days 365 -nodes -subj="/DC=com/DC=domain/DC=my" -x509 -keyout server.key -out server.crt -sha256
	MISSING_CN_CERT = `` /* 1236-byte string literal not displayed */

	MISSING_CN_KEY = `` /* 1703-byte string literal not displayed */

	// Contour CA Cert and key
	// Generated using:
	// openssl req -x509 -new -nodes -keyout certs/CAkey.pem -sha256 -days 1825 -out certs/CAcert.pem -subj "/O=Project Contour/CN=Contour CA"
	CA_CERT = `` /* 1179-byte string literal not displayed */

	CA_KEY = `` /* 1703-byte string literal not displayed */

	// Contour CA Cert and key, without a CN
	// Generated using:
	// openssl req -x509 -new -nodes -keyout certs/CAkey.pem -sha256 -days 1825 -out certs/CAcert.pem -subj "/O=Project Contour"
	CA_CERT_NO_CN = `` /* 1130-byte string literal not displayed */

	CA_KEY_NO_CN = `` /* 1703-byte string literal not displayed */

	// Wildcard certificate and key
	// See #3496
	// Generated using Contour CA
	// openssl genrsa -out certs/wildcardkey.pem 2048
	// openssl req -new -key certs/wildcardkey.pem -out certs/wildcard.csr -subj "/O=Example/CN=*.example.com"
	// openssl x509 -req -in certs/wildcard.csr -CA certs/CAcert.pem -CAkey certs/CAkey.pem -CAcreateserial -out certs/wildcardcert.pem -days 1825 -sha256 -extfile certs/wildcard.ext
	WILDCARD_CERT = `` /* 1199-byte string literal not displayed */

	WILDCARD_KEY = `` /* 1678-byte string literal not displayed */

	PKCS8_PRIVATE_KEY = `` /* 1703-byte string literal not displayed */

	CRL = `` /* 364-byte string literal not displayed */

)

nolint:revive

Variables

View Source
var SecretProjectContourCert = &v1.Secret{
	ObjectMeta: ObjectMeta("projectcontour/default-ssl-cert"),
	Type:       v1.SecretTypeTLS,
	Data:       SecretRootsCert.Data,
}
View Source
var SecretRootsCert = &v1.Secret{
	ObjectMeta: ObjectMeta("roots/ssl-cert"),
	Type:       v1.SecretTypeTLS,
	Data: map[string][]byte{
		v1.TLSCertKey:       []byte(CERTIFICATE),
		v1.TLSPrivateKeyKey: []byte(RSA_PRIVATE_KEY),
	},
}
View Source
var SecretRootsFallback = &v1.Secret{
	ObjectMeta: ObjectMeta("roots/fallbacksecret"),
	Type:       v1.SecretTypeTLS,
	Data: map[string][]byte{
		v1.TLSCertKey:       []byte(CERTIFICATE),
		v1.TLSPrivateKeyKey: []byte(RSA_PRIVATE_KEY),
	},
}
View Source
var ServiceMarketingGreen = &v1.Service{
	ObjectMeta: ObjectMeta("marketing/green"),
	Spec: v1.ServiceSpec{
		Ports: []v1.ServicePort{{
			Name:     "http",
			Protocol: "TCP",
			Port:     80,
		}},
	},
}
View Source
var ServiceRootsFoo1 = &v1.Service{
	ObjectMeta: ObjectMeta("roots/foo1"),
	Spec: v1.ServiceSpec{
		Ports: []v1.ServicePort{{
			Name:     "http",
			Protocol: "TCP",
			Port:     8080,
		}},
	},
}
View Source
var ServiceRootsFoo2 = &v1.Service{
	ObjectMeta: ObjectMeta("roots/foo2"),
	Spec: v1.ServiceSpec{
		Ports: []v1.ServicePort{{
			Name:     "http",
			Protocol: "TCP",
			Port:     8080,
		}},
	},
}
View Source
var ServiceRootsFoo3InvalidPort = &v1.Service{
	ObjectMeta: ObjectMeta("roots/foo3"),
	Spec: v1.ServiceSpec{
		Ports: []v1.ServicePort{{
			Name:     "http",
			Protocol: "TCP",
			Port:     12345678,
		}},
	},
}
View Source
var ServiceRootsHome = &v1.Service{
	ObjectMeta: ObjectMeta("roots/home"),
	Spec: v1.ServiceSpec{
		Ports: []v1.ServicePort{{
			Name:     "http",
			Protocol: "TCP",
			Port:     8080,
		}},
	},
}
View Source
var ServiceRootsKuard = &v1.Service{
	ObjectMeta: ObjectMeta("roots/kuard"),
	Spec: v1.ServiceSpec{
		Ports: []v1.ServicePort{{
			Name:       "http",
			Protocol:   "TCP",
			Port:       8080,
			TargetPort: intstr.FromInt(8080),
		}},
	},
}
View Source
var ServiceRootsNginx = &v1.Service{
	ObjectMeta: ObjectMeta("roots/nginx"),
	Spec: v1.ServiceSpec{
		Ports: []v1.ServicePort{{
			Protocol: "TCP",
			Port:     80,
		}},
	},
}
View Source
var ServiceTeamAKuard = &v1.Service{
	ObjectMeta: ObjectMeta("teama/kuard"),
	Spec: v1.ServiceSpec{
		Ports: []v1.ServicePort{{
			Name:       "http",
			Protocol:   "TCP",
			Port:       8080,
			TargetPort: intstr.FromInt(8080),
		}},
	},
}
View Source
var ServiceTeamBKuard = &v1.Service{
	ObjectMeta: ObjectMeta("teamb/kuard"),
	Spec: v1.ServiceSpec{
		Ports: []v1.ServicePort{{
			Name:       "http",
			Protocol:   "TCP",
			Port:       8080,
			TargetPort: intstr.FromInt(8080),
		}},
	},
}

Functions

func NewDiscardLogger added in v1.8.0

func NewDiscardLogger() *logrus.Logger

NewDiscardLogger returns logrus.Logger that discards log messages.

func NewTestLogger added in v1.8.0

func NewTestLogger(t *testing.T) *logrus.Logger

NewTestLogger returns logrus.Logger that writes messages using (*testing.T)Logf.

func ObjectMeta

func ObjectMeta(nameStr string) metav1.ObjectMeta

ObjectMeta cracks a Kubernetes object name string of the form "namespace/name" into a metav1.ObjectMeta struct. If the namespace portion is omitted, then the default namespace is filled in.

func ObjectMetaWithAnnotations added in v1.25.0

func ObjectMetaWithAnnotations(nameStr string, annotations map[string]string) metav1.ObjectMeta

ObjectMetaWithAnnotations returns an ObjectMeta with the given annotations.

func UpdateObjectVersion added in v1.25.0

func UpdateObjectVersion(meta *metav1.ObjectMeta) *metav1.ObjectMeta

Types

type DetailedConditionBuilder added in v1.9.0

type DetailedConditionBuilder v1.DetailedCondition

DetailedConditionBuilder is a builder object to make creating HTTPProxy fixtures more succinct.

func NewValidCondition added in v1.9.0

func NewValidCondition() *DetailedConditionBuilder

NewValidCondition creates a new DetailedConditionBuilder.

func (*DetailedConditionBuilder) Orphaned added in v1.9.0

func (*DetailedConditionBuilder) Valid added in v1.9.0

func (*DetailedConditionBuilder) WithError added in v1.9.0

func (dcb *DetailedConditionBuilder) WithError(errorType string, reason, message string) v1.DetailedCondition

func (*DetailedConditionBuilder) WithErrorf added in v1.9.0

func (dcb *DetailedConditionBuilder) WithErrorf(errorType string, reason, formatmsg string, args ...any) v1.DetailedCondition

func (*DetailedConditionBuilder) WithGeneration added in v1.9.0

func (dcb *DetailedConditionBuilder) WithGeneration(gen int64) *DetailedConditionBuilder

func (*DetailedConditionBuilder) WithWarning added in v1.9.0

func (dcb *DetailedConditionBuilder) WithWarning(errorType, reason, message string) v1.DetailedCondition

func (*DetailedConditionBuilder) WithWarningf added in v1.9.0

func (dcb *DetailedConditionBuilder) WithWarningf(warnType, reason, formatmsg string, args ...any) v1.DetailedCondition

type ProxyBuilder

type ProxyBuilder contour_api_v1.HTTPProxy

ProxyBuilder is a builder object to make creating HTTPProxy fixtures more succinct.

func NewProxy

func NewProxy(name string) *ProxyBuilder

NewProxy creates a new ProxyBuilder with the specified object name.

func (*ProxyBuilder) Annotate

func (b *ProxyBuilder) Annotate(k string, v string) *ProxyBuilder

Annotate adds the given values as metadata annotations.

func (*ProxyBuilder) Label

func (b *ProxyBuilder) Label(k string, v string) *ProxyBuilder

Label adds the given values as metadata labels.

func (*ProxyBuilder) WithAuthServer added in v1.9.0

func (*ProxyBuilder) WithCertificate added in v1.9.0

func (b *ProxyBuilder) WithCertificate(secretName string) *ProxyBuilder

func (*ProxyBuilder) WithFQDN

func (b *ProxyBuilder) WithFQDN(fqdn string) *ProxyBuilder

func (*ProxyBuilder) WithSpec

WithSpec updates the builder's Spec field, returning the build proxy.

type ServiceBuilder added in v1.8.0

type ServiceBuilder v1.Service

func NewService added in v1.8.0

func NewService(name string) *ServiceBuilder

NewService creates a new ServiceBuilder with the given resource name.

func (*ServiceBuilder) Annotate added in v1.8.0

func (s *ServiceBuilder) Annotate(k string, v string) *ServiceBuilder

Annotate adds the given values as metadata annotations.

func (*ServiceBuilder) WithPorts added in v1.8.0

func (s *ServiceBuilder) WithPorts(ports ...v1.ServicePort) *v1.Service

WithPorts specifies the ports for the .Spec.Ports field.

func (*ServiceBuilder) WithSpec added in v1.8.0

func (s *ServiceBuilder) WithSpec(spec v1.ServiceSpec) *v1.Service

WithSpec specifies the .Spec field.

Jump to

Keyboard shortcuts

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