Documentation ¶
Index ¶
- Constants
- Variables
- func NewDiscardLogger() *logrus.Logger
- func NewTestLogger(t *testing.T) *logrus.Logger
- func ObjectMeta(nameStr string) metav1.ObjectMeta
- func ObjectMetaWithAnnotations(nameStr string, annotations map[string]string) metav1.ObjectMeta
- func UpdateObjectVersion(meta *metav1.ObjectMeta) *metav1.ObjectMeta
- type DetailedConditionBuilder
- func (dcb *DetailedConditionBuilder) Orphaned() v1.DetailedCondition
- func (dcb *DetailedConditionBuilder) Valid() v1.DetailedCondition
- func (dcb *DetailedConditionBuilder) WithError(errorType string, reason, message string) v1.DetailedCondition
- func (dcb *DetailedConditionBuilder) WithErrorf(errorType string, reason, formatmsg string, args ...any) v1.DetailedCondition
- func (dcb *DetailedConditionBuilder) WithGeneration(gen int64) *DetailedConditionBuilder
- func (dcb *DetailedConditionBuilder) WithWarning(errorType, reason, message string) v1.DetailedCondition
- func (dcb *DetailedConditionBuilder) WithWarningf(warnType, reason, formatmsg string, args ...any) v1.DetailedCondition
- type ProxyBuilder
- func (b *ProxyBuilder) Annotate(k string, v string) *ProxyBuilder
- func (b *ProxyBuilder) Label(k string, v string) *ProxyBuilder
- func (b *ProxyBuilder) WithAuthServer(auth contour_api_v1.AuthorizationServer) *ProxyBuilder
- func (b *ProxyBuilder) WithCertificate(secretName string) *ProxyBuilder
- func (b *ProxyBuilder) WithFQDN(fqdn string) *ProxyBuilder
- func (b *ProxyBuilder) WithSpec(spec contour_api_v1.HTTPProxySpec) *contour_api_v1.HTTPProxy
- type ServiceBuilder
Constants ¶
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 ¶
var SecretProjectContourCert = &v1.Secret{ ObjectMeta: ObjectMeta("projectcontour/default-ssl-cert"), Type: v1.SecretTypeTLS, Data: SecretRootsCert.Data, }
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), }, }
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), }, }
var ServiceMarketingGreen = &v1.Service{ ObjectMeta: ObjectMeta("marketing/green"), Spec: v1.ServiceSpec{ Ports: []v1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 80, }}, }, }
var ServiceRootsFoo1 = &v1.Service{ ObjectMeta: ObjectMeta("roots/foo1"), Spec: v1.ServiceSpec{ Ports: []v1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, }}, }, }
var ServiceRootsFoo2 = &v1.Service{ ObjectMeta: ObjectMeta("roots/foo2"), Spec: v1.ServiceSpec{ Ports: []v1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, }}, }, }
var ServiceRootsFoo3InvalidPort = &v1.Service{ ObjectMeta: ObjectMeta("roots/foo3"), Spec: v1.ServiceSpec{ Ports: []v1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 12345678, }}, }, }
var ServiceRootsHome = &v1.Service{ ObjectMeta: ObjectMeta("roots/home"), Spec: v1.ServiceSpec{ Ports: []v1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, }}, }, }
var ServiceRootsKuard = &v1.Service{ ObjectMeta: ObjectMeta("roots/kuard"), Spec: v1.ServiceSpec{ Ports: []v1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), }}, }, }
var ServiceRootsNginx = &v1.Service{ ObjectMeta: ObjectMeta("roots/nginx"), Spec: v1.ServiceSpec{ Ports: []v1.ServicePort{{ Protocol: "TCP", Port: 80, }}, }, }
var ServiceTeamAKuard = &v1.Service{ ObjectMeta: ObjectMeta("teama/kuard"), Spec: v1.ServiceSpec{ Ports: []v1.ServicePort{{ Name: "http", Protocol: "TCP", Port: 8080, TargetPort: intstr.FromInt(8080), }}, }, }
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
NewDiscardLogger returns logrus.Logger that discards log messages.
func NewTestLogger ¶ added in v1.8.0
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 (dcb *DetailedConditionBuilder) Orphaned() v1.DetailedCondition
func (*DetailedConditionBuilder) Valid ¶ added in v1.9.0
func (dcb *DetailedConditionBuilder) Valid() v1.DetailedCondition
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 (b *ProxyBuilder) WithAuthServer(auth contour_api_v1.AuthorizationServer) *ProxyBuilder
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 ¶
func (b *ProxyBuilder) WithSpec(spec contour_api_v1.HTTPProxySpec) *contour_api_v1.HTTPProxy
WithSpec updates the builder's Spec field, returning the build proxy.
type ServiceBuilder ¶ added in v1.8.0
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.