services

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

pkg/resources/services/service.go

pkg/resources/services/types.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

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

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

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

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.

Jump to

Keyboard shortcuts

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