Add prefix nginx to annotations
This commit is contained in:
parent
97577c07a5
commit
8f1ff15a6e
54 changed files with 445 additions and 441 deletions
|
|
@ -22,29 +22,24 @@ import (
|
|||
"k8s.io/ingress-nginx/internal/ingress/defaults"
|
||||
)
|
||||
|
||||
// DefaultBackend has a method that returns the backend
|
||||
// that must be used as default
|
||||
type DefaultBackend interface {
|
||||
// Resolver is an interface that knows how to extract information from a controller
|
||||
type Resolver interface {
|
||||
// GetDefaultBackend returns the backend that must be used as default
|
||||
GetDefaultBackend() defaults.Backend
|
||||
}
|
||||
|
||||
// Secret has a method that searches for secrets contenating
|
||||
// the namespace and name using a the character /
|
||||
type Secret interface {
|
||||
// GetSecret searches for secrets contenating the namespace and name using a the character /
|
||||
GetSecret(string) (*apiv1.Secret, error)
|
||||
}
|
||||
|
||||
// AuthCertificate resolves a given secret name into an SSL certificate.
|
||||
// The secret must contain 3 keys named:
|
||||
// ca.crt: contains the certificate chain used for authentication
|
||||
type AuthCertificate interface {
|
||||
// GetAuthCertificate resolves a given secret name into an SSL certificate.
|
||||
// The secret must contain 3 keys named:
|
||||
// ca.crt: contains the certificate chain used for authentication
|
||||
GetAuthCertificate(string) (*AuthSSLCert, error)
|
||||
}
|
||||
|
||||
// Service has a method that searches for services contenating
|
||||
// the namespace and name using a the character /
|
||||
type Service interface {
|
||||
// GetService searches for services contenating the namespace and name using a the character /
|
||||
GetService(string) (*apiv1.Service, error)
|
||||
|
||||
// GetAnnotationWithPrefix returns the prefix of the Ingress annotations
|
||||
GetAnnotationWithPrefix(suffix string) string
|
||||
}
|
||||
|
||||
// AuthSSLCert contains the necessary information to do certificate based
|
||||
|
|
|
|||
56
internal/ingress/resolver/mock.go
Normal file
56
internal/ingress/resolver/mock.go
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes 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.
|
||||
*/
|
||||
|
||||
package resolver
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
|
||||
"k8s.io/ingress-nginx/internal/ingress/defaults"
|
||||
)
|
||||
|
||||
// Mock implements the Resolver interface
|
||||
type Mock struct {
|
||||
}
|
||||
|
||||
// GetDefaultBackend returns the backend that must be used as default
|
||||
func (m Mock) GetDefaultBackend() defaults.Backend {
|
||||
return defaults.Backend{}
|
||||
}
|
||||
|
||||
// GetSecret searches for secrets contenating the namespace and name using a the character /
|
||||
func (m Mock) GetSecret(string) (*apiv1.Secret, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// GetAuthCertificate resolves a given secret name into an SSL certificate.
|
||||
// The secret must contain 3 keys named:
|
||||
// ca.crt: contains the certificate chain used for authentication
|
||||
func (m Mock) GetAuthCertificate(string) (*AuthSSLCert, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// GetService searches for services contenating the namespace and name using a the character /
|
||||
func (m Mock) GetService(string) (*apiv1.Service, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// GetAnnotationWithPrefix returns the prefix of the Ingress annotations
|
||||
func (m Mock) GetAnnotationWithPrefix(name string) string {
|
||||
return fmt.Sprintf("nginx/%v", name)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue