Skip to content

Commit

Permalink
add legacy CLI option
Browse files Browse the repository at this point in the history
Signed-off-by: Seán C McCord <[email protected]>
  • Loading branch information
Ulexus committed Jun 25, 2021
1 parent d95f8c4 commit b35c754
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/dispatchers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var rpcHost string
var kubeCfg string

var apiAddr string
var legacyEndpointSlices bool

// KamailioStartupDebounceTimer is the amount of time to wait on startup to
// send an additional notify to kamailio.
Expand All @@ -46,6 +47,7 @@ func init() {
flag.StringVar(&rpcPort, "p", "9998", "Port for kamailio's RPC service")
flag.StringVar(&kubeCfg, "kubecfg", "", "Location of kubecfg file (if not running inside k8s)")
flag.StringVar(&apiAddr, "api", "", "Address on which to run web API service. Example ':8080'. (defaults to not run)")
flag.BoolVar(&legacyEndpointSlices, "legacy-endpointslices", false, "Use legacy v1beta1 EndpointSlices, for Kubernetes earlier than v1.21")
}

func main() {
Expand Down Expand Up @@ -97,7 +99,13 @@ func run() (err error) {
informerFactory := informers.NewSharedInformerFactory(kc, 10*time.Minute)

for _, v := range setDefinitions.list {
ds, err := sets.NewKubernetesSet(ctx, informerFactory, v.id, v.namespace, v.name, v.port)
var ds sets.DispatcherSet

if legacyEndpointSlices {
ds, err = sets.NewLegacyKubernetesSet(ctx, informerFactory, v.id, v.namespace, v.name, v.port)
} else {
ds, err = sets.NewKubernetesSet(ctx, informerFactory, v.id, v.namespace, v.name, v.port)
}
if err != nil {
return fmt.Errorf("failed to create dispatcher set %s: %w", v.String(), err)
}
Expand Down

0 comments on commit b35c754

Please sign in to comment.