Documentation
¶
Index ¶
- Constants
- Variables
- func All(arr []bool) bool
- func Any(arr []bool) bool
- func ArrayContains(a []string, x string) bool
- func ArrayFind(a []string, x string) int
- func ArrayStringDifference(a, b []string) []string
- func ArrayStringIntersection(a, b []string) []string
- func BasePathFromOpenAPI(obj *openapi3.T) (string, error)
- func BaseURLFromOpenAPI(obj *openapi3.T) (string, error)
- func CmpResourceList(a, b *v1.ResourceList) bool
- func CmpResources(a, b *v1.ResourceRequirements) bool
- func CompareOpenshiftVersion(ctx context.Context, client client.Client, version string) (int, bool, error)
- func DNS1123Name(in string) string
- func EnsureEnvVar(desired v1.EnvVar, existingEnvVars *[]v1.EnvVar) bool
- func EnsureObjectMeta(existing, desired common.KubernetesObject) bool
- func EnsureString(modified *bool, existing *string, required string)
- func EnvVarFromConfigMap(envVarName string, configMapName, configMapKey string) v1.EnvVar
- func EnvVarFromConfigMapOptional(envVarName string, configMapName, configMapKey string) v1.EnvVar
- func EnvVarFromSecret(envVarName string, secretName, secretKey string) v1.EnvVar
- func EnvVarFromSecretOptional(envVarName string, secretName, secretKey string) v1.EnvVar
- func EnvVarFromValue(name string, value string) v1.EnvVar
- func FindContainerPortByName(ports []v1.ContainerPort, name string) (v1.ContainerPort, bool)
- func FindEnvVar(a []v1.EnvVar, x string) int
- func FindVolumeByName(a []v1.Volume, name string) int
- func FindVolumeMountByMountPath(a []v1.VolumeMount, x v1.VolumeMount) int
- func FindVolumeMountByName(a []v1.VolumeMount, name string) int
- func FirstServerFromOpenAPI(obj *openapi3.T) *openapi3.Server
- func GenericConsoleLinkMutator(existingObj, desiredObj common.KubernetesObject) (bool, error)
- func GetEnvVar(key, def string) string
- func GetMasterConsoleLink(route *routev1.Route) *consolev1.ConsoleLink
- func GetMasterConsoleLinkName(namespace string) string
- func GetOpenshiftVersion(ctx context.Context, client client.Client) (string, bool, error)
- func GetSecret(name string, namespace string, client k8sclient.Client) (*v1.Secret, error)
- func GetSecretDataFromStringData(secretStringData map[string]string) map[string][]byte
- func GetSecretDataValue(secretData map[string][]byte, fieldName string) *string
- func GetSecretDataValueOrDefault(secretData map[string][]byte, fieldName string, defaultValue string) string
- func GetSecretStringDataFromData(secretData map[string][]byte) map[string]string
- func GetStringPointerValueOrDefault(val *string, def string) string
- func IsDeploymentConfigAvailable(dc *appsv1.DeploymentConfig) bool
- func IsEmailValid(e string) bool
- func IsInvalidSpecError(err error) bool
- func IsOrphanSpecError(err error) bool
- func IsRouteReady(route *routev1.Route) bool
- func IsWaitError(err error) bool
- func K8sNameFromOpenAPITitle(obj *openapi3.T) string
- func MarshalObjectToYAML(object runtime.Object) ([]byte, error)
- func MergeMapStringString(modified *bool, existing *map[string]string, desired map[string]string)
- func MergeSecretData(from, to map[string][]byte) map[string][]byte
- func MeteringLabels(componentName string, componentType ComponentType) map[string]string
- func MethodNameFromOpenAPIOperation(path, opVerb string, op *openapi3.Operation) string
- func MethodSystemNameFromOpenAPIOperation(path, opVerb string, op *openapi3.Operation) string
- func PortFromURL(url *url.URL) int
- func RenderOpenAPIServerURL(server *openapi3.Server) (*url.URL, error)
- func RenderOpenAPIServerURLStr(server *openapi3.Server) (string, error)
- func RouteFindByHost(a []routev1.Route, routeHost string) int
- func SetURLDefaultPort(rawurl string) string
- func SortedMapStringStringKeys(input map[string]string) []string
- func SortedMapStringStringValues(input map[string]string) []string
- func StringSliceEqualWithoutOrder(x, y []string) bool
- func SumRateForOpenshiftVersion(ctx context.Context, client client.Client) (string, error)
- func SystemNameFromOpenAPITitle(obj *openapi3.T) string
- func UIDBasedJobName(prefix string, uid types.UID) (string, error)
- func ValidateTLSSecret(nn types.NamespacedName, client k8sclient.Client) error
- func VolumeFromSecretEqual(a v1.Volume, b v1.Volume) bool
- type ComponentType
- type ExtendedSecurityRequirement
- type FieldTypeError
- type MemoryCache
- type SecretCacheElement
- type SecretSource
- func (s *SecretSource) CachedSecret(secretName string) (*v1.Secret, error)
- func (s *SecretSource) FieldValue(secretName, fieldName string, def string) (string, error)
- func (s *SecretSource) FieldValueFromRequiredSecret(secretName, fieldName string, def string) (string, error)
- func (s *SecretSource) RequiredFieldValueFromRequiredSecret(secretName, fieldName string) (string, error)
- type SpecError
- type SpecFieldError
- type TaskRunner
- type Transport
- type WaitError
Constants ¶
const ConsoleLinkMasterNamePrefix = "system-master-link"
ConsoleLinkMasterNamePrefix is the prefix applied to Console link for system master
const ConsoleLinkText = "APIManager - 3scale"
ConsoleLinkText is the text of the consoleLink shown on the webconsole
Variables ¶
var ( // NonWordCharRegexp not word characters (== [^0-9A-Za-z_]) NonWordCharRegexp = regexp.MustCompile(`\W`) // TemplateRegexp used to render openapi server URLs TemplateRegexp = regexp.MustCompile(`{([\w]+)}`) // NonAlphanumRegexp not alphanumeric NonAlphanumRegexp = regexp.MustCompile(`[^0-9A-Za-z]`) )
var DefaultTransport = &Transport{ Transport: http.DefaultTransport, }
DefaultTransport is the default logging transport that wraps http.DefaultTransport.
var (
ErrNonExistentKey = errors.New("non-existent key")
)
Errors
var ( // InvalidDNS1123Regexp not alphanumeric InvalidDNS1123Regexp = regexp.MustCompile(`[^0-9A-Za-z-]`) )
Functions ¶
func ArrayContains ¶ added in v0.7.0
ArrayContains tells whether a contains x.
func ArrayFind ¶ added in v0.7.0
ArrayFind returns the smallest index i at which x == a[i], or len(a) if there is no such index.
func ArrayStringDifference ¶ added in v0.6.0
func ArrayStringIntersection ¶ added in v0.6.0
func BasePathFromOpenAPI ¶ added in v0.8.0
func CmpResourceList ¶ added in v0.4.0
func CmpResourceList(a, b *v1.ResourceList) bool
CmpResourceList returns true if the resourceList a is equal to b,
func CmpResources ¶ added in v0.4.0
func CmpResources(a, b *v1.ResourceRequirements) bool
CmpResources returns true if the resource requirements a is equal to b,
func CompareOpenshiftVersion ¶ added in v0.10.0
func DNS1123Name ¶ added in v0.8.0
func EnsureEnvVar ¶ added in v0.8.0
EnsureEnvVar updates existingEnvVars with desired, reconciling any possible differences. It returns whether existingEnvVars has been modified.
func EnsureObjectMeta ¶ added in v0.4.0
func EnsureObjectMeta(existing, desired common.KubernetesObject) bool
EnsureObjectMeta ensure Labels, Annotations
func EnsureString ¶ added in v0.4.0
func EnvVarFromConfigMap ¶ added in v0.6.0
func EnvVarFromConfigMapOptional ¶ added in v0.6.0
func EnvVarFromSecret ¶ added in v0.6.0
func EnvVarFromSecretOptional ¶ added in v0.6.0
func FindContainerPortByName ¶ added in v0.6.0
func FindContainerPortByName(ports []v1.ContainerPort, name string) (v1.ContainerPort, bool)
func FindEnvVar ¶ added in v0.6.0
FindEnvVar returns the smallest index i at which x == a[i], or -1 if there is no such index.
func FindVolumeByName ¶ added in v0.8.0
FindVolumeByName returns the smallest index i at which x.Name == a[i].Name, or -1 if there is no such index.
func FindVolumeMountByMountPath ¶ added in v0.8.0
func FindVolumeMountByMountPath(a []v1.VolumeMount, x v1.VolumeMount) int
FindVolumeMountByMountPath returns the smallest index i at which x.MountPath == a[i].MountPath, or -1 if there is no such index.
func FindVolumeMountByName ¶ added in v0.8.0
func FindVolumeMountByName(a []v1.VolumeMount, name string) int
FindVolumeMountByMountPath returns the smallest index i at which x.MountPath == a[i].MountPath, or -1 if there is no such index.
func FirstServerFromOpenAPI ¶ added in v0.8.0
func GenericConsoleLinkMutator ¶ added in v0.7.0
func GenericConsoleLinkMutator(existingObj, desiredObj common.KubernetesObject) (bool, error)
GenericConsoleLinkMutator performs the reconciliation for consolelink objects
func GetMasterConsoleLink ¶ added in v0.7.0
func GetMasterConsoleLink(route *routev1.Route) *consolev1.ConsoleLink
GetMasterConsoleLink creates the consolelink obj for a target
func GetMasterConsoleLinkName ¶ added in v0.7.0
GetMasterConsoleLinkName returns the consolelink name
func GetOpenshiftVersion ¶ added in v0.10.0
func GetSecretDataFromStringData ¶ added in v0.5.0
func GetSecretDataValue ¶ added in v0.5.0
func GetSecretDataValueOrDefault ¶ added in v0.5.0
func GetSecretStringDataFromData ¶ added in v0.5.0
func GetStringPointerValueOrDefault ¶ added in v0.5.0
func IsDeploymentConfigAvailable ¶ added in v0.8.0
func IsDeploymentConfigAvailable(dc *appsv1.DeploymentConfig) bool
IsDeploymentConfigAvailable returns true when the provided DeploymentConfig has the "Available" condition set to true
func IsEmailValid ¶ added in v0.8.0
IsEmailValid checks the structure of the email address Based on regex by W3C https://www.w3.org/TR/2016/REC-html51-20161101/sec-forms.html#email-state-typeemail
func IsInvalidSpecError ¶ added in v0.6.0
func IsOrphanSpecError ¶ added in v0.6.0
func IsRouteReady ¶ added in v0.8.0
IsRouteReady returns true when all Ingresses of the Route have the "Admitted" Condition set to true
func IsWaitError ¶ added in v0.8.0
func K8sNameFromOpenAPITitle ¶ added in v0.8.0
func MarshalObjectToYAML ¶ added in v0.6.0
func MergeMapStringString ¶ added in v0.4.0
func MergeSecretData ¶ added in v0.5.0
Returns a new map containing the contents of `from` and the contents of `to`. The value for entries with duplicated keys will be that of `from`
func MeteringLabels ¶ added in v0.6.0
func MeteringLabels(componentName string, componentType ComponentType) map[string]string
func MethodNameFromOpenAPIOperation ¶ added in v0.8.0
func MethodSystemNameFromOpenAPIOperation ¶ added in v0.8.0
func PortFromURL ¶
PortFromURL infers port number if it is not explict
func RenderOpenAPIServerURL ¶ added in v0.8.0
func RenderOpenAPIServerURLStr ¶ added in v0.8.0
func RouteFindByHost ¶ added in v0.8.0
RouteFindByHost returns the smallest index i at which a route with a given host is found or -1 if there is no such index.
func SetURLDefaultPort ¶
SetURLDefaultPort adds the default Port if not set
func SortedMapStringStringKeys ¶ added in v0.6.0
func SortedMapStringStringValues ¶ added in v0.6.0
func StringSliceEqualWithoutOrder ¶ added in v0.8.0
https://newbedev.com/check-for-equality-on-slices-without-order
func SumRateForOpenshiftVersion ¶ added in v0.10.0
func SystemNameFromOpenAPITitle ¶ added in v0.8.0
func UIDBasedJobName ¶ added in v0.6.0
UIDBasedJobName returns a Job name that is compromised of the provided prefix, a hyphen and the provided uid: "<prefix>-<uid>". The returned name is a DNS1123 Label compliant name. Due to UIDs are 36 characters of length this means that the maximum prefix lenght that can be provided is of 26 characters. If the generated name is not DNS1123 compliant an error is returned
func ValidateTLSSecret ¶ added in v0.8.0
func ValidateTLSSecret(nn types.NamespacedName, client k8sclient.Client) error
Types ¶
type ComponentType ¶ added in v0.6.0
type ComponentType string
const ( ApplicationType ComponentType = "application" InfrastructureType ComponentType = "infrastructure" )
type ExtendedSecurityRequirement ¶ added in v0.8.0
type ExtendedSecurityRequirement struct { *openapi3.SecuritySchemeRef Scopes []string }
func NewExtendedSecurityRequirement ¶ added in v0.8.0
func NewExtendedSecurityRequirement(secSchemeRef *openapi3.SecuritySchemeRef, scopes []string) *ExtendedSecurityRequirement
func OpenAPIGlobalSecurityRequirements ¶ added in v0.8.0
func OpenAPIGlobalSecurityRequirements(openapiObj *openapi3.T) []*ExtendedSecurityRequirement
type FieldTypeError ¶ added in v0.6.0
type FieldTypeError int
const ( // InvalidError represents that the combination of configuration in the resource spec // is not supported. This is not a transient error, but // indicates a state that must be fixed before progress can be made. // Example: the two mutually exclusive attributes have been set. InvalidError FieldTypeError = iota // OrphanError represents that the configuration in the resource spec // contains reference to some not existing resource. // This is (should be) a transient error, but // indicates a state that must be fixed before progress can be made. // Example: the product Spec references non existing backend resource OrphanError )
type MemoryCache ¶ added in v0.6.0
type MemoryCache struct {
// contains filtered or unexported fields
}
MemoryCache implements a simple memory cache No expiration No eviction policies Not threadsafe
func NewMemoryCache ¶ added in v0.6.0
func NewMemoryCache() *MemoryCache
func (*MemoryCache) Exists ¶ added in v0.6.0
func (c *MemoryCache) Exists(key string) bool
func (*MemoryCache) Get ¶ added in v0.6.0
func (c *MemoryCache) Get(key string) (interface{}, error)
func (*MemoryCache) Put ¶ added in v0.6.0
func (c *MemoryCache) Put(key string, data interface{})
type SecretCacheElement ¶ added in v0.6.0
type SecretSource ¶ added in v0.6.0
type SecretSource struct {
// contains filtered or unexported fields
}
func NewSecretSource ¶ added in v0.6.0
func NewSecretSource(client k8sclient.Client, namespace string) *SecretSource
func (*SecretSource) CachedSecret ¶ added in v0.6.0
func (s *SecretSource) CachedSecret(secretName string) (*v1.Secret, error)
func (*SecretSource) FieldValue ¶ added in v0.6.0
func (s *SecretSource) FieldValue(secretName, fieldName string, def string) (string, error)
func (*SecretSource) FieldValueFromRequiredSecret ¶ added in v0.6.0
func (s *SecretSource) FieldValueFromRequiredSecret(secretName, fieldName string, def string) (string, error)
func (*SecretSource) RequiredFieldValueFromRequiredSecret ¶ added in v0.6.0
func (s *SecretSource) RequiredFieldValueFromRequiredSecret(secretName, fieldName string) (string, error)
type SpecError ¶ added in v0.6.0
type SpecError interface { error FieldType() FieldTypeError }
SpecError is exposed by errors that can be converted to an api.Status object for finer grained details.
type SpecFieldError ¶ added in v0.6.0
type SpecFieldError struct { ErrorType FieldTypeError FieldErrorList field.ErrorList }
func (*SpecFieldError) Error ¶ added in v0.6.0
func (s *SpecFieldError) Error() string
Error implements the Error interface.
func (*SpecFieldError) FieldType ¶ added in v0.6.0
func (s *SpecFieldError) FieldType() FieldTypeError
FieldType implements the SpecError interface.
type TaskRunner ¶ added in v0.6.0
type TaskRunner interface { Run() error // AddTask register tasks to be executed sequentially // Tasks will be executed in order. First in, first to be executed. AddTask(string, func(interface{}) error) }
TaskRunner abstracts task running engine
func NewTaskRunner ¶ added in v0.6.0
func NewTaskRunner(ctx interface{}, logger logr.Logger) TaskRunner
NewTaskRunner TaskRunner Constructor
type Transport ¶ added in v0.6.0
type Transport struct {
Transport http.RoundTripper
}
Transport implements http.RoundTripper. When set as Transport of http.Client, it executes HTTP requests with logging. No field is mandatory.
Source Files
¶
- boolean_utils.go
- cache.go
- container_port_utils.go
- deploymentconfig.go
- email.go
- envvarutils.go
- errors.go
- helper.go
- job.go
- labels.go
- loghttp.go
- maputils.go
- object_meta_merger.go
- openapi_utils.go
- openshift.go
- route.go
- runtime_object.go
- secretutils.go
- slice_string_utils.go
- task_runner.go
- volume_utils.go
- volumemount_utils.go
- webconsole.go