Documentation
¶
Overview ¶
pkg/resources/services/service.go
pkg/resources/services/types.go
Index ¶
- func Create(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, ...) error
- func Delete(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, ...) error
- func DeleteIfOwned(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, ...) error
- func Update(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, ...) error
- type ResolvedServiceSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, spec ResolvedServiceSpec) error
Create creates a Service owned by the CR if it does not already exist. Idempotent — if the Service exists, does nothing and returns nil. Owner reference is set so the Service is garbage collected when the CR is deleted.
func Delete ¶
func Delete(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, spec ResolvedServiceSpec) error
Delete deletes the Service if it exists.
func DeleteIfOwned ¶
func DeleteIfOwned(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, name, namespace string) error
DeleteIfOwned deletes the Service if it exists and is owned by the CR.
func Update ¶
func Update(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, spec ResolvedServiceSpec) error
Update reconciles an existing Service to match the resolved spec. Services are largely immutable on type/selector — only port changes are patched. If the Service does not exist, creates it.
Types ¶
type ResolvedServiceSpec ¶
type ResolvedServiceSpec struct {
// Name — Service name. Required.
Name string
// Namespace — target namespace. Required.
Namespace string
// Type — Kubernetes Service type: ClusterIP, NodePort, LoadBalancer.
// Default: ClusterIP.
Type string
// Headless — when true, the Service is created without a clusterIP (clusterIP: None).
// Used primarily for StatefulSets to enable stable network identities and per‑pod DNS:
// <podname>.<service>.<namespace>.svc.cluster.local
// Set this to true when the Service is meant to back a StatefulSet or provide
// direct pod‑to‑pod addressing rather than load‑balanced traffic.
Headless bool
// Protocol defines network protocols supported for things like container ports.
// "TCP", "UDP", "SCTP"
Protocol string
// Port — Service port.
Port int32
// TargetPort — container port the Service routes to.
TargetPort int32
// Labels — applied to Service metadata.
// Orkestra always adds: managed-by=orkestra, orkestra-owner=<cr-name>
Labels map[string]string
// Selector —> service selector to route traffic to pods.
Selector map[string]string
// Sleep injects an artificial delay into the reconcile of this resource.
// Useful for autoscale testing, latency simulation, and chaos engineering.
// Accepts extended duration units (s, m, h, d, w, mo, y).
Sleep string
}
ResolvedServiceSpec is the fully resolved Service specification. Produced by resolving template expressions and merging static values. Passed directly to Create, Update, and Delete.
func Resolve ¶
func Resolve(src orktypes.ServiceTemplateSource, ownerName string) ResolvedServiceSpec
Resolve builds a ResolvedServiceSpec from a ServiceTemplateSource. All fields already resolved by template.Resolver before calling here. This function assembles the spec and applies defaults.