util

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: UPL-1.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IngressClassLoadBalancerIdAnnotation = "oci-native-ingress.oraclecloud.com/id"
	IngressClassIsDefault                = "ingressclass.kubernetes.io/is-default-class"

	PodReadinessConditionPrefix = "podreadiness.ingress.oraclecloud.com"

	IngressControllerFinalizer = "oci.oraclecloud.com/ingress-controller-protection"

	// IngressClassParameter annotation to select service account to be used to exchange
	// for Workload Identity Token which can then be used to communicate to OCI APIs
	IngressClassServiceAccountName = "oci.oraclecloud.com/workload-service-account"

	ParentRPTURL = "opc-parent-rpt-url"

	IngressListenerTlsCertificateAnnotation = "oci-native-ingress.oraclecloud.com/certificate-ocid"
	IngressBackendTlsEnabledAnnotation      = "oci-native-ingress.oraclecloud.com/backend-tls-enabled"

	// IngressProtocolAnntoation - HTTP only for now
	// HTTP, HTTP2, TCP - accepted.
	IngressProtocolAnnotation = "oci-native-ingress.oraclecloud.com/protocol"

	IngressPolicyAnnotation                       = "oci-native-ingress.oraclecloud.com/policy"
	IngressClassWafPolicyAnnotation               = "oci-native-ingress.oraclecloud.com/waf-policy-ocid"
	IngressClassFireWallIdAnnotation              = "oci-native-ingress.oraclecloud.com/firewall-id"
	IngressClassNetworkSecurityGroupIdsAnnotation = "oci-native-ingress.oraclecloud.com/network-security-group-ids"
	IngressClassDeleteProtectionEnabledAnnotation = "oci-native-ingress.oraclecloud.com/delete-protection-enabled"
	IngressClassDefinedTagsAnnotation             = "oci-native-ingress.oraclecloud.com/defined-tags"
	IngressClassFreeformTagsAnnotation            = "oci-native-ingress.oraclecloud.com/freeform-tags"
	IngressClassImplicitDefaultTagsAnnotation     = "oci-native-ingress.oraclecloud.com/implicit-default-tags"

	IngressHealthCheckProtocolAnnotation             = "oci-native-ingress.oraclecloud.com/healthcheck-protocol"
	IngressHealthCheckPortAnnotation                 = "oci-native-ingress.oraclecloud.com/healthcheck-port"
	IngressHealthCheckPathAnnotation                 = "oci-native-ingress.oraclecloud.com/healthcheck-path"
	IngressHealthCheckIntervalMillisecondsAnnotation = "oci-native-ingress.oraclecloud.com/healthcheck-interval-milliseconds"
	IngressHealthCheckTimeoutMillisecondsAnnotation  = "oci-native-ingress.oraclecloud.com/healthcheck-timeout-milliseconds"
	IngressHealthCheckRetriesAnnotation              = "oci-native-ingress.oraclecloud.com/healthcheck-retries"
	IngressHealthCheckReturnCodeAnnotation           = "oci-native-ingress.oraclecloud.com/healthcheck-return-code"
	IngressHealthCheckResponseBodyRegexAnnotation    = "oci-native-ingress.oraclecloud.com/healthcheck-response-regex"
	IngressHealthCheckForcePlainTextAnnotation       = "oci-native-ingress.oraclecloud.com/healthcheck-force-plaintext"
	IngressHttpListenerPortAnnotation                = "oci-native-ingress.oraclecloud.com/http-listener-port"
	IngressHttpsListenerPortAnnotation               = "oci-native-ingress.oraclecloud.com/https-listener-port"

	ProtocolTCP                            = "TCP"
	ProtocolHTTP                           = "HTTP"
	ProtocolHTTP2                          = "HTTP2"
	ProtocolHTTP2DefaultCipherSuite        = "oci-default-http2-ssl-cipher-suite-v1"
	DefaultBackendSetName                  = "default_ingress"
	DefaultHealthCheckProtocol             = ProtocolTCP
	DefaultHealthCheckPort                 = 0
	ZeroPort                               = 0
	DefaultHealthCheckTimeOutMilliSeconds  = 3000
	DefaultHealthCheckIntervalMilliSeconds = 10000
	DefaultHealthCheckRetries              = 3
	DefaultHealthCheckReturnCode           = 200
	DefaultBackendSetRoutingPolicy         = "LEAST_CONNECTIONS"

	CertificateCacheMaxAgeInMinutes = 10
	LBCacheMaxAgeInMinutes          = 1
	WAFCacheMaxAgeInMinutes         = 5
	OciClientNotFoundInContextError = "oci client not found in the context"
	WrapperClient                   = "wrapperClient"
)
View Source
const (
	ToBeDeletedTaint = "ToBeDeletedByClusterAutoscaler"
)

