Skip to content

Commit

Permalink
begind namespace deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
fspmarshall committed Oct 3, 2022
1 parent 76f92ec commit ae99259
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2250,7 +2250,11 @@ func (process *TeleportProcess) initSSH() error {
}
// TODO: are we missing rm.Close()

// make sure the namespace exists
// make sure the default namespace is used
if ns := cfg.SSH.Namespace; ns != "" && ns != apidefaults.Namespace {
return trace.BadParameter("cannot start with custom namespace %q, custom namespaces are deprecated. "+
"use builtin namespace %q, or omit the 'namespace' config option.", ns, apidefaults.Namespace)
}
namespace := types.ProcessNamespace(cfg.SSH.Namespace)
_, err = authClient.GetNamespace(namespace)
if err != nil {
Expand Down
6 changes: 5 additions & 1 deletion lib/services/local/presence.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,11 @@ func (s *PresenceService) GetNodes(ctx context.Context, namespace string) ([]typ
// specified duration with second resolution if it's >= 1 second.
func (s *PresenceService) UpsertNode(ctx context.Context, server types.Server) (*types.KeepAlive, error) {
if server.GetNamespace() == "" {
return nil, trace.BadParameter("missing node namespace")
server.SetNamespace(apidefaults.Namespace)
}

if n := server.GetNamespace(); n != apidefaults.Namespace {
return nil, trace.BadParameter("cannot place node in namespace %q, custom namespaces are deprecated", n)
}

value, err := services.MarshalServer(server)
Expand Down

0 comments on commit ae99259

Please sign in to comment.