fixture

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright Project Contour Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright Project Contour Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// generated by https://www.selfsignedcertificate.com
	CERTIFICATE = `` /* 1138-byte string literal not displayed */

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

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

	// 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 */

	// 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 = `` /* 1237-byte string literal not displayed */

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

)

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 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.

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 ...interface{}) 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 ...interface{}) 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