Documentation
¶
Index ¶
- Constants
- Variables
- func GetLocalCacheOptionsFromConfigMappings(mappings map[string]string, vClusterNamespace string) (cache.Options, bool)
- func Lint(config config.Config) []string
- func ParseExtraHooks(valHooks []config.ValidatingWebhookConfiguration, ...) ([]admissionregistrationv1.ValidatingWebhookConfiguration, ...)
- func ResolveStandaloneConfigPath(path string) (string, error)
- func ValidateAllSyncPatches(sync config.Sync) error
- func ValidateConfigAndSetDefaults(vConfig *VirtualClusterConfig) error
- func ValidateCustomResourceSyncProxyConflicts(toHostCustomResources map[string]config.SyncToHostCustomResource, ...) error
- func ValidateExperimentalProxyCustomResourcesConfig(cfg map[string]config.CustomResourceProxy) error
- func ValidatePlatformProject(ctx context.Context, config *config.Config, loadedConfig *cliconfig.CLI) error
- func ValidateSyncFromHostClasses(fromHost config.SyncFromHost) error
- func ValidateVolumeSnapshotController(volumeSnapshotController config.VolumeSnapshotController, ...) error
- type VirtualClusterConfig
- func LoadConfig(vClusterName string) (*VirtualClusterConfig, error)
- func LoadInClusterConfig(name, path string, setValues []string) (*VirtualClusterConfig, error)
- func LoadStandaloneConfig(name string, setValues []string) (*VirtualClusterConfig, error)
- func LoadStandaloneRuntimeConfig(name, path string, setValues []string) (*VirtualClusterConfig, error)
- func ParseConfig(path, name string, setValues []string) (*VirtualClusterConfig, error)
- func ParseConfigBytes(data []byte, name string, setValues []string) (*VirtualClusterConfig, error)
- func (v VirtualClusterConfig) DisableMissingAPIs(discoveryClient discovery.DiscoveryInterface) error
- func (v VirtualClusterConfig) LegacyOptions() (*legacyconfig.LegacyVirtualClusterOptions, error)
- func (v VirtualClusterConfig) SchedulingInVirtualClusterEnabled() bool
- func (v VirtualClusterConfig) VirtualClusterKubeConfig() config.VirtualClusterKubeConfig
Constants ¶
const (
DefaultHostsRewriteImage = "library/alpine:3.20"
)
const ( // HybridSchedulingNoEffectWarning is displayed when both the virtual scheduler and the hybrid // scheduling are enabled, but no host schedulers have been added. HybridSchedulingNoEffectWarning = "You have enabled both the virtual scheduler and the hybrid scheduling, " + "but you have not added any host scheduler to sync.toHost.pods.hybridScheduling.hostSchedulers config, " + "so all the pods will be scheduled by the default scheduler in the virtual cluster. Enabling " + "the hybrid scheduling does not have any effect here. Consider either adding at least one host " + "scheduler to sync.toHost.pods.hybridScheduling.hostSchedulers, or disable the hybrid scheduling." )
Variables ¶
var ProValidateConfig = func(_ *VirtualClusterConfig) error { return nil }
Functions ¶
func GetLocalCacheOptionsFromConfigMappings ¶ added in v0.23.0
func Lint ¶ added in v0.26.0
Lint checks the virtual cluster config and returns warnings for the parts of the config that should be probably corrected, but are not breaking any functionality in the cluster.
func ParseExtraHooks ¶ added in v0.20.0
func ParseExtraHooks(valHooks []config.ValidatingWebhookConfiguration, mutHooks []config.MutatingWebhookConfiguration) ([]admissionregistrationv1.ValidatingWebhookConfiguration, []admissionregistrationv1.MutatingWebhookConfiguration, error)
func ResolveStandaloneConfigPath ¶ added in v0.34.0
ResolveStandaloneConfigPath resolves the standalone config path from an explicit path or the default standalone locations. When path is empty or points at the shared in-cluster default location, it prefers the standalone default path and falls back to the in-cluster default path if that file exists. If neither file exists, it returns the standalone default path.
func ValidateAllSyncPatches ¶ added in v0.25.0
ValidateAllSyncPatches validates all sync patches
func ValidateConfigAndSetDefaults ¶ added in v0.20.0
func ValidateConfigAndSetDefaults(vConfig *VirtualClusterConfig) error
func ValidateCustomResourceSyncProxyConflicts ¶ added in v0.31.0
func ValidateCustomResourceSyncProxyConflicts(toHostCustomResources map[string]config.SyncToHostCustomResource, fromHostCustomResources map[string]config.SyncFromHostCustomResource, proxyCustomResources map[string]config.CustomResourceProxy) error
func ValidateExperimentalProxyCustomResourcesConfig ¶ added in v0.31.0
func ValidateExperimentalProxyCustomResourcesConfig(cfg map[string]config.CustomResourceProxy) error
func ValidatePlatformProject ¶ added in v0.28.0
func ValidateSyncFromHostClasses ¶ added in v0.26.0
func ValidateSyncFromHostClasses(fromHost config.SyncFromHost) error
func ValidateVolumeSnapshotController ¶ added in v0.29.0
func ValidateVolumeSnapshotController(volumeSnapshotController config.VolumeSnapshotController, privateNodes config.PrivateNodes) error
Types ¶
type VirtualClusterConfig ¶ added in v0.20.0
type VirtualClusterConfig struct {
// Holds the vCluster config
config.Config `json:",inline"`
// Name is the name of the vCluster
Name string `json:"name"`
// HostNamespace is the namespace in the host cluster where the vCluster is running
HostNamespace string `json:"hostNamespace,omitempty"`
// Path is the path to the vCluster config
Path string `json:"path,omitempty"`
// HostConfig is the config to access the host cluster
HostConfig *rest.Config `json:"-"`
// HostClient is the client to access the host cluster
HostClient kubernetes.Interface `json:"-"`
}
VirtualClusterConfig wraps the config and adds extra info such as name, serviceName and targetNamespace
func LoadConfig ¶ added in v0.34.0
func LoadConfig(vClusterName string) (*VirtualClusterConfig, error)
LoadConfig loads config for commands that should use the current runtime context. It first respects the explicit VCLUSTER_STANDALONE environment override, then falls back to local standalone host detection, and finally falls back to the regular in-cluster config path.
When VCLUSTER_STANDALONE is set, it acts as an explicit mode override: "true" forces standalone loading and any other value forces the normal in-cluster/default config path. Only when the env var is unset we fall back to local standalone host detection via the systemd unit marker.
func LoadInClusterConfig ¶ added in v0.34.0
func LoadInClusterConfig(name, path string, setValues []string) (*VirtualClusterConfig, error)
LoadInClusterConfig loads config for a vCluster running as a regular in-cluster control plane. When path is empty, it falls back to the default pod/container config location. It does not perform standalone detection or standalone normalization.
func LoadStandaloneConfig ¶ added in v0.34.0
func LoadStandaloneConfig(name string, setValues []string) (*VirtualClusterConfig, error)
LoadStandaloneConfig loads config for a standalone vCluster installed on this host. It discovers the config path from the local systemd unit, uses the runtime vCluster name from that unit when name is empty, and then delegates to LoadStandaloneRuntimeConfig. This is for host-side CLI/API flows such as vclusterctl, not for standalone runtime startup.
func LoadStandaloneRuntimeConfig ¶ added in v0.34.0
func LoadStandaloneRuntimeConfig(name, path string, setValues []string) (*VirtualClusterConfig, error)
LoadStandaloneRuntimeConfig loads a standalone config from the given path, applies set values, overlays the chart default config values, and normalizes it as standalone. When the path is one of the default standalone config locations and the file does not exist, it falls back to an in-memory default config before merging chart defaults. Missing custom config paths still return an error.
func ParseConfig ¶ added in v0.20.0
func ParseConfig(path, name string, setValues []string) (*VirtualClusterConfig, error)
func ParseConfigBytes ¶ added in v0.28.1
func ParseConfigBytes(data []byte, name string, setValues []string) (*VirtualClusterConfig, error)
func (VirtualClusterConfig) DisableMissingAPIs ¶ added in v0.20.0
func (v VirtualClusterConfig) DisableMissingAPIs(discoveryClient discovery.DiscoveryInterface) error
DisableMissingAPIs checks if the apis are enabled, if any are missing, disable the syncer and print a log
func (VirtualClusterConfig) LegacyOptions ¶ added in v0.20.0
func (v VirtualClusterConfig) LegacyOptions() (*legacyconfig.LegacyVirtualClusterOptions, error)
LegacyOptions converts the config to the legacy cluster options
func (VirtualClusterConfig) SchedulingInVirtualClusterEnabled ¶ added in v0.26.0
func (v VirtualClusterConfig) SchedulingInVirtualClusterEnabled() bool
SchedulingInVirtualClusterEnabled returns true if the virtual scheduler or the hybrid scheduling is enabled.
func (VirtualClusterConfig) VirtualClusterKubeConfig ¶ added in v0.20.0
func (v VirtualClusterConfig) VirtualClusterKubeConfig() config.VirtualClusterKubeConfig