Variables

View Source
var ErrIngressClassNotReady = errors.New("ingress class not ready")

Functions

func DetermineListenerPort added in v1.3.7

func DetermineListenerPort(ingress *networkingv1.Ingress, tlsConfiguredHosts *sets.String, host string, servicePort int32) (int32, error)

func FakeClientGetCall added in v1.1.0

func FakeClientGetCall(client *fakeclientset.Clientset, action string, resource string, obj runtime.Object)

func GenerateBackendSetName

func GenerateBackendSetName(namespace string, serviceName string, port int32) string

func GenerateListenerName

func GenerateListenerName(servicePort int32) string

func GetBackendTlsEnabled added in v1.3.3

func GetBackendTlsEnabled(i *networkingv1.Ingress) bool

func GetCurrentTimeInUnixMillis added in v0.0.3

func GetCurrentTimeInUnixMillis() int64

func GetDefaultHeathChecker

func GetDefaultHeathChecker() *ociloadbalancer.HealthCheckerDetails

func GetEndpoints added in v1.3.0

func GetEndpoints(lister corelisters.EndpointsLister, namespace string, service string) ([]corev1.EndpointAddress, error)

func GetEndpointsListerResource added in v1.3.9

func GetEndpointsListerResource(endpointsList *v1.EndpointsList) corelisters.EndpointsLister

func GetEndpointsResource added in v1.1.0

func GetEndpointsResource(namespace string, name string, ports []v1.EndpointPort) v1.Endpoints

func GetEndpointsResourceList added in v1.1.0

func GetEndpointsResourceList(name string, namespace string, allCase bool) *v1.EndpointsList

func GetEndpointsResourceListAllCase added in v1.3.9

func GetEndpointsResourceListAllCase(name string, namespace string) *v1.EndpointsList

func GetHTTPPath added in v1.1.0

func GetHTTPPath() networkingv1.HTTPIngressPath

func GetIngressClass

func GetIngressClass(ingress *networkingv1.Ingress, ingressClassLister networkinglisters.IngressClassLister) (*networkingv1.IngressClass, error)

GetIngressClass returns non-nil error only if it's unable to list IngressClass resources. Returns (nil, nil) if no matching IngressClass found.

func GetIngressClassCompartmentId

func GetIngressClassCompartmentId(p *v1beta1.IngressClassParameters, defaultCompartment string) string

func GetIngressClassDeleteProtectionEnabled added in v1.4.0

func GetIngressClassDeleteProtectionEnabled(ic *networkingv1.IngressClass) bool

func GetIngressClassFireWallId added in v1.1.0

func GetIngressClassFireWallId(ic *networkingv1.IngressClass) string

func GetIngressClassFreeformTags added in v1.4.0

func GetIngressClassFreeformTags(ic *networkingv1.IngressClass) (map[string]string, error)

func GetIngressClassList added in v1.1.0

func GetIngressClassList() *networkingv1.IngressClassList

func GetIngressClassListWithLBSet added in v1.1.0

func GetIngressClassListWithLBSet(lbId string) *networkingv1.IngressClassList

func GetIngressClassListWithNginx added in v1.1.0

func GetIngressClassListWithNginx() *networkingv1.IngressClassList

func GetIngressClassLoadBalancerId

func GetIngressClassLoadBalancerId(ic *networkingv1.IngressClass) string

func GetIngressClassNetworkSecurityGroupIds added in v1.4.0

func GetIngressClassNetworkSecurityGroupIds(ic *networkingv1.IngressClass) []string

