Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
set StatefulSet workloads as stateful services by default
Browse files Browse the repository at this point in the history
  • Loading branch information
lostbean committed Oct 2, 2024
1 parent 27c2d0b commit 4e601e8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions kontrol-service/engine/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,18 @@ func newClusterTopologyServiceFromServiceConfig(
return clusterTopologyService, stacktrace.NewError("Service %s has no workload", serviceName)
}

// Set default for IsStateful to true if the workload is a StatefulSet, otherwise false
clusterTopologyService.IsExternal = clusterTopologyService.WorkloadSpec.IsStatefulSet()

// Override the IsStateful value by manual annotations
isStateful, ok := serviceAnnotations["kardinal.dev.service/stateful"]
if ok && isStateful == "true" {
clusterTopologyService.IsStateful = true
}
if ok && isStateful == "false" {
clusterTopologyService.IsStateful = false
}

isExternal, ok := serviceAnnotations["kardinal.dev.service/external"]
if ok && isExternal == "true" {
clusterTopologyService.IsExternal = true
Expand Down

0 comments on commit 4e601e8

Please sign in to comment.