utils

package
v0.0.0-...-0c92d4c Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: Apache-2.0, BSD-3-Clause, ISC, + 2 more Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GardenPurpose is the key of a label which is used for managed resources.
	GardenPurpose = "garden.sapcloud.io/purpose"
	// GardenCount is the key for count value
	GardenCount = "garden.sapcloud.io/count"
	// ManagedCert is a common identifier for Cert-Broker.
	ManagedCert = "managed-cert"
	// IngressRel is the key of a label which identifies the resource's Ingress relation.
	IngressRel = "garden.sapcloud.io/ingress-rel"
	// CertManagerGroup is the group of the Certificate object
	CertManagerGroup = "certmanager.k8s.io"
	// CertificateKind is the name of Cert-Manager's certificate
	CertificateKind = "Certificate"
	// CertificateResource is the resource name of Cert-Manager's certificate
	CertificateResource = "certificates"
	// CertificateVersion is the version for Cert-Manager's certificate
	CertificateVersion = "v1alpha1"
	// IngressKind is the name of the Ingress kind
	IngressKind = "Ingress"
)
View Source
const DNSProviderKey = "certmanager.k8s.io/acme-dns01-provider"

DNSProviderKey is the key used for an Ingress annotation to provider for ACME DNS01 challenge.

Variables

CertGvr is the Group, Version, Resource information for Cert-Manager's Certificate

Functions

func CleanUpIngressAndTLSSecrets

func CleanUpIngressAndTLSSecrets(client kubernetes.Interface, ingress *v1beta1.Ingress, logger *log.Entry) error

CleanUpIngressAndTLSSecrets deletes the given Ingress as well as it's configured Secrets.

func CreateNameForControlCluster

func CreateNameForControlCluster(namespace string, name string) string

CreateNameForControlCluster creates a resource name used by the control cluster. This is especially used to avoid name clashes in the control cluster.

func CreateRecorder

func CreateRecorder(kubeClient kubernetes.Interface, logger *log.Entry, componentName string) record.EventRecorder

CreateRecorder creates an EventRecorder for the given client.

func FilterOnIngressLables

func FilterOnIngressLables(obj interface{}) bool

FilterOnIngressLables takes an Ingress and returns whether it has a label dedicated to resources managed by Cert-Broker.

func SplitNamespace

func SplitNamespace(combinedString string) (namespace, name string)

SplitNamespace cuts out the namespaces and name portion of the given string. The string must have a format used by the control cluster, i.e. "cert-broker.<target-cluster-namespace>.<name>" If the format varies, namespace and name will be empty.

Types

type ControlClusterResourceFilter

type ControlClusterResourceFilter struct {
	Namespace string
}

ControlClusterResourceFilter is a helper object that has filter functionalities on K8s resources managed by Cert-Broker in the control cluster. The scope of the filter is also defined by the given Namespace.

func (*ControlClusterResourceFilter) FilterMethod

func (f *ControlClusterResourceFilter) FilterMethod() func(object interface{}) bool

FilterMethod returns a method that returns whether a K8s resource of an observed Namespace is managed by Cert-Broker.

type CreateIngressAnnotation

type CreateIngressAnnotation func() map[string]string

CreateIngressAnnotation creates the Cert-Manager annotation section for Ingress resources

type IngressTemplate

type IngressTemplate struct {
	// contains filtered or unexported fields
}

IngressTemplate holds the information necessary for Ingress resources managed by Cert-Manager.

func CreateIngressTemplate

func CreateIngressTemplate(issuerName, challengeType string) *IngressTemplate

CreateIngressTemplate creates an instance of IngressTemplate.

func (*IngressTemplate) CreateControlIngress

func (t *IngressTemplate) CreateControlIngress(name, namespace, dnsProvider string, tls []v1beta1.IngressTLS) *v1beta1.Ingress

CreateControlIngress creates an Ingress object which includes the given name, namespace and TLS info. Further settings which are necessary for the control cluster are set by this method.

func (*IngressTemplate) CreateIngressAnnotations

func (t *IngressTemplate) CreateIngressAnnotations() map[string]string

CreateIngressAnnotations creates annotations turning an Ingress to a Cert-Manager managed resource.

Jump to

Keyboard shortcuts

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