func GetIngressClassResource added in v1.1.0

func GetIngressClassResource(name string, isDefault bool, controller string) *networkingv1.IngressClass

func GetIngressClassResourceWithAnnotation added in v1.1.0

func GetIngressClassResourceWithAnnotation(name string, annotation map[string]string, controller string) *networkingv1.IngressClassList

func GetIngressClassResourceWithLbId added in v1.1.0

func GetIngressClassResourceWithLbId(name string, isDefault bool, controller string, lbid string) *networkingv1.IngressClass

func GetIngressClassSubnetId

func GetIngressClassSubnetId(p *v1beta1.IngressClassParameters, defaultSubnet string) string

func GetIngressClassWafPolicy added in v1.1.0

func GetIngressClassWafPolicy(ic *networkingv1.IngressClass) string

func GetIngressHealthCheckForcePlainText

func GetIngressHealthCheckForcePlainText(i *networkingv1.Ingress) bool

func GetIngressHealthCheckIntervalMilliseconds

func GetIngressHealthCheckIntervalMilliseconds(i *networkingv1.Ingress) (int, error)

func GetIngressHealthCheckPath

func GetIngressHealthCheckPath(i *networkingv1.Ingress) string

func GetIngressHealthCheckPort

func GetIngressHealthCheckPort(i *networkingv1.Ingress) (int, error)

func GetIngressHealthCheckProtocol

func GetIngressHealthCheckProtocol(i *networkingv1.Ingress) string

func GetIngressHealthCheckResponseBodyRegex

func GetIngressHealthCheckResponseBodyRegex(i *networkingv1.Ingress) string

func GetIngressHealthCheckRetries

func GetIngressHealthCheckRetries(i *networkingv1.Ingress) (int, error)

func GetIngressHealthCheckReturnCode

func GetIngressHealthCheckReturnCode(i *networkingv1.Ingress) (int, error)

func GetIngressHealthCheckTimeoutMilliseconds

func GetIngressHealthCheckTimeoutMilliseconds(i *networkingv1.Ingress) (int, error)

func GetIngressHttpListenerPort added in v1.3.7

func GetIngressHttpListenerPort(i *networkingv1.Ingress) (int, error)

func GetIngressHttpsListenerPort added in v1.3.7

func GetIngressHttpsListenerPort(i *networkingv1.Ingress) (int, error)

func GetIngressPolicy

func GetIngressPolicy(i *networkingv1.Ingress) string

func GetIngressProtocol

func GetIngressProtocol(i *networkingv1.Ingress) string

func GetIngressResource added in v1.3.9

func GetIngressResource(name string) *networkingv1.Ingress

func GetIngressServiceBackendResource added in v1.3.9

func GetIngressServiceBackendResource(name string, portName string, portNumber int32) networkingv1.IngressServiceBackend

func GetIngressesForClass added in v1.3.0

func GetIngressesForClass(lister networkinglisters.IngressLister, ingressClass *networkingv1.IngressClass) ([]*networkingv1.Ingress, error)

func GetListenerTlsCertificateOcid

func GetListenerTlsCertificateOcid(i *networkingv1.Ingress) *string

func GetNodesList added in v1.3.9

func GetNodesList() *v1.NodeList

func GetPodReadinessCondition

func GetPodReadinessCondition(ingressName string, host string, path networkingv1.HTTPIngressPath) corev1.PodConditionType

func GetPodReadinessGates added in v1.1.0

func GetPodReadinessGates(name string, host string) []v1.PodReadinessGate

func GetPodResourceList added in v1.1.0

func GetPodResourceList(name string, image string) *v1.PodList

func GetPodResourceWithReadiness added in v1.1.0

func GetPodResourceWithReadiness(name string, image string, ingressName string, host string, condition []v1.PodCondition) *v1.Pod

func GetSampleCertSecret added in v1.1.0

func GetSampleCertSecret(namespace, name, caChain, cert, key string) *v1.Secret

func GetSampleSecret added in v1.1.0

func GetSampleSecret(configName string, privateKey string, data string, privateKeyData string) *v1.Secret

func GetServiceListResource added in v1.1.0

