Skip to content

Commit 293094a

Browse files
committed
chore: sync config/*.go and values.schema.json to vCluster version v0.22.6
1 parent ca22b26 commit 293094a

File tree

6 files changed

+64
-406
lines changed

6 files changed

+64
-406
lines changed

config/config.go

Lines changed: 10 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ type Config struct {
7777

7878
// Plugin specifies which vCluster plugins to enable. Use "plugins" instead. Do not use this option anymore.
7979
Plugin map[string]Plugin `json:"plugin,omitempty"`
80-
81-
// SleepMode holds the native sleep mode configuration for Pro clusters
82-
SleepMode *SleepMode `json:"sleepMode,omitempty"`
8380
}
8481

8582
// Integrations holds config for vCluster integrations with other operators or tools running on the host cluster
@@ -403,41 +400,6 @@ func UnmarshalYAMLStrict(data []byte, i any) error {
403400

404401
// ExportKubeConfig describes how vCluster should export the vCluster kubeconfig.
405402
type ExportKubeConfig struct {
406-
ExportKubeConfigProperties
407-
408-
// Declare in which host cluster secret vCluster should store the generated virtual cluster kubeconfig.
409-
// If this is not defined, vCluster will create it with `vc-NAME`. If you specify another name,
410-
// vCluster creates the config in this other secret.
411-
//
412-
// Deprecated: Use AdditionalSecrets instead.
413-
Secret ExportKubeConfigSecretReference `json:"secret,omitempty"`
414-
415-
// AdditionalSecrets specifies the additional host cluster secrets in which vCluster will store the
416-
// generated virtual cluster kubeconfigs.
417-
AdditionalSecrets []ExportKubeConfigAdditionalSecretReference `json:"additionalSecrets,omitempty"`
418-
}
419-
420-
// GetAdditionalSecrets returns optional additional kubeconfig Secrets.
421-
//
422-
// If the deprecated Secret property is set, GetAdditionalSecrets only returns that secret, and
423-
// AdditionalSecrets is ignored. On the other hand, if the AdditionalSecrets property is set,
424-
// GetAdditionalSecrets returns the secrets config from the AdditionalSecrets, and Secret property
425-
// is ignored.
426-
func (e *ExportKubeConfig) GetAdditionalSecrets() []ExportKubeConfigAdditionalSecretReference {
427-
if e.Secret.IsSet() {
428-
return []ExportKubeConfigAdditionalSecretReference{
429-
{
430-
ExportKubeConfigProperties: e.ExportKubeConfigProperties,
431-
Namespace: e.Secret.Namespace,
432-
Name: e.Secret.Name,
433-
},
434-
}
435-
}
436-
437-
return e.AdditionalSecrets
438-
}
439-
440-
type ExportKubeConfigProperties struct {
441403
// Context is the name of the context within the generated kubeconfig to use.
442404
Context string `json:"context,omitempty"`
443405

@@ -449,6 +411,11 @@ type ExportKubeConfigProperties struct {
449411

450412
// ServiceAccount can be used to generate a service account token instead of the default certificates.
451413
ServiceAccount ExportKubeConfigServiceAccount `json:"serviceAccount,omitempty"`
414+
415+
// Declare in which host cluster secret vCluster should store the generated virtual cluster kubeconfig.
416+
// If this is not defined, vCluster will create it with `vc-NAME`. If you specify another name,
417+
// vCluster creates the config in this other secret.
418+
Secret ExportKubeConfigSecretReference `json:"secret,omitempty"`
452419
}
453420

454421
type ExportKubeConfigServiceAccount struct {
@@ -475,24 +442,6 @@ type ExportKubeConfigSecretReference struct {
475442
Namespace string `json:"namespace,omitempty"`
476443
}
477444

478-
// IsSet checks if at least one ExportKubeConfigSecretReference property is set.
479-
func (s *ExportKubeConfigSecretReference) IsSet() bool {
480-
return *s != (ExportKubeConfigSecretReference{})
481-
}
482-
483-
// ExportKubeConfigAdditionalSecretReference defines the additional host cluster secret in which
484-
// vCluster stores the generated virtual cluster kubeconfigs.
485-
type ExportKubeConfigAdditionalSecretReference struct {
486-
ExportKubeConfigProperties
487-
488-
// Name is the name of the secret where the kubeconfig is stored.
489-
Name string `json:"name,omitempty"`
490-
491-
// Namespace where vCluster stores the kubeconfig secret. If this is not equal to the namespace
492-
// where you deployed vCluster, you need to make sure vCluster has access to this other namespace.
493-
Namespace string `json:"namespace,omitempty"`
494-
}
495-
496445
type Sync struct {
497446
// Configure resources to sync from the virtual cluster to the host cluster.
498447
ToHost SyncToHost `json:"toHost,omitempty"`
@@ -560,38 +509,6 @@ type EnableSwitchWithPatches struct {
560509
Patches []TranslatePatch `json:"patches,omitempty"`
561510
}
562511

563-
type EnableSwitchWithResourcesMappings struct {
564-
// Enabled defines if this option should be enabled.
565-
Enabled bool `json:"enabled,omitempty"`
566-
567-
// Patches patch the resource according to the provided specification.
568-
Patches []TranslatePatch `json:"patches,omitempty"`
569-
570-
// Mappings for Namespace and Object
571-
Mappings FromHostMappings `json:"mappings,omitempty"`
572-
}
573-
574-
type FromHostMappings struct {
575-
// ByName is a map of host-object-namespace/host-object-name: virtual-object-namespace/virtual-object-name.
576-
// There are several wildcards supported:
577-
// 1. To match all objects in host namespace and sync them to different namespace in vCluster:
578-
// byName:
579-
// "foo/*": "foo-in-virtual/*"
580-
// 2. To match specific object in the host namespace and sync it to the same namespace with the same name:
581-
// byName:
582-
// "foo/my-object": "foo/my-object"
583-
// 3. To match specific object in the host namespace and sync it to the same namespace with different name:
584-
// byName:
585-
// "foo/my-object": "foo/my-virtual-object"
586-
// 4. To match all objects in the vCluster host namespace and sync them to a different namespace in vCluster:
587-
// byName:
588-
// "": "my-virtual-namespace/*"
589-
// 5. To match specific objects in the vCluster host namespace and sync them to a different namespace in vCluster:
590-
// byName:
591-
// "/my-object": "my-virtual-namespace/my-object"
592-
ByName map[string]string `json:"byName,omitempty"`
593-
}
594-
595512
type SyncFromHost struct {
596513
// Nodes defines if nodes should get synced from the host cluster to the virtual cluster, but not back.
597514
Nodes SyncNodes `json:"nodes,omitempty"`
@@ -625,12 +542,6 @@ type SyncFromHost struct {
625542

626543
// VolumeSnapshotClasses defines if volume snapshot classes created within the virtual cluster should get synced to the host cluster.
627544
VolumeSnapshotClasses EnableSwitchWithPatches `json:"volumeSnapshotClasses,omitempty"`
628-
629-
// ConfigMaps defines if config maps in the host should get synced to the virtual cluster.
630-
ConfigMaps EnableSwitchWithResourcesMappings `json:"configMaps,omitempty"`
631-
632-
// Secrets defines if secrets in the host should get synced to the virtual cluster.
633-
Secrets EnableSwitchWithResourcesMappings `json:"secrets,omitempty"`
634545
}
635546

636547
type SyncToHostCustomResource struct {
@@ -702,9 +613,6 @@ type SyncFromHostCustomResource struct {
702613

703614
// Patches patch the resource according to the provided specification.
704615
Patches []TranslatePatch `json:"patches,omitempty"`
705-
706-
// Mappings for Namespace and Object
707-
Mappings FromHostMappings `json:"mappings,omitempty"`
708616
}
709617

710618
type EnableAutoSwitch struct {
@@ -751,12 +659,6 @@ type SyncPods struct {
751659
// pod annotation.
752660
UseSecretsForSATokens bool `json:"useSecretsForSATokens,omitempty"`
753661

754-
// RuntimeClassName is the runtime class to set for synced pods.
755-
RuntimeClassName string `json:"runtimeClassName,omitempty"`
756-
757-
// PriorityClassName is the priority class to set for synced pods.
758-
PriorityClassName string `json:"priorityClassName,omitempty"`
759-
760662
// RewriteHosts is a special option needed to rewrite statefulset containers to allow the correct FQDN. virtual cluster will add
761663
// a small container to each stateful set pod that will initially rewrite the /etc/hosts file to match the FQDN expected by
762664
// the virtual cluster.
@@ -2024,9 +1926,8 @@ type Experimental struct {
20241926
// DenyProxyRequests denies certain requests in the vCluster proxy.
20251927
DenyProxyRequests []DenyRule `json:"denyProxyRequests,omitempty" product:"pro"`
20261928

2027-
// ReuseNamespace allows reusing the same namespace to create multiple vClusters.
2028-
// This flag is deprecated, as this scenario will be removed entirely in upcoming releases.
2029-
ReuseNamespace bool `json:"reuseNamespace,omitempty"`
1929+
// SleepMode holds the native sleep mode configuration for Pro clusters
1930+
SleepMode *SleepMode `json:"sleepMode,omitempty"`
20301931
}
20311932

20321933
func (e Experimental) JSONSchemaExtend(base *jsonschema.Schema) {
@@ -2452,8 +2353,6 @@ type SleepMode struct {
24522353
TimeZone string `json:"timeZone,omitempty"`
24532354
// AutoSleep holds autoSleep details
24542355
AutoSleep SleepModeAutoSleep `json:"autoSleep,omitempty"`
2455-
// AutoWakeup holds configuration for waking the vCluster on a schedule rather than waiting for some activity.
2456-
AutoWakeup AutoWakeup `json:"autoWakeup,omitempty"`
24572356
}
24582357

24592358
// SleepModeAutoSleep holds configuration for allowing a vCluster to sleep its workloads
@@ -2465,6 +2364,9 @@ type SleepModeAutoSleep struct {
24652364
// Schedule represents a cron schedule for when to sleep workloads
24662365
Schedule string `json:"schedule,omitempty"`
24672366

2367+
// Wakeup holds configuration for waking the vCluster on a schedule rather than waiting for some activity.
2368+
Wakeup AutoWakeup `json:"wakeup,omitempty"`
2369+
24682370
// Exclude holds configuration for labels that, if present, will prevent a workload from going to sleep
24692371
Exclude AutoSleepExclusion `json:"exclude,omitempty"`
24702372
}

config/default_extra_values.go

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ const (
2323

2424
// K3SVersionMap holds the supported k3s versions
2525
var K3SVersionMap = map[string]string{
26-
"1.32": "rancher/k3s:v1.32.1-k3s1",
2726
"1.31": "rancher/k3s:v1.31.1-k3s1",
2827
"1.30": "rancher/k3s:v1.30.2-k3s1",
2928
"1.29": "rancher/k3s:v1.29.6-k3s1",
@@ -33,7 +32,6 @@ var K3SVersionMap = map[string]string{
3332

3433
// K0SVersionMap holds the supported k0s versions
3534
var K0SVersionMap = map[string]string{
36-
"1.32": "k0sproject/k0s:v1.30.2-k0s.0",
3735
"1.31": "k0sproject/k0s:v1.30.2-k0s.0",
3836
"1.30": "k0sproject/k0s:v1.30.2-k0s.0",
3937
"1.29": "k0sproject/k0s:v1.29.6-k0s.0",
@@ -43,7 +41,6 @@ var K0SVersionMap = map[string]string{
4341

4442
// K8SAPIVersionMap holds the supported k8s api servers
4543
var K8SAPIVersionMap = map[string]string{
46-
"1.32": "registry.k8s.io/kube-apiserver:v1.32.1",
4744
"1.31": "registry.k8s.io/kube-apiserver:v1.31.1",
4845
"1.30": "registry.k8s.io/kube-apiserver:v1.30.2",
4946
"1.29": "registry.k8s.io/kube-apiserver:v1.29.6",
@@ -53,7 +50,6 @@ var K8SAPIVersionMap = map[string]string{
5350

5451
// K8SControllerVersionMap holds the supported k8s controller managers
5552
var K8SControllerVersionMap = map[string]string{
56-
"1.32": "registry.k8s.io/kube-controller-manager:v1.32.1",
5753
"1.31": "registry.k8s.io/kube-controller-manager:v1.31.1",
5854
"1.30": "registry.k8s.io/kube-controller-manager:v1.30.2",
5955
"1.29": "registry.k8s.io/kube-controller-manager:v1.29.6",
@@ -63,7 +59,6 @@ var K8SControllerVersionMap = map[string]string{
6359

6460
// K8SSchedulerVersionMap holds the supported k8s schedulers
6561
var K8SSchedulerVersionMap = map[string]string{
66-
"1.32": "registry.k8s.io/kube-scheduler:v1.32.1",
6762
"1.31": "registry.k8s.io/kube-scheduler:v1.31.1",
6863
"1.30": "registry.k8s.io/kube-scheduler:v1.30.2",
6964
"1.29": "registry.k8s.io/kube-scheduler:v1.29.6",
@@ -73,8 +68,7 @@ var K8SSchedulerVersionMap = map[string]string{
7368

7469
// K8SEtcdVersionMap holds the supported etcd
7570
var K8SEtcdVersionMap = map[string]string{
76-
"1.32": "registry.k8s.io/etcd:3.5.17-0",
77-
"1.31": "registry.k8s.io/etcd:3.5.15-0",
71+
"1.31": "registry.k8s.io/etcd:3.5.17-0",
7872
"1.30": "registry.k8s.io/etcd:3.5.13-0",
7973
"1.29": "registry.k8s.io/etcd:3.5.10-0",
8074
"1.28": "registry.k8s.io/etcd:3.5.9-0",
@@ -182,3 +176,21 @@ func addCommonReleaseValues(config *Config, options *ExtraValuesOptions) {
182176
}
183177
}
184178
}
179+
180+
func ParseKubernetesVersionInfo(versionStr string) (*KubernetesVersion, error) {
181+
if versionStr[0] == 'v' {
182+
versionStr = versionStr[1:]
183+
}
184+
185+
splittedVersion := strings.Split(versionStr, ".")
186+
if len(splittedVersion) != 2 && len(splittedVersion) != 3 {
187+
return nil, fmt.Errorf("unrecognized kubernetes version %s, please use format vX.X", versionStr)
188+
}
189+
190+
major := splittedVersion[0]
191+
minor := splittedVersion[1]
192+
return &KubernetesVersion{
193+
Major: major,
194+
Minor: minor,
195+
}, nil
196+
}

0 commit comments

Comments
 (0)