Skip to content

Commit f2c30ab

Browse files
authored
[Feature] Ensure Group Service Type (#1887)
1 parent ee2499c commit f2c30ab

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- (Maintenance) Optimize go.mod
55
- (Bugfix) Prevent UpToDate Condition changes during Action processing
66
- (Feature) (Platform) Reorganize Envoy Auth
7+
- (Feature) Ensure Group Service Type
78

89
## [1.2.48](https://github.com/arangodb/kube-arangodb/tree/1.2.48) (2025-05-08)
910
- (Maintenance) Extend Documentation

pkg/deployment/resources/services.go

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func (r *Resources) EnsureServices(ctx context.Context, cachedStatus inspectorIn
160160
ports := []core.ServicePort{CreateServerServicePort()}
161161
// Service should exists
162162
if !ok {
163-
s := r.createService(name, apiObject.GetNamespace(), spec.CommunicationMethod.ServiceClusterIP(), spec.CommunicationMethod.ServiceType(), false, apiObject.AsOwner(), ports, selector)
163+
s := r.createService(name, apiObject.GetNamespace(), "", core.ServiceTypeClusterIP, false, apiObject.AsOwner(), ports, selector)
164164

165165
err := globals.GetGlobalTimeouts().Kubernetes().RunWithTimeout(ctx, func(ctxChild context.Context) error {
166166
_, err := svcs.Create(ctxChild, s, meta.CreateOptions{})
@@ -175,14 +175,26 @@ func (r *Resources) EnsureServices(ctx context.Context, cachedStatus inspectorIn
175175
reconcileRequired.Required()
176176
continue
177177
} else {
178-
if _, changed, err := patcher.Patcher[*core.Service](ctx, svcs, s, meta.PatchOptions{},
179-
patcher.PatchServicePorts(ports),
180-
patcher.PatchServiceSelector(selector),
181-
patcher.PatchServicePublishNotReadyAddresses(false),
182-
patcher.PatchServiceType(spec.CommunicationMethod.ServiceType())); err != nil {
183-
return err
184-
} else if changed {
185-
reconcileRequired.Required()
178+
if s.Spec.ClusterIP == core.ClusterIPNone {
179+
// Recreation required
180+
if err := globals.GetGlobalTimeouts().Kubernetes().RunWithTimeout(ctx, func(ctxChild context.Context) error {
181+
return svcs.Delete(ctxChild, s.GetName(), meta.DeleteOptions{})
182+
}); err != nil {
183+
if !kerrors.IsNotFound(err) {
184+
return err
185+
}
186+
reconcileRequired.Required()
187+
}
188+
} else {
189+
if _, changed, err := patcher.Patcher[*core.Service](ctx, svcs, s, meta.PatchOptions{},
190+
patcher.PatchServicePorts(ports),
191+
patcher.PatchServiceSelector(selector),
192+
patcher.PatchServicePublishNotReadyAddresses(false),
193+
patcher.PatchServiceType(core.ServiceTypeClusterIP)); err != nil {
194+
return err
195+
} else if changed {
196+
reconcileRequired.Required()
197+
}
186198
}
187199
}
188200
}

0 commit comments

Comments
 (0)