func GetServiceListResource(namespace string, name string, port int32) *v1.ServiceList

func GetServiceListResourceWithPortName added in v1.1.0

func GetServiceListResourceWithPortName(namespace string, name string, port int32, portName string) *v1.ServiceList

func GetServicePortResource added in v1.3.9

func GetServicePortResource(name string, port int32, targetPort intstr.IntOrString, nodePort int32) v1.ServicePort

func GetServiceResource added in v1.1.0

func GetServiceResource(namespace string, name string, ports []v1.ServicePort) *v1.Service

func GetTargetPortForService added in v1.3.0

func GetTargetPortForService(endpointLister corelisters.EndpointsLister, svc *corev1.Service, namespace string, name string, port int32,
	portName string, isNodeportRequired bool) (int32, int32, error)

func GetTimeDifferenceInSeconds added in v0.0.3

func GetTimeDifferenceInSeconds(startTime, endTime int64) float64

GetTimeDifferenceInSeconds returns time difference in seconds of two timestamp values passed in Milliseconds

func HandleErr added in v1.3.0

func HandleErr(queue workqueue.RateLimitingInterface, err error, message string, key interface{})

HandleErr checks if an error happened and makes sure we will retry later.

func IsBackendServiceEqual added in v1.3.7

func IsBackendServiceEqual(b1 *networkingv1.IngressBackend, b2 *networkingv1.IngressBackend) bool

b1 and b2 are assumed non-nil

func IsIngressDeleting

func IsIngressDeleting(i *networkingv1.Ingress) bool

func IsIngressProtocolTCP added in v1.3.8

func IsIngressProtocolTCP(ingress *networkingv1.Ingress) bool

func NewBackend added in v1.3.0

func NewBackend(ip string, port int32) ociloadbalancer.BackendDetails

func PatchIngressClassWithAnnotation added in v1.1.0

func PatchIngressClassWithAnnotation(client kubernetes.Interface, ic *networkingv1.IngressClass, annotationName string, annotationValue string) (error, bool)

func PathToRoutePolicyName

func PathToRoutePolicyName(ingressName string, host string, path networkingv1.HTTPIngressPath) string

func PathToServiceAndPort

func PathToServiceAndPort(ingressNamespace string, path networkingv1.HTTPIngressPath, serviceLister corelisters.ServiceLister) (string, int32, error)

func PathToServiceAndTargetPort added in v1.3.0

func PathToServiceAndTargetPort(endpointLister corelisters.EndpointsLister, svc *corev1.Service, svcBackend networkingv1.IngressServiceBackend,
	namespace string, isNodePortRequired bool) (string, int32, int32, error)

func PrettyPrint

func PrettyPrint(i interface{}) string

func ReadResourceAsIngressList added in v1.1.0

func ReadResourceAsIngressList(fileName string) *networkingv1.IngressList

func RetrievePods added in v1.3.0

func RetrievePods(endpointLister corelisters.EndpointsLister, podLister corelisters.PodLister, namespace string, svcName string) ([]*corev1.Pod, error)

func SampleLoadBalancerResponse added in v1.1.0

func SampleLoadBalancerResponse() ociloadbalancer.GetLoadBalancerResponse

func StringSlicesHaveSameElements added in v1.4.0

func StringSlicesHaveSameElements(s1 []string, s2 []string) bool

StringSlicesHaveSameElements checks if s1 and s2 have the same elements, ignoring order and duplicates. Returns true if one slice is nil and the other is empty.

func UpdateFakeClientCall added in v1.1.0

func UpdateFakeClientCall(client *fakeclientset.Clientset, action string, resource string, object runtime.Object)

Types

type DefinedTagsType added in v1.4.0

type DefinedTagsType = map[string]map[string]interface{}

func GetIngressClassDefinedTags added in v1.4.0

func GetIngressClassDefinedTags(ic *networkingv1.IngressClass) (DefinedTagsType, error)

func GetIngressClassImplicitDefaultTags added in v1.4.0

func GetIngressClassImplicitDefaultTags(ic *networkingv1.IngressClass) (DefinedTagsType, error)

Jump to

Keyboard shortcuts

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