mirror of
https://github.com/gravitational/teleport.git
synced 2026-10-12 02:15:01 +00:00
Add resource matchers to Windows desktop service config (#46985)
* Add DynamicWindowsDesktop to proto * Add resource matchers to Windows desktop service config * move rpc to separate server * e * remove dynamic windows from paginated resource * Update api/proto/teleport/legacy/types/types.proto Co-authored-by: rosstimothy <[email protected]> * gci --------- Co-authored-by: rosstimothy <[email protected]>
This commit is contained in:
co-authored by
rosstimothy
parent
4c7fa50e82
commit
af3ac37bc0
@@ -2246,6 +2246,12 @@ func applyWindowsDesktopConfig(fc *FileConfig, cfg *servicecfg.Config) error {
|
||||
}
|
||||
cfg.WindowsDesktop.HostLabels = servicecfg.NewHostLabelRules(hlrs...)
|
||||
|
||||
for _, matcher := range fc.WindowsDesktop.ResourceMatchers {
|
||||
cfg.WindowsDesktop.ResourceMatchers = append(cfg.WindowsDesktop.ResourceMatchers, services.ResourceMatcher{
|
||||
Labels: matcher.Labels,
|
||||
})
|
||||
}
|
||||
|
||||
if fc.WindowsDesktop.Labels != nil {
|
||||
cfg.WindowsDesktop.Labels = maps.Clone(fc.WindowsDesktop.Labels)
|
||||
}
|
||||
|
||||
@@ -2399,6 +2399,8 @@ type WindowsDesktopService struct {
|
||||
// A host can match multiple rules and will get a union of all
|
||||
// the matched labels.
|
||||
HostLabels []WindowsHostLabelRule `yaml:"host_labels,omitempty"`
|
||||
// ResourceMatchers match dynamic Windows desktop resources.
|
||||
ResourceMatchers []ResourceMatcher `yaml:"resources,omitempty"`
|
||||
}
|
||||
|
||||
// Check checks whether the WindowsDesktopService is valid or not
|
||||
|
||||
@@ -236,6 +236,7 @@ func (process *TeleportProcess) initWindowsDesktopServiceRegistered(logger *slog
|
||||
DiscoveryLDAPAttributeLabels: cfg.WindowsDesktop.Discovery.LabelAttributes,
|
||||
Hostname: cfg.Hostname,
|
||||
ConnectedProxyGetter: proxyGetter,
|
||||
ResourceMatchers: cfg.WindowsDesktop.ResourceMatchers,
|
||||
})
|
||||
if err != nil {
|
||||
return trace.Wrap(err)
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
"regexp"
|
||||
|
||||
"github.com/gravitational/teleport/lib/limiter"
|
||||
"github.com/gravitational/teleport/lib/services"
|
||||
"github.com/gravitational/teleport/lib/utils"
|
||||
)
|
||||
|
||||
@@ -65,6 +66,8 @@ type WindowsDesktopConfig struct {
|
||||
// HostLabels specifies rules that are used to apply labels to Windows hosts.
|
||||
HostLabels HostLabelRules
|
||||
Labels map[string]string
|
||||
// ResourceMatchers match dynamic Windows desktop resources.
|
||||
ResourceMatchers []services.ResourceMatcher
|
||||
}
|
||||
|
||||
// WindowsHost is configuration for single Windows desktop host
|
||||
|
||||
@@ -210,6 +210,8 @@ type WindowsServiceConfig struct {
|
||||
// ConnectedProxyGetter gets the proxies teleport is connected to.
|
||||
ConnectedProxyGetter *reversetunnel.ConnectedProxyGetter
|
||||
Labels map[string]string
|
||||
// ResourceMatchers match dynamic Windows desktop resources.
|
||||
ResourceMatchers []services.ResourceMatcher
|
||||
}
|
||||
|
||||
// HeartbeatConfig contains the configuration for service heartbeats.
|
||||
|
||||
Reference in New Issue
Block a user