Documentation
¶
Index ¶
- Constants
- func AddFinalizer(o client.Object) bool
- func HasFinalizer(o client.Object) bool
- func IsInternalDomain(host string) bool
- func LoadCerts() (*x509.CertPool, error)
- func MergeMaps[K comparable, V any](maps ...map[K]V) map[K]V
- func ObjToGVK(obj client.Object) string
- func ObjToHumanGvkName(obj client.Object) string
- func ObjToHumanName(obj client.Object) string
- func ObjToKind(obj client.Object) string
- func ObjToName(obj client.Object) string
- func ParseAndSanitizeEndpointURL(input string, isIngressURL bool) (*url.URL, error)
- func ParseHelmDictionary(dict string) (map[string]string, error)
- func RegisterAndSyncFinalizer(ctx context.Context, c client.Writer, o client.Object) error
- func RemoveAndSyncFinalizer(ctx context.Context, c client.Writer, o client.Object) error
- func RemoveFinalizer(o client.Object) bool
- func ToClientObjects[T any, PT interface{ ... }](s []T) []client.Object
- type ActionType
- type Actions
- type EndpointAction
- type EndpointRule
- type RawAction
- type RawConfig
- type RawRule
- type TrafficPolicy
Constants ¶
const ( PhaseOnHttpRequest = "on_http_request" PhaseOnHttpResponse = "on_http_response" LegacyPhaseInbound = "inbound" LegacyPhaseOutbound = "outbound" )
const (
// FinalizerName is the finalizer used by the ngrok operator
FinalizerName = "k8s.ngrok.com/finalizer"
)
Variables ¶
This section is empty.
Functions ¶
func AddFinalizer ¶
AddFinalizer adds the ngrok finalizer to the object if not already present. Returns true if the finalizer was added.
func HasFinalizer ¶
HasFinalizer returns true if the object has the ngrok finalizer present.
func IsInternalDomain ¶
IsInternalDomain returns true if the given hostname ends with ".internal" TLD. Internal domains cannot be reserved via the ngrok API (returns HTTP 400). This function handles case-insensitivity and trailing dots.
func MergeMaps ¶
func MergeMaps[K comparable, V any](maps ...map[K]V) map[K]V
MergeMaps merges multiple maps into a single map giving precedence to the last map in the list
func ObjToHumanGvkName ¶
ObjToHumanGvkName converts a client.Object to a human-readable full name including GroupVersionKind
func ObjToHumanName ¶
ObjToHumanName converts a client.Object to a human-readable name
func ParseAndSanitizeEndpointURL ¶
ParseAndSanitizeEndpointURL parses/sanitizes an input string for an endpoint url and provides a *url.URL following the restrictions for endpoints. when isIngressURL is true, the input string does not require a port (excluding tcp addresses)
func ParseHelmDictionary ¶
ParseHelmDictionary parses a string in the format of a Helm dictionary and returns a map - Keys and Values must be strings - Format must be key=val,key=val
func RegisterAndSyncFinalizer ¶
RegisterAndSyncFinalizer adds the ngrok finalizer to the object if not already present. If it adds the finalizer, it patches the object in the Kubernetes API. Uses Patch instead of Update to avoid resourceVersion conflicts by only sending the diff.
func RemoveAndSyncFinalizer ¶
RemoveAndSyncFinalizer removes the ngrok finalizer from the object if present. If it removes the finalizer, it patches the object in the Kubernetes API. Uses Patch instead of Update to avoid resourceVersion conflicts by only sending the diff.
func RemoveFinalizer ¶
RemoveFinalizer removes the ngrok finalizer from the object if present. Returns true if the finalizer was removed.
Types ¶
type ActionType ¶
type ActionType string
type EndpointAction ¶
type EndpointRule ¶
type RawAction ¶
type RawAction = json.RawMessage
RawAction exists to make generic raw json/map manipulation more legible. It adds no additional functionality on top of RawMessage.
type RawConfig ¶
type RawConfig = json.RawMessage
RawConfig exists to make generic raw json/map manipulation more legible. It adds no additional functionality on top of RawMessage.
type RawRule ¶
type RawRule = json.RawMessage
RawRule exists to make generic raw json/map manipulation more legible. It adds no additional functionality on top of RawMessage.
type TrafficPolicy ¶
type TrafficPolicy interface {
// Merge takes another instance of TrafficPolicy and merges them.
Merge(TrafficPolicy)
// MergeRawRule merges the rule into the list of existing rules in the specified phase.
MergeEndpointRule(rule EndpointRule, phase string) error
// Deconstruct must be implemented such that two differing underlying implementations can be represented as the same
// format during merges.
Deconstruct() map[string][]RawRule
// ToCRDJson returns a raw json version of the underlying traffic policy document to be saved to an Edge CRD.
ToCRDJson() (json.RawMessage, error)
// ToAPIJson() returns a raw json version of the underlying traffic policy document to be sent to the backend API.
ToAPIJson() (json.RawMessage, error)
// IsLegacyPolicy determines if the specified policy contains legacy phases.
IsLegacyPolicy() bool
// Enabled returns the value if it was present in a traffic policy document, nil if not.
Enabled() *bool
// ConvertLegacyPhases explicitly maps old phases to new phases. This doesn't guarantee in a resulting "valid" phase set,
// so users will need to check the implementation used for this interface.
ConvertLegacyDirectionsToPhases()
}
func NewTrafficPolicy ¶
func NewTrafficPolicy() TrafficPolicy
func NewTrafficPolicyFromJson ¶
func NewTrafficPolicyFromJson(msg json.RawMessage) (TrafficPolicy, error)