Documentation
¶
Overview ¶
Package servicespec contains various utilities to deal with Service Specs
Index ¶
- func ApplyProposedChanges(target, proposed *corev1.ServiceSpec, annotations map[string]string) error
- func SetLastApplied(object *metav1.ObjectMeta, spec *corev1.ServiceSpec)
- type Builder
- func (builder *Builder) Build() *apiv1.ServiceTemplateSpec
- func (builder *Builder) SetPGBouncerSelector(name string) *Builder
- func (builder *Builder) SetSelectors(selectors map[string]string) *Builder
- func (builder *Builder) WithAnnotation(name, value string) *Builder
- func (builder *Builder) WithLabel(name, value string) *Builder
- func (builder *Builder) WithServicePort(value *corev1.ServicePort) *Builder
- func (builder *Builder) WithServicePortNoOverwrite(value *corev1.ServicePort) *Builder
- func (builder *Builder) WithServiceType(serviceType corev1.ServiceType, overwrite bool) *Builder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyProposedChanges ¶ added in v1.27.4
func ApplyProposedChanges(target, proposed *corev1.ServiceSpec, annotations map[string]string) error
ApplyProposedChanges computes an RFC 7386 JSON Merge Patch between the last-applied spec (from annotations) and proposed, then applies it to target. Kubernetes-assigned port defaults (NodePort, Protocol, TargetPort) are restored after the merge.
func SetLastApplied ¶ added in v1.27.4
func SetLastApplied(object *metav1.ObjectMeta, spec *corev1.ServiceSpec)
SetLastApplied stores the proposed service spec as a JSON annotation, enabling three-way merge on future reconciliations.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder enables users to create a serviceTemplate starting from a baseline and adding patches
func NewFrom ¶
func NewFrom(serviceTemplate *apiv1.ServiceTemplateSpec) *Builder
NewFrom creates a serviceTemplate builder from a certain Service template
func (*Builder) Build ¶
func (builder *Builder) Build() *apiv1.ServiceTemplateSpec
Build gets the final ServiceTemplate
func (*Builder) SetPGBouncerSelector ¶ added in v1.24.0
SetPGBouncerSelector overwrites the selectors field with the PgbouncerNameLabel selector.
func (*Builder) SetSelectors ¶ added in v1.24.0
SetSelectors overwrites the selector fields
func (*Builder) WithAnnotation ¶
WithAnnotation adds an annotation to the current status
func (*Builder) WithServicePort ¶
func (builder *Builder) WithServicePort(value *corev1.ServicePort) *Builder
WithServicePort adds a port to the current service
func (*Builder) WithServicePortNoOverwrite ¶ added in v1.23.3
func (builder *Builder) WithServicePortNoOverwrite(value *corev1.ServicePort) *Builder
WithServicePortNoOverwrite adds a ServicePort to the current service if no ServicePort that matches the name or port value is found
func (*Builder) WithServiceType ¶
func (builder *Builder) WithServiceType(serviceType corev1.ServiceType, overwrite bool) *Builder
WithServiceType adds a service type to the current status