Documentation
¶
Index ¶
- Variables
- func ConfigForKCPCluster(clusterName string, cfg *rest.Config) (*rest.Config, error)
- func PathForCluster(name string, clt client.Client) (string, error)
- type APIBindingReconciler
- type ClusterPathResolver
- type ClusterPathResolverProvider
- type ConfigWatcher
- type DiscoveryFactory
- type DiscoveryFactoryProvider
- type KCPReconciler
- func (r *KCPReconciler) GetManager() ctrl.Manager
- func (r *KCPReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *KCPReconciler) SetupWithManager(mgr ctrl.Manager) error
- func (r *KCPReconciler) StartVirtualWorkspaceWatching(ctx context.Context, configPath string) error
- type NewDiscoveryIFFunc
- type SchemaGenerationParams
- type VirtualWorkspace
- type VirtualWorkspaceConfigManager
- type VirtualWorkspaceManager
- func (v *VirtualWorkspaceManager) CreateDiscoveryClient(workspace VirtualWorkspace) (discovery.DiscoveryInterface, error)
- func (v *VirtualWorkspaceManager) CreateRESTConfig(workspace VirtualWorkspace) (*rest.Config, error)
- func (v *VirtualWorkspaceManager) GetWorkspacePath(workspace VirtualWorkspace) string
- func (v *VirtualWorkspaceManager) LoadConfig(configPath string) (*VirtualWorkspacesConfig, error)
- type VirtualWorkspaceReconciler
- type VirtualWorkspacesConfig
Constants ¶
This section is empty.
Variables ¶
var ( ErrNilConfig = errors.New("config cannot be nil") ErrNilScheme = errors.New("scheme should not be nil") ErrGetClusterConfig = errors.New("failed to get cluster config") ErrGetLogicalCluster = errors.New("failed to get logicalcluster resource") ErrMissingPathAnnotation = errors.New("failed to get cluster path from kcp.io/path annotation") ErrParseHostURL = errors.New("failed to parse rest config's Host URL") ErrClusterIsDeleted = errors.New("cluster is deleted") )
var ( ErrNilDiscoveryConfig = errors.New("config cannot be nil") ErrGetDiscoveryClusterConfig = errors.New("failed to get rest config for cluster") ErrParseDiscoveryHostURL = errors.New("failed to parse rest config's Host URL") ErrCreateHTTPClient = errors.New("failed to create http client") ErrCreateDynamicMapper = errors.New("failed to create dynamic REST mapper") )
var ( ErrInvalidVirtualWorkspaceURL = errors.New("invalid virtual workspace URL") ErrParseVirtualWorkspaceURL = errors.New("failed to parse virtual workspace URL") )
Functions ¶
func ConfigForKCPCluster ¶
ConfigForKCPCluster creates a rest.Config for a specific KCP cluster/workspace This is a shared utility used across the KCP package to avoid duplication
Types ¶
type APIBindingReconciler ¶
type APIBindingReconciler struct {
Client client.Client
Scheme *runtime.Scheme
RestConfig *rest.Config
IOHandler workspacefile.IOHandler
DiscoveryFactory DiscoveryFactory
APISchemaResolver apischema.Resolver
ClusterPathResolver ClusterPathResolver
Log *logger.Logger
}
APIBindingReconciler reconciles an APIBinding object
func (*APIBindingReconciler) SetupWithManager ¶
func (r *APIBindingReconciler) SetupWithManager(mgr ctrl.Manager) error
type ClusterPathResolver ¶
type ClusterPathResolverProvider ¶
type ClusterPathResolverProvider struct {
*runtime.Scheme
*rest.Config
// contains filtered or unexported fields
}
func NewClusterPathResolver ¶
func (*ClusterPathResolverProvider) ClientForCluster ¶
func (rf *ClusterPathResolverProvider) ClientForCluster(name string) (client.Client, error)
type ConfigWatcher ¶
type ConfigWatcher struct {
// contains filtered or unexported fields
}
ConfigWatcher watches the virtual workspaces configuration file for changes
func NewConfigWatcher ¶
func NewConfigWatcher(virtualWSManager VirtualWorkspaceConfigManager, log *logger.Logger) (*ConfigWatcher, error)
NewConfigWatcher creates a new config file watcher
func (*ConfigWatcher) OnFileChanged ¶
func (c *ConfigWatcher) OnFileChanged(filepath string)
OnFileChanged implements watcher.FileEventHandler
func (*ConfigWatcher) OnFileDeleted ¶
func (c *ConfigWatcher) OnFileDeleted(filepath string)
OnFileDeleted implements watcher.FileEventHandler
func (*ConfigWatcher) Watch ¶
func (c *ConfigWatcher) Watch(ctx context.Context, configPath string, changeHandler func(*VirtualWorkspacesConfig)) error
Watch starts watching the configuration file and blocks until context is cancelled
type DiscoveryFactory ¶
type DiscoveryFactory interface {
ClientForCluster(name string) (discovery.DiscoveryInterface, error)
RestMapperForCluster(name string) (meta.RESTMapper, error)
}
type DiscoveryFactoryProvider ¶
type DiscoveryFactoryProvider struct {
*rest.Config
NewDiscoveryIFFunc
}
func NewDiscoveryFactory ¶
func NewDiscoveryFactory(cfg *rest.Config) (*DiscoveryFactoryProvider, error)
func (*DiscoveryFactoryProvider) ClientForCluster ¶
func (f *DiscoveryFactoryProvider) ClientForCluster(name string) (discovery.DiscoveryInterface, error)
func (*DiscoveryFactoryProvider) RestMapperForCluster ¶
func (f *DiscoveryFactoryProvider) RestMapperForCluster(name string) (meta.RESTMapper, error)
type KCPReconciler ¶
type KCPReconciler struct {
// contains filtered or unexported fields
}
func NewKCPReconciler ¶
func NewKCPReconciler( appCfg config.Config, opts reconciler.ReconcilerOpts, log *logger.Logger, ) (*KCPReconciler, error)
func (*KCPReconciler) GetManager ¶
func (r *KCPReconciler) GetManager() ctrl.Manager
func (*KCPReconciler) SetupWithManager ¶
func (r *KCPReconciler) SetupWithManager(mgr ctrl.Manager) error
func (*KCPReconciler) StartVirtualWorkspaceWatching ¶
func (r *KCPReconciler) StartVirtualWorkspaceWatching(ctx context.Context, configPath string) error
StartVirtualWorkspaceWatching starts watching virtual workspace configuration
type NewDiscoveryIFFunc ¶
type NewDiscoveryIFFunc func(cfg *rest.Config) (discovery.DiscoveryInterface, error)
type SchemaGenerationParams ¶
type SchemaGenerationParams struct {
ClusterPath string
DiscoveryClient discovery.DiscoveryInterface
RESTMapper meta.RESTMapper
HostOverride string // Optional: for virtual workspaces with custom URLs
}
SchemaGenerationParams contains parameters for schema generation
type VirtualWorkspace ¶
type VirtualWorkspace struct {
Name string `yaml:"name"`
URL string `yaml:"url"`
Kubeconfig string `yaml:"kubeconfig,omitempty"` // Optional path to kubeconfig for authentication
}
VirtualWorkspace represents a virtual workspace configuration
type VirtualWorkspaceConfigManager ¶
type VirtualWorkspaceConfigManager interface {
LoadConfig(configPath string) (*VirtualWorkspacesConfig, error)
}
VirtualWorkspaceConfigManager interface for loading virtual workspace configurations
type VirtualWorkspaceManager ¶
type VirtualWorkspaceManager struct {
// contains filtered or unexported fields
}
VirtualWorkspaceManager handles virtual workspace operations
func NewVirtualWorkspaceManager ¶
func NewVirtualWorkspaceManager(appCfg config.Config) *VirtualWorkspaceManager
NewVirtualWorkspaceManager creates a new virtual workspace manager
func (*VirtualWorkspaceManager) CreateDiscoveryClient ¶
func (v *VirtualWorkspaceManager) CreateDiscoveryClient(workspace VirtualWorkspace) (discovery.DiscoveryInterface, error)
CreateDiscoveryClient creates a discovery client for the virtual workspace
func (*VirtualWorkspaceManager) CreateRESTConfig ¶
func (v *VirtualWorkspaceManager) CreateRESTConfig(workspace VirtualWorkspace) (*rest.Config, error)
CreateRESTConfig creates a REST config for the virtual workspace (for REST mappers)
func (*VirtualWorkspaceManager) GetWorkspacePath ¶
func (v *VirtualWorkspaceManager) GetWorkspacePath(workspace VirtualWorkspace) string
GetWorkspacePath returns the file path for storing the virtual workspace schema
func (*VirtualWorkspaceManager) LoadConfig ¶
func (v *VirtualWorkspaceManager) LoadConfig(configPath string) (*VirtualWorkspacesConfig, error)
LoadConfig loads the virtual workspaces configuration from a file
type VirtualWorkspaceReconciler ¶
type VirtualWorkspaceReconciler struct {
// contains filtered or unexported fields
}
VirtualWorkspaceReconciler handles reconciliation of virtual workspaces
func NewVirtualWorkspaceReconciler ¶
func NewVirtualWorkspaceReconciler( virtualWSManager *VirtualWorkspaceManager, ioHandler workspacefile.IOHandler, apiSchemaResolver apischema.Resolver, log *logger.Logger, ) *VirtualWorkspaceReconciler
NewVirtualWorkspaceReconciler creates a new virtual workspace reconciler
func (*VirtualWorkspaceReconciler) ReconcileConfig ¶
func (r *VirtualWorkspaceReconciler) ReconcileConfig(ctx context.Context, config *VirtualWorkspacesConfig) error
ReconcileConfig processes a virtual workspaces configuration update
type VirtualWorkspacesConfig ¶
type VirtualWorkspacesConfig struct {
VirtualWorkspaces []VirtualWorkspace `yaml:"virtualWorkspaces"`
}
VirtualWorkspacesConfig represents the configuration file structure