From f129530501ee8173d14a4c8cc718be31e98e9603 Mon Sep 17 00:00:00 2001 From: Denise Schannon Date: Tue, 16 Apr 2024 12:46:22 -0700 Subject: [PATCH 1/2] Update from product:pro to tier:pro --- config/config.go | 66 +++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/config/config.go b/config/config.go index d050f1f52..2193b3eca 100644 --- a/config/config.go +++ b/config/config.go @@ -385,15 +385,15 @@ 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"` + // ResolveDNS allows to define extra DNS rules. This only works if embedded coredns is configured. This is a Pro feature since embedded coredns is a Pro feature. + ResolveDNS []ResolveDNS `json:"resolveDNS,omitempty" tier:"pro"` // Advanced holds advanced network options. Advanced NetworkingAdvanced `json:"advanced,omitempty"` } func (n Networking) JSONSchemaExtend(base *jsonschema.Schema) { - addProToJSONSchema(base, reflect.TypeOf(n)) + addTierToJSONSchema(base, reflect.TypeOf(n)) } type ReplicateServices struct { @@ -561,8 +561,8 @@ type ControlPlane struct { // 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"` + // HostPathMapper defines if vCluster should rewrite host paths. This is a Pro feature since central is a Pro feature and we don't recommend using HostPathMapper without central. + HostPathMapper HostPathMapper `json:"hostPathMapper,omitempty" tier:"pro"` // Ingress defines options for vCluster ingress deployed by Helm. Ingress ControlPlaneIngress `json:"ingress,omitempty"` @@ -581,7 +581,7 @@ type ControlPlane struct { } func (c ControlPlane) JSONSchemaExtend(base *jsonschema.Schema) { - addProToJSONSchema(base, reflect.TypeOf(c)) + addTierToJSONSchema(base, reflect.TypeOf(c)) } type ControlPlaneStatefulSet struct { @@ -798,29 +798,25 @@ type DatabaseKine struct { } type Etcd struct { - // Embedded defines to use embedded etcd as a storage backend for the virtual cluster - Embedded EtcdEmbedded `json:"embedded,omitempty" product:"pro"` + // Embedded defines to use embedded etcd as a storage backend for the virtual cluster. This is a Pro feature. + Embedded EtcdEmbedded `json:"embedded,omitempty" tier:"pro"` // Deploy defines to use an external etcd that is deployed by the helm chart Deploy EtcdDeploy `json:"deploy,omitempty"` } func (e Etcd) JSONSchemaExtend(base *jsonschema.Schema) { - addProToJSONSchema(base, reflect.TypeOf(e)) + addTierToJSONSchema(base, reflect.TypeOf(e)) } type EtcdEmbedded struct { // Enabled defines if the embedded etcd should be used. - Enabled bool `json:"enabled,omitempty" product:"pro"` + Enabled bool `json:"enabled,omitempty"` // MigrateFromDeployedEtcd signals that vCluster should migrate from the deployed external etcd to embedded etcd. MigrateFromDeployedEtcd bool `json:"migrateFromDeployedEtcd,omitempty"` } -func (e EtcdEmbedded) JSONSchemaExtend(base *jsonschema.Schema) { - addProToJSONSchema(base, reflect.TypeOf(e)) -} - type EtcdDeploy struct { // Enabled defines that an external etcd should be deployed. Enabled bool `json:"enabled,omitempty"` @@ -913,8 +909,8 @@ type CoreDNS struct { // Enabled defines if coredns is enabled Enabled bool `json:"enabled,omitempty"` - // 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. - Embedded bool `json:"embedded,omitempty" product:"pro"` + // 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. + Embedded bool `json:"embedded,omitempty" tier:"pro"` // Service holds extra options for the coredns service deployed within the virtual cluster Service CoreDNSService `json:"service,omitempty"` @@ -930,7 +926,7 @@ type CoreDNS struct { } func (c CoreDNS) JSONSchemaExtend(base *jsonschema.Schema) { - addProToJSONSchema(base, reflect.TypeOf(c)) + addTierToJSONSchema(base, reflect.TypeOf(c)) } type CoreDNSService struct { @@ -1237,12 +1233,12 @@ type Policies struct { // LimitRange specifies limit range options. LimitRange LimitRange `json:"limitRange,omitempty"` - // CentralAdmission defines what validating or mutating webhooks should be enforced within the virtual cluster. - CentralAdmission CentralAdmission `json:"centralAdmission,omitempty" product:"pro"` + // CentralAdmission defines what validating or mutating webhooks should be enforced within the virtual cluster. This is a Pro feature. + CentralAdmission CentralAdmission `json:"centralAdmission,omitempty" tier:"pro"` } func (p Policies) JSONSchemaExtend(base *jsonschema.Schema) { - addProToJSONSchema(base, reflect.TypeOf(p)) + addTierToJSONSchema(base, reflect.TypeOf(p)) } type ResourceQuota struct { @@ -1526,18 +1522,18 @@ type Experimental struct { // 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. MultiNamespaceMode ExperimentalMultiNamespaceMode `json:"multiNamespaceMode,omitempty"` - // IsolatedControlPlane is a feature to run the vCluster control plane in a different Kubernetes cluster than the workloads themselves. - IsolatedControlPlane ExperimentalIsolatedControlPlane `json:"isolatedControlPlane,omitempty" product:"pro"` + // IsolatedControlPlane is a feature to run the vCluster control plane in a different Kubernetes cluster than the workloads themselves. This is a Pro feature. + IsolatedControlPlane ExperimentalIsolatedControlPlane `json:"isolatedControlPlane,omitempty" tier:"pro"` // VirtualClusterKubeConfig allows you to override distro specifics and specify where vCluster will find the required certificates and vCluster config. VirtualClusterKubeConfig VirtualClusterKubeConfig `json:"virtualClusterKubeConfig,omitempty"` - // DenyProxyRequests denies certain requests in the vCluster proxy. - DenyProxyRequests []DenyRule `json:"denyProxyRequests,omitempty" product:"pro"` + // DenyProxyRequests denies certain requests in the vCluster proxy. This is a Pro feature. + DenyProxyRequests []DenyRule `json:"denyProxyRequests,omitempty" tier:"pro"` } func (e Experimental) JSONSchemaExtend(base *jsonschema.Schema) { - addProToJSONSchema(base, reflect.TypeOf(e)) + addTierToJSONSchema(base, reflect.TypeOf(e)) } type ExperimentalMultiNamespaceMode struct { @@ -1550,7 +1546,7 @@ type ExperimentalMultiNamespaceMode struct { type ExperimentalIsolatedControlPlane struct { // Enabled specifies if the isolated control plane feature should be enabled. - Enabled bool `json:"enabled,omitempty" product:"pro"` + Enabled bool `json:"enabled,omitempty"` // Headless states that Helm should deploy the vCluster in headless mode for the isolated control plane. Headless bool `json:"headless,omitempty"` @@ -1566,11 +1562,11 @@ type ExperimentalIsolatedControlPlane struct { } type ExperimentalSyncSettings struct { - // DisableSync will not sync any resources and disable most control plane functionality. - DisableSync bool `json:"disableSync,omitempty" product:"pro"` + // DisableSync will not sync any resources and disable most control plane functionality. This is a Pro feature. + DisableSync bool `json:"disableSync,omitempty" tier:"pro"` - // RewriteKubernetesService will rewrite the Kubernetes service to point to the vCluster service if disableSync is enabled - RewriteKubernetesService bool `json:"rewriteKubernetesService,omitempty" product:"pro"` + // RewriteKubernetesService will rewrite the Kubernetes service to point to the vCluster service if disableSync is enabled. This is a Pro feature. + RewriteKubernetesService bool `json:"rewriteKubernetesService,omitempty" tier:"pro"` // TargetNamespace is the namespace where the workloads should get synced to. TargetNamespace string `json:"targetNamespace,omitempty"` @@ -1589,7 +1585,7 @@ type ExperimentalSyncSettings struct { } func (e ExperimentalSyncSettings) JSONSchemaExtend(base *jsonschema.Schema) { - addProToJSONSchema(base, reflect.TypeOf(e)) + addTierToJSONSchema(base, reflect.TypeOf(e)) } type ExperimentalDeploy struct { @@ -1874,12 +1870,12 @@ type RuleWithVerbs struct { Verbs []string `json:"operations,omitempty"` } -// addProToJSONSchema looks for fields with the `product:"pro"` tag and adds the pro tag to the central field. +// addTierToJSONSchema looks for fields with the `tier:"pro"` tag and adds the tier tag to the central field. // Requires `json:""` tag to be set as well. -func addProToJSONSchema(base *jsonschema.Schema, t reflect.Type) { +func addTierToJSONSchema(base *jsonschema.Schema, t reflect.Type) { proFields := []string{} for i := 0; i < t.NumField(); i++ { - tag := t.Field(i).Tag.Get("product") + tag := t.Field(i).Tag.Get("tier") jsonName := strings.Split(t.Field(i).Tag.Get("json"), ",")[0] if tag == "" { continue @@ -1898,6 +1894,6 @@ func addProToJSONSchema(base *jsonschema.Schema, t reflect.Type) { if central.Extras == nil { central.Extras = map[string]interface{}{} } - central.Extras["pro"] = true + central.Extras["tier"] = "pro" } } From f5b0b245bab0fc3f03a0208c674b03715118a80e Mon Sep 17 00:00:00 2001 From: Denise Schannon Date: Tue, 16 Apr 2024 12:51:19 -0700 Subject: [PATCH 2/2] update chart/values.yaml and values.schema.json based on config.go changes --- chart/values.schema.json | 21 ++++++++++----------- chart/values.yaml | 14 +++++++------- config/config.go | 2 +- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/chart/values.schema.json b/chart/values.schema.json index c173fc0b5..759fd06d4 100755 --- a/chart/values.schema.json +++ b/chart/values.schema.json @@ -56,7 +56,7 @@ }, "hostPathMapper": { "$ref": "#/$defs/HostPathMapper", - "description": "HostPathMapper defines if vCluster should rewrite host paths.", + "description": "HostPathMapper defines if vCluster should rewrite host paths. This is a Pro feature since central is a Pro feature and we don't recommend using HostPathMapper without central.", "pro": true }, "ingress": { @@ -517,7 +517,7 @@ }, "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.", + "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": { @@ -913,7 +913,7 @@ "properties": { "embedded": { "$ref": "#/$defs/EtcdEmbedded", - "description": "Embedded defines to use embedded etcd as a storage backend for the virtual cluster", + "description": "Embedded defines to use embedded etcd as a storage backend for the virtual cluster. This is a Pro feature.", "pro": true }, "deploy": { @@ -1054,8 +1054,7 @@ "properties": { "enabled": { "type": "boolean", - "description": "Enabled defines if the embedded etcd should be used.", - "pro": true + "description": "Enabled defines if the embedded etcd should be used." }, "migrateFromDeployedEtcd": { "type": "boolean", @@ -1085,7 +1084,7 @@ }, "isolatedControlPlane": { "$ref": "#/$defs/ExperimentalIsolatedControlPlane", - "description": "IsolatedControlPlane is a feature to run the vCluster control plane in a different Kubernetes cluster than the workloads themselves.", + "description": "IsolatedControlPlane is a feature to run the vCluster control plane in a different Kubernetes cluster than the workloads themselves. This is a Pro feature.", "pro": true }, "virtualClusterKubeConfig": { @@ -1097,7 +1096,7 @@ "$ref": "#/$defs/DenyRule" }, "type": "array", - "description": "DenyProxyRequests denies certain requests in the vCluster proxy.", + "description": "DenyProxyRequests denies certain requests in the vCluster proxy. This is a Pro feature.", "pro": true } }, @@ -1280,12 +1279,12 @@ "properties": { "disableSync": { "type": "boolean", - "description": "DisableSync will not sync any resources and disable most control plane functionality.", + "description": "DisableSync will not sync any resources and disable most control plane functionality. This is a Pro feature.", "pro": true }, "rewriteKubernetesService": { "type": "boolean", - "description": "RewriteKubernetesService will rewrite the Kubernetes service to point to the vCluster service if disableSync is enabled", + "description": "RewriteKubernetesService will rewrite the Kubernetes service to point to the vCluster service if disableSync is enabled. This is a Pro feature.", "pro": true }, "targetNamespace": { @@ -1799,7 +1798,7 @@ "$ref": "#/$defs/ResolveDNS" }, "type": "array", - "description": "ResolveDNS allows to define extra DNS rules. This only works if embedded coredns is configured.", + "description": "ResolveDNS allows to define extra DNS rules. This only works if embedded coredns is configured. This is a Pro feature since embedded coredns is a Pro feature.", "pro": true }, "advanced": { @@ -2214,7 +2213,7 @@ }, "centralAdmission": { "$ref": "#/$defs/CentralAdmission", - "description": "CentralAdmission defines what validating or mutating webhooks should be enforced within the virtual cluster.", + "description": "CentralAdmission defines what validating or mutating webhooks should be enforced within the virtual cluster. This is a Pro feature.", "pro": true } }, diff --git a/chart/values.yaml b/chart/values.yaml index 52cf3eb92..121418195 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -304,7 +304,7 @@ controlPlane: caFile: "" # Etcd defines that etcd should be used as the backend for the virtual cluster etcd: - # Embedded defines to use embedded etcd as a storage backend for the virtual cluster + # Embedded defines to use embedded etcd as a storage backend for the virtual cluster. This is a Pro feature. embedded: # Enabled defines if the embedded etcd should be used. enabled: false @@ -408,7 +408,7 @@ controlPlane: coredns: # Enabled defines if coredns is enabled enabled: true - # 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. + # 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. embedded: false # OverwriteManifests can be used to overwrite the coredns manifests used to deploy coredns overwriteManifests: "" @@ -665,7 +665,7 @@ networking: # FromHost defines the services that should get synced from the host to the virtual cluster. fromHost: [] - # ResolveDNS allows to define extra DNS rules. This only works if embedded coredns is configured. + # ResolveDNS allows to define extra DNS rules. This only works if embedded coredns is configured. This is a Pro feature since embedded coredns is a Pro feature. resolveDNS: [] # Advanced holds advanced network options. @@ -759,7 +759,7 @@ policies: - 172.16.0.0/12 - 192.168.0.0/16 - # CentralAdmission defines what validating or mutating webhooks should be enforced within the virtual cluster. + # CentralAdmission defines what validating or mutating webhooks should be enforced within the virtual cluster. This is a Pro feature. centralAdmission: # ValidatingWebhooks are validating webhooks that should be enforced in the virtual cluster validatingWebhooks: [] @@ -796,16 +796,16 @@ experimental: # SyncSettings are advanced settings for the syncer controller. syncSettings: - # DisableSync will not sync any resources and disable most control plane functionality. + # DisableSync will not sync any resources and disable most control plane functionality. This is a Pro feature. disableSync: false - # RewriteKubernetesService will rewrite the Kubernetes service to point to the vCluster service if disableSync is enabled + # RewriteKubernetesService will rewrite the Kubernetes service to point to the vCluster service if disableSync is enabled. This is a Pro feature. rewriteKubernetesService: false # TargetNamespace is the namespace where the workloads should get synced to. targetNamespace: "" # SetOwner specifies if vCluster should set an owner reference on the synced objects to the vCluster service. This allows for easy garbage collection. setOwner: true - # IsolatedControlPlane is a feature to run the vCluster control plane in a different Kubernetes cluster than the workloads themselves. + # IsolatedControlPlane is a feature to run the vCluster control plane in a different Kubernetes cluster than the workloads themselves. This is a Pro feature. isolatedControlPlane: # Headless states that Helm should deploy the vCluster in headless mode for the isolated control plane. headless: false diff --git a/config/config.go b/config/config.go index 2193b3eca..ed4372f18 100644 --- a/config/config.go +++ b/config/config.go @@ -1894,6 +1894,6 @@ func addTierToJSONSchema(base *jsonschema.Schema, t reflect.Type) { if central.Extras == nil { central.Extras = map[string]interface{}{} } - central.Extras["tier"] = "pro" + central.Extras["pro"] = true } }