From 051252fc14794a47dd971e21f689b9db69a1eeee Mon Sep 17 00:00:00 2001 From: Ricardo Weir Date: Wed, 25 Sep 2024 14:25:06 -0700 Subject: [PATCH 1/6] Create sub-directories in config for versions Some vcluster config logic is version specific. Splitting the config package into version specific sub-directories helps maintain backwards compatibility for package consumers. The subdirectories allow us to use version specific code as needed without carrying it forward to newer versions, creating unnecessary technical debt. Separate go module versions were proposed as an alternative but were rejected in favor of sub-directories for now, as sub-directories are simpler to implement and does not necessitate consumers to import multiple modules. --- config/{ => v0.20}/README.md | 0 config/{ => v0.20}/config.go | 0 config/{ => v0.20}/config_test.go | 0 config/{ => v0.20}/default_extra_values.go | 0 config/{ => v0.20}/diff.go | 0 config/{ => v0.20}/values.yaml | 0 config/v0.21/README.md | 6 + config/v0.21/config.go | 2250 ++++++++++++++++++++ config/v0.21/config_test.go | 403 ++++ config/v0.21/default_extra_values.go | 381 ++++ config/v0.21/diff.go | 166 ++ config/v0.21/values.yaml | 542 +++++ hack/schema/main.go | 2 +- 13 files changed, 3749 insertions(+), 1 deletion(-) rename config/{ => v0.20}/README.md (100%) rename config/{ => v0.20}/config.go (100%) rename config/{ => v0.20}/config_test.go (100%) rename config/{ => v0.20}/default_extra_values.go (100%) rename config/{ => v0.20}/diff.go (100%) rename config/{ => v0.20}/values.yaml (100%) create mode 100644 config/v0.21/README.md create mode 100644 config/v0.21/config.go create mode 100644 config/v0.21/config_test.go create mode 100644 config/v0.21/default_extra_values.go create mode 100644 config/v0.21/diff.go create mode 100644 config/v0.21/values.yaml diff --git a/config/README.md b/config/v0.20/README.md similarity index 100% rename from config/README.md rename to config/v0.20/README.md diff --git a/config/config.go b/config/v0.20/config.go similarity index 100% rename from config/config.go rename to config/v0.20/config.go diff --git a/config/config_test.go b/config/v0.20/config_test.go similarity index 100% rename from config/config_test.go rename to config/v0.20/config_test.go diff --git a/config/default_extra_values.go b/config/v0.20/default_extra_values.go similarity index 100% rename from config/default_extra_values.go rename to config/v0.20/default_extra_values.go diff --git a/config/diff.go b/config/v0.20/diff.go similarity index 100% rename from config/diff.go rename to config/v0.20/diff.go diff --git a/config/values.yaml b/config/v0.20/values.yaml similarity index 100% rename from config/values.yaml rename to config/v0.20/values.yaml diff --git a/config/v0.21/README.md b/config/v0.21/README.md new file mode 100644 index 000000000..bce68441a --- /dev/null +++ b/config/v0.21/README.md @@ -0,0 +1,6 @@ +This file will get synced to [github.com/loft-sh/vcluster-config](https://github.com/loft-sh/vcluster-config). Please do not add any external dependencies to the code here. + +If you make changes to the config or values.yaml, please run: +``` +go run hack/schema/main.go +``` diff --git a/config/v0.21/config.go b/config/v0.21/config.go new file mode 100644 index 000000000..9041b6dbc --- /dev/null +++ b/config/v0.21/config.go @@ -0,0 +1,2250 @@ +package config + +import ( + _ "embed" + "errors" + "fmt" + "reflect" + "regexp" + "strings" + + "github.com/invopop/jsonschema" + "sigs.k8s.io/yaml" +) + +//go:embed values.yaml +var Values string + +var ErrInvalidConfig = errors.New("invalid config") + +// NewDefaultConfig creates a new config based on the values.yaml, including all default values. +func NewDefaultConfig() (*Config, error) { + retConfig := &Config{} + err := yaml.Unmarshal([]byte(Values), retConfig) + if err != nil { + return nil, err + } + + return retConfig, nil +} + +// Config is the vCluster config. This struct describes valid Helm values for vCluster as well as configuration used by the vCluster binary itself. +type Config struct { + // Global values shared across all (sub)charts + Global interface{} `json:"global,omitempty"` + + // ExportKubeConfig describes how vCluster should export the vCluster kubeConfig file. + ExportKubeConfig ExportKubeConfig `json:"exportKubeConfig,omitempty"` + + // Sync describes how to sync resources from the virtual cluster to host cluster and back. + Sync Sync `json:"sync,omitempty"` + + // Integrations holds config for vCluster integrations with other operators or tools running on the host cluster + Integrations Integrations `json:"integrations,omitempty"` + + // Networking options related to the virtual cluster. + Networking Networking `json:"networking,omitempty"` + + // Policies to enforce for the virtual cluster deployment as well as within the virtual cluster. + Policies Policies `json:"policies,omitempty"` + + // Configure vCluster's control plane components and deployment. + ControlPlane ControlPlane `json:"controlPlane,omitempty"` + + // RBAC options for the virtual cluster. + RBAC RBAC `json:"rbac,omitempty"` + + // Define which vCluster plugins to load. + Plugins map[string]Plugins `json:"plugins,omitempty"` + + // Experimental features for vCluster. Configuration here might change, so be careful with this. + Experimental Experimental `json:"experimental,omitempty"` + + // External holds configuration for tools that are external to the vCluster. + External map[string]ExternalConfig `json:"external,omitempty"` + + // Configuration related to telemetry gathered about vCluster usage. + Telemetry Telemetry `json:"telemetry,omitempty"` + + // ServiceCIDR holds the service cidr for the virtual cluster. Do not use this option anymore. + ServiceCIDR string `json:"serviceCIDR,omitempty"` + + // Specifies whether to use vCluster Pro. This is automatically inferred in newer versions. Do not use that option anymore. + Pro bool `json:"pro,omitempty"` + + // Plugin specifies which vCluster plugins to enable. Use "plugins" instead. Do not use this option anymore. + Plugin map[string]Plugin `json:"plugin,omitempty"` +} + +// Integrations holds config for vCluster integrations with other operators or tools running on the host cluster +type Integrations struct { + // MetricsServer reuses the metrics server from the host cluster within the vCluster. + MetricsServer MetricsServer `json:"metricsServer,omitempty"` + + // KubeVirt reuses a host kubevirt and makes certain CRDs from it available inside the vCluster + KubeVirt KubeVirt `json:"kubeVirt,omitempty"` + + // ExternalSecrets reuses a host external secret operator and makes certain CRDs from it available inside the vCluster + ExternalSecrets ExternalSecrets `json:"externalSecrets,omitempty"` +} + +// ExternalSecrets reuses a host external secret operator and makes certain CRDs from it available inside the vCluster +type ExternalSecrets struct { + // Enabled defines whether the external secret integration is enabled or not + Enabled bool `json:"enabled,omitempty"` + // Webhook defines whether the host webhooks are reused or not + Webhook EnableSwitch `json:"webhook,omitempty"` + // Sync defines the syncing behavior for the integration + Sync ExternalSecretsSync `json:"sync,omitempty"` +} + +type ExternalSecretsSync struct { + // ExternalSecrets defines whether to sync external secrets or not + ExternalSecrets EnableSwitch `json:"externalSecrets,omitempty"` + // Stores defines whether to sync stores or not + Stores EnableSwitch `json:"stores,omitempty"` + // ClusterStores defines whether to sync cluster stores or not + ClusterStores ClusterStoresSyncConfig `json:"clusterStores,omitempty"` +} + +type ClusterStoresSyncConfig struct { + EnableSwitch + // Selector defines what cluster stores should be synced + Selector LabelSelector `json:"selector,omitempty"` +} + +type LabelSelector struct { + // Labels defines what labels should be looked for + Labels map[string]string `json:"labels,omitempty"` +} + +// KubeVirt reuses a host kubevirt and makes certain CRDs from it available inside the vCluster +type KubeVirt struct { + // Enabled signals if the integration should be enabled + Enabled bool `json:"enabled,omitempty"` + // APIService holds information about where to find the virt-api service. Defaults to virt-api/kubevirt. + APIService APIService `json:"apiService,omitempty"` + // Webhook holds configuration for enabling the webhook within the vCluster + Webhook EnableSwitch `json:"webhook,omitempty"` + // Sync holds configuration on what resources to sync + Sync KubeVirtSync `json:"sync,omitempty"` +} + +// KubeVirtSync are the crds that are supported by this integration +type KubeVirtSync struct { + // If DataVolumes should get synced + DataVolumes EnableSwitch `json:"dataVolumes,omitempty"` + // If VirtualMachineInstanceMigrations should get synced + VirtualMachineInstanceMigrations EnableSwitch `json:"virtualMachineInstanceMigrations,omitempty"` + // If VirtualMachineInstances should get synced + VirtualMachineInstances EnableSwitch `json:"virtualMachineInstances,omitempty"` + // If VirtualMachines should get synced + VirtualMachines EnableSwitch `json:"virtualMachines,omitempty"` + // If VirtualMachineClones should get synced + VirtualMachineClones EnableSwitch `json:"virtualMachineClones,omitempty"` + // If VirtualMachinePools should get synced + VirtualMachinePools EnableSwitch `json:"virtualMachinePools,omitempty"` +} + +// MetricsServer reuses the metrics server from the host cluster within the vCluster. +type MetricsServer struct { + // Enabled signals the metrics server integration should be enabled. + Enabled bool `json:"enabled,omitempty"` + + // APIService holds information about where to find the metrics-server service. Defaults to metrics-server/kube-system. + APIService APIService `json:"apiService,omitempty"` + + // Nodes defines if metrics-server nodes api should get proxied from host to virtual cluster. + Nodes bool `json:"nodes,omitempty"` + + // Pods defines if metrics-server pods api should get proxied from host to virtual cluster. + Pods bool `json:"pods,omitempty"` +} + +// APIService holds configuration related to the api server +type APIService struct { + // Service is a reference to the service for the API server. + Service APIServiceService `json:"service,omitempty"` +} + +// APIServiceService holds the service name and namespace of the host apiservice. +type APIServiceService struct { + // Name is the name of the host service of the apiservice. + Name string `json:"name,omitempty"` + + // Namespace is the name of the host service of the apiservice. + Namespace string `json:"namespace,omitempty"` + + // Port is the target port on the host service to connect to. + Port int `json:"port,omitempty"` +} + +// ExternalConfig holds external tool configuration +type ExternalConfig map[string]interface{} + +func (c *Config) UnmarshalYAMLStrict(data []byte) error { + return UnmarshalYAMLStrict(data, c) +} + +func (c *Config) GetPlatformConfig() (*PlatformConfig, error) { + if c.External == nil { + return &PlatformConfig{}, nil + } + if c.External["platform"] == nil { + return &PlatformConfig{}, nil + } + + yamlBytes, err := yaml.Marshal(c.External["platform"]) + if err != nil { + return nil, fmt.Errorf("%w: %w", ErrInvalidConfig, err) + } + + retConfig := &PlatformConfig{} + if err := yaml.Unmarshal(yamlBytes, retConfig); err != nil { + return nil, fmt.Errorf("%w: %w", ErrInvalidConfig, err) + } + + return retConfig, nil +} + +func (c *Config) SetPlatformConfig(platformConfig *PlatformConfig) error { + yamlBytes, err := yaml.Marshal(platformConfig) + if err != nil { + return fmt.Errorf("%w: %w", ErrInvalidConfig, err) + } + + setConfig := ExternalConfig{} + if err := yaml.Unmarshal(yamlBytes, &setConfig); err != nil { + return fmt.Errorf("%w: %w", ErrInvalidConfig, err) + } + + if c.External == nil { + c.External = map[string]ExternalConfig{} + } + c.External["platform"] = setConfig + return nil +} + +// BackingStoreType returns the backing store type of the vCluster. +// If no backing store is enabled, it returns StoreTypeUnknown. +func (c *Config) BackingStoreType() StoreType { + switch { + case c.ControlPlane.BackingStore.Etcd.Embedded.Enabled: + return StoreTypeEmbeddedEtcd + case c.ControlPlane.BackingStore.Etcd.Deploy.Enabled: + return StoreTypeExternalEtcd + case c.ControlPlane.BackingStore.Database.Embedded.Enabled: + return StoreTypeEmbeddedDatabase + case c.ControlPlane.BackingStore.Database.External.Enabled: + return StoreTypeExternalDatabase + default: + return StoreTypeEmbeddedDatabase + } +} + +func (c *Config) EmbeddedDatabase() bool { + return !c.ControlPlane.BackingStore.Database.External.Enabled && !c.ControlPlane.BackingStore.Etcd.Embedded.Enabled && !c.ControlPlane.BackingStore.Etcd.Deploy.Enabled +} + +func (c *Config) Distro() string { + if c.ControlPlane.Distro.K3S.Enabled { + return K3SDistro + } else if c.ControlPlane.Distro.K0S.Enabled { + return K0SDistro + } else if c.ControlPlane.Distro.K8S.Enabled { + return K8SDistro + } + + return K8SDistro +} + +func (c *Config) IsConfiguredForSleepMode() bool { + if c != nil && c.External != nil && c.External["platform"] == nil { + return false + } + + return c.External["platform"]["autoSleep"] != nil || c.External["platform"]["autoDelete"] != nil +} + +// ValidateChanges checks for disallowed config changes. +// Currently only certain backingstore changes are allowed but no distro change. +func ValidateChanges(oldCfg, newCfg *Config) error { + oldDistro, newDistro := oldCfg.Distro(), newCfg.Distro() + oldBackingStore, newBackingStore := oldCfg.BackingStoreType(), newCfg.BackingStoreType() + + return ValidateStoreAndDistroChanges(newBackingStore, oldBackingStore, newDistro, oldDistro) +} + +// ValidateStoreAndDistroChanges checks whether migrating from one store to the other is allowed. +func ValidateStoreAndDistroChanges(currentStoreType, previousStoreType StoreType, currentDistro, previousDistro string) error { + if currentDistro != previousDistro && !(previousDistro == "eks" && currentDistro == K8SDistro) { + return fmt.Errorf("seems like you were using %s as a distro before and now have switched to %s, please make sure to not switch between vCluster distros", previousDistro, currentDistro) + } + + if currentStoreType != previousStoreType { + if currentStoreType != StoreTypeEmbeddedEtcd { + return fmt.Errorf("seems like you were using %s as a store before and now have switched to %s, please make sure to not switch between vCluster stores", previousStoreType, currentStoreType) + } + if previousStoreType != StoreTypeExternalEtcd && previousStoreType != StoreTypeEmbeddedDatabase { + return fmt.Errorf("seems like you were using %s as a store before and now have switched to %s, please make sure to not switch between vCluster stores", previousStoreType, currentStoreType) + } + } + + return nil +} + +func (c *Config) IsProFeatureEnabled() bool { + if len(c.Networking.ResolveDNS) > 0 { + return true + } + + if c.ControlPlane.CoreDNS.Embedded { + return true + } + + if c.Distro() == K8SDistro { + if c.ControlPlane.BackingStore.Database.External.Enabled { + return true + } + } + + if c.ControlPlane.BackingStore.Etcd.Embedded.Enabled { + return true + } + + if len(c.Policies.CentralAdmission.ValidatingWebhooks) > 0 || len(c.Policies.CentralAdmission.MutatingWebhooks) > 0 { + return true + } + + if c.ControlPlane.HostPathMapper.Central { + return true + } + + if c.Experimental.SyncSettings.DisableSync { + return true + } + + if c.Experimental.SyncSettings.RewriteKubernetesService { + return true + } + + if c.Experimental.IsolatedControlPlane.Enabled { + return true + } + + if len(c.Experimental.DenyProxyRequests) > 0 { + return true + } + + if len(c.External["platform"]) > 0 { + return true + } + + return false +} + +func UnmarshalYAMLStrict(data []byte, i any) error { + if err := yaml.UnmarshalStrict(data, i); err != nil { + return fmt.Errorf("%w: %w", ErrInvalidConfig, err) + } + return nil +} + +// ExportKubeConfig describes how vCluster should export the vCluster kubeconfig. +type ExportKubeConfig struct { + // Context is the name of the context within the generated kubeconfig to use. + Context string `json:"context"` + + // Override the default https://localhost:8443 and specify a custom hostname for the generated kubeconfig. + Server string `json:"server"` + + // Declare in which host cluster secret vCluster should store the generated virtual cluster kubeconfig. + // If this is not defined, vCluster create it with `vc-NAME`. If you specify another name, + // vCluster creates the config in this other secret. + Secret ExportKubeConfigSecretReference `json:"secret,omitempty"` +} + +// Declare in which host cluster secret vCluster should store the generated virtual cluster kubeconfig. +// If this is not defined, vCluster create it with `vc-NAME`. If you specify another name, +// vCluster creates the config in this other secret. +type ExportKubeConfigSecretReference struct { + // Name is the name of the secret where the kubeconfig should get stored. + Name string `json:"name,omitempty"` + + // Namespace where vCluster should store the kubeconfig secret. If this is not equal to the namespace + // where you deployed vCluster, you need to make sure vCluster has access to this other namespace. + Namespace string `json:"namespace,omitempty"` +} + +type Sync struct { + // Configure resources to sync from the virtual cluster to the host cluster. + ToHost SyncToHost `json:"toHost,omitempty"` + + // Configure what resources vCluster should sync from the host cluster to the virtual cluster. + FromHost SyncFromHost `json:"fromHost,omitempty"` +} + +type SyncToHost struct { + // Pods defines if pods created within the virtual cluster should get synced to the host cluster. + Pods SyncPods `json:"pods,omitempty"` + + // Secrets defines if secrets created within the virtual cluster should get synced to the host cluster. + Secrets SyncAllResource `json:"secrets,omitempty"` + + // ConfigMaps defines if config maps created within the virtual cluster should get synced to the host cluster. + ConfigMaps SyncAllResource `json:"configMaps,omitempty"` + + // Ingresses defines if ingresses created within the virtual cluster should get synced to the host cluster. + Ingresses EnableSwitchWithTranslate `json:"ingresses,omitempty"` + + // Services defines if services created within the virtual cluster should get synced to the host cluster. + Services EnableSwitchWithTranslate `json:"services,omitempty"` + + // Endpoints defines if endpoints created within the virtual cluster should get synced to the host cluster. + Endpoints EnableSwitch `json:"endpoints,omitempty"` + + // NetworkPolicies defines if network policies created within the virtual cluster should get synced to the host cluster. + NetworkPolicies EnableSwitch `json:"networkPolicies,omitempty"` + + // PersistentVolumeClaims defines if persistent volume claims created within the virtual cluster should get synced to the host cluster. + PersistentVolumeClaims EnableSwitchWithTranslate `json:"persistentVolumeClaims,omitempty"` + + // PersistentVolumes defines if persistent volumes created within the virtual cluster should get synced to the host cluster. + PersistentVolumes EnableSwitch `json:"persistentVolumes,omitempty"` + + // VolumeSnapshots defines if volume snapshots created within the virtual cluster should get synced to the host cluster. + VolumeSnapshots EnableSwitch `json:"volumeSnapshots,omitempty"` + + // StorageClasses defines if storage classes created within the virtual cluster should get synced to the host cluster. + StorageClasses EnableSwitch `json:"storageClasses,omitempty"` + + // ServiceAccounts defines if service accounts created within the virtual cluster should get synced to the host cluster. + ServiceAccounts EnableSwitch `json:"serviceAccounts,omitempty"` + + // PodDisruptionBudgets defines if pod disruption budgets created within the virtual cluster should get synced to the host cluster. + PodDisruptionBudgets EnableSwitch `json:"podDisruptionBudgets,omitempty"` + + // PriorityClasses defines if priority classes created within the virtual cluster should get synced to the host cluster. + PriorityClasses EnableSwitch `json:"priorityClasses,omitempty"` + + // CustomResourceDefinitions defines what custom resource definitions should get synced from the virtual cluster to the host cluster. + CustomResourceDefinitions map[string]SyncToHostCustomResourceDefinition `json:"customResourceDefinitions,omitempty"` +} + +type EnableSwitchWithTranslate struct { + // Enabled defines if this option should be enabled. + Enabled bool `json:"enabled,omitempty"` + + // Translate the patch according to the given patches. + Translate []TranslatePatch `json:"translate,omitempty"` +} + +type SyncFromHost struct { + // Nodes defines if nodes should get synced from the host cluster to the virtual cluster, but not back. + Nodes SyncNodes `json:"nodes,omitempty"` + + // Events defines if events should get synced from the host cluster to the virtual cluster, but not back. + Events EnableSwitch `json:"events,omitempty"` + + // IngressClasses defines if ingress classes should get synced from the host cluster to the virtual cluster, but not back. + IngressClasses EnableSwitch `json:"ingressClasses,omitempty"` + + // RuntimeClasses defines if runtime classes should get synced from the host cluster to the virtual cluster, but not back. + RuntimeClasses EnableSwitch `json:"runtimeClasses,omitempty"` + + // PriorityClasses defines if priority classes classes should get synced from the host cluster to the virtual cluster, but not back. + PriorityClasses EnableSwitch `json:"priorityClasses,omitempty"` + + // StorageClasses defines if storage classes should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled. + StorageClasses EnableAutoSwitch `json:"storageClasses,omitempty"` + + // CSINodes defines if csi nodes should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled. + CSINodes EnableAutoSwitch `json:"csiNodes,omitempty"` + + // CSIDrivers defines if csi drivers should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled. + CSIDrivers EnableAutoSwitch `json:"csiDrivers,omitempty"` + + // CSIStorageCapacities defines if csi storage capacities should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled. + CSIStorageCapacities EnableAutoSwitch `json:"csiStorageCapacities,omitempty"` + + // CustomResourceDefinitions defines what custom resource definitions should get synced read-only to the virtual cluster from the host cluster. + CustomResourceDefinitions map[string]SyncFromHostCustomResourceDefinition `json:"customResourceDefinitions,omitempty"` +} + +type SyncToHostCustomResourceDefinition struct { + // Enabled defines if this option should be enabled. + Enabled bool `json:"enabled,omitempty"` + + // Translate the patch according to the given patches. + Translate []TranslatePatch `json:"translate,omitempty"` +} + +type TranslatePatch struct { + // Path is the path within the patch to target. If the path is not found within the patch, the patch is not applied. + Path string `json:"path,omitempty"` + + // Expression transforms the value according to the given JavaScript expression. + Expression *TranslatePatchExpression `json:"expression,omitempty" jsonschema:"oneof_required=expression"` + + // Reference treats the path value as a reference to another object and will rewrite it based on the chosen mode + // automatically. In single-namespace mode this will translate the name to "vxxxxxxxxx" to avoid conflicts with + // other names, in multi-namespace mode this will not translate the name. + Reference *TranslatePatchReference `json:"reference,omitempty" jsonschema:"oneof_required=reference"` + + // Labels treats the path value as a labels selector. + Labels *TranslatePatchLabels `json:"labels,omitempty" jsonschema:"oneof_required=labels"` +} + +type TranslatePatchLabels struct{} + +type TranslatePatchReference struct { + // APIVersion is the apiVersion of the referenced object. + APIVersion string `json:"apiVersion,omitempty" jsonschema:"required"` + + // APIVersionPath is optional relative path to use to determine the kind. If APIVersionPath is not found, will fallback to apiVersion. + APIVersionPath string `json:"apiVersionPath,omitempty"` + + // Kind is the kind of the referenced object. + Kind string `json:"kind,omitempty" jsonschema:"required"` + + // KindPath is the optional relative path to use to determine the kind. If KindPath is not found, will fallback to kind. + KindPath string `json:"kindPath,omitempty"` + + // NamePath is the optional relative path to the reference name within the object. + NamePath string `json:"namePath,omitempty"` + + // NamespacePath is the optional relative path to the reference namespace within the object. If omitted or not found, namespacePath equals to the + // metadata.namespace path of the object. + NamespacePath string `json:"namespacePath,omitempty"` +} + +type TranslatePatchExpression struct { + // ToHost is the expression to apply when retrieving a change from virtual to host. + ToHost string `json:"toHost,omitempty" jsonschema:"oneof_required=toHost"` + + // FromHost is the patch to apply when retrieving a change from host to virtual. + FromHost string `json:"fromHost,omitempty" jsonschema:"oneof_required=fromHost"` +} + +type SyncFromHostCustomResourceDefinition struct { + // Enabled defines if this option should be enabled. + Enabled bool `json:"enabled,omitempty"` +} + +type EnableAutoSwitch struct { + // Enabled defines if this option should be enabled. + Enabled StrBool `json:"enabled,omitempty" jsonschema:"oneof_type=string;boolean"` +} + +type EnableSwitch struct { + // Enabled defines if this option should be enabled. + Enabled bool `json:"enabled,omitempty"` +} + +type SyncAllResource struct { + // Enabled defines if this option should be enabled. + Enabled bool `json:"enabled,omitempty"` + + // All defines if all resources of that type should get synced or only the necessary ones that are needed. + All bool `json:"all,omitempty"` + + // Translate the patch according to the given patches. + Translate []TranslatePatch `json:"translate,omitempty"` +} + +type SyncPods struct { + // Enabled defines if pod syncing should be enabled. + Enabled bool `json:"enabled,omitempty"` + + // TranslateImage maps an image to another image that should be used instead. For example this can be used to rewrite + // a certain image that is used within the virtual cluster to be another image on the host cluster + TranslateImage map[string]string `json:"translateImage,omitempty"` + + // EnforceTolerations will add the specified tolerations to all pods synced by the virtual cluster. + EnforceTolerations []string `json:"enforceTolerations,omitempty"` + + // UseSecretsForSATokens will use secrets to save the generated service account tokens by virtual cluster instead of using a + // pod annotation. + UseSecretsForSATokens bool `json:"useSecretsForSATokens,omitempty"` + + // RewriteHosts is a special option needed to rewrite statefulset containers to allow the correct FQDN. virtual cluster will add + // a small container to each stateful set pod that will initially rewrite the /etc/hosts file to match the FQDN expected by + // the virtual cluster. + RewriteHosts SyncRewriteHosts `json:"rewriteHosts,omitempty"` + + // Translate the patch according to the given patches. + Translate []TranslatePatch `json:"translate,omitempty"` +} + +type SyncRewriteHosts struct { + // Enabled specifies if rewriting stateful set pods should be enabled. + Enabled bool `json:"enabled,omitempty"` + + // InitContainer holds extra options for the init container used by vCluster to rewrite the FQDN for stateful set pods. + InitContainer SyncRewriteHostsInitContainer `json:"initContainer,omitempty"` +} + +type SyncRewriteHostsInitContainer struct { + // Image is the image virtual cluster should use to rewrite this FQDN. + Image string `json:"image,omitempty"` + + // Resources are the resources that should be assigned to the init container for each stateful set init container. + Resources Resources `json:"resources,omitempty"` +} + +type SyncNodes struct { + // Enabled specifies if syncing real nodes should be enabled. If this is disabled, vCluster will create fake nodes instead. + Enabled bool `json:"enabled,omitempty"` + + // SyncBackChanges enables syncing labels and taints from the virtual cluster to the host cluster. If this is enabled someone within the virtual cluster will be able to change the labels and taints of the host cluster node. + SyncBackChanges bool `json:"syncBackChanges,omitempty"` + + // ClearImageStatus will erase the image status when syncing a node. This allows to hide images that are pulled by the node. + ClearImageStatus bool `json:"clearImageStatus,omitempty"` + + // Selector can be used to define more granular what nodes should get synced from the host cluster to the virtual cluster. + Selector SyncNodeSelector `json:"selector,omitempty"` +} + +type SyncNodeSelector struct { + // All specifies if all nodes should get synced by vCluster from the host to the virtual cluster or only the ones where pods are assigned to. + All bool `json:"all,omitempty"` + + // Labels are the node labels used to sync nodes from host cluster to virtual cluster. This will also set the node selector when syncing a pod from virtual cluster to host cluster to the same value. + Labels map[string]string `json:"labels,omitempty"` +} + +type ServiceMonitor struct { + // Enabled configures if Helm should create the service monitor. + Enabled bool `json:"enabled,omitempty"` + + // Labels are the extra labels to add to the service monitor. + Labels map[string]string `json:"labels,omitempty"` + + // Annotations are the extra annotations to add to the service monitor. + Annotations map[string]string `json:"annotations,omitempty"` +} + +type Networking struct { + // ReplicateServices allows replicating services from the host within the virtual cluster or the other way around. + ReplicateServices ReplicateServices `json:"replicateServices,omitempty"` + + // ResolveDNS allows to define extra DNS rules. This only works if embedded coredns is configured. + ResolveDNS []ResolveDNS `json:"resolveDNS,omitempty" product:"pro"` + + // Advanced holds advanced network options. + Advanced NetworkingAdvanced `json:"advanced,omitempty"` +} + +func (n Networking) JSONSchemaExtend(base *jsonschema.Schema) { + addProToJSONSchema(base, reflect.TypeOf(n)) +} + +type ReplicateServices struct { + // ToHost defines the services that should get synced from virtual cluster to the host cluster. If services are + // synced to a different namespace than the virtual cluster is in, additional permissions for the other namespace + // are required. + ToHost []ServiceMapping `json:"toHost,omitempty"` + + // FromHost defines the services that should get synced from the host to the virtual cluster. + FromHost []ServiceMapping `json:"fromHost,omitempty"` +} + +type ServiceMapping struct { + // From is the service that should get synced. Can be either in the form name or namespace/name. + From string `json:"from,omitempty"` + + // To is the target service that it should get synced to. Can be either in the form name or namespace/name. + To string `json:"to,omitempty"` +} + +type ResolveDNS struct { + // Hostname is the hostname within the vCluster that should be resolved from. + Hostname string `json:"hostname"` + + // Service is the virtual cluster service that should be resolved from. + Service string `json:"service"` + + // Namespace is the virtual cluster namespace that should be resolved from. + Namespace string `json:"namespace"` + + // Target is the DNS target that should get mapped to + Target ResolveDNSTarget `json:"target,omitempty"` +} + +type ResolveDNSTarget struct { + // Hostname to use as a DNS target + Hostname string `json:"hostname,omitempty"` + + // IP to use as a DNS target + IP string `json:"ip,omitempty"` + + // HostService to target, format is hostNamespace/hostService + HostService string `json:"hostService,omitempty"` + + // HostNamespace to target + HostNamespace string `json:"hostNamespace,omitempty"` + + // VClusterService format is hostNamespace/vClusterName/vClusterNamespace/vClusterService + VClusterService string `json:"vClusterService,omitempty"` +} + +type NetworkingAdvanced struct { + // ClusterDomain is the Kubernetes cluster domain to use within the virtual cluster. + ClusterDomain string `json:"clusterDomain,omitempty"` + + // FallbackHostCluster allows to fallback dns to the host cluster. This is useful if you want to reach host services without + // any other modification. You will need to provide a namespace for the service, e.g. my-other-service.my-other-namespace + FallbackHostCluster bool `json:"fallbackHostCluster,omitempty"` + + // ProxyKubelets allows rewriting certain metrics and stats from the Kubelet to "fake" this for applications such as + // prometheus or other node exporters. + ProxyKubelets NetworkProxyKubelets `json:"proxyKubelets,omitempty"` +} + +type NetworkProxyKubelets struct { + // ByHostname will add a special vCluster hostname to the nodes where the node can be reached at. This doesn't work + // for all applications, e.g. Prometheus requires a node IP. + ByHostname bool `json:"byHostname,omitempty"` + + // ByIP will create a separate service in the host cluster for every node that will point to virtual cluster and will be used to + // route traffic. + ByIP bool `json:"byIP,omitempty"` +} + +type Plugin struct { + Plugins `json:",inline"` + + // Version is the plugin version, this is only needed for legacy plugins. + Version string `json:"version,omitempty"` + Env []interface{} `json:"env,omitempty"` + EnvFrom []interface{} `json:"envFrom,omitempty"` + Lifecycle map[string]interface{} `json:"lifecycle,omitempty"` + LivenessProbe map[string]interface{} `json:"livenessProbe,omitempty"` + ReadinessProbe map[string]interface{} `json:"readinessProbe,omitempty"` + StartupProbe map[string]interface{} `json:"startupProbe,omitempty"` + WorkingDir string `json:"workingDir,omitempty"` + Optional bool `json:"optional,omitempty"` +} + +type Plugins struct { + // Name is the name of the init-container and NOT the plugin name + Name string `json:"name,omitempty"` + + // Image is the container image that should be used for the plugin + Image string `json:"image,omitempty"` + + // ImagePullPolicy is the pull policy to use for the container image + ImagePullPolicy string `json:"imagePullPolicy,omitempty"` + + // Config is the plugin config to use. This can be arbitrary config used for the plugin. + Config map[string]interface{} `json:"config,omitempty"` + + // RBAC holds additional rbac configuration for the plugin + RBAC PluginsRBAC `json:"rbac,omitempty"` + + // Command is the command that should be used for the init container + Command []string `json:"command,omitempty"` + + // Args are the arguments that should be used for the init container + Args []string `json:"args,omitempty"` + + // SecurityContext is the container security context used for the init container + SecurityContext map[string]interface{} `json:"securityContext,omitempty"` + + // Resources are the container resources used for the init container + Resources map[string]interface{} `json:"resources,omitempty"` + + // VolumeMounts are extra volume mounts for the init container + VolumeMounts []interface{} `json:"volumeMounts,omitempty"` +} + +type PluginsRBAC struct { + // Role holds extra virtual cluster role permissions for the plugin + Role PluginsExtraRules `json:"role,omitempty"` + + // ClusterRole holds extra virtual cluster cluster role permissions required for the plugin + ClusterRole PluginsExtraRules `json:"clusterRole,omitempty"` +} + +type PluginsExtraRules struct { + // ExtraRules are extra rbac permissions roles that will be added to role or cluster role + ExtraRules []RBACPolicyRule `json:"extraRules,omitempty"` +} + +type RBACPolicyRule struct { + // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. + Verbs []string `json:"verbs"` + + // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + // the enumerated resources in any API group will be allowed. "" represents the core API group and "*" represents all API groups. + APIGroups []string `json:"apiGroups,omitempty"` + + // Resources is a list of resources this rule applies to. '*' represents all resources. + Resources []string `json:"resources,omitempty"` + + // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + ResourceNames []string `json:"resourceNames,omitempty"` + + // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path + // Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. + // Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both. + NonResourceURLs []string `json:"nonResourceURLs,omitempty"` +} + +type ControlPlane struct { + // Distro holds virtual cluster related distro options. A distro cannot be changed after vCluster is deployed. + Distro Distro `json:"distro,omitempty"` + + // BackingStore defines which backing store to use for virtual cluster. If not defined will use embedded database as a default backing store. + BackingStore BackingStore `json:"backingStore,omitempty"` + + // CoreDNS defines everything related to the coredns that is deployed and used within the vCluster. + CoreDNS CoreDNS `json:"coredns,omitempty"` + + // Proxy defines options for the virtual cluster control plane proxy that is used to do authentication and intercept requests. + Proxy ControlPlaneProxy `json:"proxy,omitempty"` + + // HostPathMapper defines if vCluster should rewrite host paths. + HostPathMapper HostPathMapper `json:"hostPathMapper,omitempty" product:"pro"` + + // Ingress defines options for vCluster ingress deployed by Helm. + Ingress ControlPlaneIngress `json:"ingress,omitempty"` + + // Service defines options for vCluster service deployed by Helm. + Service ControlPlaneService `json:"service,omitempty"` + + // StatefulSet defines options for vCluster statefulSet deployed by Helm. + StatefulSet ControlPlaneStatefulSet `json:"statefulSet,omitempty"` + + // ServiceMonitor can be used to automatically create a service monitor for vCluster deployment itself. + ServiceMonitor ServiceMonitor `json:"serviceMonitor,omitempty"` + + // Advanced holds additional configuration for the vCluster control plane. + Advanced ControlPlaneAdvanced `json:"advanced,omitempty"` +} + +func (c ControlPlane) JSONSchemaExtend(base *jsonschema.Schema) { + addProToJSONSchema(base, reflect.TypeOf(c)) +} + +type ControlPlaneStatefulSet struct { + // HighAvailability holds options related to high availability. + HighAvailability ControlPlaneHighAvailability `json:"highAvailability,omitempty"` + + // Resources are the resource requests and limits for the statefulSet container. + Resources Resources `json:"resources,omitempty"` + + // Scheduling holds options related to scheduling. + Scheduling ControlPlaneScheduling `json:"scheduling,omitempty"` + + // Security defines pod or container security context. + Security ControlPlaneSecurity `json:"security,omitempty"` + + // Probes enables or disables the main container probes. + Probes ControlPlaneProbes `json:"probes,omitempty"` + + // Persistence defines options around persistence for the statefulSet. + Persistence ControlPlanePersistence `json:"persistence,omitempty"` + + // EnableServiceLinks for the StatefulSet pod + EnableServiceLinks *bool `json:"enableServiceLinks,omitempty"` + + LabelsAndAnnotations `json:",inline"` + + // Additional labels or annotations for the statefulSet pods. + Pods LabelsAndAnnotations `json:"pods,omitempty"` + + // Image is the image for the controlPlane statefulSet container + Image StatefulSetImage `json:"image,omitempty"` + + // ImagePullPolicy is the policy how to pull the image. + ImagePullPolicy string `json:"imagePullPolicy,omitempty"` + + // WorkingDir specifies in what folder the main process should get started. + WorkingDir string `json:"workingDir,omitempty"` + + // Command allows you to override the main command. + Command []string `json:"command,omitempty"` + + // Args allows you to override the main arguments. + Args []string `json:"args,omitempty"` + + // Env are additional environment variables for the statefulSet container. + Env []map[string]interface{} `json:"env,omitempty"` + + // Set DNS policy for the pod. + DNSPolicy DNSPolicy `json:"dnsPolicy,omitempty"` + + // Specifies the DNS parameters of a pod. + DNSConfig *PodDNSConfig `json:"dnsConfig,omitempty"` +} + +type Distro struct { + // K8S holds K8s relevant configuration. + K8S DistroK8s `json:"k8s,omitempty"` + + // K3S holds K3s relevant configuration. + K3S DistroK3s `json:"k3s,omitempty"` + + // K0S holds k0s relevant configuration. + K0S DistroK0s `json:"k0s,omitempty"` +} + +type DistroK3s struct { + // Enabled specifies if the K3s distro should be enabled. Only one distro can be enabled at the same time. + Enabled bool `json:"enabled,omitempty"` + + // Token is the K3s token to use. If empty, vCluster will choose one. + Token string `json:"token,omitempty"` + + DistroCommon `json:",inline"` + DistroContainer `json:",inline"` +} + +type DistroK8s struct { + // Enabled specifies if the K8s distro should be enabled. Only one distro can be enabled at the same time. + Enabled bool `json:"enabled,omitempty"` + + // Version specifies k8s components (scheduler, kube-controller-manager & apiserver) version. + // It is a shortcut for controlPlane.distro.k8s.apiServer.image.tag, + // controlPlane.distro.k8s.controllerManager.image.tag and + // controlPlane.distro.k8s.scheduler.image.tag + // If e.g. controlPlane.distro.k8s.version is set to v1.30.1 and + // controlPlane.distro.k8s.scheduler.image.tag + //(or controlPlane.distro.k8s.controllerManager.image.tag or controlPlane.distro.k8s.apiServer.image.tag) + // is set to v1.31.0, + // value from controlPlane.distro.k8s..image.tag will be used + // (where 0 && len(v.Pre) > 0 && supportedStartVer.Pre[0] != v.Pre[0] { + // this is a special case- its possible in our releases for an alpha to be ahead of a beta; + // we cannot compare prebuilds unless they share the same first element. + return true, nil + } + if v.GTE(supportedStartVer) { + return true, nil + } + return false, nil + } + // in the case no relevant start version was found for minor we can assume k8s version is supported + return true, nil +} + +func parseImage(image string) Image { + registry, repository, tag := SplitImage(image) + return Image{ + Registry: registry, + Repository: repository, + Tag: tag, + } +} + +func SplitImage(image string) (string, string, string) { + imageSplitted := strings.Split(image, ":") + if len(imageSplitted) == 1 { + return "", "", "" + } + + // check if registry needs to be filled + registryAndRepository := strings.Join(imageSplitted[:len(imageSplitted)-1], ":") + parts := strings.Split(registryAndRepository, "/") + registry := "" + repository := strings.Join(parts, "/") + if len(parts) >= 2 && (strings.ContainsRune(parts[0], '.') || strings.ContainsRune(parts[0], ':')) { + // The first part of the repository is treated as the registry domain + // iff it contains a '.' or ':' character, otherwise it is all repository + // and the domain defaults to Docker Hub. + registry = parts[0] + repository = strings.Join(parts[1:], "/") + } + + return registry, repository, imageSplitted[len(imageSplitted)-1] +} + +func getImageByVersion(kubernetesVersion KubernetesVersion, versionImageMap map[string]string) (string, error) { + // check if there is a minor and major version + if kubernetesVersion.Minor == "" || kubernetesVersion.Major == "" { + return "", nil + } + + // find highest and lowest supported version for this map + highestMinorVersion := 0 + lowestMinorVersion := 0 + for version := range versionImageMap { + kubeVersion, err := ParseKubernetesVersionInfo(version) + if err != nil { + return "", fmt.Errorf("parse kube version %s: %w", version, err) + } + + minorVersion, err := strconv.Atoi(kubeVersion.Minor) + if err != nil { + return "", fmt.Errorf("convert minor version %s: %w", kubeVersion.Minor, err) + } + + if lowestMinorVersion == 0 || minorVersion < lowestMinorVersion { + lowestMinorVersion = minorVersion + } + if highestMinorVersion == 0 || minorVersion > highestMinorVersion { + highestMinorVersion = minorVersion + } + } + + // figure out what image to use + serverVersionString := getKubernetesVersion(kubernetesVersion) + serverMinorInt, err := getKubernetesMinorVersion(kubernetesVersion) + if err != nil { + return "", err + } + + // try to get from map + image, ok := versionImageMap[serverVersionString] + if !ok { + if serverMinorInt > highestMinorVersion { + image = versionImageMap["1."+strconv.Itoa(highestMinorVersion)] + } else { + image = versionImageMap["1."+strconv.Itoa(lowestMinorVersion)] + } + } + + return image, nil +} + +func addCommonReleaseValues(config *Config, options *ExtraValuesOptions) { + if options.Expose { + if config.ControlPlane.Service.Spec == nil { + config.ControlPlane.Service.Spec = map[string]interface{}{} + } + + config.ControlPlane.Service.Spec["type"] = "LoadBalancer" + } else if options.NodePort { + if config.ControlPlane.Service.Spec == nil { + config.ControlPlane.Service.Spec = map[string]interface{}{} + } + + config.ControlPlane.Service.Spec["type"] = "NodePort" + } + + if options.DisableTelemetry { + config.Telemetry.Enabled = false + } else if options.InstanceCreatorType != "" { + config.Telemetry.InstanceCreator = options.InstanceCreatorType + config.Telemetry.PlatformUserID = options.PlatformUserID + config.Telemetry.PlatformInstanceID = options.PlatformInstanceID + config.Telemetry.MachineID = options.MachineID + } + + if options.Distro != "" { + switch options.Distro { + case K3SDistro: + config.ControlPlane.Distro.K3S.Enabled = true + case K0SDistro: + config.ControlPlane.Distro.K0S.Enabled = true + case K8SDistro: + } + } +} + +func getKubernetesVersion(serverVersion KubernetesVersion) string { + return replaceRegEx.ReplaceAllString(serverVersion.Major, "") + "." + replaceRegEx.ReplaceAllString(serverVersion.Minor, "") +} + +func getKubernetesMinorVersion(serverVersion KubernetesVersion) (int, error) { + return strconv.Atoi(replaceRegEx.ReplaceAllString(serverVersion.Minor, "")) +} + +func ParseKubernetesVersionInfo(versionStr string) (*KubernetesVersion, error) { + if versionStr[0] == 'v' { + versionStr = versionStr[1:] + } + + splittedVersion := strings.Split(versionStr, ".") + if len(splittedVersion) != 2 && len(splittedVersion) != 3 { + return nil, fmt.Errorf("unrecognized kubernetes version %s, please use format vX.X", versionStr) + } + + major := splittedVersion[0] + minor := splittedVersion[1] + return &KubernetesVersion{ + Major: major, + Minor: minor, + }, nil +} diff --git a/config/v0.21/diff.go b/config/v0.21/diff.go new file mode 100644 index 000000000..c879ba13a --- /dev/null +++ b/config/v0.21/diff.go @@ -0,0 +1,166 @@ +package config + +import ( + "encoding/json" + "errors" + "reflect" + "strconv" + + "sigs.k8s.io/yaml" +) + +// ErrUnsupportedType is returned if the type is not implemented +var ErrUnsupportedType = errors.New("unsupported type") + +func Diff(fromConfig *Config, toConfig *Config) (string, error) { + // convert to map[string]interface{} + fromRaw := map[string]interface{}{} + err := convert(fromConfig, &fromRaw) + if err != nil { + return "", err + } + + toRaw := map[string]interface{}{} + err = convert(toConfig, &toRaw) + if err != nil { + return "", err + } + + diffRaw := diff(fromRaw, toRaw) + if diffRaw == nil { + diffRaw = map[string]interface{}{} + } + + out, err := yaml.Marshal(diffRaw) + if err != nil { + return "", err + } + + return string(out), nil +} + +func diff(from, to any) any { + if reflect.DeepEqual(from, to) { + return nil + } + + switch fromType := from.(type) { + case map[string]interface{}: + toMap, ok := to.(map[string]interface{}) + if !ok { + return prune(to) + } + + retMap := map[string]interface{}{} + + // from -> to + for k, fromValue := range fromType { + toValue, ok := toMap[k] + if !ok { + switch fromValue.(type) { + // if its a boolean, its true -> false + case bool: + retMap[k] = false + // if its a string, its "something" -> "" + case string: + retMap[k] = "" + // if its an int, its 3 -> 0 + case int: + retMap[k] = 0 + // if its an int, its 3 -> 0 + case int64: + retMap[k] = int64(0) + // if its an int, its 3 -> 0 + case float64: + retMap[k] = float64(0) + } + } else if !reflect.DeepEqual(fromValue, toValue) { + switch fromValue.(type) { + case map[string]interface{}: + retMap[k] = diff(fromValue, toValue) + default: + retMap[k] = toValue + } + } + } + + // to -> from + for k, toValue := range toMap { + _, ok := fromType[k] + if !ok { + retMap[k] = toValue + } + } + + return prune(retMap) + default: + return prune(to) + } +} + +func prune(in interface{}) interface{} { + switch inType := in.(type) { + case []interface{}: + for i, v := range inType { + inType[i] = prune(v) + } + return in + case map[string]interface{}: + if len(inType) == 0 { + return nil + } + + for k, v := range inType { + inType[k] = prune(v) + if inType[k] == nil { + delete(inType, k) + } + } + + if len(inType) == 0 { + return nil + } + return inType + default: + return in + } +} + +func convert(from, to any) error { + rawFrom, err := json.Marshal(from) + if err != nil { + return err + } + + return json.Unmarshal(rawFrom, to) +} + +type StrBool string + +func (f *StrBool) UnmarshalJSON(data []byte) error { + var jsonObj interface{} + err := json.Unmarshal(data, &jsonObj) + if err != nil { + return err + } + switch obj := jsonObj.(type) { + case string: + *f = StrBool(obj) + return nil + case bool: + *f = StrBool(strconv.FormatBool(obj)) + return nil + } + return ErrUnsupportedType +} + +func (f *StrBool) MarshalJSON() ([]byte, error) { + switch *f { + case "true": + return []byte("true"), nil + case "false": + return []byte("false"), nil + default: + return []byte("\"" + *f + "\""), nil + } +} diff --git a/config/v0.21/values.yaml b/config/v0.21/values.yaml new file mode 100644 index 000000000..767f21265 --- /dev/null +++ b/config/v0.21/values.yaml @@ -0,0 +1,542 @@ +# DO NOT ADD ANY COMMENTS TO THIS FILE. +# Comments are added automatically in the hack/schema/main.go script according to the type defined in config.go +# If you want to change or add any comment, please change/add it in the config.go and rerun hack/schema/main.go +sync: + toHost: + services: + enabled: true + endpoints: + enabled: true + persistentVolumeClaims: + enabled: true + configMaps: + enabled: true + all: false + secrets: + enabled: true + all: false + pods: + enabled: true + translateImage: {} + enforceTolerations: [] + useSecretsForSATokens: false + rewriteHosts: + enabled: true + initContainer: + image: "library/alpine:3.20" + resources: + limits: + cpu: 30m + memory: 64Mi + requests: + cpu: 30m + memory: 64Mi + ingresses: + enabled: false + priorityClasses: + enabled: false + networkPolicies: + enabled: false + volumeSnapshots: + enabled: false + podDisruptionBudgets: + enabled: false + serviceAccounts: + enabled: false + storageClasses: + enabled: false + persistentVolumes: + enabled: false + + fromHost: + events: + enabled: true + csiDrivers: + enabled: auto + csiNodes: + enabled: auto + csiStorageCapacities: + enabled: auto + storageClasses: + enabled: auto + ingressClasses: + enabled: false + runtimeClasses: + enabled: false + priorityClasses: + enabled: false + nodes: + enabled: false + syncBackChanges: false + clearImageStatus: false + selector: + all: false + labels: {} + +controlPlane: + distro: + k8s: + enabled: false + version: "" + apiServer: + enabled: true + command: [] + extraArgs: [] + imagePullPolicy: "" + image: + registry: registry.k8s.io + repository: kube-apiserver + tag: "v1.30.2" + controllerManager: + enabled: true + command: [] + extraArgs: [] + imagePullPolicy: "" + image: + registry: registry.k8s.io + repository: "kube-controller-manager" + tag: "v1.30.2" + scheduler: + command: [] + extraArgs: [] + imagePullPolicy: "" + image: + registry: registry.k8s.io + repository: "kube-scheduler" + tag: "v1.30.2" + env: [] + securityContext: {} + resources: + limits: + cpu: 100m + memory: 256Mi + requests: + cpu: 40m + memory: 64Mi + + k3s: + enabled: false + command: [] + extraArgs: [] + imagePullPolicy: "" + image: + registry: "" + repository: "rancher/k3s" + tag: "v1.30.2-k3s1" + securityContext: {} + resources: + limits: + cpu: 100m + memory: 256Mi + requests: + cpu: 40m + memory: 64Mi + + k0s: + enabled: false + config: "" + command: [] + extraArgs: [] + imagePullPolicy: "" + image: + registry: "" + repository: "k0sproject/k0s" + tag: "v1.30.2-k0s.0" + securityContext: {} + resources: + limits: + cpu: 100m + memory: 256Mi + requests: + cpu: 40m + memory: 64Mi + + backingStore: + database: + embedded: + enabled: false + external: + enabled: false + dataSource: "" + certFile: "" + keyFile: "" + caFile: "" + etcd: + embedded: + enabled: false + migrateFromDeployedEtcd: false + deploy: + enabled: false + statefulSet: + enabled: true + enableServiceLinks: true + annotations: {} + labels: {} + image: + registry: "registry.k8s.io" + repository: "etcd" + tag: "3.5.13-0" + imagePullPolicy: "" + extraArgs: [] + env: [] + resources: + requests: + cpu: 20m + memory: 150Mi + pods: + annotations: {} + labels: {} + highAvailability: + replicas: 1 + scheduling: + podManagementPolicy: Parallel + nodeSelector: {} + affinity: {} + tolerations: [] + topologySpreadConstraints: [] + priorityClassName: "" + security: + podSecurityContext: {} + containerSecurityContext: {} + persistence: + volumeClaim: + enabled: true + retentionPolicy: Retain + size: 5Gi + storageClass: "" + accessModes: [ "ReadWriteOnce" ] + volumeClaimTemplates: [] + addVolumes: [] + addVolumeMounts: [] + service: + enabled: true + annotations: {} + headlessService: + enabled: true + annotations: {} + + proxy: + bindAddress: "0.0.0.0" + port: 8443 + extraSANs: [] + + coredns: + enabled: true + embedded: false + overwriteManifests: "" + overwriteConfig: "" + priorityClassName: "" + service: + annotations: {} + labels: {} + spec: + type: ClusterIP + deployment: + annotations: {} + labels: {} + image: "" + replicas: 1 + pods: + labels: {} + annotations: {} + nodeSelector: {} + affinity: {} + tolerations: [] + resources: + limits: + cpu: 1000m + memory: 170Mi + requests: + cpu: 20m + memory: 64Mi + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: kubernetes.io/hostname + whenUnsatisfiable: DoNotSchedule + labelSelector: + matchLabels: + k8s-app: kube-dns + + service: + enabled: true + labels: {} + annotations: {} + kubeletNodePort: 0 + httpsNodePort: 0 + spec: + type: ClusterIP + + ingress: + enabled: false + host: "my-host.com" + pathType: ImplementationSpecific + labels: {} + annotations: + nginx.ingress.kubernetes.io/backend-protocol: HTTPS + nginx.ingress.kubernetes.io/ssl-passthrough: "true" + nginx.ingress.kubernetes.io/ssl-redirect: "true" + spec: + tls: [] + + statefulSet: + labels: {} + annotations: {} + imagePullPolicy: "" + image: + registry: "ghcr.io" + repository: "loft-sh/vcluster-pro" + tag: "" + + workingDir: "" + command: [] + args: [] + env: [] + + resources: + limits: + ephemeral-storage: 8Gi + memory: 2Gi + requests: + ephemeral-storage: 400Mi + cpu: 200m + memory: 256Mi + + pods: + labels: {} + annotations: {} + + highAvailability: + replicas: 1 + leaseDuration: 60 + renewDeadline: 40 + retryPeriod: 15 + + security: + podSecurityContext: {} + containerSecurityContext: + allowPrivilegeEscalation: false + runAsUser: 0 + runAsGroup: 0 + + persistence: + volumeClaim: + enabled: auto + retentionPolicy: Retain + size: 5Gi + storageClass: "" + accessModes: [ "ReadWriteOnce" ] + volumeClaimTemplates: [] + addVolumeMounts: [] + addVolumes: [] + dataVolume: [] + binariesVolume: + - name: binaries + emptyDir: {} + + enableServiceLinks: true + + scheduling: + podManagementPolicy: Parallel + topologySpreadConstraints: [] + priorityClassName: "" + nodeSelector: {} + affinity: {} + tolerations: [] + + probes: + livenessProbe: + enabled: true + readinessProbe: + enabled: true + startupProbe: + enabled: true + + serviceMonitor: + enabled: false + labels: {} + annotations: {} + + advanced: + defaultImageRegistry: "" + + virtualScheduler: + enabled: false + + serviceAccount: + enabled: true + name: "" + imagePullSecrets: [] + labels: {} + annotations: {} + + workloadServiceAccount: + enabled: true + name: "" + imagePullSecrets: [] + annotations: {} + labels: {} + + headlessService: + labels: {} + annotations: {} + + globalMetadata: + annotations: {} + +integrations: + metricsServer: + enabled: false + nodes: true + pods: true + externalSecrets: + enabled: false + webhook: + enabled: false + sync: + externalSecrets: + enabled: true + stores: + enabled: false + clusterStores: + enabled: false + selector: + labels: {} + kubeVirt: + enabled: false + webhook: + enabled: true + sync: + dataVolumes: + enabled: false + virtualMachines: + enabled: true + virtualMachineInstances: + enabled: true + virtualMachinePools: + enabled: true + virtualMachineClones: + enabled: true + virtualMachineInstanceMigrations: + enabled: true + +rbac: + role: + enabled: true + overwriteRules: [] + extraRules: [] + clusterRole: + enabled: auto + overwriteRules: [] + extraRules: [] + +networking: + replicateServices: + toHost: [] + fromHost: [] + resolveDNS: [] + advanced: + clusterDomain: "cluster.local" + fallbackHostCluster: false + proxyKubelets: + byHostname: true + byIP: true + +policies: + resourceQuota: + enabled: auto + labels: {} + annotations: {} + quota: + requests.cpu: 10 + requests.memory: 20Gi + requests.storage: "100Gi" + requests.ephemeral-storage: 60Gi + limits.cpu: 20 + limits.memory: 40Gi + limits.ephemeral-storage: 160Gi + services.nodeports: 0 + services.loadbalancers: 1 + count/endpoints: 40 + count/pods: 20 + count/services: 20 + count/secrets: 100 + count/configmaps: 100 + count/persistentvolumeclaims: 20 + scopeSelector: + matchExpressions: [] + scopes: [] + + limitRange: + enabled: auto + labels: {} + annotations: {} + default: + ephemeral-storage: 8Gi + memory: 512Mi + cpu: "1" + defaultRequest: + ephemeral-storage: 3Gi + memory: 128Mi + cpu: 100m + + networkPolicy: + enabled: false + labels: {} + annotations: {} + fallbackDns: 8.8.8.8 + outgoingConnections: + platform: true + ipBlock: + cidr: 0.0.0.0/0 + except: + - 100.64.0.0/10 + - 127.0.0.0/8 + - 10.0.0.0/8 + - 172.16.0.0/12 + - 192.168.0.0/16 + + centralAdmission: + validatingWebhooks: [] + mutatingWebhooks: [] + +exportKubeConfig: + context: "" + server: "" + secret: + name: "" + namespace: "" + +external: {} + +plugins: {} + +experimental: + multiNamespaceMode: + enabled: false + + syncSettings: + disableSync: false + rewriteKubernetesService: false + targetNamespace: "" + setOwner: true + + isolatedControlPlane: + headless: false + + deploy: + host: + manifests: "" + manifestsTemplate: "" + vcluster: + manifests: "" + manifestsTemplate: "" + helm: [] + + genericSync: + clusterRole: + extraRules: [] + role: + extraRules: [] + +telemetry: + enabled: true diff --git a/hack/schema/main.go b/hack/schema/main.go index 544182782..a1f0f4bb0 100644 --- a/hack/schema/main.go +++ b/hack/schema/main.go @@ -11,7 +11,7 @@ import ( orderedmap "github.com/wk8/go-ordered-map/v2" "github.com/invopop/jsonschema" - "github.com/loft-sh/vcluster/config" + "github.com/loft-sh/vcluster/config/v0.21" "gopkg.in/yaml.v3" ) From 1d4418c4d2822daf285c1efe57f979e5a036fcae Mon Sep 17 00:00:00 2001 From: Ricardo Weir Date: Fri, 27 Sep 2024 16:20:33 -0700 Subject: [PATCH 2/6] working script --- config/v0.20/schema/main.go | 331 ++++++++++++++++++++++++++++++++++ config/v0.21/schema/main.go | 332 +++++++++++++++++++++++++++++++++++ hack/schema/create-schema.sh | 13 ++ hack/schema/main.go | 319 +-------------------------------- 4 files changed, 679 insertions(+), 316 deletions(-) create mode 100644 config/v0.20/schema/main.go create mode 100644 config/v0.21/schema/main.go create mode 100755 hack/schema/create-schema.sh diff --git a/config/v0.20/schema/main.go b/config/v0.20/schema/main.go new file mode 100644 index 000000000..6c817593d --- /dev/null +++ b/config/v0.20/schema/main.go @@ -0,0 +1,331 @@ +package main + +import ( + "bytes" + "encoding/json" + "fmt" + "github.com/loft-sh/vcluster/config/v0.20" + "os" + "path/filepath" + "strings" + + orderedmap "github.com/wk8/go-ordered-map/v2" + + "github.com/invopop/jsonschema" + "gopkg.in/yaml.v3" +) + +const version = "v0.20" + +var ( + OutFile = fmt.Sprintf("./config/%s/chart/values.schema.json", version) + ValuesOutFile = fmt.Sprintf("./config/%s/chart/values.yaml", version) +) + +const ( + defsPrefix = "#/$defs/" + externalConfigName = "ExternalConfig" + platformConfigName = "PlatformConfig" + platformConfigRef = defsPrefix + platformConfigName + externalConfigRef = defsPrefix + externalConfigName +) + +var SkipProperties = map[string]string{ + "EnableSwitch": "*", + "EnableSwitchWithTranslate": "enabled", + "SyncAllResource": "enabled", + "DistroContainerEnabled": "enabled", + "EtcdDeployService": "*", + "EtcdDeployHeadlessService": "*", + "LabelsAndAnnotations": "*", +} + +var SkipKeys = map[string]bool{ + "annotations": true, + "labels": true, +} + +// Run executes the command logic +func main() { + reflector, err := getReflector() + if err != nil { + panic(err) + } + + generatedSchema := reflector.Reflect(&config.Config{}) + transformMapProperties(generatedSchema) + modifySchema(generatedSchema, cleanUp) + err = addPlatformSchema(generatedSchema) + if err != nil { + panic(err) + } + err = writeSchema(generatedSchema, OutFile) + if err != nil { + panic(err) + } + + err = writeValues(generatedSchema) + if err != nil { + panic(err) + } +} + +func addPlatformSchema(toSchema *jsonschema.Schema) error { + commentsMap := make(map[string]string) + r := new(jsonschema.Reflector) + r.RequiredFromJSONSchemaTags = true + r.BaseSchemaID = "https://vcluster.com/schemas" + r.ExpandedStruct = true + + if err := jsonschema.ExtractGoComments("github.com/loft-sh/vcluster", fmt.Sprintf("config/%s", version), commentsMap); err != nil { + return err + } + r.CommentMap = commentsMap + platformConfigSchema := r.Reflect(&config.PlatformConfig{}) + + platformNode := &jsonschema.Schema{ + AdditionalProperties: nil, + Description: platformConfigName + " holds platform configuration", + Properties: jsonschema.NewProperties(), + Type: "object", + } + for pair := platformConfigSchema.Properties.Oldest(); pair != nil; pair = pair.Next() { + platformNode.Properties.AddPairs( + orderedmap.Pair[string, *jsonschema.Schema]{ + Key: pair.Key, + Value: pair.Value, + }) + } + + for k, v := range platformConfigSchema.Definitions { + if k == "PlatformConfig" { + continue + } + toSchema.Definitions[k] = v + } + + for pair := platformConfigSchema.Properties.Oldest(); pair != nil; pair = pair.Next() { + pair := pair + platformNode.Properties.AddPairs(*pair) + } + + toSchema.Definitions[platformConfigName] = platformNode + properties := jsonschema.NewProperties() + properties.AddPairs(orderedmap.Pair[string, *jsonschema.Schema]{ + Key: "platform", + Value: &jsonschema.Schema{ + Ref: platformConfigRef, + Description: "platform holds platform configuration", + Type: "object", + }, + }) + externalConfigNode, ok := toSchema.Definitions[externalConfigName] + if !ok { + externalConfigNode = &jsonschema.Schema{ + AdditionalProperties: nil, + Description: externalConfigName + " holds external configuration", + Properties: properties, + } + } else { + externalConfigNode.Properties = properties + externalConfigNode.Description = externalConfigName + " holds external configuration" + } + toSchema.Definitions[externalConfigName] = externalConfigNode + + for defName, node := range platformConfigSchema.Definitions { + toSchema.Definitions[defName] = node + } + externalProperty, ok := toSchema.Properties.Get("external") + if !ok { + return nil + } + externalProperty.Ref = externalConfigRef + externalProperty.AdditionalProperties = nil + externalProperty.Type = "" + + return nil +} + +func writeValues(schema *jsonschema.Schema) error { + yamlNode := &yaml.Node{} + err := yaml.Unmarshal([]byte(config.Values), yamlNode) + if err != nil { + return err + } + + // traverse yaml nodes + err = traverseNode(yamlNode, schema, schema.Definitions, 0) + if err != nil { + return fmt.Errorf("traverse node: %w", err) + } + + b := &bytes.Buffer{} + enc := yaml.NewEncoder(b) + enc.SetIndent(2) + err = enc.Encode(yamlNode) + if err != nil { + return err + } + + err = os.WriteFile(ValuesOutFile, b.Bytes(), 0666) + if err != nil { + return err + } + + return nil +} + +func traverseNode(node *yaml.Node, schema *jsonschema.Schema, definitions jsonschema.Definitions, depth int) error { + if node.Kind == yaml.MappingNode { + // next nodes are key: value, key: value + if len(node.Content)%2 != 0 { + return fmt.Errorf("unexpected amount of children: %d", len(node.Content)) + } + + // loop over content + for i := 0; i < len(node.Content); i += 2 { + key := node.Content[i].Value + value := node.Content[i+1] + + // find properties + properties := schema.Properties + ref := strings.TrimPrefix(schema.Ref, defsPrefix) + if ref != "" { + refSchema, ok := definitions[ref] + if ok { + properties = refSchema.Properties + } + } + if properties == nil || SkipProperties[ref] == key || SkipProperties[ref] == "*" || SkipKeys[key] { + continue + } + + // get property + valueSchema, ok := properties.Get(key) + if ok { + // set comment + node.Content[i].HeadComment = valueSchema.Description + + // add new line if property on level 0 + if i > 0 && depth < 2 { + node.Content[i].HeadComment = "\n" + node.Content[i].HeadComment + } + + // next node + err := traverseNode(value, valueSchema, definitions, depth+1) + if err != nil { + return err + } + } + } + } else { + for _, child := range node.Content { + err := traverseNode(child, schema, definitions, depth) + if err != nil { + return err + } + } + } + + return nil +} + +func getReflector() (*jsonschema.Reflector, error) { + r := new(jsonschema.Reflector) + r.RequiredFromJSONSchemaTags = true + r.BaseSchemaID = "https://vcluster.com/schemas" + r.ExpandedStruct = true + + commentMap := map[string]string{} + err := jsonschema.ExtractGoComments("github.com/loft-sh/vcluster", fmt.Sprintf("config/%s", version), commentMap) + if err != nil { + return nil, err + } + r.CommentMap = commentMap + + return r, nil +} + +func writeSchema(schema *jsonschema.Schema, schemaFile string) error { + prefix := "" + schemaString, err := json.MarshalIndent(schema, prefix, " ") + if err != nil { + return err + } + + err = os.MkdirAll(filepath.Dir(schemaFile), os.ModePerm) + if err != nil { + return err + } + + err = os.WriteFile(schemaFile, schemaString, os.ModePerm) + if err != nil { + return err + } + + return nil +} + +func modifySchema(schema *jsonschema.Schema, visitors ...func(s *jsonschema.Schema)) { + // Apply visitors + if len(visitors) > 0 { + for _, visitor := range visitors { + walk(schema, visitor) + } + } +} + +func transformMapProperties(s *jsonschema.Schema) { + plugins, ok := s.Properties.Get("plugins") + if ok { + plugins.AnyOf = modifyAnyOf(plugins) + plugins.PatternProperties = nil + } + + plugin, ok := s.Properties.Get("plugin") + if ok { + plugin.AnyOf = modifyAnyOf(plugin) + plugin.PatternProperties = nil + } +} + +func modifyAnyOf(field interface{}) []*jsonschema.Schema { + return []*jsonschema.Schema{ + { + Type: "object", + PatternProperties: map[string]*jsonschema.Schema{ + ".*": { + Type: "string", + }, + }, + }, + { + Type: "object", + PatternProperties: field.(*jsonschema.Schema).PatternProperties, + }, + { + Type: "object", + }, + } +} + +func cleanUp(s *jsonschema.Schema) { + if len(s.OneOf) > 0 || len(s.AnyOf) > 0 { + s.Ref = "" + s.Type = "" + s.Items = nil + s.PatternProperties = nil + } +} + +func walk(schema *jsonschema.Schema, visit func(s *jsonschema.Schema)) { + for pair := schema.Properties.Oldest(); pair != nil; pair = pair.Next() { + visit(pair.Value) + } + + for _, definition := range schema.Definitions { + for pair := definition.Properties.Oldest(); pair != nil; pair = pair.Next() { + visit(pair.Value) + } + } +} diff --git a/config/v0.21/schema/main.go b/config/v0.21/schema/main.go new file mode 100644 index 000000000..65d9c6af6 --- /dev/null +++ b/config/v0.21/schema/main.go @@ -0,0 +1,332 @@ +package main + +import ( + "bytes" + "encoding/json" + "fmt" + config "github.com/loft-sh/vcluster/config/v0.20" + config2 "github.com/loft-sh/vcluster/config/v0.21" + "os" + "path/filepath" + "strings" + + orderedmap "github.com/wk8/go-ordered-map/v2" + + "github.com/invopop/jsonschema" + "gopkg.in/yaml.v3" +) + +const version = "v0.21" + +var ( + OutFile = fmt.Sprintf("./config/%s/chart/values.schema.json", version) + ValuesOutFile = fmt.Sprintf("./config/%s/chart/values.yaml", version) +) + +const ( + defsPrefix = "#/$defs/" + externalConfigName = "ExternalConfig" + platformConfigName = "PlatformConfig" + platformConfigRef = defsPrefix + platformConfigName + externalConfigRef = defsPrefix + externalConfigName +) + +var SkipProperties = map[string]string{ + "EnableSwitch": "*", + "EnableSwitchWithTranslate": "enabled", + "SyncAllResource": "enabled", + "DistroContainerEnabled": "enabled", + "EtcdDeployService": "*", + "EtcdDeployHeadlessService": "*", + "LabelsAndAnnotations": "*", +} + +var SkipKeys = map[string]bool{ + "annotations": true, + "labels": true, +} + +// Run executes the command logic +func main() { + reflector, err := getReflector() + if err != nil { + panic(err) + } + + generatedSchema := reflector.Reflect(&config2.Config{}) + transformMapProperties(generatedSchema) + modifySchema(generatedSchema, cleanUp) + err = addPlatformSchema(generatedSchema) + if err != nil { + panic(err) + } + err = writeSchema(generatedSchema, OutFile) + if err != nil { + panic(err) + } + + err = writeValues(generatedSchema) + if err != nil { + panic(err) + } +} + +func addPlatformSchema(toSchema *jsonschema.Schema) error { + commentsMap := make(map[string]string) + r := new(jsonschema.Reflector) + r.RequiredFromJSONSchemaTags = true + r.BaseSchemaID = "https://vcluster.com/schemas" + r.ExpandedStruct = true + + if err := jsonschema.ExtractGoComments("github.com/loft-sh/vcluster", fmt.Sprintf("config/%s", version), commentsMap); err != nil { + return err + } + r.CommentMap = commentsMap + platformConfigSchema := r.Reflect(&config.PlatformConfig{}) + + platformNode := &jsonschema.Schema{ + AdditionalProperties: nil, + Description: platformConfigName + " holds platform configuration", + Properties: jsonschema.NewProperties(), + Type: "object", + } + for pair := platformConfigSchema.Properties.Oldest(); pair != nil; pair = pair.Next() { + platformNode.Properties.AddPairs( + orderedmap.Pair[string, *jsonschema.Schema]{ + Key: pair.Key, + Value: pair.Value, + }) + } + + for k, v := range platformConfigSchema.Definitions { + if k == "PlatformConfig" { + continue + } + toSchema.Definitions[k] = v + } + + for pair := platformConfigSchema.Properties.Oldest(); pair != nil; pair = pair.Next() { + pair := pair + platformNode.Properties.AddPairs(*pair) + } + + toSchema.Definitions[platformConfigName] = platformNode + properties := jsonschema.NewProperties() + properties.AddPairs(orderedmap.Pair[string, *jsonschema.Schema]{ + Key: "platform", + Value: &jsonschema.Schema{ + Ref: platformConfigRef, + Description: "platform holds platform configuration", + Type: "object", + }, + }) + externalConfigNode, ok := toSchema.Definitions[externalConfigName] + if !ok { + externalConfigNode = &jsonschema.Schema{ + AdditionalProperties: nil, + Description: externalConfigName + " holds external configuration", + Properties: properties, + } + } else { + externalConfigNode.Properties = properties + externalConfigNode.Description = externalConfigName + " holds external configuration" + } + toSchema.Definitions[externalConfigName] = externalConfigNode + + for defName, node := range platformConfigSchema.Definitions { + toSchema.Definitions[defName] = node + } + externalProperty, ok := toSchema.Properties.Get("external") + if !ok { + return nil + } + externalProperty.Ref = externalConfigRef + externalProperty.AdditionalProperties = nil + externalProperty.Type = "" + + return nil +} + +func writeValues(schema *jsonschema.Schema) error { + yamlNode := &yaml.Node{} + err := yaml.Unmarshal([]byte(config.Values), yamlNode) + if err != nil { + return err + } + + // traverse yaml nodes + err = traverseNode(yamlNode, schema, schema.Definitions, 0) + if err != nil { + return fmt.Errorf("traverse node: %w", err) + } + + b := &bytes.Buffer{} + enc := yaml.NewEncoder(b) + enc.SetIndent(2) + err = enc.Encode(yamlNode) + if err != nil { + return err + } + + err = os.WriteFile(ValuesOutFile, b.Bytes(), 0666) + if err != nil { + return err + } + + return nil +} + +func traverseNode(node *yaml.Node, schema *jsonschema.Schema, definitions jsonschema.Definitions, depth int) error { + if node.Kind == yaml.MappingNode { + // next nodes are key: value, key: value + if len(node.Content)%2 != 0 { + return fmt.Errorf("unexpected amount of children: %d", len(node.Content)) + } + + // loop over content + for i := 0; i < len(node.Content); i += 2 { + key := node.Content[i].Value + value := node.Content[i+1] + + // find properties + properties := schema.Properties + ref := strings.TrimPrefix(schema.Ref, defsPrefix) + if ref != "" { + refSchema, ok := definitions[ref] + if ok { + properties = refSchema.Properties + } + } + if properties == nil || SkipProperties[ref] == key || SkipProperties[ref] == "*" || SkipKeys[key] { + continue + } + + // get property + valueSchema, ok := properties.Get(key) + if ok { + // set comment + node.Content[i].HeadComment = valueSchema.Description + + // add new line if property on level 0 + if i > 0 && depth < 2 { + node.Content[i].HeadComment = "\n" + node.Content[i].HeadComment + } + + // next node + err := traverseNode(value, valueSchema, definitions, depth+1) + if err != nil { + return err + } + } + } + } else { + for _, child := range node.Content { + err := traverseNode(child, schema, definitions, depth) + if err != nil { + return err + } + } + } + + return nil +} + +func getReflector() (*jsonschema.Reflector, error) { + r := new(jsonschema.Reflector) + r.RequiredFromJSONSchemaTags = true + r.BaseSchemaID = "https://vcluster.com/schemas" + r.ExpandedStruct = true + + commentMap := map[string]string{} + err := jsonschema.ExtractGoComments("github.com/loft-sh/vcluster", fmt.Sprintf("config/%s", version), commentMap) + if err != nil { + return nil, err + } + r.CommentMap = commentMap + + return r, nil +} + +func writeSchema(schema *jsonschema.Schema, schemaFile string) error { + prefix := "" + schemaString, err := json.MarshalIndent(schema, prefix, " ") + if err != nil { + return err + } + + err = os.MkdirAll(filepath.Dir(schemaFile), os.ModePerm) + if err != nil { + return err + } + + err = os.WriteFile(schemaFile, schemaString, os.ModePerm) + if err != nil { + return err + } + + return nil +} + +func modifySchema(schema *jsonschema.Schema, visitors ...func(s *jsonschema.Schema)) { + // Apply visitors + if len(visitors) > 0 { + for _, visitor := range visitors { + walk(schema, visitor) + } + } +} + +func transformMapProperties(s *jsonschema.Schema) { + plugins, ok := s.Properties.Get("plugins") + if ok { + plugins.AnyOf = modifyAnyOf(plugins) + plugins.PatternProperties = nil + } + + plugin, ok := s.Properties.Get("plugin") + if ok { + plugin.AnyOf = modifyAnyOf(plugin) + plugin.PatternProperties = nil + } +} + +func modifyAnyOf(field interface{}) []*jsonschema.Schema { + return []*jsonschema.Schema{ + { + Type: "object", + PatternProperties: map[string]*jsonschema.Schema{ + ".*": { + Type: "string", + }, + }, + }, + { + Type: "object", + PatternProperties: field.(*jsonschema.Schema).PatternProperties, + }, + { + Type: "object", + }, + } +} + +func cleanUp(s *jsonschema.Schema) { + if len(s.OneOf) > 0 || len(s.AnyOf) > 0 { + s.Ref = "" + s.Type = "" + s.Items = nil + s.PatternProperties = nil + } +} + +func walk(schema *jsonschema.Schema, visit func(s *jsonschema.Schema)) { + for pair := schema.Properties.Oldest(); pair != nil; pair = pair.Next() { + visit(pair.Value) + } + + for _, definition := range schema.Definitions { + for pair := definition.Properties.Oldest(); pair != nil; pair = pair.Next() { + visit(pair.Value) + } + } +} diff --git a/hack/schema/create-schema.sh b/hack/schema/create-schema.sh new file mode 100755 index 000000000..7dc33f2c7 --- /dev/null +++ b/hack/schema/create-schema.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +declare -a arr +for subdir in config/v*/; do + arr+=("${subdir}") + go run config/"${subdir#config/}"schema/main.go +done + +declare -a arr2 +arr2=($(sort -V <<<"${arr[*]}")) +latest="${arr2[-1]}" + +cp "${latest}"chart/* chart/ diff --git a/hack/schema/main.go b/hack/schema/main.go index a1f0f4bb0..5621f5a58 100644 --- a/hack/schema/main.go +++ b/hack/schema/main.go @@ -1,326 +1,13 @@ package main import ( - "bytes" - "encoding/json" - "fmt" - "os" - "path/filepath" - "strings" - - orderedmap "github.com/wk8/go-ordered-map/v2" - - "github.com/invopop/jsonschema" - "github.com/loft-sh/vcluster/config/v0.21" - "gopkg.in/yaml.v3" -) - -const OutFile = "chart/values.schema.json" -const ValuesOutFile = "chart/values.yaml" -const ( - defsPrefix = "#/$defs/" - externalConfigName = "ExternalConfig" - platformConfigName = "PlatformConfig" - platformConfigRef = defsPrefix + platformConfigName - externalConfigRef = defsPrefix + externalConfigName + "os/exec" ) -var SkipProperties = map[string]string{ - "EnableSwitch": "*", - "EnableSwitchWithTranslate": "enabled", - "SyncAllResource": "enabled", - "DistroContainerEnabled": "enabled", - "EtcdDeployService": "*", - "EtcdDeployHeadlessService": "*", - "LabelsAndAnnotations": "*", -} - -var SkipKeys = map[string]bool{ - "annotations": true, - "labels": true, -} - -// Run executes the command logic func main() { - reflector, err := getReflector() - if err != nil { - panic(err) - } - - generatedSchema := reflector.Reflect(&config.Config{}) - transformMapProperties(generatedSchema) - modifySchema(generatedSchema, cleanUp) - err = addPlatformSchema(generatedSchema) + cmd := exec.Command("./hack/schema/create-schema.sh") + _, err := cmd.Output() if err != nil { panic(err) } - err = writeSchema(generatedSchema, OutFile) - if err != nil { - panic(err) - } - - err = writeValues(generatedSchema) - if err != nil { - panic(err) - } -} - -func addPlatformSchema(toSchema *jsonschema.Schema) error { - commentsMap := make(map[string]string) - r := new(jsonschema.Reflector) - r.RequiredFromJSONSchemaTags = true - r.BaseSchemaID = "https://vcluster.com/schemas" - r.ExpandedStruct = true - - if err := jsonschema.ExtractGoComments("github.com/loft-sh/vcluster", "config", commentsMap); err != nil { - return err - } - r.CommentMap = commentsMap - platformConfigSchema := r.Reflect(&config.PlatformConfig{}) - - platformNode := &jsonschema.Schema{ - AdditionalProperties: nil, - Description: platformConfigName + " holds platform configuration", - Properties: jsonschema.NewProperties(), - Type: "object", - } - for pair := platformConfigSchema.Properties.Oldest(); pair != nil; pair = pair.Next() { - platformNode.Properties.AddPairs( - orderedmap.Pair[string, *jsonschema.Schema]{ - Key: pair.Key, - Value: pair.Value, - }) - } - - for k, v := range platformConfigSchema.Definitions { - if k == "PlatformConfig" { - continue - } - toSchema.Definitions[k] = v - } - - for pair := platformConfigSchema.Properties.Oldest(); pair != nil; pair = pair.Next() { - pair := pair - platformNode.Properties.AddPairs(*pair) - } - - toSchema.Definitions[platformConfigName] = platformNode - properties := jsonschema.NewProperties() - properties.AddPairs(orderedmap.Pair[string, *jsonschema.Schema]{ - Key: "platform", - Value: &jsonschema.Schema{ - Ref: platformConfigRef, - Description: "platform holds platform configuration", - Type: "object", - }, - }) - externalConfigNode, ok := toSchema.Definitions[externalConfigName] - if !ok { - externalConfigNode = &jsonschema.Schema{ - AdditionalProperties: nil, - Description: externalConfigName + " holds external configuration", - Properties: properties, - } - } else { - externalConfigNode.Properties = properties - externalConfigNode.Description = externalConfigName + " holds external configuration" - } - toSchema.Definitions[externalConfigName] = externalConfigNode - - for defName, node := range platformConfigSchema.Definitions { - toSchema.Definitions[defName] = node - } - externalProperty, ok := toSchema.Properties.Get("external") - if !ok { - return nil - } - externalProperty.Ref = externalConfigRef - externalProperty.AdditionalProperties = nil - externalProperty.Type = "" - - return nil -} - -func writeValues(schema *jsonschema.Schema) error { - yamlNode := &yaml.Node{} - err := yaml.Unmarshal([]byte(config.Values), yamlNode) - if err != nil { - return err - } - - // traverse yaml nodes - err = traverseNode(yamlNode, schema, schema.Definitions, 0) - if err != nil { - return fmt.Errorf("traverse node: %w", err) - } - - b := &bytes.Buffer{} - enc := yaml.NewEncoder(b) - enc.SetIndent(2) - err = enc.Encode(yamlNode) - if err != nil { - return err - } - - err = os.WriteFile(ValuesOutFile, b.Bytes(), 0666) - if err != nil { - return err - } - - return nil -} - -func traverseNode(node *yaml.Node, schema *jsonschema.Schema, definitions jsonschema.Definitions, depth int) error { - if node.Kind == yaml.MappingNode { - // next nodes are key: value, key: value - if len(node.Content)%2 != 0 { - return fmt.Errorf("unexpected amount of children: %d", len(node.Content)) - } - - // loop over content - for i := 0; i < len(node.Content); i += 2 { - key := node.Content[i].Value - value := node.Content[i+1] - - // find properties - properties := schema.Properties - ref := strings.TrimPrefix(schema.Ref, defsPrefix) - if ref != "" { - refSchema, ok := definitions[ref] - if ok { - properties = refSchema.Properties - } - } - if properties == nil || SkipProperties[ref] == key || SkipProperties[ref] == "*" || SkipKeys[key] { - continue - } - - // get property - valueSchema, ok := properties.Get(key) - if ok { - // set comment - node.Content[i].HeadComment = valueSchema.Description - - // add new line if property on level 0 - if i > 0 && depth < 2 { - node.Content[i].HeadComment = "\n" + node.Content[i].HeadComment - } - - // next node - err := traverseNode(value, valueSchema, definitions, depth+1) - if err != nil { - return err - } - } - } - } else { - for _, child := range node.Content { - err := traverseNode(child, schema, definitions, depth) - if err != nil { - return err - } - } - } - - return nil -} - -func getReflector() (*jsonschema.Reflector, error) { - r := new(jsonschema.Reflector) - r.RequiredFromJSONSchemaTags = true - r.BaseSchemaID = "https://vcluster.com/schemas" - r.ExpandedStruct = true - - commentMap := map[string]string{} - err := jsonschema.ExtractGoComments("github.com/loft-sh/vcluster", "config", commentMap) - if err != nil { - return nil, err - } - r.CommentMap = commentMap - - return r, nil -} - -func writeSchema(schema *jsonschema.Schema, schemaFile string) error { - prefix := "" - schemaString, err := json.MarshalIndent(schema, prefix, " ") - if err != nil { - return err - } - - err = os.MkdirAll(filepath.Dir(schemaFile), os.ModePerm) - if err != nil { - return err - } - - err = os.WriteFile(schemaFile, schemaString, os.ModePerm) - if err != nil { - return err - } - - return nil -} - -func modifySchema(schema *jsonschema.Schema, visitors ...func(s *jsonschema.Schema)) { - // Apply visitors - if len(visitors) > 0 { - for _, visitor := range visitors { - walk(schema, visitor) - } - } -} - -func transformMapProperties(s *jsonschema.Schema) { - plugins, ok := s.Properties.Get("plugins") - if ok { - plugins.AnyOf = modifyAnyOf(plugins) - plugins.PatternProperties = nil - } - - plugin, ok := s.Properties.Get("plugin") - if ok { - plugin.AnyOf = modifyAnyOf(plugin) - plugin.PatternProperties = nil - } -} - -func modifyAnyOf(field interface{}) []*jsonschema.Schema { - return []*jsonschema.Schema{ - { - Type: "object", - PatternProperties: map[string]*jsonschema.Schema{ - ".*": { - Type: "string", - }, - }, - }, - { - Type: "object", - PatternProperties: field.(*jsonschema.Schema).PatternProperties, - }, - { - Type: "object", - }, - } -} - -func cleanUp(s *jsonschema.Schema) { - if len(s.OneOf) > 0 || len(s.AnyOf) > 0 { - s.Ref = "" - s.Type = "" - s.Items = nil - s.PatternProperties = nil - } -} - -func walk(schema *jsonschema.Schema, visit func(s *jsonschema.Schema)) { - for pair := schema.Properties.Oldest(); pair != nil; pair = pair.Next() { - visit(pair.Value) - } - - for _, definition := range schema.Definitions { - for pair := definition.Properties.Oldest(); pair != nil; pair = pair.Next() { - visit(pair.Value) - } - } } From cbe09a0ff8fa7c487fcae1066486d51e1b151613 Mon Sep 17 00:00:00 2001 From: Ricardo Weir Date: Sat, 28 Sep 2024 11:24:39 -0700 Subject: [PATCH 3/6] go run hack/schema/main.go --- chart/values.schema.json | 15 +- config/v0.20/chart/values.schema.json | 3594 +++++++++++++++++++++++++ config/v0.20/chart/values.yaml | 918 +++++++ config/v0.21/chart/values.schema.json | 3589 ++++++++++++++++++++++++ config/v0.21/chart/values.yaml | 918 +++++++ 5 files changed, 9024 insertions(+), 10 deletions(-) create mode 100755 config/v0.20/chart/values.schema.json create mode 100644 config/v0.20/chart/values.yaml create mode 100755 config/v0.21/chart/values.schema.json create mode 100644 config/v0.21/chart/values.yaml diff --git a/chart/values.schema.json b/chart/values.schema.json index c46c09dd4..2fb3cd917 100755 --- a/chart/values.schema.json +++ b/chart/values.schema.json @@ -2256,27 +2256,22 @@ "PlatformAPIKey": { "properties": { "secretName": { - "type": "string", - "description": "SecretName is the name of the secret where the platform access key is stored. This defaults to vcluster-platform-api-key if undefined." + "type": "string" }, "namespace": { - "type": "string", - "description": "Namespace defines the namespace where the access key secret should be retrieved from. If this is not equal to the namespace\nwhere the vCluster instance is deployed, you need to make sure vCluster has access to this other namespace." + "type": "string" }, "createRBAC": { - "type": "boolean", - "description": "CreateRBAC will automatically create the necessary RBAC roles and role bindings to allow vCluster to read the secret specified\nin the above namespace, if specified.\nThis defaults to true." + "type": "boolean" } }, "additionalProperties": false, - "type": "object", - "description": "PlatformAPIKey defines where to find the platform access key." + "type": "object" }, "PlatformConfig": { "properties": { "apiKey": { - "$ref": "#/$defs/PlatformAPIKey", - "description": "APIKey defines where to find the platform access key and host. By default, vCluster will search in the following locations in this precedence:\n* environment variable called LICENSE\n* secret specified under external.platform.apiKey.secretName\n* secret called \"vcluster-platform-api-key\" in the vCluster namespace" + "$ref": "#/$defs/PlatformAPIKey" } }, "type": "object", diff --git a/config/v0.20/chart/values.schema.json b/config/v0.20/chart/values.schema.json new file mode 100755 index 000000000..c46c09dd4 --- /dev/null +++ b/config/v0.20/chart/values.schema.json @@ -0,0 +1,3594 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://vcluster.com/schemas/config", + "$defs": { + "APIService": { + "properties": { + "service": { + "$ref": "#/$defs/APIServiceService", + "description": "Service is a reference to the service for the API server." + } + }, + "additionalProperties": false, + "type": "object", + "description": "APIService holds configuration related to the api server" + }, + "APIServiceService": { + "properties": { + "name": { + "type": "string", + "description": "Name is the name of the host service of the apiservice." + }, + "namespace": { + "type": "string", + "description": "Namespace is the name of the host service of the apiservice." + }, + "port": { + "type": "integer", + "description": "Port is the target port on the host service to connect to." + } + }, + "additionalProperties": false, + "type": "object", + "description": "APIServiceService holds the service name and namespace of the host apiservice." + }, + "BackingStore": { + "properties": { + "etcd": { + "$ref": "#/$defs/Etcd", + "description": "Etcd defines that etcd should be used as the backend for the virtual cluster" + }, + "database": { + "$ref": "#/$defs/Database", + "description": "Database defines that a database backend should be used as the backend for the virtual cluster. This uses a project called kine under the hood which is a shim for bridging Kubernetes and relational databases." + } + }, + "additionalProperties": false, + "type": "object" + }, + "CentralAdmission": { + "properties": { + "validatingWebhooks": { + "items": { + "$ref": "#/$defs/ValidatingWebhookConfiguration" + }, + "type": "array", + "description": "ValidatingWebhooks are validating webhooks that should be enforced in the virtual cluster" + }, + "mutatingWebhooks": { + "items": { + "$ref": "#/$defs/MutatingWebhookConfiguration" + }, + "type": "array", + "description": "MutatingWebhooks are mutating webhooks that should be enforced in the virtual cluster" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ClusterStoresSyncConfig": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if this option should be enabled." + }, + "selector": { + "$ref": "#/$defs/LabelSelector", + "description": "Selector defines what cluster stores should be synced" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ControlPlane": { + "properties": { + "distro": { + "$ref": "#/$defs/Distro", + "description": "Distro holds virtual cluster related distro options. A distro cannot be changed after vCluster is deployed." + }, + "backingStore": { + "$ref": "#/$defs/BackingStore", + "description": "BackingStore defines which backing store to use for virtual cluster. If not defined will use embedded database as a default backing store." + }, + "coredns": { + "$ref": "#/$defs/CoreDNS", + "description": "CoreDNS defines everything related to the coredns that is deployed and used within the vCluster." + }, + "proxy": { + "$ref": "#/$defs/ControlPlaneProxy", + "description": "Proxy defines options for the virtual cluster control plane proxy that is used to do authentication and intercept requests." + }, + "hostPathMapper": { + "$ref": "#/$defs/HostPathMapper", + "description": "HostPathMapper defines if vCluster should rewrite host paths.", + "pro": true + }, + "ingress": { + "$ref": "#/$defs/ControlPlaneIngress", + "description": "Ingress defines options for vCluster ingress deployed by Helm." + }, + "service": { + "$ref": "#/$defs/ControlPlaneService", + "description": "Service defines options for vCluster service deployed by Helm." + }, + "statefulSet": { + "$ref": "#/$defs/ControlPlaneStatefulSet", + "description": "StatefulSet defines options for vCluster statefulSet deployed by Helm." + }, + "serviceMonitor": { + "$ref": "#/$defs/ServiceMonitor", + "description": "ServiceMonitor can be used to automatically create a service monitor for vCluster deployment itself." + }, + "advanced": { + "$ref": "#/$defs/ControlPlaneAdvanced", + "description": "Advanced holds additional configuration for the vCluster control plane." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ControlPlaneAdvanced": { + "properties": { + "defaultImageRegistry": { + "type": "string", + "description": "DefaultImageRegistry will be used as a prefix for all internal images deployed by vCluster or Helm. This makes it easy to\nupload all required vCluster images to a single private repository and set this value. Workload images are not affected by this." + }, + "virtualScheduler": { + "$ref": "#/$defs/EnableSwitch", + "description": "VirtualScheduler defines if a scheduler should be used within the virtual cluster or the scheduling decision for workloads will be made by the host cluster." + }, + "serviceAccount": { + "$ref": "#/$defs/ControlPlaneServiceAccount", + "description": "ServiceAccount specifies options for the vCluster control plane service account." + }, + "workloadServiceAccount": { + "$ref": "#/$defs/ControlPlaneWorkloadServiceAccount", + "description": "WorkloadServiceAccount specifies options for the service account that will be used for the workloads that run within the virtual cluster." + }, + "headlessService": { + "$ref": "#/$defs/ControlPlaneHeadlessService", + "description": "HeadlessService specifies options for the headless service used for the vCluster StatefulSet." + }, + "globalMetadata": { + "$ref": "#/$defs/ControlPlaneGlobalMetadata", + "description": "GlobalMetadata is metadata that will be added to all resources deployed by Helm." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ControlPlaneGlobalMetadata": { + "properties": { + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are extra annotations for this resource." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ControlPlaneHeadlessService": { + "properties": { + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are extra annotations for this resource." + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Labels are extra labels for this resource." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ControlPlaneHighAvailability": { + "properties": { + "replicas": { + "type": "integer", + "description": "Replicas is the amount of replicas to use for the statefulSet." + }, + "leaseDuration": { + "type": "integer", + "description": "LeaseDuration is the time to lease for the leader." + }, + "renewDeadline": { + "type": "integer", + "description": "RenewDeadline is the deadline to renew a lease for the leader." + }, + "retryPeriod": { + "type": "integer", + "description": "RetryPeriod is the time until a replica will retry to get a lease." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ControlPlaneIngress": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if the control plane ingress should be enabled" + }, + "host": { + "type": "string", + "description": "Host is the host where vCluster will be reachable" + }, + "pathType": { + "type": "string", + "description": "PathType is the path type of the ingress" + }, + "spec": { + "type": "object", + "description": "Spec allows you to configure extra ingress options." + }, + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are extra annotations for this resource." + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Labels are extra labels for this resource." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ControlPlanePersistence": { + "properties": { + "volumeClaim": { + "$ref": "#/$defs/VolumeClaim", + "description": "VolumeClaim can be used to configure the persistent volume claim." + }, + "volumeClaimTemplates": { + "items": { + "type": "object" + }, + "type": "array", + "description": "VolumeClaimTemplates defines the volumeClaimTemplates for the statefulSet" + }, + "dataVolume": { + "items": { + "type": "object" + }, + "type": "array", + "description": "Allows you to override the dataVolume. Only works correctly if volumeClaim.enabled=false." + }, + "binariesVolume": { + "items": { + "type": "object" + }, + "type": "array", + "description": "BinariesVolume defines a binaries volume that is used to retrieve\ndistro specific executables to be run by the syncer controller.\nThis volume doesn't need to be persistent." + }, + "addVolumes": { + "items": { + "type": "object" + }, + "type": "array", + "description": "AddVolumes defines extra volumes for the pod" + }, + "addVolumeMounts": { + "items": { + "$ref": "#/$defs/VolumeMount" + }, + "type": "array", + "description": "AddVolumeMounts defines extra volume mounts for the container" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ControlPlaneProbes": { + "properties": { + "livenessProbe": { + "$ref": "#/$defs/EnableSwitch", + "description": "LivenessProbe specifies if the liveness probe for the container should be enabled" + }, + "readinessProbe": { + "$ref": "#/$defs/EnableSwitch", + "description": "ReadinessProbe specifies if the readiness probe for the container should be enabled" + }, + "startupProbe": { + "$ref": "#/$defs/EnableSwitch", + "description": "StartupProbe specifies if the startup probe for the container should be enabled" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ControlPlaneProxy": { + "properties": { + "bindAddress": { + "type": "string", + "description": "BindAddress under which vCluster will expose the proxy." + }, + "port": { + "type": "integer", + "description": "Port under which vCluster will expose the proxy. Changing port is currently not supported." + }, + "extraSANs": { + "items": { + "type": "string" + }, + "type": "array", + "description": "ExtraSANs are extra hostnames to sign the vCluster proxy certificate for." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ControlPlaneScheduling": { + "properties": { + "nodeSelector": { + "type": "object", + "description": "NodeSelector is the node selector to apply to the pod." + }, + "affinity": { + "type": "object", + "description": "Affinity is the affinity to apply to the pod." + }, + "tolerations": { + "items": { + "type": "object" + }, + "type": "array", + "description": "Tolerations are the tolerations to apply to the pod." + }, + "priorityClassName": { + "type": "string", + "description": "PriorityClassName is the priority class name for the the pod." + }, + "podManagementPolicy": { + "type": "string", + "description": "PodManagementPolicy is the statefulSet pod management policy." + }, + "topologySpreadConstraints": { + "items": true, + "type": "array", + "description": "TopologySpreadConstraints are the topology spread constraints for the pod." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ControlPlaneSecurity": { + "properties": { + "podSecurityContext": { + "type": "object", + "description": "PodSecurityContext specifies security context options on the pod level." + }, + "containerSecurityContext": { + "type": "object", + "description": "ContainerSecurityContext specifies security context options on the container level." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ControlPlaneService": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if the control plane service should be enabled" + }, + "spec": { + "type": "object", + "description": "Spec allows you to configure extra service options." + }, + "kubeletNodePort": { + "type": "integer", + "description": "KubeletNodePort is the node port where the fake kubelet is exposed. Defaults to 0." + }, + "httpsNodePort": { + "type": "integer", + "description": "HTTPSNodePort is the node port where https is exposed. Defaults to 0." + }, + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are extra annotations for this resource." + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Labels are extra labels for this resource." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ControlPlaneServiceAccount": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled specifies if the service account should get deployed." + }, + "name": { + "type": "string", + "description": "Name specifies what name to use for the service account." + }, + "imagePullSecrets": { + "items": { + "$ref": "#/$defs/ImagePullSecretName" + }, + "type": "array", + "description": "ImagePullSecrets defines extra image pull secrets for the service account." + }, + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are extra annotations for this resource." + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Labels are extra labels for this resource." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ControlPlaneStatefulSet": { + "properties": { + "highAvailability": { + "$ref": "#/$defs/ControlPlaneHighAvailability", + "description": "HighAvailability holds options related to high availability." + }, + "resources": { + "$ref": "#/$defs/Resources", + "description": "Resources are the resource requests and limits for the statefulSet container." + }, + "scheduling": { + "$ref": "#/$defs/ControlPlaneScheduling", + "description": "Scheduling holds options related to scheduling." + }, + "security": { + "$ref": "#/$defs/ControlPlaneSecurity", + "description": "Security defines pod or container security context." + }, + "probes": { + "$ref": "#/$defs/ControlPlaneProbes", + "description": "Probes enables or disables the main container probes." + }, + "persistence": { + "$ref": "#/$defs/ControlPlanePersistence", + "description": "Persistence defines options around persistence for the statefulSet." + }, + "enableServiceLinks": { + "type": "boolean", + "description": "EnableServiceLinks for the StatefulSet pod" + }, + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are extra annotations for this resource." + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Labels are extra labels for this resource." + }, + "pods": { + "$ref": "#/$defs/LabelsAndAnnotations", + "description": "Additional labels or annotations for the statefulSet pods." + }, + "image": { + "$ref": "#/$defs/StatefulSetImage", + "description": "Image is the image for the controlPlane statefulSet container" + }, + "imagePullPolicy": { + "type": "string", + "description": "ImagePullPolicy is the policy how to pull the image." + }, + "workingDir": { + "type": "string", + "description": "WorkingDir specifies in what folder the main process should get started." + }, + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Command allows you to override the main command." + }, + "args": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Args allows you to override the main arguments." + }, + "env": { + "items": { + "type": "object" + }, + "type": "array", + "description": "Env are additional environment variables for the statefulSet container." + }, + "dnsPolicy": { + "type": "string", + "description": "Set DNS policy for the pod." + }, + "dnsConfig": { + "$ref": "#/$defs/PodDNSConfig", + "description": "Specifies the DNS parameters of a pod." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ControlPlaneWorkloadServiceAccount": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled specifies if the service account for the workloads should get deployed." + }, + "name": { + "type": "string", + "description": "Name specifies what name to use for the service account for the virtual cluster workloads." + }, + "imagePullSecrets": { + "items": { + "$ref": "#/$defs/ImagePullSecretName" + }, + "type": "array", + "description": "ImagePullSecrets defines extra image pull secrets for the workload service account." + }, + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are extra annotations for this resource." + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Labels are extra labels for this resource." + } + }, + "additionalProperties": false, + "type": "object" + }, + "CoreDNS": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if coredns is enabled" + }, + "embedded": { + "type": "boolean", + "description": "Embedded defines if vCluster will start the embedded coredns service within the control-plane and not as a separate deployment. This is a PRO feature.", + "pro": true + }, + "service": { + "$ref": "#/$defs/CoreDNSService", + "description": "Service holds extra options for the coredns service deployed within the virtual cluster" + }, + "deployment": { + "$ref": "#/$defs/CoreDNSDeployment", + "description": "Deployment holds extra options for the coredns deployment deployed within the virtual cluster" + }, + "overwriteConfig": { + "type": "string", + "description": "OverwriteConfig can be used to overwrite the coredns config" + }, + "overwriteManifests": { + "type": "string", + "description": "OverwriteManifests can be used to overwrite the coredns manifests used to deploy coredns" + }, + "priorityClassName": { + "type": "string", + "description": "PriorityClassName specifies the priority class name for the CoreDNS pods." + } + }, + "additionalProperties": false, + "type": "object" + }, + "CoreDNSDeployment": { + "properties": { + "image": { + "type": "string", + "description": "Image is the coredns image to use" + }, + "replicas": { + "type": "integer", + "description": "Replicas is the amount of coredns pods to run." + }, + "nodeSelector": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "NodeSelector is the node selector to use for coredns." + }, + "affinity": { + "type": "object", + "description": "Affinity is the affinity to apply to the pod." + }, + "tolerations": { + "items": { + "type": "object" + }, + "type": "array", + "description": "Tolerations are the tolerations to apply to the pod." + }, + "resources": { + "$ref": "#/$defs/Resources", + "description": "Resources are the desired resources for coredns." + }, + "pods": { + "$ref": "#/$defs/LabelsAndAnnotations", + "description": "Pods is additional metadata for the coredns pods." + }, + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are extra annotations for this resource." + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Labels are extra labels for this resource." + }, + "topologySpreadConstraints": { + "items": true, + "type": "array", + "description": "TopologySpreadConstraints are the topology spread constraints for the CoreDNS pod." + } + }, + "additionalProperties": false, + "type": "object" + }, + "CoreDNSService": { + "properties": { + "spec": { + "type": "object", + "description": "Spec holds extra options for the coredns service" + }, + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are extra annotations for this resource." + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Labels are extra labels for this resource." + } + }, + "additionalProperties": false, + "type": "object" + }, + "Database": { + "properties": { + "embedded": { + "$ref": "#/$defs/DatabaseKine", + "description": "Embedded defines that an embedded database (sqlite) should be used as the backend for the virtual cluster" + }, + "external": { + "$ref": "#/$defs/DatabaseKine", + "description": "External defines that an external database should be used as the backend for the virtual cluster" + } + }, + "additionalProperties": false, + "type": "object" + }, + "DatabaseKine": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if the database should be used." + }, + "dataSource": { + "type": "string", + "description": "DataSource is the kine dataSource to use for the database. This depends on the database format.\nThis is optional for the embedded database. Examples:\n* mysql: mysql://username:password@tcp(hostname:3306)/k3s\n* postgres: postgres://username:password@hostname:5432/k3s" + }, + "keyFile": { + "type": "string", + "description": "KeyFile is the key file to use for the database. This is optional." + }, + "certFile": { + "type": "string", + "description": "CertFile is the cert file to use for the database. This is optional." + }, + "caFile": { + "type": "string", + "description": "CaFile is the ca file to use for the database. This is optional." + } + }, + "additionalProperties": false, + "type": "object" + }, + "DenyRule": { + "properties": { + "name": { + "type": "string", + "description": "The name of the check." + }, + "namespaces": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Namespace describe a list of namespaces that will be affected by the check.\nAn empty list means that all namespaces will be affected.\nIn case of ClusterScoped rules, only the Namespace resource is affected." + }, + "rules": { + "items": { + "$ref": "#/$defs/RuleWithVerbs" + }, + "type": "array", + "description": "Rules describes on which verbs and on what resources/subresources the webhook is enforced.\nThe webhook is enforced if it matches any Rule.\nThe version of the request must match the rule version exactly. Equivalent matching is not supported." + }, + "excludedUsers": { + "items": { + "type": "string" + }, + "type": "array", + "description": "ExcludedUsers describe a list of users for which the checks will be skipped.\nImpersonation attempts on these users will still be subjected to the checks." + } + }, + "additionalProperties": false, + "type": "object" + }, + "Distro": { + "properties": { + "k8s": { + "$ref": "#/$defs/DistroK8s", + "description": "K8S holds K8s relevant configuration." + }, + "k3s": { + "$ref": "#/$defs/DistroK3s", + "description": "K3S holds K3s relevant configuration." + }, + "k0s": { + "$ref": "#/$defs/DistroK0s", + "description": "K0S holds k0s relevant configuration." + } + }, + "additionalProperties": false, + "type": "object" + }, + "DistroContainer": { + "properties": { + "image": { + "$ref": "#/$defs/Image", + "description": "Image is the distro image" + }, + "imagePullPolicy": { + "type": "string", + "description": "ImagePullPolicy is the pull policy for the distro image" + }, + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Command is the command to start the distro binary. This will override the existing command." + }, + "extraArgs": { + "items": { + "type": "string" + }, + "type": "array", + "description": "ExtraArgs are additional arguments to pass to the distro binary." + } + }, + "additionalProperties": false, + "type": "object" + }, + "DistroContainerEnabled": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled signals this container should be enabled." + }, + "image": { + "$ref": "#/$defs/Image", + "description": "Image is the distro image" + }, + "imagePullPolicy": { + "type": "string", + "description": "ImagePullPolicy is the pull policy for the distro image" + }, + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Command is the command to start the distro binary. This will override the existing command." + }, + "extraArgs": { + "items": { + "type": "string" + }, + "type": "array", + "description": "ExtraArgs are additional arguments to pass to the distro binary." + } + }, + "additionalProperties": false, + "type": "object" + }, + "DistroK0s": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled specifies if the k0s distro should be enabled. Only one distro can be enabled at the same time." + }, + "config": { + "type": "string", + "description": "Config allows you to override the k0s config passed to the k0s binary." + }, + "env": { + "items": { + "type": "object" + }, + "type": "array", + "description": "Env are extra environment variables to use for the main container and NOT the init container." + }, + "resources": { + "type": "object", + "description": "Resources for the distro init container" + }, + "securityContext": { + "type": "object", + "description": "Security options can be used for the distro init container" + }, + "image": { + "$ref": "#/$defs/Image", + "description": "Image is the distro image" + }, + "imagePullPolicy": { + "type": "string", + "description": "ImagePullPolicy is the pull policy for the distro image" + }, + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Command is the command to start the distro binary. This will override the existing command." + }, + "extraArgs": { + "items": { + "type": "string" + }, + "type": "array", + "description": "ExtraArgs are additional arguments to pass to the distro binary." + } + }, + "additionalProperties": false, + "type": "object" + }, + "DistroK3s": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled specifies if the K3s distro should be enabled. Only one distro can be enabled at the same time." + }, + "token": { + "type": "string", + "description": "Token is the K3s token to use. If empty, vCluster will choose one." + }, + "env": { + "items": { + "type": "object" + }, + "type": "array", + "description": "Env are extra environment variables to use for the main container and NOT the init container." + }, + "resources": { + "type": "object", + "description": "Resources for the distro init container" + }, + "securityContext": { + "type": "object", + "description": "Security options can be used for the distro init container" + }, + "image": { + "$ref": "#/$defs/Image", + "description": "Image is the distro image" + }, + "imagePullPolicy": { + "type": "string", + "description": "ImagePullPolicy is the pull policy for the distro image" + }, + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Command is the command to start the distro binary. This will override the existing command." + }, + "extraArgs": { + "items": { + "type": "string" + }, + "type": "array", + "description": "ExtraArgs are additional arguments to pass to the distro binary." + } + }, + "additionalProperties": false, + "type": "object" + }, + "DistroK8s": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled specifies if the K8s distro should be enabled. Only one distro can be enabled at the same time." + }, + "version": { + "type": "string", + "description": "Version specifies k8s components (scheduler, kube-controller-manager \u0026 apiserver) version.\nIt is a shortcut for controlPlane.distro.k8s.apiServer.image.tag,\ncontrolPlane.distro.k8s.controllerManager.image.tag and\ncontrolPlane.distro.k8s.scheduler.image.tag\nIf e.g. controlPlane.distro.k8s.version is set to v1.30.1 and\ncontrolPlane.distro.k8s.scheduler.image.tag\n(or controlPlane.distro.k8s.controllerManager.image.tag or controlPlane.distro.k8s.apiServer.image.tag)\nis set to v1.31.0,\nvalue from controlPlane.distro.k8s.\u003ccontrolPlane-component\u003e.image.tag will be used\n(where \u003ccontrolPlane-component is apiServer, controllerManager and scheduler)." + }, + "apiServer": { + "$ref": "#/$defs/DistroContainerEnabled", + "description": "APIServer holds configuration specific to starting the api server." + }, + "controllerManager": { + "$ref": "#/$defs/DistroContainerEnabled", + "description": "ControllerManager holds configuration specific to starting the controller manager." + }, + "scheduler": { + "$ref": "#/$defs/DistroContainer", + "description": "Scheduler holds configuration specific to starting the scheduler. Enable this via controlPlane.advanced.virtualScheduler.enabled" + }, + "env": { + "items": { + "type": "object" + }, + "type": "array", + "description": "Env are extra environment variables to use for the main container and NOT the init container." + }, + "resources": { + "type": "object", + "description": "Resources for the distro init container" + }, + "securityContext": { + "type": "object", + "description": "Security options can be used for the distro init container" + } + }, + "additionalProperties": false, + "type": "object" + }, + "EnableAutoSwitch": { + "properties": { + "enabled": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "boolean" + } + ], + "description": "Enabled defines if this option should be enabled." + } + }, + "additionalProperties": false, + "type": "object" + }, + "EnableSwitch": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if this option should be enabled." + } + }, + "additionalProperties": false, + "type": "object" + }, + "EnableSwitchWithTranslate": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if this option should be enabled." + }, + "translate": { + "items": { + "$ref": "#/$defs/TranslatePatch" + }, + "type": "array", + "description": "Translate the patch according to the given patches." + } + }, + "additionalProperties": false, + "type": "object" + }, + "Etcd": { + "properties": { + "embedded": { + "$ref": "#/$defs/EtcdEmbedded", + "description": "Embedded defines to use embedded etcd as a storage backend for the virtual cluster", + "pro": true + }, + "deploy": { + "$ref": "#/$defs/EtcdDeploy", + "description": "Deploy defines to use an external etcd that is deployed by the helm chart" + } + }, + "additionalProperties": false, + "type": "object" + }, + "EtcdDeploy": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines that an external etcd should be deployed." + }, + "statefulSet": { + "$ref": "#/$defs/EtcdDeployStatefulSet", + "description": "StatefulSet holds options for the external etcd statefulSet." + }, + "service": { + "$ref": "#/$defs/EtcdDeployService", + "description": "Service holds options for the external etcd service." + }, + "headlessService": { + "$ref": "#/$defs/EtcdDeployHeadlessService", + "description": "HeadlessService holds options for the external etcd headless service." + } + }, + "additionalProperties": false, + "type": "object" + }, + "EtcdDeployHeadlessService": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if the etcd headless service should be deployed" + }, + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are extra annotations for the external etcd headless service" + } + }, + "additionalProperties": false, + "type": "object" + }, + "EtcdDeployService": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if the etcd service should be deployed" + }, + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are extra annotations for the external etcd service" + } + }, + "additionalProperties": false, + "type": "object" + }, + "EtcdDeployStatefulSet": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if the statefulSet should be deployed" + }, + "enableServiceLinks": { + "type": "boolean", + "description": "EnableServiceLinks for the StatefulSet pod" + }, + "image": { + "$ref": "#/$defs/Image", + "description": "Image is the image to use for the external etcd statefulSet" + }, + "imagePullPolicy": { + "type": "string", + "description": "ImagePullPolicy is the pull policy for the external etcd image" + }, + "env": { + "items": { + "type": "object" + }, + "type": "array", + "description": "Env are extra environment variables" + }, + "extraArgs": { + "items": { + "type": "string" + }, + "type": "array", + "description": "ExtraArgs are appended to the etcd command." + }, + "resources": { + "$ref": "#/$defs/Resources", + "description": "Resources the etcd can consume" + }, + "pods": { + "$ref": "#/$defs/LabelsAndAnnotations", + "description": "Pods defines extra metadata for the etcd pods." + }, + "highAvailability": { + "$ref": "#/$defs/ExternalEtcdHighAvailability", + "description": "HighAvailability are high availability options" + }, + "scheduling": { + "$ref": "#/$defs/ControlPlaneScheduling", + "description": "Scheduling options for the etcd pods." + }, + "security": { + "$ref": "#/$defs/ControlPlaneSecurity", + "description": "Security options for the etcd pods." + }, + "persistence": { + "$ref": "#/$defs/ExternalEtcdPersistence", + "description": "Persistence options for the etcd pods." + }, + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are extra annotations for this resource." + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Labels are extra labels for this resource." + } + }, + "additionalProperties": false, + "type": "object" + }, + "EtcdEmbedded": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if the embedded etcd should be used.", + "pro": true + }, + "migrateFromDeployedEtcd": { + "type": "boolean", + "description": "MigrateFromDeployedEtcd signals that vCluster should migrate from the deployed external etcd to embedded etcd." + } + }, + "additionalProperties": false, + "type": "object" + }, + "Experimental": { + "properties": { + "deploy": { + "$ref": "#/$defs/ExperimentalDeploy", + "description": "Deploy allows you to configure manifests and Helm charts to deploy within the virtual cluster." + }, + "syncSettings": { + "$ref": "#/$defs/ExperimentalSyncSettings", + "description": "SyncSettings are advanced settings for the syncer controller." + }, + "genericSync": { + "$ref": "#/$defs/ExperimentalGenericSync", + "description": "GenericSync holds options to generically sync resources from virtual cluster to host." + }, + "multiNamespaceMode": { + "$ref": "#/$defs/ExperimentalMultiNamespaceMode", + "description": "MultiNamespaceMode tells virtual cluster to sync to multiple namespaces instead of a single one. This will map each virtual cluster namespace to a single namespace in the host cluster." + }, + "isolatedControlPlane": { + "$ref": "#/$defs/ExperimentalIsolatedControlPlane", + "description": "IsolatedControlPlane is a feature to run the vCluster control plane in a different Kubernetes cluster than the workloads themselves.", + "pro": true + }, + "virtualClusterKubeConfig": { + "$ref": "#/$defs/VirtualClusterKubeConfig", + "description": "VirtualClusterKubeConfig allows you to override distro specifics and specify where vCluster will find the required certificates and vCluster config." + }, + "denyProxyRequests": { + "items": { + "$ref": "#/$defs/DenyRule" + }, + "type": "array", + "description": "DenyProxyRequests denies certain requests in the vCluster proxy.", + "pro": true + } + }, + "additionalProperties": false, + "type": "object" + }, + "ExperimentalDeploy": { + "properties": { + "host": { + "$ref": "#/$defs/ExperimentalDeployHost", + "description": "Host defines what manifests to deploy into the host cluster" + }, + "vcluster": { + "$ref": "#/$defs/ExperimentalDeployVCluster", + "description": "VCluster defines what manifests and charts to deploy into the vCluster" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ExperimentalDeployHelm": { + "properties": { + "chart": { + "$ref": "#/$defs/ExperimentalDeployHelmChart", + "description": "Chart defines what chart should get deployed." + }, + "release": { + "$ref": "#/$defs/ExperimentalDeployHelmRelease", + "description": "Release defines what release should get deployed." + }, + "values": { + "type": "string", + "description": "Values defines what values should get used." + }, + "timeout": { + "type": "string", + "description": "Timeout defines the timeout for Helm" + }, + "bundle": { + "type": "string", + "description": "Bundle allows to compress the Helm chart and specify this instead of an online chart" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ExperimentalDeployHelmChart": { + "properties": { + "name": { + "type": "string" + }, + "repo": { + "type": "string" + }, + "insecure": { + "type": "boolean" + }, + "version": { + "type": "string" + }, + "username": { + "type": "string" + }, + "password": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ExperimentalDeployHelmRelease": { + "properties": { + "name": { + "type": "string", + "description": "Name of the release" + }, + "namespace": { + "type": "string", + "description": "Namespace of the release" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ExperimentalDeployHost": { + "properties": { + "manifests": { + "type": "string", + "description": "Manifests are raw Kubernetes manifests that should get applied within the virtual cluster." + }, + "manifestsTemplate": { + "type": "string", + "description": "ManifestsTemplate is a Kubernetes manifest template that will be rendered with vCluster values before applying it within the virtual cluster." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ExperimentalDeployVCluster": { + "properties": { + "manifests": { + "type": "string", + "description": "Manifests are raw Kubernetes manifests that should get applied within the virtual cluster." + }, + "manifestsTemplate": { + "type": "string", + "description": "ManifestsTemplate is a Kubernetes manifest template that will be rendered with vCluster values before applying it within the virtual cluster." + }, + "helm": { + "items": { + "$ref": "#/$defs/ExperimentalDeployHelm" + }, + "type": "array", + "description": "Helm are Helm charts that should get deployed into the virtual cluster" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ExperimentalGenericSync": { + "properties": { + "version": { + "type": "string", + "description": "Version is the config version" + }, + "export": { + "items": { + "$ref": "#/$defs/Export" + }, + "type": "array", + "description": "Exports syncs a resource from the virtual cluster to the host" + }, + "import": { + "items": { + "$ref": "#/$defs/Import" + }, + "type": "array", + "description": "Imports syncs a resource from the host cluster to virtual cluster" + }, + "hooks": { + "$ref": "#/$defs/Hooks", + "description": "Hooks are hooks that can be used to inject custom patches before syncing" + }, + "clusterRole": { + "$ref": "#/$defs/ExperimentalGenericSyncExtraRules" + }, + "role": { + "$ref": "#/$defs/ExperimentalGenericSyncExtraRules" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ExperimentalGenericSyncExtraRules": { + "properties": { + "extraRules": { + "items": true, + "type": "array" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ExperimentalIsolatedControlPlane": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled specifies if the isolated control plane feature should be enabled." + }, + "headless": { + "type": "boolean", + "description": "Headless states that Helm should deploy the vCluster in headless mode for the isolated control plane." + }, + "kubeConfig": { + "type": "string", + "description": "KubeConfig is the path where to find the remote workload cluster kubeconfig." + }, + "namespace": { + "type": "string", + "description": "Namespace is the namespace where to sync the workloads into." + }, + "service": { + "type": "string", + "description": "Service is the vCluster service in the remote cluster." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ExperimentalMultiNamespaceMode": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled specifies if multi namespace mode should get enabled" + }, + "namespaceLabels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "NamespaceLabels are extra labels that will be added by vCluster to each created namespace." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ExperimentalSyncSettings": { + "properties": { + "disableSync": { + "type": "boolean", + "description": "DisableSync will not sync any resources and disable most control plane functionality.", + "pro": true + }, + "rewriteKubernetesService": { + "type": "boolean", + "description": "RewriteKubernetesService will rewrite the Kubernetes service to point to the vCluster service if disableSync is enabled", + "pro": true + }, + "targetNamespace": { + "type": "string", + "description": "TargetNamespace is the namespace where the workloads should get synced to." + }, + "setOwner": { + "type": "boolean", + "description": "SetOwner specifies if vCluster should set an owner reference on the synced objects to the vCluster service. This allows for easy garbage collection." + }, + "hostMetricsBindAddress": { + "type": "string", + "description": "HostMetricsBindAddress is the bind address for the local manager" + }, + "virtualMetricsBindAddress": { + "type": "string", + "description": "VirtualMetricsBindAddress is the bind address for the virtual manager" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Export": { + "properties": { + "apiVersion": { + "type": "string", + "description": "APIVersion of the object to sync" + }, + "kind": { + "type": "string", + "description": "Kind of the object to sync" + }, + "optional": { + "type": "boolean" + }, + "replaceOnConflict": { + "type": "boolean", + "description": "ReplaceWhenInvalid determines if the controller should try to recreate the object\nif there is a problem applying" + }, + "patches": { + "items": { + "$ref": "#/$defs/Patch" + }, + "type": "array", + "description": "Patches are the patches to apply on the virtual cluster objects\nwhen syncing them from the host cluster" + }, + "reversePatches": { + "items": { + "$ref": "#/$defs/Patch" + }, + "type": "array", + "description": "ReversePatches are the patches to apply to host cluster objects\nafter it has been synced to the virtual cluster" + }, + "selector": { + "$ref": "#/$defs/Selector", + "description": "Selector is a label selector to select the synced objects in the virtual cluster.\nIf empty, all objects will be synced." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ExportKubeConfig": { + "properties": { + "context": { + "type": "string", + "description": "Context is the name of the context within the generated kubeconfig to use." + }, + "server": { + "type": "string", + "description": "Override the default https://localhost:8443 and specify a custom hostname for the generated kubeconfig." + }, + "secret": { + "$ref": "#/$defs/ExportKubeConfigSecretReference", + "description": "Declare in which host cluster secret vCluster should store the generated virtual cluster kubeconfig.\nIf this is not defined, vCluster create it with `vc-NAME`. If you specify another name,\nvCluster creates the config in this other secret." + } + }, + "additionalProperties": false, + "type": "object", + "description": "ExportKubeConfig describes how vCluster should export the vCluster kubeconfig." + }, + "ExportKubeConfigSecretReference": { + "properties": { + "name": { + "type": "string", + "description": "Name is the name of the secret where the kubeconfig should get stored." + }, + "namespace": { + "type": "string", + "description": "Namespace where vCluster should store the kubeconfig secret. If this is not equal to the namespace\nwhere you deployed vCluster, you need to make sure vCluster has access to this other namespace." + } + }, + "additionalProperties": false, + "type": "object", + "description": "Declare in which host cluster secret vCluster should store the generated virtual cluster kubeconfig." + }, + "ExternalConfig": { + "properties": { + "platform": { + "$ref": "#/$defs/PlatformConfig", + "type": "object", + "description": "platform holds platform configuration" + } + }, + "type": "object", + "description": "ExternalConfig holds external configuration" + }, + "ExternalEtcdHighAvailability": { + "properties": { + "replicas": { + "type": "integer", + "description": "Replicas are the amount of pods to use." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ExternalEtcdPersistence": { + "properties": { + "volumeClaim": { + "$ref": "#/$defs/ExternalEtcdPersistenceVolumeClaim", + "description": "VolumeClaim can be used to configure the persistent volume claim." + }, + "volumeClaimTemplates": { + "items": { + "type": "object" + }, + "type": "array", + "description": "VolumeClaimTemplates defines the volumeClaimTemplates for the statefulSet" + }, + "addVolumes": { + "items": { + "type": "object" + }, + "type": "array", + "description": "AddVolumes defines extra volumes for the pod" + }, + "addVolumeMounts": { + "items": { + "$ref": "#/$defs/VolumeMount" + }, + "type": "array", + "description": "AddVolumeMounts defines extra volume mounts for the container" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ExternalEtcdPersistenceVolumeClaim": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled enables deploying a persistent volume claim." + }, + "accessModes": { + "items": { + "type": "string" + }, + "type": "array", + "description": "AccessModes are the persistent volume claim access modes." + }, + "retentionPolicy": { + "type": "string", + "description": "RetentionPolicy is the persistent volume claim retention policy." + }, + "size": { + "type": "string", + "description": "Size is the persistent volume claim storage size." + }, + "storageClass": { + "type": "string", + "description": "StorageClass is the persistent volume claim storage class." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ExternalSecrets": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines whether the external secret integration is enabled or not" + }, + "webhook": { + "$ref": "#/$defs/EnableSwitch", + "description": "Webhook defines whether the host webhooks are reused or not" + }, + "sync": { + "$ref": "#/$defs/ExternalSecretsSync", + "description": "Sync defines the syncing behavior for the integration" + } + }, + "additionalProperties": false, + "type": "object", + "description": "ExternalSecrets reuses a host external secret operator and makes certain CRDs from it available inside the vCluster" + }, + "ExternalSecretsSync": { + "properties": { + "externalSecrets": { + "$ref": "#/$defs/EnableSwitch", + "description": "ExternalSecrets defines whether to sync external secrets or not" + }, + "stores": { + "$ref": "#/$defs/EnableSwitch", + "description": "Stores defines whether to sync stores or not" + }, + "clusterStores": { + "$ref": "#/$defs/ClusterStoresSyncConfig", + "description": "ClusterStores defines whether to sync cluster stores or not" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Hook": { + "properties": { + "apiVersion": { + "type": "string", + "description": "APIVersion of the object to sync" + }, + "kind": { + "type": "string", + "description": "Kind of the object to sync" + }, + "verbs": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Verbs are the verbs that the hook should mutate" + }, + "patches": { + "items": { + "$ref": "#/$defs/Patch" + }, + "type": "array", + "description": "Patches are the patches to apply on the object to be synced" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Hooks": { + "properties": { + "hostToVirtual": { + "items": { + "$ref": "#/$defs/Hook" + }, + "type": "array", + "description": "HostToVirtual is a hook that is executed before syncing from the host to the virtual cluster" + }, + "virtualToHost": { + "items": { + "$ref": "#/$defs/Hook" + }, + "type": "array", + "description": "VirtualToHost is a hook that is executed before syncing from the virtual to the host cluster" + } + }, + "additionalProperties": false, + "type": "object" + }, + "HostPathMapper": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled specifies if the host path mapper will be used" + }, + "central": { + "type": "boolean", + "description": "Central specifies if the central host path mapper will be used" + } + }, + "additionalProperties": false, + "type": "object" + }, + "IPBlock": { + "properties": { + "cidr": { + "type": "string", + "description": "cidr is a string representing the IPBlock\nValid examples are \"192.168.1.0/24\" or \"2001:db8::/64\"" + }, + "except": { + "items": { + "type": "string" + }, + "type": "array", + "description": "except is a slice of CIDRs that should not be included within an IPBlock\nValid examples are \"192.168.1.0/24\" or \"2001:db8::/64\"\nExcept values will be rejected if they are outside the cidr range\n+optional" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Image": { + "properties": { + "registry": { + "type": "string", + "description": "Registry is the registry of the container image, e.g. my-registry.com or ghcr.io. This setting can be globally\noverridden via the controlPlane.advanced.defaultImageRegistry option. Empty means docker hub." + }, + "repository": { + "type": "string", + "description": "Repository is the repository of the container image, e.g. my-repo/my-image" + }, + "tag": { + "type": "string", + "description": "Tag is the tag of the container image, e.g. latest" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ImagePullSecretName": { + "properties": { + "name": { + "type": "string", + "description": "Name of the image pull secret to use." + } + }, + "additionalProperties": false, + "type": "object" + }, + "Import": { + "properties": { + "apiVersion": { + "type": "string", + "description": "APIVersion of the object to sync" + }, + "kind": { + "type": "string", + "description": "Kind of the object to sync" + }, + "optional": { + "type": "boolean" + }, + "replaceOnConflict": { + "type": "boolean", + "description": "ReplaceWhenInvalid determines if the controller should try to recreate the object\nif there is a problem applying" + }, + "patches": { + "items": { + "$ref": "#/$defs/Patch" + }, + "type": "array", + "description": "Patches are the patches to apply on the virtual cluster objects\nwhen syncing them from the host cluster" + }, + "reversePatches": { + "items": { + "$ref": "#/$defs/Patch" + }, + "type": "array", + "description": "ReversePatches are the patches to apply to host cluster objects\nafter it has been synced to the virtual cluster" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Integrations": { + "properties": { + "metricsServer": { + "$ref": "#/$defs/MetricsServer", + "description": "MetricsServer reuses the metrics server from the host cluster within the vCluster." + }, + "kubeVirt": { + "$ref": "#/$defs/KubeVirt", + "description": "KubeVirt reuses a host kubevirt and makes certain CRDs from it available inside the vCluster" + }, + "externalSecrets": { + "$ref": "#/$defs/ExternalSecrets", + "description": "ExternalSecrets reuses a host external secret operator and makes certain CRDs from it available inside the vCluster" + } + }, + "additionalProperties": false, + "type": "object", + "description": "Integrations holds config for vCluster integrations with other operators or tools running on the host cluster" + }, + "KubeVirt": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled signals if the integration should be enabled" + }, + "apiService": { + "$ref": "#/$defs/APIService", + "description": "APIService holds information about where to find the virt-api service. Defaults to virt-api/kubevirt." + }, + "webhook": { + "$ref": "#/$defs/EnableSwitch", + "description": "Webhook holds configuration for enabling the webhook within the vCluster" + }, + "sync": { + "$ref": "#/$defs/KubeVirtSync", + "description": "Sync holds configuration on what resources to sync" + } + }, + "additionalProperties": false, + "type": "object", + "description": "KubeVirt reuses a host kubevirt and makes certain CRDs from it available inside the vCluster" + }, + "KubeVirtSync": { + "properties": { + "dataVolumes": { + "$ref": "#/$defs/EnableSwitch", + "description": "If DataVolumes should get synced" + }, + "virtualMachineInstanceMigrations": { + "$ref": "#/$defs/EnableSwitch", + "description": "If VirtualMachineInstanceMigrations should get synced" + }, + "virtualMachineInstances": { + "$ref": "#/$defs/EnableSwitch", + "description": "If VirtualMachineInstances should get synced" + }, + "virtualMachines": { + "$ref": "#/$defs/EnableSwitch", + "description": "If VirtualMachines should get synced" + }, + "virtualMachineClones": { + "$ref": "#/$defs/EnableSwitch", + "description": "If VirtualMachineClones should get synced" + }, + "virtualMachinePools": { + "$ref": "#/$defs/EnableSwitch", + "description": "If VirtualMachinePools should get synced" + } + }, + "additionalProperties": false, + "type": "object", + "description": "KubeVirtSync are the crds that are supported by this integration" + }, + "LabelSelector": { + "properties": { + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Labels defines what labels should be looked for" + } + }, + "additionalProperties": false, + "type": "object" + }, + "LabelsAndAnnotations": { + "properties": { + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are extra annotations for this resource." + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Labels are extra labels for this resource." + } + }, + "additionalProperties": false, + "type": "object" + }, + "LimitRange": { + "properties": { + "enabled": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "boolean" + } + ], + "description": "Enabled defines if the limit range should be deployed by vCluster. \"auto\" means that if resourceQuota is enabled,\nthe limitRange will be enabled as well." + }, + "default": { + "type": "object", + "description": "Default are the default limits for the limit range" + }, + "defaultRequest": { + "type": "object", + "description": "DefaultRequest are the default request options for the limit range" + }, + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are extra annotations for this resource." + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Labels are extra labels for this resource." + } + }, + "additionalProperties": false, + "type": "object" + }, + "MetricsServer": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled signals the metrics server integration should be enabled." + }, + "apiService": { + "$ref": "#/$defs/APIService", + "description": "APIService holds information about where to find the metrics-server service. Defaults to metrics-server/kube-system." + }, + "nodes": { + "type": "boolean", + "description": "Nodes defines if metrics-server nodes api should get proxied from host to virtual cluster." + }, + "pods": { + "type": "boolean", + "description": "Pods defines if metrics-server pods api should get proxied from host to virtual cluster." + } + }, + "additionalProperties": false, + "type": "object", + "description": "MetricsServer reuses the metrics server from the host cluster within the vCluster." + }, + "MutatingWebhook": { + "properties": { + "reinvocationPolicy": { + "type": "string", + "description": "reinvocationPolicy indicates whether this webhook should be called multiple times as part of a single admission evaluation.\nAllowed values are \"Never\" and \"IfNeeded\"." + }, + "name": { + "type": "string", + "description": "The name of the admission webhook.\nName should be fully qualified, e.g., imagepolicy.kubernetes.io, where\n\"imagepolicy\" is the name of the webhook, and kubernetes.io is the name\nof the organization." + }, + "clientConfig": { + "$ref": "#/$defs/ValidatingWebhookClientConfig", + "description": "ClientConfig defines how to communicate with the hook." + }, + "rules": { + "items": true, + "type": "array", + "description": "Rules describes what operations on what resources/subresources the webhook cares about.\nThe webhook cares about an operation if it matches _any_ Rule." + }, + "failurePolicy": { + "type": "string", + "description": "FailurePolicy defines how unrecognized errors from the admission endpoint are handled -\nallowed values are Ignore or Fail. Defaults to Fail." + }, + "matchPolicy": { + "type": "string", + "description": "matchPolicy defines how the \"rules\" list is used to match incoming requests.\nAllowed values are \"Exact\" or \"Equivalent\"." + }, + "namespaceSelector": { + "description": "NamespaceSelector decides whether to run the webhook on an object based\non whether the namespace for that object matches the selector. If the\nobject itself is a namespace, the matching is performed on\nobject.metadata.labels. If the object is another cluster scoped resource,\nit never skips the webhook." + }, + "objectSelector": { + "description": "ObjectSelector decides whether to run the webhook based on if the\nobject has matching labels. objectSelector is evaluated against both\nthe oldObject and newObject that would be sent to the webhook, and\nis considered to match if either object matches the selector." + }, + "sideEffects": { + "type": "string", + "description": "SideEffects states whether this webhook has side effects." + }, + "timeoutSeconds": { + "type": "integer", + "description": "TimeoutSeconds specifies the timeout for this webhook." + }, + "admissionReviewVersions": { + "items": { + "type": "string" + }, + "type": "array", + "description": "AdmissionReviewVersions is an ordered list of preferred `AdmissionReview`\nversions the Webhook expects." + }, + "matchConditions": { + "items": true, + "type": "array", + "description": "MatchConditions is a list of conditions that must be met for a request to be sent to this\nwebhook. Match conditions filter requests that have already been matched by the rules,\nnamespaceSelector, and objectSelector. An empty list of matchConditions matches all requests.\nThere are a maximum of 64 match conditions allowed." + } + }, + "additionalProperties": false, + "type": "object" + }, + "MutatingWebhookConfiguration": { + "properties": { + "kind": { + "type": "string", + "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to." + }, + "apiVersion": { + "type": "string", + "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values." + }, + "metadata": { + "$ref": "#/$defs/ObjectMeta", + "description": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata." + }, + "webhooks": { + "items": { + "$ref": "#/$defs/MutatingWebhook" + }, + "type": "array", + "description": "Webhooks is a list of webhooks and the affected resources and operations." + } + }, + "additionalProperties": false, + "type": "object" + }, + "NetworkPolicy": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if the network policy should be deployed by vCluster." + }, + "fallbackDns": { + "type": "string" + }, + "outgoingConnections": { + "$ref": "#/$defs/OutgoingConnections" + }, + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are extra annotations for this resource." + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Labels are extra labels for this resource." + } + }, + "additionalProperties": false, + "type": "object" + }, + "NetworkProxyKubelets": { + "properties": { + "byHostname": { + "type": "boolean", + "description": "ByHostname will add a special vCluster hostname to the nodes where the node can be reached at. This doesn't work\nfor all applications, e.g. Prometheus requires a node IP." + }, + "byIP": { + "type": "boolean", + "description": "ByIP will create a separate service in the host cluster for every node that will point to virtual cluster and will be used to\nroute traffic." + } + }, + "additionalProperties": false, + "type": "object" + }, + "Networking": { + "properties": { + "replicateServices": { + "$ref": "#/$defs/ReplicateServices", + "description": "ReplicateServices allows replicating services from the host within the virtual cluster or the other way around." + }, + "resolveDNS": { + "items": { + "$ref": "#/$defs/ResolveDNS" + }, + "type": "array", + "description": "ResolveDNS allows to define extra DNS rules. This only works if embedded coredns is configured.", + "pro": true + }, + "advanced": { + "$ref": "#/$defs/NetworkingAdvanced", + "description": "Advanced holds advanced network options." + } + }, + "additionalProperties": false, + "type": "object" + }, + "NetworkingAdvanced": { + "properties": { + "clusterDomain": { + "type": "string", + "description": "ClusterDomain is the Kubernetes cluster domain to use within the virtual cluster." + }, + "fallbackHostCluster": { + "type": "boolean", + "description": "FallbackHostCluster allows to fallback dns to the host cluster. This is useful if you want to reach host services without\nany other modification. You will need to provide a namespace for the service, e.g. my-other-service.my-other-namespace" + }, + "proxyKubelets": { + "$ref": "#/$defs/NetworkProxyKubelets", + "description": "ProxyKubelets allows rewriting certain metrics and stats from the Kubelet to \"fake\" this for applications such as\nprometheus or other node exporters." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ObjectMeta": { + "properties": { + "name": { + "type": "string", + "description": "Name must be unique within a namespace. Is required when creating resources, although\nsome resources may allow a client to request the generation of an appropriate name\nautomatically. Name is primarily intended for creation idempotence and configuration\ndefinition." + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Map of string keys and values that can be used to organize and categorize\n(scope and select) objects. May match selectors of replication controllers\nand services." + }, + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations is an unstructured key value map stored with a resource that may be\nset by external tools to store and retrieve arbitrary metadata." + } + }, + "additionalProperties": false, + "type": "object" + }, + "OutgoingConnections": { + "properties": { + "ipBlock": { + "$ref": "#/$defs/IPBlock", + "description": "IPBlock describes a particular CIDR (Ex. \"192.168.1.0/24\",\"2001:db8::/64\") that is allowed\nto the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs\nthat should not be included within this rule." + }, + "platform": { + "type": "boolean", + "description": "Platform enables egress access towards loft platform" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Patch": { + "properties": { + "op": { + "type": "string", + "description": "Operation is the type of the patch" + }, + "fromPath": { + "type": "string", + "description": "FromPath is the path from the other object" + }, + "path": { + "type": "string", + "description": "Path is the path of the patch" + }, + "namePath": { + "type": "string", + "description": "NamePath is the path to the name of a child resource within Path" + }, + "namespacePath": { + "type": "string", + "description": "NamespacePath is path to the namespace of a child resource within Path" + }, + "value": { + "description": "Value is the new value to be set to the path" + }, + "regex": { + "type": "string", + "description": "Regex - is regular expresion used to identify the Name,\nand optionally Namespace, parts of the field value that\nwill be replaced with the rewritten Name and/or Namespace" + }, + "conditions": { + "items": { + "$ref": "#/$defs/PatchCondition" + }, + "type": "array", + "description": "Conditions are conditions that must be true for\nthe patch to get executed" + }, + "ignore": { + "type": "boolean", + "description": "Ignore determines if the path should be ignored if handled as a reverse patch" + }, + "sync": { + "$ref": "#/$defs/PatchSync", + "description": "Sync defines if a specialized syncer should be initialized using values\nfrom the rewriteName operation as Secret/Configmap names to be synced" + } + }, + "additionalProperties": false, + "type": "object" + }, + "PatchCondition": { + "properties": { + "path": { + "type": "string", + "description": "Path is the path within the object to select" + }, + "subPath": { + "type": "string", + "description": "SubPath is the path below the selected object to select" + }, + "equal": { + "description": "Equal is the value the path should be equal to" + }, + "notEqual": { + "description": "NotEqual is the value the path should not be equal to" + }, + "empty": { + "type": "boolean", + "description": "Empty means that the path value should be empty or unset" + } + }, + "additionalProperties": false, + "type": "object" + }, + "PatchSync": { + "properties": { + "secret": { + "type": "boolean" + }, + "configmap": { + "type": "boolean" + } + }, + "additionalProperties": false, + "type": "object" + }, + "PlatformAPIKey": { + "properties": { + "secretName": { + "type": "string", + "description": "SecretName is the name of the secret where the platform access key is stored. This defaults to vcluster-platform-api-key if undefined." + }, + "namespace": { + "type": "string", + "description": "Namespace defines the namespace where the access key secret should be retrieved from. If this is not equal to the namespace\nwhere the vCluster instance is deployed, you need to make sure vCluster has access to this other namespace." + }, + "createRBAC": { + "type": "boolean", + "description": "CreateRBAC will automatically create the necessary RBAC roles and role bindings to allow vCluster to read the secret specified\nin the above namespace, if specified.\nThis defaults to true." + } + }, + "additionalProperties": false, + "type": "object", + "description": "PlatformAPIKey defines where to find the platform access key." + }, + "PlatformConfig": { + "properties": { + "apiKey": { + "$ref": "#/$defs/PlatformAPIKey", + "description": "APIKey defines where to find the platform access key and host. By default, vCluster will search in the following locations in this precedence:\n* environment variable called LICENSE\n* secret specified under external.platform.apiKey.secretName\n* secret called \"vcluster-platform-api-key\" in the vCluster namespace" + } + }, + "type": "object", + "description": "PlatformConfig holds platform configuration" + }, + "Plugin": { + "properties": { + "name": { + "type": "string", + "description": "Name is the name of the init-container and NOT the plugin name" + }, + "image": { + "type": "string", + "description": "Image is the container image that should be used for the plugin" + }, + "imagePullPolicy": { + "type": "string", + "description": "ImagePullPolicy is the pull policy to use for the container image" + }, + "config": { + "type": "object", + "description": "Config is the plugin config to use. This can be arbitrary config used for the plugin." + }, + "rbac": { + "$ref": "#/$defs/PluginsRBAC", + "description": "RBAC holds additional rbac configuration for the plugin" + }, + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Command is the command that should be used for the init container" + }, + "args": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Args are the arguments that should be used for the init container" + }, + "securityContext": { + "type": "object", + "description": "SecurityContext is the container security context used for the init container" + }, + "resources": { + "type": "object", + "description": "Resources are the container resources used for the init container" + }, + "volumeMounts": { + "items": true, + "type": "array", + "description": "VolumeMounts are extra volume mounts for the init container" + }, + "version": { + "type": "string", + "description": "Version is the plugin version, this is only needed for legacy plugins." + }, + "env": { + "items": true, + "type": "array" + }, + "envFrom": { + "items": true, + "type": "array" + }, + "lifecycle": { + "type": "object" + }, + "livenessProbe": { + "type": "object" + }, + "readinessProbe": { + "type": "object" + }, + "startupProbe": { + "type": "object" + }, + "workingDir": { + "type": "string" + }, + "optional": { + "type": "boolean" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Plugins": { + "properties": { + "name": { + "type": "string", + "description": "Name is the name of the init-container and NOT the plugin name" + }, + "image": { + "type": "string", + "description": "Image is the container image that should be used for the plugin" + }, + "imagePullPolicy": { + "type": "string", + "description": "ImagePullPolicy is the pull policy to use for the container image" + }, + "config": { + "type": "object", + "description": "Config is the plugin config to use. This can be arbitrary config used for the plugin." + }, + "rbac": { + "$ref": "#/$defs/PluginsRBAC", + "description": "RBAC holds additional rbac configuration for the plugin" + }, + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Command is the command that should be used for the init container" + }, + "args": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Args are the arguments that should be used for the init container" + }, + "securityContext": { + "type": "object", + "description": "SecurityContext is the container security context used for the init container" + }, + "resources": { + "type": "object", + "description": "Resources are the container resources used for the init container" + }, + "volumeMounts": { + "items": true, + "type": "array", + "description": "VolumeMounts are extra volume mounts for the init container" + } + }, + "additionalProperties": false, + "type": "object" + }, + "PluginsExtraRules": { + "properties": { + "extraRules": { + "items": { + "$ref": "#/$defs/RBACPolicyRule" + }, + "type": "array", + "description": "ExtraRules are extra rbac permissions roles that will be added to role or cluster role" + } + }, + "additionalProperties": false, + "type": "object" + }, + "PluginsRBAC": { + "properties": { + "role": { + "$ref": "#/$defs/PluginsExtraRules", + "description": "Role holds extra virtual cluster role permissions for the plugin" + }, + "clusterRole": { + "$ref": "#/$defs/PluginsExtraRules", + "description": "ClusterRole holds extra virtual cluster cluster role permissions required for the plugin" + } + }, + "additionalProperties": false, + "type": "object" + }, + "PodDNSConfig": { + "properties": { + "nameservers": { + "items": { + "type": "string" + }, + "type": "array", + "description": "A list of DNS name server IP addresses.\nThis will be appended to the base nameservers generated from DNSPolicy.\nDuplicated nameservers will be removed.\n+optional\n+listType=atomic" + }, + "searches": { + "items": { + "type": "string" + }, + "type": "array", + "description": "A list of DNS search domains for host-name lookup.\nThis will be appended to the base search paths generated from DNSPolicy.\nDuplicated search paths will be removed.\n+optional\n+listType=atomic" + }, + "options": { + "items": { + "$ref": "#/$defs/PodDNSConfigOption" + }, + "type": "array", + "description": "A list of DNS resolver options.\nThis will be merged with the base options generated from DNSPolicy.\nDuplicated entries will be removed. Resolution options given in Options\nwill override those that appear in the base DNSPolicy.\n+optional\n+listType=atomic" + } + }, + "additionalProperties": false, + "type": "object", + "description": "PodDNSConfig defines the DNS parameters of a pod in addition to those generated from DNSPolicy." + }, + "PodDNSConfigOption": { + "properties": { + "name": { + "type": "string", + "description": "Required." + }, + "value": { + "type": "string", + "description": "+optional" + } + }, + "additionalProperties": false, + "type": "object", + "description": "PodDNSConfigOption defines DNS resolver options of a pod." + }, + "Policies": { + "properties": { + "networkPolicy": { + "$ref": "#/$defs/NetworkPolicy", + "description": "NetworkPolicy specifies network policy options." + }, + "podSecurityStandard": { + "type": "string", + "description": "PodSecurityStandard that can be enforced can be one of: empty (\"\"), baseline, restricted or privileged" + }, + "resourceQuota": { + "$ref": "#/$defs/ResourceQuota", + "description": "ResourceQuota specifies resource quota options." + }, + "limitRange": { + "$ref": "#/$defs/LimitRange", + "description": "LimitRange specifies limit range options." + }, + "centralAdmission": { + "$ref": "#/$defs/CentralAdmission", + "description": "CentralAdmission defines what validating or mutating webhooks should be enforced within the virtual cluster.", + "pro": true + } + }, + "additionalProperties": false, + "type": "object" + }, + "RBAC": { + "properties": { + "role": { + "$ref": "#/$defs/RBACRole", + "description": "Role holds virtual cluster role configuration" + }, + "clusterRole": { + "$ref": "#/$defs/RBACClusterRole", + "description": "ClusterRole holds virtual cluster cluster role configuration" + } + }, + "additionalProperties": false, + "type": "object" + }, + "RBACClusterRole": { + "properties": { + "enabled": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "boolean" + } + ], + "description": "Enabled defines if the cluster role should be enabled or disabled. If auto, vCluster automatically determines whether the virtual cluster requires a cluster role." + }, + "extraRules": { + "items": { + "type": "object" + }, + "type": "array", + "description": "ExtraRules will add rules to the cluster role." + }, + "overwriteRules": { + "items": { + "type": "object" + }, + "type": "array", + "description": "OverwriteRules will overwrite the cluster role rules completely." + } + }, + "additionalProperties": false, + "type": "object" + }, + "RBACPolicyRule": { + "properties": { + "verbs": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs." + }, + "apiGroups": { + "items": { + "type": "string" + }, + "type": "array", + "description": "APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of\nthe enumerated resources in any API group will be allowed. \"\" represents the core API group and \"*\" represents all API groups." + }, + "resources": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Resources is a list of resources this rule applies to. '*' represents all resources." + }, + "resourceNames": { + "items": { + "type": "string" + }, + "type": "array", + "description": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed." + }, + "nonResourceURLs": { + "items": { + "type": "string" + }, + "type": "array", + "description": "NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path\nSince non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding.\nRules can either apply to API resources (such as \"pods\" or \"secrets\") or non-resource URL paths (such as \"/api\"), but not both." + } + }, + "additionalProperties": false, + "type": "object" + }, + "RBACRole": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if the role should be enabled or disabled." + }, + "extraRules": { + "items": { + "type": "object" + }, + "type": "array", + "description": "ExtraRules will add rules to the role." + }, + "overwriteRules": { + "items": { + "type": "object" + }, + "type": "array", + "description": "OverwriteRules will overwrite the role rules completely." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ReplicateServices": { + "properties": { + "toHost": { + "items": { + "$ref": "#/$defs/ServiceMapping" + }, + "type": "array", + "description": "ToHost defines the services that should get synced from virtual cluster to the host cluster. If services are\nsynced to a different namespace than the virtual cluster is in, additional permissions for the other namespace\nare required." + }, + "fromHost": { + "items": { + "$ref": "#/$defs/ServiceMapping" + }, + "type": "array", + "description": "FromHost defines the services that should get synced from the host to the virtual cluster." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ResolveDNS": { + "properties": { + "hostname": { + "type": "string", + "description": "Hostname is the hostname within the vCluster that should be resolved from." + }, + "service": { + "type": "string", + "description": "Service is the virtual cluster service that should be resolved from." + }, + "namespace": { + "type": "string", + "description": "Namespace is the virtual cluster namespace that should be resolved from." + }, + "target": { + "$ref": "#/$defs/ResolveDNSTarget", + "description": "Target is the DNS target that should get mapped to" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ResolveDNSTarget": { + "properties": { + "hostname": { + "type": "string", + "description": "Hostname to use as a DNS target" + }, + "ip": { + "type": "string", + "description": "IP to use as a DNS target" + }, + "hostService": { + "type": "string", + "description": "HostService to target, format is hostNamespace/hostService" + }, + "hostNamespace": { + "type": "string", + "description": "HostNamespace to target" + }, + "vClusterService": { + "type": "string", + "description": "VClusterService format is hostNamespace/vClusterName/vClusterNamespace/vClusterService" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ResourceQuota": { + "properties": { + "enabled": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "boolean" + } + ], + "description": "Enabled defines if the resource quota should be enabled. \"auto\" means that if limitRange is enabled,\nthe resourceQuota will be enabled as well." + }, + "quota": { + "type": "object", + "description": "Quota are the quota options" + }, + "scopeSelector": { + "type": "object", + "description": "ScopeSelector is the resource quota scope selector" + }, + "scopes": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Scopes are the resource quota scopes" + }, + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are extra annotations for this resource." + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Labels are extra labels for this resource." + } + }, + "additionalProperties": false, + "type": "object" + }, + "Resources": { + "properties": { + "limits": { + "type": "object", + "description": "Limits are resource limits for the container" + }, + "requests": { + "type": "object", + "description": "Requests are minimal resources that will be consumed by the container" + } + }, + "additionalProperties": false, + "type": "object" + }, + "RuleWithVerbs": { + "properties": { + "apiGroups": { + "items": { + "type": "string" + }, + "type": "array", + "description": "APIGroups is the API groups the resources belong to. '*' is all groups." + }, + "apiVersions": { + "items": { + "type": "string" + }, + "type": "array", + "description": "APIVersions is the API versions the resources belong to. '*' is all versions." + }, + "resources": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Resources is a list of resources this rule applies to." + }, + "scope": { + "type": "string", + "description": "Scope specifies the scope of this rule." + }, + "operations": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Verb is the kube verb associated with the request for API requests, not the http verb. This includes things like list and watch.\nFor non-resource requests, this is the lowercase http verb.\nIf '*' is present, the length of the slice must be one." + } + }, + "additionalProperties": false, + "type": "object" + }, + "Selector": { + "properties": { + "labelSelector": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "LabelSelector are the labels to select the object from" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ServiceMapping": { + "properties": { + "from": { + "type": "string", + "description": "From is the service that should get synced. Can be either in the form name or namespace/name." + }, + "to": { + "type": "string", + "description": "To is the target service that it should get synced to. Can be either in the form name or namespace/name." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ServiceMonitor": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled configures if Helm should create the service monitor." + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Labels are the extra labels to add to the service monitor." + }, + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Annotations are the extra annotations to add to the service monitor." + } + }, + "additionalProperties": false, + "type": "object" + }, + "StatefulSetImage": { + "properties": { + "registry": { + "type": "string", + "description": "Configure the registry of the container image, e.g. my-registry.com or ghcr.io\nIt defaults to ghcr.io and can be overriding either by using this field or controlPlane.advanced.defaultImageRegistry" + }, + "repository": { + "type": "string", + "description": "Configure the repository of the container image, e.g. my-repo/my-image.\nIt defaults to the vCluster pro repository that includes the optional pro modules that are turned off by default.\nIf you still want to use the pure OSS build, use 'loft-sh/vcluster-oss' instead." + }, + "tag": { + "type": "string", + "description": "Tag is the tag of the container image, e.g. latest" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Sync": { + "properties": { + "toHost": { + "$ref": "#/$defs/SyncToHost", + "description": "Configure resources to sync from the virtual cluster to the host cluster." + }, + "fromHost": { + "$ref": "#/$defs/SyncFromHost", + "description": "Configure what resources vCluster should sync from the host cluster to the virtual cluster." + } + }, + "additionalProperties": false, + "type": "object" + }, + "SyncAllResource": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if this option should be enabled." + }, + "all": { + "type": "boolean", + "description": "All defines if all resources of that type should get synced or only the necessary ones that are needed." + }, + "translate": { + "items": { + "$ref": "#/$defs/TranslatePatch" + }, + "type": "array", + "description": "Translate the patch according to the given patches." + } + }, + "additionalProperties": false, + "type": "object" + }, + "SyncFromHost": { + "properties": { + "nodes": { + "$ref": "#/$defs/SyncNodes", + "description": "Nodes defines if nodes should get synced from the host cluster to the virtual cluster, but not back." + }, + "events": { + "$ref": "#/$defs/EnableSwitch", + "description": "Events defines if events should get synced from the host cluster to the virtual cluster, but not back." + }, + "ingressClasses": { + "$ref": "#/$defs/EnableSwitch", + "description": "IngressClasses defines if ingress classes should get synced from the host cluster to the virtual cluster, but not back." + }, + "runtimeClasses": { + "$ref": "#/$defs/EnableSwitch", + "description": "RuntimeClasses defines if runtime classes should get synced from the host cluster to the virtual cluster, but not back." + }, + "priorityClasses": { + "$ref": "#/$defs/EnableSwitch", + "description": "PriorityClasses defines if priority classes classes should get synced from the host cluster to the virtual cluster, but not back." + }, + "storageClasses": { + "$ref": "#/$defs/EnableAutoSwitch", + "description": "StorageClasses defines if storage classes should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled." + }, + "csiNodes": { + "$ref": "#/$defs/EnableAutoSwitch", + "description": "CSINodes defines if csi nodes should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled." + }, + "csiDrivers": { + "$ref": "#/$defs/EnableAutoSwitch", + "description": "CSIDrivers defines if csi drivers should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled." + }, + "csiStorageCapacities": { + "$ref": "#/$defs/EnableAutoSwitch", + "description": "CSIStorageCapacities defines if csi storage capacities should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled." + }, + "customResourceDefinitions": { + "additionalProperties": { + "$ref": "#/$defs/SyncFromHostCustomResourceDefinition" + }, + "type": "object", + "description": "CustomResourceDefinitions defines what custom resource definitions should get synced read-only to the virtual cluster from the host cluster." + } + }, + "additionalProperties": false, + "type": "object" + }, + "SyncFromHostCustomResourceDefinition": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if this option should be enabled." + } + }, + "additionalProperties": false, + "type": "object" + }, + "SyncNodeSelector": { + "properties": { + "all": { + "type": "boolean", + "description": "All specifies if all nodes should get synced by vCluster from the host to the virtual cluster or only the ones where pods are assigned to." + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Labels are the node labels used to sync nodes from host cluster to virtual cluster. This will also set the node selector when syncing a pod from virtual cluster to host cluster to the same value." + } + }, + "additionalProperties": false, + "type": "object" + }, + "SyncNodes": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled specifies if syncing real nodes should be enabled. If this is disabled, vCluster will create fake nodes instead." + }, + "syncBackChanges": { + "type": "boolean", + "description": "SyncBackChanges enables syncing labels and taints from the virtual cluster to the host cluster. If this is enabled someone within the virtual cluster will be able to change the labels and taints of the host cluster node." + }, + "clearImageStatus": { + "type": "boolean", + "description": "ClearImageStatus will erase the image status when syncing a node. This allows to hide images that are pulled by the node." + }, + "selector": { + "$ref": "#/$defs/SyncNodeSelector", + "description": "Selector can be used to define more granular what nodes should get synced from the host cluster to the virtual cluster." + } + }, + "additionalProperties": false, + "type": "object" + }, + "SyncPods": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if pod syncing should be enabled." + }, + "translateImage": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "TranslateImage maps an image to another image that should be used instead. For example this can be used to rewrite\na certain image that is used within the virtual cluster to be another image on the host cluster" + }, + "enforceTolerations": { + "items": { + "type": "string" + }, + "type": "array", + "description": "EnforceTolerations will add the specified tolerations to all pods synced by the virtual cluster." + }, + "useSecretsForSATokens": { + "type": "boolean", + "description": "UseSecretsForSATokens will use secrets to save the generated service account tokens by virtual cluster instead of using a\npod annotation." + }, + "rewriteHosts": { + "$ref": "#/$defs/SyncRewriteHosts", + "description": "RewriteHosts is a special option needed to rewrite statefulset containers to allow the correct FQDN. virtual cluster will add\na small container to each stateful set pod that will initially rewrite the /etc/hosts file to match the FQDN expected by\nthe virtual cluster." + }, + "translate": { + "items": { + "$ref": "#/$defs/TranslatePatch" + }, + "type": "array", + "description": "Translate the patch according to the given patches." + } + }, + "additionalProperties": false, + "type": "object" + }, + "SyncRewriteHosts": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled specifies if rewriting stateful set pods should be enabled." + }, + "initContainer": { + "$ref": "#/$defs/SyncRewriteHostsInitContainer", + "description": "InitContainer holds extra options for the init container used by vCluster to rewrite the FQDN for stateful set pods." + } + }, + "additionalProperties": false, + "type": "object" + }, + "SyncRewriteHostsInitContainer": { + "properties": { + "image": { + "type": "string", + "description": "Image is the image virtual cluster should use to rewrite this FQDN." + }, + "resources": { + "$ref": "#/$defs/Resources", + "description": "Resources are the resources that should be assigned to the init container for each stateful set init container." + } + }, + "additionalProperties": false, + "type": "object" + }, + "SyncToHost": { + "properties": { + "pods": { + "$ref": "#/$defs/SyncPods", + "description": "Pods defines if pods created within the virtual cluster should get synced to the host cluster." + }, + "secrets": { + "$ref": "#/$defs/SyncAllResource", + "description": "Secrets defines if secrets created within the virtual cluster should get synced to the host cluster." + }, + "configMaps": { + "$ref": "#/$defs/SyncAllResource", + "description": "ConfigMaps defines if config maps created within the virtual cluster should get synced to the host cluster." + }, + "ingresses": { + "$ref": "#/$defs/EnableSwitchWithTranslate", + "description": "Ingresses defines if ingresses created within the virtual cluster should get synced to the host cluster." + }, + "services": { + "$ref": "#/$defs/EnableSwitchWithTranslate", + "description": "Services defines if services created within the virtual cluster should get synced to the host cluster." + }, + "endpoints": { + "$ref": "#/$defs/EnableSwitch", + "description": "Endpoints defines if endpoints created within the virtual cluster should get synced to the host cluster." + }, + "networkPolicies": { + "$ref": "#/$defs/EnableSwitch", + "description": "NetworkPolicies defines if network policies created within the virtual cluster should get synced to the host cluster." + }, + "persistentVolumeClaims": { + "$ref": "#/$defs/EnableSwitchWithTranslate", + "description": "PersistentVolumeClaims defines if persistent volume claims created within the virtual cluster should get synced to the host cluster." + }, + "persistentVolumes": { + "$ref": "#/$defs/EnableSwitch", + "description": "PersistentVolumes defines if persistent volumes created within the virtual cluster should get synced to the host cluster." + }, + "volumeSnapshots": { + "$ref": "#/$defs/EnableSwitch", + "description": "VolumeSnapshots defines if volume snapshots created within the virtual cluster should get synced to the host cluster." + }, + "storageClasses": { + "$ref": "#/$defs/EnableSwitch", + "description": "StorageClasses defines if storage classes created within the virtual cluster should get synced to the host cluster." + }, + "serviceAccounts": { + "$ref": "#/$defs/EnableSwitch", + "description": "ServiceAccounts defines if service accounts created within the virtual cluster should get synced to the host cluster." + }, + "podDisruptionBudgets": { + "$ref": "#/$defs/EnableSwitch", + "description": "PodDisruptionBudgets defines if pod disruption budgets created within the virtual cluster should get synced to the host cluster." + }, + "priorityClasses": { + "$ref": "#/$defs/EnableSwitch", + "description": "PriorityClasses defines if priority classes created within the virtual cluster should get synced to the host cluster." + }, + "customResourceDefinitions": { + "additionalProperties": { + "$ref": "#/$defs/SyncToHostCustomResourceDefinition" + }, + "type": "object", + "description": "CustomResourceDefinitions defines what custom resource definitions should get synced from the virtual cluster to the host cluster." + } + }, + "additionalProperties": false, + "type": "object" + }, + "SyncToHostCustomResourceDefinition": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled defines if this option should be enabled." + }, + "translate": { + "items": { + "$ref": "#/$defs/TranslatePatch" + }, + "type": "array", + "description": "Translate the patch according to the given patches." + } + }, + "additionalProperties": false, + "type": "object" + }, + "Telemetry": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Enabled specifies that the telemetry for the vCluster control plane should be enabled." + }, + "instanceCreator": { + "type": "string" + }, + "machineID": { + "type": "string" + }, + "platformUserID": { + "type": "string" + }, + "platformInstanceID": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "TranslatePatch": { + "oneOf": [ + { + "required": [ + "expression" + ], + "title": "expression" + }, + { + "required": [ + "reference" + ], + "title": "reference" + }, + { + "required": [ + "labels" + ], + "title": "labels" + } + ], + "properties": { + "path": { + "type": "string", + "description": "Path is the path within the patch to target. If the path is not found within the patch, the patch is not applied." + }, + "expression": { + "$ref": "#/$defs/TranslatePatchExpression", + "description": "Expression transforms the value according to the given JavaScript expression." + }, + "reference": { + "$ref": "#/$defs/TranslatePatchReference", + "description": "Reference treats the path value as a reference to another object and will rewrite it based on the chosen mode\nautomatically. In single-namespace mode this will translate the name to \"vxxxxxxxxx\" to avoid conflicts with\nother names, in multi-namespace mode this will not translate the name." + }, + "labels": { + "$ref": "#/$defs/TranslatePatchLabels", + "description": "Labels treats the path value as a labels selector." + } + }, + "additionalProperties": false, + "type": "object" + }, + "TranslatePatchExpression": { + "oneOf": [ + { + "required": [ + "toHost" + ], + "title": "toHost" + }, + { + "required": [ + "fromHost" + ], + "title": "fromHost" + } + ], + "properties": { + "toHost": { + "type": "string", + "description": "ToHost is the expression to apply when retrieving a change from virtual to host." + }, + "fromHost": { + "type": "string", + "description": "FromHost is the patch to apply when retrieving a change from host to virtual." + } + }, + "additionalProperties": false, + "type": "object" + }, + "TranslatePatchLabels": { + "properties": {}, + "additionalProperties": false, + "type": "object" + }, + "TranslatePatchReference": { + "properties": { + "apiVersion": { + "type": "string", + "description": "APIVersion is the apiVersion of the referenced object." + }, + "apiVersionPath": { + "type": "string", + "description": "APIVersionPath is optional relative path to use to determine the kind. If APIVersionPath is not found, will fallback to apiVersion." + }, + "kind": { + "type": "string", + "description": "Kind is the kind of the referenced object." + }, + "kindPath": { + "type": "string", + "description": "KindPath is the optional relative path to use to determine the kind. If KindPath is not found, will fallback to kind." + }, + "namePath": { + "type": "string", + "description": "NamePath is the optional relative path to the reference name within the object." + }, + "namespacePath": { + "type": "string", + "description": "NamespacePath is the optional relative path to the reference namespace within the object. If omitted or not found, namespacePath equals to the\nmetadata.namespace path of the object." + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "apiVersion", + "kind" + ] + }, + "ValidatingWebhook": { + "properties": { + "name": { + "type": "string", + "description": "The name of the admission webhook.\nName should be fully qualified, e.g., imagepolicy.kubernetes.io, where\n\"imagepolicy\" is the name of the webhook, and kubernetes.io is the name\nof the organization." + }, + "clientConfig": { + "$ref": "#/$defs/ValidatingWebhookClientConfig", + "description": "ClientConfig defines how to communicate with the hook." + }, + "rules": { + "items": true, + "type": "array", + "description": "Rules describes what operations on what resources/subresources the webhook cares about.\nThe webhook cares about an operation if it matches _any_ Rule." + }, + "failurePolicy": { + "type": "string", + "description": "FailurePolicy defines how unrecognized errors from the admission endpoint are handled -\nallowed values are Ignore or Fail. Defaults to Fail." + }, + "matchPolicy": { + "type": "string", + "description": "matchPolicy defines how the \"rules\" list is used to match incoming requests.\nAllowed values are \"Exact\" or \"Equivalent\"." + }, + "namespaceSelector": { + "description": "NamespaceSelector decides whether to run the webhook on an object based\non whether the namespace for that object matches the selector. If the\nobject itself is a namespace, the matching is performed on\nobject.metadata.labels. If the object is another cluster scoped resource,\nit never skips the webhook." + }, + "objectSelector": { + "description": "ObjectSelector decides whether to run the webhook based on if the\nobject has matching labels. objectSelector is evaluated against both\nthe oldObject and newObject that would be sent to the webhook, and\nis considered to match if either object matches the selector." + }, + "sideEffects": { + "type": "string", + "description": "SideEffects states whether this webhook has side effects." + }, + "timeoutSeconds": { + "type": "integer", + "description": "TimeoutSeconds specifies the timeout for this webhook." + }, + "admissionReviewVersions": { + "items": { + "type": "string" + }, + "type": "array", + "description": "AdmissionReviewVersions is an ordered list of preferred `AdmissionReview`\nversions the Webhook expects." + }, + "matchConditions": { + "items": true, + "type": "array", + "description": "MatchConditions is a list of conditions that must be met for a request to be sent to this\nwebhook. Match conditions filter requests that have already been matched by the rules,\nnamespaceSelector, and objectSelector. An empty list of matchConditions matches all requests.\nThere are a maximum of 64 match conditions allowed." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ValidatingWebhookClientConfig": { + "properties": { + "url": { + "type": "string", + "description": "URL gives the location of the webhook, in standard URL form\n(`scheme://host:port/path`). Exactly one of `url` or `service`\nmust be specified." + }, + "service": { + "$ref": "#/$defs/ValidatingWebhookServiceReference", + "description": "Service is a reference to the service for this webhook. Either\n`service` or `url` must be specified.\n\nIf the webhook is running within the cluster, then you should use `service`." + }, + "caBundle": { + "type": "string", + "contentEncoding": "base64", + "description": "CABundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate.\nIf unspecified, system trust roots on the apiserver are used." + } + }, + "additionalProperties": false, + "type": "object", + "description": "ValidatingWebhookClientConfig contains the information to make a TLS connection with the webhook" + }, + "ValidatingWebhookConfiguration": { + "properties": { + "kind": { + "type": "string", + "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to." + }, + "apiVersion": { + "type": "string", + "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values." + }, + "metadata": { + "$ref": "#/$defs/ObjectMeta", + "description": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata." + }, + "webhooks": { + "items": { + "$ref": "#/$defs/ValidatingWebhook" + }, + "type": "array", + "description": "Webhooks is a list of webhooks and the affected resources and operations." + } + }, + "additionalProperties": false, + "type": "object" + }, + "ValidatingWebhookServiceReference": { + "properties": { + "namespace": { + "type": "string", + "description": "Namespace is the namespace of the service." + }, + "name": { + "type": "string", + "description": "Name is the name of the service." + }, + "path": { + "type": "string", + "description": "Path is an optional URL path which will be sent in any request to\nthis service." + }, + "port": { + "type": "integer", + "description": "If specified, the port on the service that hosting webhook.\nDefault to 443 for backward compatibility.\n`port` should be a valid port number (1-65535, inclusive)." + } + }, + "additionalProperties": false, + "type": "object" + }, + "VirtualClusterKubeConfig": { + "properties": { + "kubeConfig": { + "type": "string", + "description": "KubeConfig is the virtual cluster kubeconfig path." + }, + "serverCAKey": { + "type": "string", + "description": "ServerCAKey is the server ca key path." + }, + "serverCACert": { + "type": "string", + "description": "ServerCAKey is the server ca cert path." + }, + "clientCACert": { + "type": "string", + "description": "ServerCAKey is the client ca cert path." + }, + "requestHeaderCACert": { + "type": "string", + "description": "RequestHeaderCACert is the request header ca cert path." + } + }, + "additionalProperties": false, + "type": "object" + }, + "VolumeClaim": { + "properties": { + "enabled": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "boolean" + } + ], + "description": "Enabled enables deploying a persistent volume claim. If auto, vCluster will automatically determine\nbased on the chosen distro and other options if this is required." + }, + "accessModes": { + "items": { + "type": "string" + }, + "type": "array", + "description": "AccessModes are the persistent volume claim access modes." + }, + "retentionPolicy": { + "type": "string", + "description": "RetentionPolicy is the persistent volume claim retention policy." + }, + "size": { + "type": "string", + "description": "Size is the persistent volume claim storage size." + }, + "storageClass": { + "type": "string", + "description": "StorageClass is the persistent volume claim storage class." + } + }, + "additionalProperties": false, + "type": "object" + }, + "VolumeMount": { + "properties": { + "name": { + "type": "string", + "description": "This must match the Name of a Volume." + }, + "readOnly": { + "type": "boolean", + "description": "Mounted read-only if true, read-write otherwise (false or unspecified).\nDefaults to false." + }, + "mountPath": { + "type": "string", + "description": "Path within the container at which the volume should be mounted. Must\nnot contain ':'." + }, + "subPath": { + "type": "string", + "description": "Path within the volume from which the container's volume should be mounted.\nDefaults to \"\" (volume's root)." + }, + "mountPropagation": { + "type": "string", + "description": "mountPropagation determines how mounts are propagated from the host\nto container and the other way around.\nWhen not set, MountPropagationNone is used.\nThis field is beta in 1.10." + }, + "subPathExpr": { + "type": "string", + "description": "Expanded path within the volume from which the container's volume should be mounted.\nBehaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment.\nDefaults to \"\" (volume's root).\nSubPathExpr and SubPath are mutually exclusive." + } + }, + "additionalProperties": false, + "type": "object", + "description": "VolumeMount describes a mounting of a Volume within a container." + } + }, + "properties": { + "global": { + "description": "Global values shared across all (sub)charts" + }, + "exportKubeConfig": { + "$ref": "#/$defs/ExportKubeConfig", + "description": "ExportKubeConfig describes how vCluster should export the vCluster kubeConfig file." + }, + "sync": { + "$ref": "#/$defs/Sync", + "description": "Sync describes how to sync resources from the virtual cluster to host cluster and back." + }, + "integrations": { + "$ref": "#/$defs/Integrations", + "description": "Integrations holds config for vCluster integrations with other operators or tools running on the host cluster" + }, + "networking": { + "$ref": "#/$defs/Networking", + "description": "Networking options related to the virtual cluster." + }, + "policies": { + "$ref": "#/$defs/Policies", + "description": "Policies to enforce for the virtual cluster deployment as well as within the virtual cluster." + }, + "controlPlane": { + "$ref": "#/$defs/ControlPlane", + "description": "Configure vCluster's control plane components and deployment." + }, + "rbac": { + "$ref": "#/$defs/RBAC", + "description": "RBAC options for the virtual cluster." + }, + "plugins": { + "anyOf": [ + { + "patternProperties": { + ".*": { + "type": "string" + } + }, + "type": "object" + }, + { + "type": "object" + }, + { + "type": "object" + } + ], + "additionalProperties": { + "$ref": "#/$defs/Plugins" + }, + "description": "Define which vCluster plugins to load." + }, + "experimental": { + "$ref": "#/$defs/Experimental", + "description": "Experimental features for vCluster. Configuration here might change, so be careful with this." + }, + "external": { + "$ref": "#/$defs/ExternalConfig", + "description": "External holds configuration for tools that are external to the vCluster." + }, + "telemetry": { + "$ref": "#/$defs/Telemetry", + "description": "Configuration related to telemetry gathered about vCluster usage." + }, + "serviceCIDR": { + "type": "string", + "description": "ServiceCIDR holds the service cidr for the virtual cluster. Do not use this option anymore." + }, + "pro": { + "type": "boolean", + "description": "Specifies whether to use vCluster Pro. This is automatically inferred in newer versions. Do not use that option anymore." + }, + "plugin": { + "anyOf": [ + { + "patternProperties": { + ".*": { + "type": "string" + } + }, + "type": "object" + }, + { + "type": "object" + }, + { + "type": "object" + } + ], + "additionalProperties": { + "$ref": "#/$defs/Plugin" + }, + "description": "Plugin specifies which vCluster plugins to enable. Use \"plugins\" instead. Do not use this option anymore." + } + }, + "additionalProperties": false, + "type": "object", + "description": "Config is the vCluster config." +} \ No newline at end of file diff --git a/config/v0.20/chart/values.yaml b/config/v0.20/chart/values.yaml new file mode 100644 index 000000000..ecad7bf23 --- /dev/null +++ b/config/v0.20/chart/values.yaml @@ -0,0 +1,918 @@ +# Sync describes how to sync resources from the virtual cluster to host cluster and back. +sync: + # Configure resources to sync from the virtual cluster to the host cluster. + toHost: + # Services defines if services created within the virtual cluster should get synced to the host cluster. + services: + enabled: true + # Endpoints defines if endpoints created within the virtual cluster should get synced to the host cluster. + endpoints: + enabled: true + # PersistentVolumeClaims defines if persistent volume claims created within the virtual cluster should get synced to the host cluster. + persistentVolumeClaims: + enabled: true + # ConfigMaps defines if config maps created within the virtual cluster should get synced to the host cluster. + configMaps: + enabled: true + # All defines if all resources of that type should get synced or only the necessary ones that are needed. + all: false + # Secrets defines if secrets created within the virtual cluster should get synced to the host cluster. + secrets: + enabled: true + # All defines if all resources of that type should get synced or only the necessary ones that are needed. + all: false + # Pods defines if pods created within the virtual cluster should get synced to the host cluster. + pods: + # Enabled defines if pod syncing should be enabled. + enabled: true + # TranslateImage maps an image to another image that should be used instead. For example this can be used to rewrite + # a certain image that is used within the virtual cluster to be another image on the host cluster + translateImage: {} + # EnforceTolerations will add the specified tolerations to all pods synced by the virtual cluster. + enforceTolerations: [] + # UseSecretsForSATokens will use secrets to save the generated service account tokens by virtual cluster instead of using a + # pod annotation. + useSecretsForSATokens: false + # RewriteHosts is a special option needed to rewrite statefulset containers to allow the correct FQDN. virtual cluster will add + # a small container to each stateful set pod that will initially rewrite the /etc/hosts file to match the FQDN expected by + # the virtual cluster. + rewriteHosts: + # Enabled specifies if rewriting stateful set pods should be enabled. + enabled: true + # InitContainer holds extra options for the init container used by vCluster to rewrite the FQDN for stateful set pods. + initContainer: + # Image is the image virtual cluster should use to rewrite this FQDN. + image: "library/alpine:3.20" + # Resources are the resources that should be assigned to the init container for each stateful set init container. + resources: + # Limits are resource limits for the container + limits: + cpu: 30m + memory: 64Mi + # Requests are minimal resources that will be consumed by the container + requests: + cpu: 30m + memory: 64Mi + # Ingresses defines if ingresses created within the virtual cluster should get synced to the host cluster. + ingresses: + enabled: false + # PriorityClasses defines if priority classes created within the virtual cluster should get synced to the host cluster. + priorityClasses: + enabled: false + # NetworkPolicies defines if network policies created within the virtual cluster should get synced to the host cluster. + networkPolicies: + enabled: false + # VolumeSnapshots defines if volume snapshots created within the virtual cluster should get synced to the host cluster. + volumeSnapshots: + enabled: false + # PodDisruptionBudgets defines if pod disruption budgets created within the virtual cluster should get synced to the host cluster. + podDisruptionBudgets: + enabled: false + # ServiceAccounts defines if service accounts created within the virtual cluster should get synced to the host cluster. + serviceAccounts: + enabled: false + # StorageClasses defines if storage classes created within the virtual cluster should get synced to the host cluster. + storageClasses: + enabled: false + # PersistentVolumes defines if persistent volumes created within the virtual cluster should get synced to the host cluster. + persistentVolumes: + enabled: false + + # Configure what resources vCluster should sync from the host cluster to the virtual cluster. + fromHost: + # Events defines if events should get synced from the host cluster to the virtual cluster, but not back. + events: + enabled: true + # CSIDrivers defines if csi drivers should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled. + csiDrivers: + # Enabled defines if this option should be enabled. + enabled: auto + # CSINodes defines if csi nodes should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled. + csiNodes: + # Enabled defines if this option should be enabled. + enabled: auto + # CSIStorageCapacities defines if csi storage capacities should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled. + csiStorageCapacities: + # Enabled defines if this option should be enabled. + enabled: auto + # StorageClasses defines if storage classes should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled. + storageClasses: + # Enabled defines if this option should be enabled. + enabled: auto + # IngressClasses defines if ingress classes should get synced from the host cluster to the virtual cluster, but not back. + ingressClasses: + enabled: false + # RuntimeClasses defines if runtime classes should get synced from the host cluster to the virtual cluster, but not back. + runtimeClasses: + enabled: false + # PriorityClasses defines if priority classes classes should get synced from the host cluster to the virtual cluster, but not back. + priorityClasses: + enabled: false + # Nodes defines if nodes should get synced from the host cluster to the virtual cluster, but not back. + nodes: + # Enabled specifies if syncing real nodes should be enabled. If this is disabled, vCluster will create fake nodes instead. + enabled: false + # SyncBackChanges enables syncing labels and taints from the virtual cluster to the host cluster. If this is enabled someone within the virtual cluster will be able to change the labels and taints of the host cluster node. + syncBackChanges: false + # ClearImageStatus will erase the image status when syncing a node. This allows to hide images that are pulled by the node. + clearImageStatus: false + # Selector can be used to define more granular what nodes should get synced from the host cluster to the virtual cluster. + selector: + # All specifies if all nodes should get synced by vCluster from the host to the virtual cluster or only the ones where pods are assigned to. + all: false + labels: {} + +# Configure vCluster's control plane components and deployment. +controlPlane: + # Distro holds virtual cluster related distro options. A distro cannot be changed after vCluster is deployed. + distro: + # K8S holds K8s relevant configuration. + k8s: + # Enabled specifies if the K8s distro should be enabled. Only one distro can be enabled at the same time. + enabled: false + # Version specifies k8s components (scheduler, kube-controller-manager & apiserver) version. + # It is a shortcut for controlPlane.distro.k8s.apiServer.image.tag, + # controlPlane.distro.k8s.controllerManager.image.tag and + # controlPlane.distro.k8s.scheduler.image.tag + # If e.g. controlPlane.distro.k8s.version is set to v1.30.1 and + # controlPlane.distro.k8s.scheduler.image.tag + # (or controlPlane.distro.k8s.controllerManager.image.tag or controlPlane.distro.k8s.apiServer.image.tag) + # is set to v1.31.0, + # value from controlPlane.distro.k8s..image.tag will be used + # (where .image.tag will be used + # (where Date: Sat, 28 Sep 2024 11:28:10 -0700 Subject: [PATCH 4/6] Use actual 0.20 config for 0.20 config package --- config/v0.20/config.go | 250 +++-------------------------------------- 1 file changed, 17 insertions(+), 233 deletions(-) diff --git a/config/v0.20/config.go b/config/v0.20/config.go index 9041b6dbc..799899776 100644 --- a/config/v0.20/config.go +++ b/config/v0.20/config.go @@ -80,70 +80,6 @@ type Config struct { type Integrations struct { // MetricsServer reuses the metrics server from the host cluster within the vCluster. MetricsServer MetricsServer `json:"metricsServer,omitempty"` - - // KubeVirt reuses a host kubevirt and makes certain CRDs from it available inside the vCluster - KubeVirt KubeVirt `json:"kubeVirt,omitempty"` - - // ExternalSecrets reuses a host external secret operator and makes certain CRDs from it available inside the vCluster - ExternalSecrets ExternalSecrets `json:"externalSecrets,omitempty"` -} - -// ExternalSecrets reuses a host external secret operator and makes certain CRDs from it available inside the vCluster -type ExternalSecrets struct { - // Enabled defines whether the external secret integration is enabled or not - Enabled bool `json:"enabled,omitempty"` - // Webhook defines whether the host webhooks are reused or not - Webhook EnableSwitch `json:"webhook,omitempty"` - // Sync defines the syncing behavior for the integration - Sync ExternalSecretsSync `json:"sync,omitempty"` -} - -type ExternalSecretsSync struct { - // ExternalSecrets defines whether to sync external secrets or not - ExternalSecrets EnableSwitch `json:"externalSecrets,omitempty"` - // Stores defines whether to sync stores or not - Stores EnableSwitch `json:"stores,omitempty"` - // ClusterStores defines whether to sync cluster stores or not - ClusterStores ClusterStoresSyncConfig `json:"clusterStores,omitempty"` -} - -type ClusterStoresSyncConfig struct { - EnableSwitch - // Selector defines what cluster stores should be synced - Selector LabelSelector `json:"selector,omitempty"` -} - -type LabelSelector struct { - // Labels defines what labels should be looked for - Labels map[string]string `json:"labels,omitempty"` -} - -// KubeVirt reuses a host kubevirt and makes certain CRDs from it available inside the vCluster -type KubeVirt struct { - // Enabled signals if the integration should be enabled - Enabled bool `json:"enabled,omitempty"` - // APIService holds information about where to find the virt-api service. Defaults to virt-api/kubevirt. - APIService APIService `json:"apiService,omitempty"` - // Webhook holds configuration for enabling the webhook within the vCluster - Webhook EnableSwitch `json:"webhook,omitempty"` - // Sync holds configuration on what resources to sync - Sync KubeVirtSync `json:"sync,omitempty"` -} - -// KubeVirtSync are the crds that are supported by this integration -type KubeVirtSync struct { - // If DataVolumes should get synced - DataVolumes EnableSwitch `json:"dataVolumes,omitempty"` - // If VirtualMachineInstanceMigrations should get synced - VirtualMachineInstanceMigrations EnableSwitch `json:"virtualMachineInstanceMigrations,omitempty"` - // If VirtualMachineInstances should get synced - VirtualMachineInstances EnableSwitch `json:"virtualMachineInstances,omitempty"` - // If VirtualMachines should get synced - VirtualMachines EnableSwitch `json:"virtualMachines,omitempty"` - // If VirtualMachineClones should get synced - VirtualMachineClones EnableSwitch `json:"virtualMachineClones,omitempty"` - // If VirtualMachinePools should get synced - VirtualMachinePools EnableSwitch `json:"virtualMachinePools,omitempty"` } // MetricsServer reuses the metrics server from the host cluster within the vCluster. @@ -395,10 +331,10 @@ type SyncToHost struct { ConfigMaps SyncAllResource `json:"configMaps,omitempty"` // Ingresses defines if ingresses created within the virtual cluster should get synced to the host cluster. - Ingresses EnableSwitchWithTranslate `json:"ingresses,omitempty"` + Ingresses EnableSwitch `json:"ingresses,omitempty"` // Services defines if services created within the virtual cluster should get synced to the host cluster. - Services EnableSwitchWithTranslate `json:"services,omitempty"` + Services EnableSwitch `json:"services,omitempty"` // Endpoints defines if endpoints created within the virtual cluster should get synced to the host cluster. Endpoints EnableSwitch `json:"endpoints,omitempty"` @@ -407,7 +343,7 @@ type SyncToHost struct { NetworkPolicies EnableSwitch `json:"networkPolicies,omitempty"` // PersistentVolumeClaims defines if persistent volume claims created within the virtual cluster should get synced to the host cluster. - PersistentVolumeClaims EnableSwitchWithTranslate `json:"persistentVolumeClaims,omitempty"` + PersistentVolumeClaims EnableSwitch `json:"persistentVolumeClaims,omitempty"` // PersistentVolumes defines if persistent volumes created within the virtual cluster should get synced to the host cluster. PersistentVolumes EnableSwitch `json:"persistentVolumes,omitempty"` @@ -426,17 +362,6 @@ type SyncToHost struct { // PriorityClasses defines if priority classes created within the virtual cluster should get synced to the host cluster. PriorityClasses EnableSwitch `json:"priorityClasses,omitempty"` - - // CustomResourceDefinitions defines what custom resource definitions should get synced from the virtual cluster to the host cluster. - CustomResourceDefinitions map[string]SyncToHostCustomResourceDefinition `json:"customResourceDefinitions,omitempty"` -} - -type EnableSwitchWithTranslate struct { - // Enabled defines if this option should be enabled. - Enabled bool `json:"enabled,omitempty"` - - // Translate the patch according to the given patches. - Translate []TranslatePatch `json:"translate,omitempty"` } type SyncFromHost struct { @@ -449,12 +374,6 @@ type SyncFromHost struct { // IngressClasses defines if ingress classes should get synced from the host cluster to the virtual cluster, but not back. IngressClasses EnableSwitch `json:"ingressClasses,omitempty"` - // RuntimeClasses defines if runtime classes should get synced from the host cluster to the virtual cluster, but not back. - RuntimeClasses EnableSwitch `json:"runtimeClasses,omitempty"` - - // PriorityClasses defines if priority classes classes should get synced from the host cluster to the virtual cluster, but not back. - PriorityClasses EnableSwitch `json:"priorityClasses,omitempty"` - // StorageClasses defines if storage classes should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled. StorageClasses EnableAutoSwitch `json:"storageClasses,omitempty"` @@ -466,69 +385,6 @@ type SyncFromHost struct { // CSIStorageCapacities defines if csi storage capacities should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled. CSIStorageCapacities EnableAutoSwitch `json:"csiStorageCapacities,omitempty"` - - // CustomResourceDefinitions defines what custom resource definitions should get synced read-only to the virtual cluster from the host cluster. - CustomResourceDefinitions map[string]SyncFromHostCustomResourceDefinition `json:"customResourceDefinitions,omitempty"` -} - -type SyncToHostCustomResourceDefinition struct { - // Enabled defines if this option should be enabled. - Enabled bool `json:"enabled,omitempty"` - - // Translate the patch according to the given patches. - Translate []TranslatePatch `json:"translate,omitempty"` -} - -type TranslatePatch struct { - // Path is the path within the patch to target. If the path is not found within the patch, the patch is not applied. - Path string `json:"path,omitempty"` - - // Expression transforms the value according to the given JavaScript expression. - Expression *TranslatePatchExpression `json:"expression,omitempty" jsonschema:"oneof_required=expression"` - - // Reference treats the path value as a reference to another object and will rewrite it based on the chosen mode - // automatically. In single-namespace mode this will translate the name to "vxxxxxxxxx" to avoid conflicts with - // other names, in multi-namespace mode this will not translate the name. - Reference *TranslatePatchReference `json:"reference,omitempty" jsonschema:"oneof_required=reference"` - - // Labels treats the path value as a labels selector. - Labels *TranslatePatchLabels `json:"labels,omitempty" jsonschema:"oneof_required=labels"` -} - -type TranslatePatchLabels struct{} - -type TranslatePatchReference struct { - // APIVersion is the apiVersion of the referenced object. - APIVersion string `json:"apiVersion,omitempty" jsonschema:"required"` - - // APIVersionPath is optional relative path to use to determine the kind. If APIVersionPath is not found, will fallback to apiVersion. - APIVersionPath string `json:"apiVersionPath,omitempty"` - - // Kind is the kind of the referenced object. - Kind string `json:"kind,omitempty" jsonschema:"required"` - - // KindPath is the optional relative path to use to determine the kind. If KindPath is not found, will fallback to kind. - KindPath string `json:"kindPath,omitempty"` - - // NamePath is the optional relative path to the reference name within the object. - NamePath string `json:"namePath,omitempty"` - - // NamespacePath is the optional relative path to the reference namespace within the object. If omitted or not found, namespacePath equals to the - // metadata.namespace path of the object. - NamespacePath string `json:"namespacePath,omitempty"` -} - -type TranslatePatchExpression struct { - // ToHost is the expression to apply when retrieving a change from virtual to host. - ToHost string `json:"toHost,omitempty" jsonschema:"oneof_required=toHost"` - - // FromHost is the patch to apply when retrieving a change from host to virtual. - FromHost string `json:"fromHost,omitempty" jsonschema:"oneof_required=fromHost"` -} - -type SyncFromHostCustomResourceDefinition struct { - // Enabled defines if this option should be enabled. - Enabled bool `json:"enabled,omitempty"` } type EnableAutoSwitch struct { @@ -547,9 +403,6 @@ type SyncAllResource struct { // All defines if all resources of that type should get synced or only the necessary ones that are needed. All bool `json:"all,omitempty"` - - // Translate the patch according to the given patches. - Translate []TranslatePatch `json:"translate,omitempty"` } type SyncPods struct { @@ -571,9 +424,6 @@ type SyncPods struct { // a small container to each stateful set pod that will initially rewrite the /etc/hosts file to match the FQDN expected by // the virtual cluster. RewriteHosts SyncRewriteHosts `json:"rewriteHosts,omitempty"` - - // Translate the patch according to the given patches. - Translate []TranslatePatch `json:"translate,omitempty"` } type SyncRewriteHosts struct { @@ -872,12 +722,6 @@ type ControlPlaneStatefulSet struct { // Env are additional environment variables for the statefulSet container. Env []map[string]interface{} `json:"env,omitempty"` - - // Set DNS policy for the pod. - DNSPolicy DNSPolicy `json:"dnsPolicy,omitempty"` - - // Specifies the DNS parameters of a pod. - DNSConfig *PodDNSConfig `json:"dnsConfig,omitempty"` } type Distro struct { @@ -1226,12 +1070,6 @@ type CoreDNSDeployment struct { // NodeSelector is the node selector to use for coredns. NodeSelector map[string]string `json:"nodeSelector,omitempty"` - // Affinity is the affinity to apply to the pod. - Affinity map[string]interface{} `json:"affinity,omitempty"` - - // Tolerations are the tolerations to apply to the pod. - Tolerations []map[string]interface{} `json:"tolerations,omitempty"` - // Resources are the desired resources for coredns. Resources Resources `json:"resources,omitempty"` @@ -1404,31 +1242,31 @@ type VolumeClaim struct { // VolumeMount describes a mounting of a Volume within a container. type VolumeMount struct { // This must match the Name of a Volume. - Name string `protobuf:"bytes,1,opt,name=name" json:"name"` + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` // Mounted read-only if true, read-write otherwise (false or unspecified). // Defaults to false. - ReadOnly bool `protobuf:"varint,2,opt,name=readOnly" json:"readOnly,omitempty"` + ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,2,opt,name=readOnly"` // Path within the container at which the volume should be mounted. Must // not contain ':'. - MountPath string `protobuf:"bytes,3,opt,name=mountPath" json:"mountPath"` + MountPath string `json:"mountPath" protobuf:"bytes,3,opt,name=mountPath"` // Path within the volume from which the container's volume should be mounted. // Defaults to "" (volume's root). - SubPath string `protobuf:"bytes,4,opt,name=subPath" json:"subPath,omitempty"` + SubPath string `json:"subPath,omitempty" protobuf:"bytes,4,opt,name=subPath"` // mountPropagation determines how mounts are propagated from the host // to container and the other way around. // When not set, MountPropagationNone is used. // This field is beta in 1.10. - MountPropagation *string `protobuf:"bytes,5,opt,name=mountPropagation,casttype=MountPropagationMode" json:"mountPropagation,omitempty"` + MountPropagation *string `json:"mountPropagation,omitempty" protobuf:"bytes,5,opt,name=mountPropagation,casttype=MountPropagationMode"` // Expanded path within the volume from which the container's volume should be mounted. // Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. // Defaults to "" (volume's root). // SubPathExpr and SubPath are mutually exclusive. - SubPathExpr string `protobuf:"bytes,6,opt,name=subPathExpr" json:"subPathExpr,omitempty"` + SubPathExpr string `json:"subPathExpr,omitempty" protobuf:"bytes,6,opt,name=subPathExpr"` } type ControlPlaneScheduling struct { @@ -1644,7 +1482,7 @@ type MutatingWebhookConfiguration struct { type MutatingWebhook struct { // reinvocationPolicy indicates whether this webhook should be called multiple times as part of a single admission evaluation. // Allowed values are "Never" and "IfNeeded". - ReinvocationPolicy *string `protobuf:"bytes,10,opt,name=reinvocationPolicy,casttype=ReinvocationPolicyType" json:"reinvocationPolicy,omitempty"` + ReinvocationPolicy *string `json:"reinvocationPolicy,omitempty" protobuf:"bytes,10,opt,name=reinvocationPolicy,casttype=ReinvocationPolicyType"` ValidatingWebhook `json:",inline"` } @@ -1876,6 +1714,9 @@ type ExperimentalSyncSettings struct { // SetOwner specifies if vCluster should set an owner reference on the synced objects to the vCluster service. This allows for easy garbage collection. SetOwner bool `json:"setOwner,omitempty"` + // SyncLabels are labels that should get not rewritten when syncing from the virtual cluster. + SyncLabels []string `json:"syncLabels,omitempty"` + // HostMetricsBindAddress is the bind address for the local manager HostMetricsBindAddress string `json:"hostMetricsBindAddress,omitempty"` @@ -2147,16 +1988,16 @@ type DenyRule struct { type RuleWithVerbs struct { // APIGroups is the API groups the resources belong to. '*' is all groups. - APIGroups []string `protobuf:"bytes,1,rep,name=apiGroups" json:"apiGroups,omitempty"` + APIGroups []string `json:"apiGroups,omitempty" protobuf:"bytes,1,rep,name=apiGroups"` // APIVersions is the API versions the resources belong to. '*' is all versions. - APIVersions []string `protobuf:"bytes,2,rep,name=apiVersions" json:"apiVersions,omitempty"` + APIVersions []string `json:"apiVersions,omitempty" protobuf:"bytes,2,rep,name=apiVersions"` // Resources is a list of resources this rule applies to. - Resources []string `protobuf:"bytes,3,rep,name=resources" json:"resources,omitempty"` + Resources []string `json:"resources,omitempty" protobuf:"bytes,3,rep,name=resources"` // Scope specifies the scope of this rule. - Scope *string `protobuf:"bytes,4,rep,name=scope" json:"scope,omitempty"` + Scope *string `json:"scope,omitempty" protobuf:"bytes,4,rep,name=scope"` // Verb is the kube verb associated with the request for API requests, not the http verb. This includes things like list and watch. // For non-resource requests, this is the lowercase http verb. @@ -2164,63 +2005,6 @@ type RuleWithVerbs struct { Verbs []string `json:"operations,omitempty"` } -// PodDNSConfig defines the DNS parameters of a pod in addition to -// those generated from DNSPolicy. -type PodDNSConfig struct { - // A list of DNS name server IP addresses. - // This will be appended to the base nameservers generated from DNSPolicy. - // Duplicated nameservers will be removed. - // +optional - // +listType=atomic - Nameservers []string `protobuf:"bytes,1,rep,name=nameservers" json:"nameservers,omitempty"` - // A list of DNS search domains for host-name lookup. - // This will be appended to the base search paths generated from DNSPolicy. - // Duplicated search paths will be removed. - // +optional - // +listType=atomic - Searches []string `protobuf:"bytes,2,rep,name=searches" json:"searches,omitempty"` - // A list of DNS resolver options. - // This will be merged with the base options generated from DNSPolicy. - // Duplicated entries will be removed. Resolution options given in Options - // will override those that appear in the base DNSPolicy. - // +optional - // +listType=atomic - Options []PodDNSConfigOption `protobuf:"bytes,3,rep,name=options" json:"options,omitempty"` -} - -// PodDNSConfigOption defines DNS resolver options of a pod. -type PodDNSConfigOption struct { - // Required. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - // +optional - Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` -} - -// DNSPolicy defines how a pod's DNS will be configured. -// +enum -type DNSPolicy string - -const ( - // DNSClusterFirstWithHostNet indicates that the pod should use cluster DNS - // first, if it is available, then fall back on the default - // (as determined by kubelet) DNS settings. - DNSClusterFirstWithHostNet DNSPolicy = "ClusterFirstWithHostNet" - - // DNSClusterFirst indicates that the pod should use cluster DNS - // first unless hostNetwork is true, if it is available, then - // fall back on the default (as determined by kubelet) DNS settings. - DNSClusterFirst DNSPolicy = "ClusterFirst" - - // DNSDefault indicates that the pod should use the default (as - // determined by kubelet) DNS settings. - DNSDefault DNSPolicy = "Default" - - // DNSNone indicates that the pod should use empty DNS settings. DNS - // parameters such as nameservers and search paths should be defined via - // DNSConfig. - DNSNone DNSPolicy = "None" -) - // addProToJSONSchema looks for fields with the `product:"pro"` tag and adds the pro tag to the central field. // Requires `json:""` tag to be set as well. func addProToJSONSchema(base *jsonschema.Schema, t reflect.Type) { From 562da8484d1dd652880c1e7c052a168f91bb2f30 Mon Sep 17 00:00:00 2001 From: Ricardo Weir Date: Sat, 28 Sep 2024 11:28:56 -0700 Subject: [PATCH 5/6] go run hack/schema/main.go --- config/v0.20/chart/values.schema.json | 390 +------------------------- config/v0.20/chart/values.yaml | 25 -- 2 files changed, 10 insertions(+), 405 deletions(-) diff --git a/config/v0.20/chart/values.schema.json b/config/v0.20/chart/values.schema.json index c46c09dd4..f66670a57 100755 --- a/config/v0.20/chart/values.schema.json +++ b/config/v0.20/chart/values.schema.json @@ -66,20 +66,6 @@ "additionalProperties": false, "type": "object" }, - "ClusterStoresSyncConfig": { - "properties": { - "enabled": { - "type": "boolean", - "description": "Enabled defines if this option should be enabled." - }, - "selector": { - "$ref": "#/$defs/LabelSelector", - "description": "Selector defines what cluster stores should be synced" - } - }, - "additionalProperties": false, - "type": "object" - }, "ControlPlane": { "properties": { "distro": { @@ -531,14 +517,6 @@ }, "type": "array", "description": "Env are additional environment variables for the statefulSet container." - }, - "dnsPolicy": { - "type": "string", - "description": "Set DNS policy for the pod." - }, - "dnsConfig": { - "$ref": "#/$defs/PodDNSConfig", - "description": "Specifies the DNS parameters of a pod." } }, "additionalProperties": false, @@ -631,17 +609,6 @@ "type": "object", "description": "NodeSelector is the node selector to use for coredns." }, - "affinity": { - "type": "object", - "description": "Affinity is the affinity to apply to the pod." - }, - "tolerations": { - "items": { - "type": "object" - }, - "type": "array", - "description": "Tolerations are the tolerations to apply to the pod." - }, "resources": { "$ref": "#/$defs/Resources", "description": "Resources are the desired resources for coredns." @@ -1016,23 +983,6 @@ "additionalProperties": false, "type": "object" }, - "EnableSwitchWithTranslate": { - "properties": { - "enabled": { - "type": "boolean", - "description": "Enabled defines if this option should be enabled." - }, - "translate": { - "items": { - "$ref": "#/$defs/TranslatePatch" - }, - "type": "array", - "description": "Translate the patch according to the given patches." - } - }, - "additionalProperties": false, - "type": "object" - }, "Etcd": { "properties": { "embedded": { @@ -1452,6 +1402,13 @@ "type": "boolean", "description": "SetOwner specifies if vCluster should set an owner reference on the synced objects to the vCluster service. This allows for easy garbage collection." }, + "syncLabels": { + "items": { + "type": "string" + }, + "type": "array", + "description": "SyncLabels are labels that should get not rewritten when syncing from the virtual cluster." + }, "hostMetricsBindAddress": { "type": "string", "description": "HostMetricsBindAddress is the bind address for the local manager" @@ -1618,43 +1575,6 @@ "additionalProperties": false, "type": "object" }, - "ExternalSecrets": { - "properties": { - "enabled": { - "type": "boolean", - "description": "Enabled defines whether the external secret integration is enabled or not" - }, - "webhook": { - "$ref": "#/$defs/EnableSwitch", - "description": "Webhook defines whether the host webhooks are reused or not" - }, - "sync": { - "$ref": "#/$defs/ExternalSecretsSync", - "description": "Sync defines the syncing behavior for the integration" - } - }, - "additionalProperties": false, - "type": "object", - "description": "ExternalSecrets reuses a host external secret operator and makes certain CRDs from it available inside the vCluster" - }, - "ExternalSecretsSync": { - "properties": { - "externalSecrets": { - "$ref": "#/$defs/EnableSwitch", - "description": "ExternalSecrets defines whether to sync external secrets or not" - }, - "stores": { - "$ref": "#/$defs/EnableSwitch", - "description": "Stores defines whether to sync stores or not" - }, - "clusterStores": { - "$ref": "#/$defs/ClusterStoresSyncConfig", - "description": "ClusterStores defines whether to sync cluster stores or not" - } - }, - "additionalProperties": false, - "type": "object" - }, "Hook": { "properties": { "apiVersion": { @@ -1802,87 +1722,12 @@ "metricsServer": { "$ref": "#/$defs/MetricsServer", "description": "MetricsServer reuses the metrics server from the host cluster within the vCluster." - }, - "kubeVirt": { - "$ref": "#/$defs/KubeVirt", - "description": "KubeVirt reuses a host kubevirt and makes certain CRDs from it available inside the vCluster" - }, - "externalSecrets": { - "$ref": "#/$defs/ExternalSecrets", - "description": "ExternalSecrets reuses a host external secret operator and makes certain CRDs from it available inside the vCluster" } }, "additionalProperties": false, "type": "object", "description": "Integrations holds config for vCluster integrations with other operators or tools running on the host cluster" }, - "KubeVirt": { - "properties": { - "enabled": { - "type": "boolean", - "description": "Enabled signals if the integration should be enabled" - }, - "apiService": { - "$ref": "#/$defs/APIService", - "description": "APIService holds information about where to find the virt-api service. Defaults to virt-api/kubevirt." - }, - "webhook": { - "$ref": "#/$defs/EnableSwitch", - "description": "Webhook holds configuration for enabling the webhook within the vCluster" - }, - "sync": { - "$ref": "#/$defs/KubeVirtSync", - "description": "Sync holds configuration on what resources to sync" - } - }, - "additionalProperties": false, - "type": "object", - "description": "KubeVirt reuses a host kubevirt and makes certain CRDs from it available inside the vCluster" - }, - "KubeVirtSync": { - "properties": { - "dataVolumes": { - "$ref": "#/$defs/EnableSwitch", - "description": "If DataVolumes should get synced" - }, - "virtualMachineInstanceMigrations": { - "$ref": "#/$defs/EnableSwitch", - "description": "If VirtualMachineInstanceMigrations should get synced" - }, - "virtualMachineInstances": { - "$ref": "#/$defs/EnableSwitch", - "description": "If VirtualMachineInstances should get synced" - }, - "virtualMachines": { - "$ref": "#/$defs/EnableSwitch", - "description": "If VirtualMachines should get synced" - }, - "virtualMachineClones": { - "$ref": "#/$defs/EnableSwitch", - "description": "If VirtualMachineClones should get synced" - }, - "virtualMachinePools": { - "$ref": "#/$defs/EnableSwitch", - "description": "If VirtualMachinePools should get synced" - } - }, - "additionalProperties": false, - "type": "object", - "description": "KubeVirtSync are the crds that are supported by this integration" - }, - "LabelSelector": { - "properties": { - "labels": { - "additionalProperties": { - "type": "string" - }, - "type": "object", - "description": "Labels defines what labels should be looked for" - } - }, - "additionalProperties": false, - "type": "object" - }, "LabelsAndAnnotations": { "properties": { "annotations": { @@ -2445,49 +2290,6 @@ "additionalProperties": false, "type": "object" }, - "PodDNSConfig": { - "properties": { - "nameservers": { - "items": { - "type": "string" - }, - "type": "array", - "description": "A list of DNS name server IP addresses.\nThis will be appended to the base nameservers generated from DNSPolicy.\nDuplicated nameservers will be removed.\n+optional\n+listType=atomic" - }, - "searches": { - "items": { - "type": "string" - }, - "type": "array", - "description": "A list of DNS search domains for host-name lookup.\nThis will be appended to the base search paths generated from DNSPolicy.\nDuplicated search paths will be removed.\n+optional\n+listType=atomic" - }, - "options": { - "items": { - "$ref": "#/$defs/PodDNSConfigOption" - }, - "type": "array", - "description": "A list of DNS resolver options.\nThis will be merged with the base options generated from DNSPolicy.\nDuplicated entries will be removed. Resolution options given in Options\nwill override those that appear in the base DNSPolicy.\n+optional\n+listType=atomic" - } - }, - "additionalProperties": false, - "type": "object", - "description": "PodDNSConfig defines the DNS parameters of a pod in addition to those generated from DNSPolicy." - }, - "PodDNSConfigOption": { - "properties": { - "name": { - "type": "string", - "description": "Required." - }, - "value": { - "type": "string", - "description": "+optional" - } - }, - "additionalProperties": false, - "type": "object", - "description": "PodDNSConfigOption defines DNS resolver options of a pod." - }, "Policies": { "properties": { "networkPolicy": { @@ -2883,13 +2685,6 @@ "all": { "type": "boolean", "description": "All defines if all resources of that type should get synced or only the necessary ones that are needed." - }, - "translate": { - "items": { - "$ref": "#/$defs/TranslatePatch" - }, - "type": "array", - "description": "Translate the patch according to the given patches." } }, "additionalProperties": false, @@ -2909,14 +2704,6 @@ "$ref": "#/$defs/EnableSwitch", "description": "IngressClasses defines if ingress classes should get synced from the host cluster to the virtual cluster, but not back." }, - "runtimeClasses": { - "$ref": "#/$defs/EnableSwitch", - "description": "RuntimeClasses defines if runtime classes should get synced from the host cluster to the virtual cluster, but not back." - }, - "priorityClasses": { - "$ref": "#/$defs/EnableSwitch", - "description": "PriorityClasses defines if priority classes classes should get synced from the host cluster to the virtual cluster, but not back." - }, "storageClasses": { "$ref": "#/$defs/EnableAutoSwitch", "description": "StorageClasses defines if storage classes should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled." @@ -2932,23 +2719,6 @@ "csiStorageCapacities": { "$ref": "#/$defs/EnableAutoSwitch", "description": "CSIStorageCapacities defines if csi storage capacities should get synced from the host cluster to the virtual cluster, but not back. If auto, is automatically enabled when the virtual scheduler is enabled." - }, - "customResourceDefinitions": { - "additionalProperties": { - "$ref": "#/$defs/SyncFromHostCustomResourceDefinition" - }, - "type": "object", - "description": "CustomResourceDefinitions defines what custom resource definitions should get synced read-only to the virtual cluster from the host cluster." - } - }, - "additionalProperties": false, - "type": "object" - }, - "SyncFromHostCustomResourceDefinition": { - "properties": { - "enabled": { - "type": "boolean", - "description": "Enabled defines if this option should be enabled." } }, "additionalProperties": false, @@ -3020,13 +2790,6 @@ "rewriteHosts": { "$ref": "#/$defs/SyncRewriteHosts", "description": "RewriteHosts is a special option needed to rewrite statefulset containers to allow the correct FQDN. virtual cluster will add\na small container to each stateful set pod that will initially rewrite the /etc/hosts file to match the FQDN expected by\nthe virtual cluster." - }, - "translate": { - "items": { - "$ref": "#/$defs/TranslatePatch" - }, - "type": "array", - "description": "Translate the patch according to the given patches." } }, "additionalProperties": false, @@ -3075,11 +2838,11 @@ "description": "ConfigMaps defines if config maps created within the virtual cluster should get synced to the host cluster." }, "ingresses": { - "$ref": "#/$defs/EnableSwitchWithTranslate", + "$ref": "#/$defs/EnableSwitch", "description": "Ingresses defines if ingresses created within the virtual cluster should get synced to the host cluster." }, "services": { - "$ref": "#/$defs/EnableSwitchWithTranslate", + "$ref": "#/$defs/EnableSwitch", "description": "Services defines if services created within the virtual cluster should get synced to the host cluster." }, "endpoints": { @@ -3091,7 +2854,7 @@ "description": "NetworkPolicies defines if network policies created within the virtual cluster should get synced to the host cluster." }, "persistentVolumeClaims": { - "$ref": "#/$defs/EnableSwitchWithTranslate", + "$ref": "#/$defs/EnableSwitch", "description": "PersistentVolumeClaims defines if persistent volume claims created within the virtual cluster should get synced to the host cluster." }, "persistentVolumes": { @@ -3117,30 +2880,6 @@ "priorityClasses": { "$ref": "#/$defs/EnableSwitch", "description": "PriorityClasses defines if priority classes created within the virtual cluster should get synced to the host cluster." - }, - "customResourceDefinitions": { - "additionalProperties": { - "$ref": "#/$defs/SyncToHostCustomResourceDefinition" - }, - "type": "object", - "description": "CustomResourceDefinitions defines what custom resource definitions should get synced from the virtual cluster to the host cluster." - } - }, - "additionalProperties": false, - "type": "object" - }, - "SyncToHostCustomResourceDefinition": { - "properties": { - "enabled": { - "type": "boolean", - "description": "Enabled defines if this option should be enabled." - }, - "translate": { - "items": { - "$ref": "#/$defs/TranslatePatch" - }, - "type": "array", - "description": "Translate the patch according to the given patches." } }, "additionalProperties": false, @@ -3168,115 +2907,6 @@ "additionalProperties": false, "type": "object" }, - "TranslatePatch": { - "oneOf": [ - { - "required": [ - "expression" - ], - "title": "expression" - }, - { - "required": [ - "reference" - ], - "title": "reference" - }, - { - "required": [ - "labels" - ], - "title": "labels" - } - ], - "properties": { - "path": { - "type": "string", - "description": "Path is the path within the patch to target. If the path is not found within the patch, the patch is not applied." - }, - "expression": { - "$ref": "#/$defs/TranslatePatchExpression", - "description": "Expression transforms the value according to the given JavaScript expression." - }, - "reference": { - "$ref": "#/$defs/TranslatePatchReference", - "description": "Reference treats the path value as a reference to another object and will rewrite it based on the chosen mode\nautomatically. In single-namespace mode this will translate the name to \"vxxxxxxxxx\" to avoid conflicts with\nother names, in multi-namespace mode this will not translate the name." - }, - "labels": { - "$ref": "#/$defs/TranslatePatchLabels", - "description": "Labels treats the path value as a labels selector." - } - }, - "additionalProperties": false, - "type": "object" - }, - "TranslatePatchExpression": { - "oneOf": [ - { - "required": [ - "toHost" - ], - "title": "toHost" - }, - { - "required": [ - "fromHost" - ], - "title": "fromHost" - } - ], - "properties": { - "toHost": { - "type": "string", - "description": "ToHost is the expression to apply when retrieving a change from virtual to host." - }, - "fromHost": { - "type": "string", - "description": "FromHost is the patch to apply when retrieving a change from host to virtual." - } - }, - "additionalProperties": false, - "type": "object" - }, - "TranslatePatchLabels": { - "properties": {}, - "additionalProperties": false, - "type": "object" - }, - "TranslatePatchReference": { - "properties": { - "apiVersion": { - "type": "string", - "description": "APIVersion is the apiVersion of the referenced object." - }, - "apiVersionPath": { - "type": "string", - "description": "APIVersionPath is optional relative path to use to determine the kind. If APIVersionPath is not found, will fallback to apiVersion." - }, - "kind": { - "type": "string", - "description": "Kind is the kind of the referenced object." - }, - "kindPath": { - "type": "string", - "description": "KindPath is the optional relative path to use to determine the kind. If KindPath is not found, will fallback to kind." - }, - "namePath": { - "type": "string", - "description": "NamePath is the optional relative path to the reference name within the object." - }, - "namespacePath": { - "type": "string", - "description": "NamespacePath is the optional relative path to the reference namespace within the object. If omitted or not found, namespacePath equals to the\nmetadata.namespace path of the object." - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "apiVersion", - "kind" - ] - }, "ValidatingWebhook": { "properties": { "name": { diff --git a/config/v0.20/chart/values.yaml b/config/v0.20/chart/values.yaml index ecad7bf23..b5ea2ee58 100644 --- a/config/v0.20/chart/values.yaml +++ b/config/v0.20/chart/values.yaml @@ -102,10 +102,8 @@ sync: # IngressClasses defines if ingress classes should get synced from the host cluster to the virtual cluster, but not back. ingressClasses: enabled: false - # RuntimeClasses defines if runtime classes should get synced from the host cluster to the virtual cluster, but not back. runtimeClasses: enabled: false - # PriorityClasses defines if priority classes classes should get synced from the host cluster to the virtual cluster, but not back. priorityClasses: enabled: false # Nodes defines if nodes should get synced from the host cluster to the virtual cluster, but not back. @@ -430,9 +428,7 @@ controlPlane: annotations: {} # NodeSelector is the node selector to use for coredns. nodeSelector: {} - # Affinity is the affinity to apply to the pod. affinity: {} - # Tolerations are the tolerations to apply to the pod. tolerations: [] # Resources are the desired resources for coredns. resources: @@ -653,55 +649,34 @@ integrations: nodes: true # Pods defines if metrics-server pods api should get proxied from host to virtual cluster. pods: true - - # ExternalSecrets reuses a host external secret operator and makes certain CRDs from it available inside the vCluster externalSecrets: - # Enabled defines whether the external secret integration is enabled or not enabled: false - # Webhook defines whether the host webhooks are reused or not webhook: enabled: false - # Sync defines the syncing behavior for the integration sync: - # ExternalSecrets defines whether to sync external secrets or not externalSecrets: enabled: true - # Stores defines whether to sync stores or not stores: enabled: false - # ClusterStores defines whether to sync cluster stores or not clusterStores: - # Enabled defines if this option should be enabled. enabled: false - # Selector defines what cluster stores should be synced selector: labels: {} - - # KubeVirt reuses a host kubevirt and makes certain CRDs from it available inside the vCluster kubeVirt: - # Enabled signals if the integration should be enabled enabled: false - # Webhook holds configuration for enabling the webhook within the vCluster webhook: enabled: true - # Sync holds configuration on what resources to sync sync: - # If DataVolumes should get synced dataVolumes: enabled: false - # If VirtualMachines should get synced virtualMachines: enabled: true - # If VirtualMachineInstances should get synced virtualMachineInstances: enabled: true - # If VirtualMachinePools should get synced virtualMachinePools: enabled: true - # If VirtualMachineClones should get synced virtualMachineClones: enabled: true - # If VirtualMachineInstanceMigrations should get synced virtualMachineInstanceMigrations: enabled: true From 9485d98353b9818078b3bd18d336cdac7bdf59a2 Mon Sep 17 00:00:00 2001 From: Ricardo Weir Date: Sun, 29 Sep 2024 07:32:11 -0700 Subject: [PATCH 6/6] Fix config pkg references --- config/legacyconfig/config.go | 2 +- config/legacyconfig/migrate.go | 2 +- config/v0.20/schema/main.go | 5 ++--- config/v0.21/schema/main.go | 8 +++----- hack/assets/main.go | 2 +- hack/assets/separate/main.go | 2 +- hack/compat-matrix/main.go | 2 +- pkg/cli/create_helm.go | 2 +- pkg/cli/create_platform.go | 2 +- pkg/cli/describe_helm.go | 2 +- pkg/config/config.go | 2 +- pkg/config/coredns_plugin_validation.go | 2 +- pkg/config/parse.go | 2 +- pkg/config/validation.go | 2 +- pkg/config/validation_test.go | 2 +- pkg/controllers/deploy/deploy.go | 2 +- pkg/controllers/generic/export_patcher.go | 2 +- pkg/controllers/generic/export_syncer.go | 2 +- pkg/controllers/generic/import_patcher.go | 2 +- pkg/controllers/generic/import_syncer.go | 2 +- pkg/controllers/register.go | 2 +- pkg/etcd/client.go | 2 +- pkg/k0s/k0s.go | 2 +- pkg/k8s/k8s.go | 2 +- pkg/mappings/generic/mapper_test.go | 2 +- pkg/patcher/patcher.go | 2 +- pkg/patches/conditions.go | 2 +- pkg/patches/patch.go | 2 +- pkg/patches/patch_test.go | 2 +- pkg/patches/patch_types.go | 2 +- pkg/pro/patches.go | 2 +- pkg/setup/config.go | 2 +- pkg/setup/initialize.go | 2 +- pkg/util/testing/config.go | 2 +- 34 files changed, 37 insertions(+), 40 deletions(-) diff --git a/config/legacyconfig/config.go b/config/legacyconfig/config.go index 6a404889d..be4bcb258 100644 --- a/config/legacyconfig/config.go +++ b/config/legacyconfig/config.go @@ -1,7 +1,7 @@ package legacyconfig import ( - "github.com/loft-sh/vcluster/config" + "github.com/loft-sh/vcluster/config/v0.21" ) type LegacyK0sAndK3s struct { diff --git a/config/legacyconfig/migrate.go b/config/legacyconfig/migrate.go index 2b8568757..d5f3c8259 100644 --- a/config/legacyconfig/migrate.go +++ b/config/legacyconfig/migrate.go @@ -6,7 +6,7 @@ import ( "strconv" "strings" - "github.com/loft-sh/vcluster/config" + "github.com/loft-sh/vcluster/config/v0.21" "sigs.k8s.io/yaml" ) diff --git a/config/v0.20/schema/main.go b/config/v0.20/schema/main.go index 6c817593d..16d50e301 100644 --- a/config/v0.20/schema/main.go +++ b/config/v0.20/schema/main.go @@ -4,14 +4,13 @@ import ( "bytes" "encoding/json" "fmt" - "github.com/loft-sh/vcluster/config/v0.20" "os" "path/filepath" "strings" - orderedmap "github.com/wk8/go-ordered-map/v2" - "github.com/invopop/jsonschema" + "github.com/loft-sh/vcluster/config/v0.20" + orderedmap "github.com/wk8/go-ordered-map/v2" "gopkg.in/yaml.v3" ) diff --git a/config/v0.21/schema/main.go b/config/v0.21/schema/main.go index 65d9c6af6..4c2725e83 100644 --- a/config/v0.21/schema/main.go +++ b/config/v0.21/schema/main.go @@ -4,15 +4,13 @@ import ( "bytes" "encoding/json" "fmt" - config "github.com/loft-sh/vcluster/config/v0.20" - config2 "github.com/loft-sh/vcluster/config/v0.21" "os" "path/filepath" "strings" - orderedmap "github.com/wk8/go-ordered-map/v2" - "github.com/invopop/jsonschema" + config "github.com/loft-sh/vcluster/config/v0.21" + orderedmap "github.com/wk8/go-ordered-map/v2" "gopkg.in/yaml.v3" ) @@ -53,7 +51,7 @@ func main() { panic(err) } - generatedSchema := reflector.Reflect(&config2.Config{}) + generatedSchema := reflector.Reflect(&config.Config{}) transformMapProperties(generatedSchema) modifySchema(generatedSchema, cleanUp) err = addPlatformSchema(generatedSchema) diff --git a/hack/assets/main.go b/hack/assets/main.go index c3e81cf9e..879d968db 100644 --- a/hack/assets/main.go +++ b/hack/assets/main.go @@ -5,7 +5,7 @@ import ( "os" "strings" - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/config" "github.com/loft-sh/vcluster/pkg/constants" "github.com/loft-sh/vcluster/pkg/coredns" diff --git a/hack/assets/separate/main.go b/hack/assets/separate/main.go index 02e1b031e..a2306beae 100644 --- a/hack/assets/separate/main.go +++ b/hack/assets/separate/main.go @@ -6,7 +6,7 @@ import ( "slices" "strings" - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/config" "github.com/loft-sh/vcluster/pkg/constants" "github.com/loft-sh/vcluster/pkg/coredns" diff --git a/hack/compat-matrix/main.go b/hack/compat-matrix/main.go index 2e760c000..d2eec8f12 100644 --- a/hack/compat-matrix/main.go +++ b/hack/compat-matrix/main.go @@ -8,7 +8,7 @@ import ( "slices" "strings" - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" "github.com/olekukonko/tablewriter" "gopkg.in/yaml.v2" diff --git a/pkg/cli/create_helm.go b/pkg/cli/create_helm.go index a6d6f51e1..3a411c2cc 100644 --- a/pkg/cli/create_helm.go +++ b/pkg/cli/create_helm.go @@ -16,8 +16,8 @@ import ( "github.com/loft-sh/log" "github.com/loft-sh/log/survey" "github.com/loft-sh/log/terminal" - "github.com/loft-sh/vcluster/config" "github.com/loft-sh/vcluster/config/legacyconfig" + "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/cli/find" "github.com/loft-sh/vcluster/pkg/cli/flags" "github.com/loft-sh/vcluster/pkg/cli/localkubernetes" diff --git a/pkg/cli/create_platform.go b/pkg/cli/create_platform.go index d26abba32..22799327b 100644 --- a/pkg/cli/create_platform.go +++ b/pkg/cli/create_platform.go @@ -13,7 +13,7 @@ import ( managementv1 "github.com/loft-sh/api/v4/pkg/apis/management/v1" storagev1 "github.com/loft-sh/api/v4/pkg/apis/storage/v1" "github.com/loft-sh/log" - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/cli/flags" "github.com/loft-sh/vcluster/pkg/constants" "github.com/loft-sh/vcluster/pkg/kube" diff --git a/pkg/cli/describe_helm.go b/pkg/cli/describe_helm.go index 4e47a46c7..247214679 100644 --- a/pkg/cli/describe_helm.go +++ b/pkg/cli/describe_helm.go @@ -9,7 +9,7 @@ import ( "github.com/ghodss/yaml" "github.com/loft-sh/log" - "github.com/loft-sh/vcluster/config" + "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/cli/find" "github.com/loft-sh/vcluster/pkg/cli/flags" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/config/config.go b/pkg/config/config.go index 9972d9277..d709f015b 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -3,8 +3,8 @@ package config import ( "strings" - "github.com/loft-sh/vcluster/config" "github.com/loft-sh/vcluster/config/legacyconfig" + "github.com/loft-sh/vcluster/config/v0.21" kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/discovery" diff --git a/pkg/config/coredns_plugin_validation.go b/pkg/config/coredns_plugin_validation.go index fa2e5fe48..5f2da06f9 100644 --- a/pkg/config/coredns_plugin_validation.go +++ b/pkg/config/coredns_plugin_validation.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" ) func validateMappings(resolveDNS []vclusterconfig.ResolveDNS) error { diff --git a/pkg/config/parse.go b/pkg/config/parse.go index a4adbc7c7..ffab4aa13 100644 --- a/pkg/config/parse.go +++ b/pkg/config/parse.go @@ -5,7 +5,7 @@ import ( "os" "regexp" - "github.com/loft-sh/vcluster/config" + "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/strvals" "github.com/pkg/errors" "sigs.k8s.io/yaml" diff --git a/pkg/config/validation.go b/pkg/config/validation.go index 8cc3e7d36..37d2e9e47 100644 --- a/pkg/config/validation.go +++ b/pkg/config/validation.go @@ -8,7 +8,7 @@ import ( "slices" "github.com/ghodss/yaml" - "github.com/loft-sh/vcluster/config" + "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/util/toleration" admissionregistrationv1 "k8s.io/api/admissionregistration/v1" "k8s.io/apimachinery/pkg/api/validation" diff --git a/pkg/config/validation_test.go b/pkg/config/validation_test.go index 7178eae00..c3c4ea9bd 100644 --- a/pkg/config/validation_test.go +++ b/pkg/config/validation_test.go @@ -3,7 +3,7 @@ package config import ( "testing" - "github.com/loft-sh/vcluster/config" + "github.com/loft-sh/vcluster/config/v0.21" ) func Test(t *testing.T) { diff --git a/pkg/controllers/deploy/deploy.go b/pkg/controllers/deploy/deploy.go index d1a689ecd..685f052ed 100644 --- a/pkg/controllers/deploy/deploy.go +++ b/pkg/controllers/deploy/deploy.go @@ -13,7 +13,7 @@ import ( "strings" "time" - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/config" "github.com/loft-sh/vcluster/pkg/k0s" "github.com/pkg/errors" diff --git a/pkg/controllers/generic/export_patcher.go b/pkg/controllers/generic/export_patcher.go index 1ec85b7ea..c5725a273 100644 --- a/pkg/controllers/generic/export_patcher.go +++ b/pkg/controllers/generic/export_patcher.go @@ -4,7 +4,7 @@ import ( "fmt" "regexp" - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/mappings" "github.com/loft-sh/vcluster/pkg/patches" patchesregex "github.com/loft-sh/vcluster/pkg/patches/regex" diff --git a/pkg/controllers/generic/export_syncer.go b/pkg/controllers/generic/export_syncer.go index 1c82802cf..203c2e40b 100644 --- a/pkg/controllers/generic/export_syncer.go +++ b/pkg/controllers/generic/export_syncer.go @@ -16,7 +16,7 @@ import ( "github.com/loft-sh/vcluster/pkg/log" - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/util/translate" kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/controllers/generic/import_patcher.go b/pkg/controllers/generic/import_patcher.go index 8591e1085..e5bf956cb 100644 --- a/pkg/controllers/generic/import_patcher.go +++ b/pkg/controllers/generic/import_patcher.go @@ -3,7 +3,7 @@ package generic import ( "regexp" - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/mappings" "github.com/loft-sh/vcluster/pkg/patches" "github.com/loft-sh/vcluster/pkg/syncer/synccontext" diff --git a/pkg/controllers/generic/import_syncer.go b/pkg/controllers/generic/import_syncer.go index 9914ff734..ec56c0e8b 100644 --- a/pkg/controllers/generic/import_syncer.go +++ b/pkg/controllers/generic/import_syncer.go @@ -6,7 +6,7 @@ import ( "strings" "time" - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/mappings" "github.com/loft-sh/vcluster/pkg/scheme" "github.com/loft-sh/vcluster/pkg/syncer" diff --git a/pkg/controllers/register.go b/pkg/controllers/register.go index 2b81d7da3..0538e8831 100644 --- a/pkg/controllers/register.go +++ b/pkg/controllers/register.go @@ -5,7 +5,7 @@ import ( "net/http" "strings" - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/controllers/deploy" "github.com/loft-sh/vcluster/pkg/controllers/generic" "github.com/loft-sh/vcluster/pkg/controllers/servicesync" diff --git a/pkg/etcd/client.go b/pkg/etcd/client.go index c72f9c0a5..ef73e97c3 100644 --- a/pkg/etcd/client.go +++ b/pkg/etcd/client.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" - vconfig "github.com/loft-sh/vcluster/config" + vconfig "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/config" "github.com/loft-sh/vcluster/pkg/constants" clientv3 "go.etcd.io/etcd/client/v3" diff --git a/pkg/k0s/k0s.go b/pkg/k0s/k0s.go index 1fb755402..32d1d8517 100644 --- a/pkg/k0s/k0s.go +++ b/pkg/k0s/k0s.go @@ -11,7 +11,7 @@ import ( "strings" "text/template" - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/config" "github.com/loft-sh/vcluster/pkg/etcd" "github.com/loft-sh/vcluster/pkg/util/commandwriter" diff --git a/pkg/k8s/k8s.go b/pkg/k8s/k8s.go index 3cdc34742..95177df89 100644 --- a/pkg/k8s/k8s.go +++ b/pkg/k8s/k8s.go @@ -11,7 +11,7 @@ import ( "strings" "time" - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/config" "github.com/loft-sh/vcluster/pkg/constants" "github.com/loft-sh/vcluster/pkg/etcd" diff --git a/pkg/mappings/generic/mapper_test.go b/pkg/mappings/generic/mapper_test.go index 8dcf52acd..2dd1affa6 100644 --- a/pkg/mappings/generic/mapper_test.go +++ b/pkg/mappings/generic/mapper_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/loft-sh/vcluster/config" + "github.com/loft-sh/vcluster/config/v0.21" config2 "github.com/loft-sh/vcluster/pkg/config" "github.com/loft-sh/vcluster/pkg/mappings" "github.com/loft-sh/vcluster/pkg/mappings/store" diff --git a/pkg/patcher/patcher.go b/pkg/patcher/patcher.go index 0d273374a..bab1f87d7 100644 --- a/pkg/patcher/patcher.go +++ b/pkg/patcher/patcher.go @@ -7,7 +7,7 @@ import ( "reflect" jsonpatch "github.com/evanphx/json-patch" - "github.com/loft-sh/vcluster/config" + "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/pro" "github.com/loft-sh/vcluster/pkg/scheme" "github.com/loft-sh/vcluster/pkg/syncer/synccontext" diff --git a/pkg/patches/conditions.go b/pkg/patches/conditions.go index 1f322af81..b921b266a 100644 --- a/pkg/patches/conditions.go +++ b/pkg/patches/conditions.go @@ -1,7 +1,7 @@ package patches import ( - "github.com/loft-sh/vcluster/config" + "github.com/loft-sh/vcluster/config/v0.21" "github.com/pkg/errors" "github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath" yaml "gopkg.in/yaml.v3" diff --git a/pkg/patches/patch.go b/pkg/patches/patch.go index 9d06e7859..8fb7788b8 100644 --- a/pkg/patches/patch.go +++ b/pkg/patches/patch.go @@ -5,7 +5,7 @@ import ( "fmt" "regexp" - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" jsonyaml "github.com/ghodss/yaml" diff --git a/pkg/patches/patch_test.go b/pkg/patches/patch_test.go index fdc5e410e..313343b61 100644 --- a/pkg/patches/patch_test.go +++ b/pkg/patches/patch_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/loft-sh/vcluster/config" + "github.com/loft-sh/vcluster/config/v0.21" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" diff --git a/pkg/patches/patch_types.go b/pkg/patches/patch_types.go index 4b4514e13..0bed0c66a 100644 --- a/pkg/patches/patch_types.go +++ b/pkg/patches/patch_types.go @@ -4,7 +4,7 @@ import ( "fmt" "strconv" - "github.com/loft-sh/vcluster/config" + "github.com/loft-sh/vcluster/config/v0.21" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/pkg/errors" diff --git a/pkg/pro/patches.go b/pkg/pro/patches.go index 85001cbf1..71a74afb7 100644 --- a/pkg/pro/patches.go +++ b/pkg/pro/patches.go @@ -1,7 +1,7 @@ package pro import ( - "github.com/loft-sh/vcluster/config" + "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/syncer/synccontext" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/pkg/setup/config.go b/pkg/setup/config.go index fe0586a66..5439938e7 100644 --- a/pkg/setup/config.go +++ b/pkg/setup/config.go @@ -5,7 +5,7 @@ import ( "fmt" "os" - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/config" "github.com/loft-sh/vcluster/pkg/k3s" "github.com/loft-sh/vcluster/pkg/util/translate" diff --git a/pkg/setup/initialize.go b/pkg/setup/initialize.go index 12cb0a049..a985b0c58 100644 --- a/pkg/setup/initialize.go +++ b/pkg/setup/initialize.go @@ -11,7 +11,7 @@ import ( "strings" "time" - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/certs" "github.com/loft-sh/vcluster/pkg/config" "github.com/loft-sh/vcluster/pkg/k0s" diff --git a/pkg/util/testing/config.go b/pkg/util/testing/config.go index f1900055c..856b363ba 100644 --- a/pkg/util/testing/config.go +++ b/pkg/util/testing/config.go @@ -1,7 +1,7 @@ package testing import ( - vclusterconfig "github.com/loft-sh/vcluster/config" + vclusterconfig "github.com/loft-sh/vcluster/config/v0.21" "github.com/loft-sh/vcluster/pkg/config" )