Documentation
¶
Index ¶
- Constants
- func CreateFieldMutator(config FieldMutatorConfig) *fieldMutator
- func CreateNamePrefixPlugin(config NamePrefixConfig) *namePrefixTransformer
- func CreateNamespacePlugin(namespace string) (*namespacePlugin, error)
- func CreateNetworkPolicyTransformer(config NetworkPolicyTransformerConfig) *networkPolicyTransformer
- func CreateServiceTransformer(config ServiceTransformerConfig) *serviceTransformer
- func ValidateK8sLabelName(name string) error
- type FieldMapping
- type FieldMutatorConfig
- type NamePrefixConfig
- type NetworkPolicyTransformerConfig
- type ServiceTransformerConfig
Constants ¶
const (
// AllNamespacesSelector is the special value to allow all namespaces.
AllNamespacesSelector = "*"
)
Variables ¶
This section is empty.
Functions ¶
func CreateFieldMutator ¶
func CreateFieldMutator(config FieldMutatorConfig) *fieldMutator
CreateFieldMutator creates a mutator plugin that sets a value for a given field.
func CreateNamePrefixPlugin ¶
func CreateNamePrefixPlugin(config NamePrefixConfig) *namePrefixTransformer
CreateNamePrefixPlugin creates a transformer plugin that adds a prefix to resource names. Acts as a constructor, ensuring the plugin is properly initialized with its configuration.
func CreateNamespacePlugin ¶
CreateNamespacePlugin creates a new namespace plugin.
func CreateNetworkPolicyTransformer ¶
func CreateNetworkPolicyTransformer(config NetworkPolicyTransformerConfig) *networkPolicyTransformer
CreateNetworkPolicyTransformer creates a transformer for NetworkPolicy resources.
func CreateServiceTransformer ¶ added in v0.12.0
func CreateServiceTransformer(config ServiceTransformerConfig) *serviceTransformer
CreateServiceTransformer creates a transformer for Service resources.
func ValidateK8sLabelName ¶
ValidateK8sLabelName uses the strictest naming rule (for Namespaces) to ensure the provided name string is valid for any given Resource.
Types ¶
type FieldMapping ¶
type FieldMapping struct {
// SourceValue is the value to copy to the target field.
SourceValue any `json:"sourceValue"`
// DefaultValue is the value to use if SourceValue is empty.
// This provides a fallback mechanism, making transformations more robust.
DefaultValue any `json:"defaultValue,omitempty"`
// TargetField is the JSON Pointer path to the field in the target object.
// Uses RFC 6901 JSON Pointer syntax like "/spec/ports/0/port"
// Special characters in field names are escaped: ~0 for ~ and ~1 for /
// Example: "/spec/selector/app.kubernetes.io~1instance"
TargetField string `json:"targetField"`
// TargetKind is the kind of resource to apply the transformation to.
TargetKind string `json:"targetKind"`
// CreateIfNotExists will create the target field and any intermediate
// map structures if they don't exist in the target resource.
CreateIfNotExists bool `json:"createIfNotExists,omitempty"`
}
FieldMapping defines a single field mapping.
type FieldMutatorConfig ¶
type FieldMutatorConfig struct {
// Mappings is a list of field mappings to apply.
Mappings []FieldMapping `json:"mappings"`
}
FieldMutatorConfig is a collection of FieldMappings.
type NamePrefixConfig ¶
type NamePrefixConfig struct {
// Prefix to add to resource names.
Prefix string
// IncludeKinds specifies which resource kinds to apply the prefix to.
// If empty, the prefix is applied to all resource kinds not specified in ExcludeKinds.
IncludeKinds []string
// ExcludeKinds specifies which resource kinds to exclude from prefixing.
// This list takes precedence over IncludeKinds; if a kind is in both lists,
// it will be excluded.
ExcludeKinds []string
}
NamePrefixConfig holds configuration for the name prefix plugin.
type NetworkPolicyTransformerConfig ¶
type NetworkPolicyTransformerConfig struct {
// InstanceName is the name of the OGXServer instance.
InstanceName string
// ServicePort is the port the service is exposed on.
ServicePort int32
// OperatorNamespace is the namespace where the operator is running.
OperatorNamespace string
// NetworkSpec is the network configuration from the CR spec.
NetworkSpec *ogxiov1beta1.NetworkSpec
// MetricsPort is the port for Prometheus scraping. 0 means monitoring is disabled.
MetricsPort int32
// PraxisPeer is the ingress peer identifying Praxis pods, the only application
// workload allowed to reach OGX on the service port. When nil, a fail-safe default
// peer (pods labeled app.kubernetes.io/name: praxis-gateway in the praxis-standalone
// namespace) is used.
PraxisPeer *networkingv1.NetworkPolicyPeer
// PraxisMode selects the internal-only, Praxis-fronted ingress posture. When true,
// ingress is restricted to the Praxis peer plus the operator namespace and user rules
// are appended additively. When false, the legacy behavior is preserved: same-namespace
// and OpenShift-router peers, with user-provided ingress rules fully replacing the
// defaults.
PraxisMode bool
}
NetworkPolicyTransformerConfig holds the configuration for the NetworkPolicy transformer.
type ServiceTransformerConfig ¶ added in v0.12.0
type ServiceTransformerConfig struct {
// MetricsPort is the port for Prometheus scraping. 0 means monitoring is disabled.
MetricsPort int32
// ServicePort is the main API service port.
ServicePort int32
}
ServiceTransformerConfig holds the configuration for the Service transformer.