Skip to content

Commit

Permalink
feat(kuma-cp): deprecate standalone mode (#8478)
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Dyszkiewicz <[email protected]>
  • Loading branch information
jakubdyszkiewicz authored Dec 1, 2023
1 parent 53b1545 commit 0471cf3
Show file tree
Hide file tree
Showing 102 changed files with 315 additions and 337 deletions.
7 changes: 7 additions & 0 deletions app/kuma-cp/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
kuma_cmd "github.com/kumahq/kuma/pkg/cmd"
"github.com/kumahq/kuma/pkg/config"
kuma_cp "github.com/kumahq/kuma/pkg/config/app/kuma-cp"
config_core "github.com/kumahq/kuma/pkg/config/core"
"github.com/kumahq/kuma/pkg/core/bootstrap"
"github.com/kumahq/kuma/pkg/defaults"
"github.com/kumahq/kuma/pkg/diagnostics"
Expand Down Expand Up @@ -52,6 +53,12 @@ func newRunCmdWithOpts(opts kuma_cmd.RunCmdOpts) *cobra.Command {
return err
}

// nolint:staticcheck
if cfg.Mode == config_core.Standalone {
runLog.Info(`[WARNING] "standalone" mode is deprecated. Changing it to "zone". Set KUMA_MODE to "zone" as "standalone" will be removed in the future.`)
cfg.Mode = config_core.Zone
}

kuma_cp.PrintDeprecations(&cfg, cmd.OutOrStdout())

gracefulCtx, ctx := opts.SetupSignalHandler()
Expand Down
2 changes: 1 addition & 1 deletion app/kuma-dp/pkg/dataplane/envoy/remote_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (b *remoteBootstrap) Generate(ctx context.Context, url string, cfg kuma_dp.
case DpNotFoundErr:
log.Info("Dataplane entity is not yet found in the Control Plane. If you are running on Kubernetes, the control plane is most likely still in the process of converting Pod to Dataplane. If it takes too long, check pod events and control plane logs to see possible cause. Retrying.", "backoff", cfg.ControlPlane.Retry.Backoff)
default:
log.Info("could not fetch bootstrap configuration, make sure you are not trying to connect to global-cp. retrying (this could help only if you're connecting to zone-cp or standalone).", "backoff", cfg.ControlPlane.Retry.Backoff, "err", err.Error())
log.Info("could not fetch bootstrap configuration, make sure you are not trying to connect to global-cp. retrying (this could help only if you're connecting to zone-cp).", "backoff", cfg.ControlPlane.Retry.Backoff, "err", err.Error())
}
return retry.RetryableError(err)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func DefaultInstallCpContext() InstallCpContext {
Cni_image_registry: "",
Cni_image_repository: "kuma-cni",
Cni_image_tag: kuma_version.Build.Version,
ControlPlane_mode: core.Standalone,
ControlPlane_mode: core.Zone,
ControlPlane_zone: "",
ControlPlane_globalZoneSyncService_type: "LoadBalancer",
Image_registry: "docker.io/kumahq",
Expand Down
8 changes: 0 additions & 8 deletions app/kumactl/cmd/install/install_control_plane_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,6 @@ controlPlane:
extraArgs: []string{"--kds-global-address", "grpcs://192.168.0.1:5685", "--mode", "zone", "--zone", "zone-1", "--set", "controlPlane.environment=universal", "--set", "egress.enabled=true"},
errorMsg: "Can't have egress.enabled when running controlPlane.mode=='universal'",
}),
Entry("--kds-global-address is missing when installing zone", errTestCase{
extraArgs: []string{"--mode", "zone", "--zone", "zone-1"},
errorMsg: "controlPlane.kdsGlobalAddress can't be empty when controlPlane.mode=='zone'",
}),
Entry("--zone is missing when installing zone", errTestCase{
extraArgs: []string{"--kds-global-address", "grpcs://192.168.0.1:5685", "--mode", "zone"},
errorMsg: "Can't have controlPlane.zone to be empty when controlPlane.mode=='zone'",
}),
Entry("--zone is more than 253 characters", errTestCase{
extraArgs: []string{"--kds-global-address", "grpcs://192.168.0.1:5685", "--mode", "zone", "--zone", "takryywlpeftgnlwuwmwwfwohwzqxqlofjfsuuldtatoxlmnniytycvdnduwplvgnpnjwvzmbkqrvgnlovpynrtuyhhrqibdzwbfjrmhvwkkryzfnudghaxmegfvacjlytuyeikuawquolrykwwldjiynaxrpqgxmvwashrkigadzhxdeihcbjurhpmdrnulajpaspqcgzqxsnjrdenhruaawooojpyoprgnnoqiqdhncuztbgfsvhparjlippv"},
errorMsg: "controlPlane.zone must be no more than 253 characters",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ spec:
- name: KUMA_INJECTOR_INIT_CONTAINER_IMAGE
value: "docker.io/kumahq/kuma-init:0.0.1"
- name: KUMA_MODE
value: "standalone"
value: "zone"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_CERT_DIR
value: "/var/run/secrets/kuma.io/tls-cert"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6562,7 +6562,7 @@ spec:
- name: KUMA_INJECTOR_INIT_CONTAINER_IMAGE
value: "docker.io/kumahq/kuma-init:0.0.1"
- name: KUMA_MODE
value: "standalone"
value: "zone"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_CERT_DIR
value: "/var/run/secrets/kuma.io/tls-cert"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ controlPlane:
# -- Kuma CP log output path: Defaults to /dev/stdout
logOutputPath: ""

# -- Kuma CP modes: one of standalone,zone,global
mode: "standalone"
# -- Kuma CP modes: one of zone,global
mode: "zone"

# -- (string) Kuma CP zone, if running multizone
zone:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6562,7 +6562,7 @@ spec:
- name: KUMA_INJECTOR_INIT_CONTAINER_IMAGE
value: "docker.io/kumahq/kuma-init:0.0.1"
- name: KUMA_MODE
value: "standalone"
value: "zone"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_CERT_DIR
value: "/var/run/secrets/kuma.io/tls-cert"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6770,7 +6770,7 @@ spec:
- name: KUMA_INJECTOR_INIT_CONTAINER_IMAGE
value: "docker.io/kumahq/kuma-init:0.0.1"
- name: KUMA_MODE
value: "standalone"
value: "zone"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_CERT_DIR
value: "/var/run/secrets/kuma.io/tls-cert"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ spec:
- name: KUMA_INJECTOR_INIT_CONTAINER_IMAGE
value: "docker.io/kumahq/kuma-init:0.0.1"
- name: KUMA_MODE
value: "standalone"
value: "zone"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_CERT_DIR
value: "/var/run/secrets/kuma.io/tls-cert"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ spec:
- name: KUMA_INJECTOR_INIT_CONTAINER_IMAGE
value: "gcr.io/octo/kuma-init:0.0.1"
- name: KUMA_MODE
value: "standalone"
value: "zone"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_CERT_DIR
value: "/var/run/secrets/kuma.io/tls-cert"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ spec:
- name: KUMA_INJECTOR_INIT_CONTAINER_IMAGE
value: "docker.io/kumahq/kuma-init:0.0.1"
- name: KUMA_MODE
value: "standalone"
value: "zone"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_CERT_DIR
value: "/var/run/secrets/kuma.io/tls-cert"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ spec:
- name: KUMA_INJECTOR_INIT_CONTAINER_IMAGE
value: "docker.io/kumahq/kuma-init:0.0.1"
- name: KUMA_MODE
value: "standalone"
value: "zone"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_CERT_DIR
value: "/var/run/secrets/kuma.io/tls-cert"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ spec:
- name: KUMA_INJECTOR_INIT_CONTAINER_IMAGE
value: "docker.io/kumahq/kuma-init:0.0.1"
- name: KUMA_MODE
value: "standalone"
value: "zone"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_CERT_DIR
value: "/var/run/secrets/kuma.io/tls-cert"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ spec:
- name: KUMA_INJECTOR_INIT_CONTAINER_IMAGE
value: "docker.io/kumahq/kuma-init:0.0.1"
- name: KUMA_MODE
value: "standalone"
value: "zone"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_CERT_DIR
value: "/var/run/secrets/kuma.io/tls-cert"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ spec:
- name: KUMA_INJECTOR_INIT_CONTAINER_IMAGE
value: "docker.io/kumahq/kuma-init:0.0.1"
- name: KUMA_MODE
value: "standalone"
value: "zone"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_CERT_DIR
value: "/var/run/secrets/kuma.io/tls-cert"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ spec:
- name: KUMA_INJECTOR_INIT_CONTAINER_IMAGE
value: "docker.io/kumahq/kuma-init:0.0.1"
- name: KUMA_MODE
value: "standalone"
value: "zone"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_CERT_DIR
value: "/var/run/secrets/kuma.io/tls-cert"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ spec:
- name: KUMA_INJECTOR_INIT_CONTAINER_IMAGE
value: "docker.io/kumahq/kuma-init:0.0.1"
- name: KUMA_MODE
value: "standalone"
value: "zone"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_CERT_DIR
value: "/var/run/secrets/kuma.io/tls-cert"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ spec:
- name: KUMA_INJECTOR_INIT_CONTAINER_IMAGE
value: "docker.io/kumahq/kuma-init:0.0.1"
- name: KUMA_MODE
value: "standalone"
value: "zone"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_CERT_DIR
value: "/var/run/secrets/kuma.io/tls-cert"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ spec:
- name: KUMA_INJECTOR_INIT_CONTAINER_IMAGE
value: "docker.io/kumahq/kuma-init:0.0.1"
- name: KUMA_MODE
value: "standalone"
value: "zone"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_CERT_DIR
value: "/var/run/secrets/kuma.io/tls-cert"
- name: KUMA_RUNTIME_KUBERNETES_ADMISSION_SERVER_PORT
Expand Down
2 changes: 1 addition & 1 deletion deployments/charts/kuma/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ A Helm chart for the Kuma Control Plane
| controlPlane.extraLabels | object | `{}` | Labels to add to resources in addition to default labels |
| controlPlane.logLevel | string | `"info"` | Kuma CP log level: one of off,info,debug |
| controlPlane.logOutputPath | string | `""` | Kuma CP log output path: Defaults to /dev/stdout |
| controlPlane.mode | string | `"standalone"` | Kuma CP modes: one of standalone,zone,global |
| controlPlane.mode | string | `"zone"` | Kuma CP modes: one of zone,global |
| controlPlane.zone | string | `nil` | Kuma CP zone, if running multizone |
| controlPlane.kdsGlobalAddress | string | `""` | Only used in `zone` mode |
| controlPlane.replicas | int | `1` | Number of replicas of the Kuma CP. Ignored when autoscaling is enabled |
Expand Down
8 changes: 2 additions & 6 deletions deployments/charts/kuma/templates/cp-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
{{ fail $msg }}
{{ end }}
{{ if eq .Values.controlPlane.mode "zone" }}
{{ if empty .Values.controlPlane.zone }}
{{ fail "Can't have controlPlane.zone to be empty when controlPlane.mode=='zone'" }}
{{ else }}
{{ if not (empty .Values.controlPlane.zone) }}
{{ if gt (len .Values.controlPlane.zone) 253 }}
{{ fail "controlPlane.zone must be no more than 253 characters" }}
{{ else }}
Expand All @@ -30,9 +28,7 @@
{{ end }}
{{ end }}
{{ end }}
{{ if empty .Values.controlPlane.kdsGlobalAddress }}
{{ fail "controlPlane.kdsGlobalAddress can't be empty when controlPlane.mode=='zone', needs to be the global control-plane address" }}
{{ else }}
{{ if not (empty .Values.controlPlane.kdsGlobalAddress) }}
{{ $url := urlParse .Values.controlPlane.kdsGlobalAddress }}
{{ if not (or (eq $url.scheme "grpcs") (eq $url.scheme "grpc")) }}
{{ $msg := printf "controlPlane.kdsGlobalAddress must be a url with scheme grpcs:// or grpc:// got:'%s'" .Values.controlPlane.kdsGlobalAddress }}
Expand Down
4 changes: 2 additions & 2 deletions deployments/charts/kuma/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ controlPlane:
# -- Kuma CP log output path: Defaults to /dev/stdout
logOutputPath: ""

# -- Kuma CP modes: one of standalone,zone,global
mode: "standalone"
# -- Kuma CP modes: one of zone,global
mode: "zone"

# -- (string) Kuma CP zone, if running multizone
zone:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ kumactl install control-plane [flags]
--ingress-use-node-port use NodePort instead of LoadBalancer for the Ingress Service
--injector-failure-policy string failure policy of the mutating web hook implemented by the Kuma Injector component (default "Fail")
--kds-global-address string URL of Global Kuma CP (example: grpcs://192.168.0.1:5685)
--mode string kuma cp modes: one of standalone|zone|global (default "standalone")
--mode string kuma cp modes: one of standalone|zone|global (default "zone")
--namespace string namespace to install Kuma Control Plane to (default "kuma-system")
--registry string registry for all images (default "docker.io/kumahq")
--set helm template <chart> --set ... set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2), This is similar to helm template <chart> --set ... to use set-file or set-string just use helm instead
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/kuma-cp.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Here are all options to configure the control-plane:
```yaml
# Environment type. Available values are: "kubernetes" or "universal"
environment: universal # ENV: KUMA_ENVIRONMENT
# Mode in which Kuma CP is running. Available values are: "standalone", "global", "zone"
mode: standalone # ENV: KUMA_MODE
# Mode in which Kuma CP is running. Available values are: "global", "zone", "standalone" (deprecated, use "zone")
mode: zone # ENV: KUMA_MODE

# Resource Store configuration
store:
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/raw/helm-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ controlPlane:
# -- Kuma CP log output path: Defaults to /dev/stdout
logOutputPath: ""

# -- Kuma CP modes: one of standalone,zone,global
mode: "standalone"
# -- Kuma CP modes: one of zone,global
mode: "zone"

# -- (string) Kuma CP zone, if running multizone
zone:
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/raw/kuma-cp.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Environment type. Available values are: "kubernetes" or "universal"
environment: universal # ENV: KUMA_ENVIRONMENT
# Mode in which Kuma CP is running. Available values are: "standalone", "global", "zone"
mode: standalone # ENV: KUMA_MODE
# Mode in which Kuma CP is running. Available values are: "global", "zone", "standalone" (deprecated, use "zone")
mode: zone # ENV: KUMA_MODE

# Resource Store configuration
store:
Expand Down
2 changes: 1 addition & 1 deletion mk/k3d.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CI_K3S_VERSION ?= $(K8S_MIN_VERSION)
METALLB_VERSION ?= v0.13.9

KUMA_MODE ?= standalone
KUMA_MODE ?= zone
KUMA_NAMESPACE ?= kuma-system
# Comment about PORT_PREFIX generation
#
Expand Down
2 changes: 1 addition & 1 deletion mk/kind.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ endef

CI_KUBERNETES_VERSION ?= v1.23.17@sha256:59c989ff8a517a93127d4a536e7014d28e235fb3529d9fba91b3951d461edfdb

KUMA_MODE ?= standalone
KUMA_MODE ?= zone
KUMA_NAMESPACE ?= kuma-system

.PHONY: kind/start
Expand Down
2 changes: 1 addition & 1 deletion mk/run.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ endef

POSTGRES_MODE = standard
CP_STORE = memory
CP_ENV += KUMA_ENVIRONMENT=universal KUMA_STORE_TYPE=$(CP_STORE)
CP_ENV += KUMA_ENVIRONMENT=universal KUMA_MULTIZONE_ZONE_NAME=zone-1 KUMA_STORE_TYPE=$(CP_STORE)
ifeq ($(CP_STORE),postgres)
CP_ENV += KUMA_STORE_POSTGRES_HOST=localhost \
KUMA_STORE_POSTGRES_PORT=15432 \
Expand Down
9 changes: 2 additions & 7 deletions pkg/api-server/api_server_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ type testApiServerConfigurer struct {
func NewTestApiServerConfigurer() *testApiServerConfigurer {
t := &testApiServerConfigurer{
metrics: func() core_metrics.Metrics {
m, _ := core_metrics.NewMetrics("Standalone")
m, _ := core_metrics.NewMetrics("Zone")
return m
},
config: config_api_server.DefaultApiServerConfig(),
Expand All @@ -182,12 +182,6 @@ func (t *testApiServerConfigurer) WithGlobal() *testApiServerConfigurer {
return t
}

func (t *testApiServerConfigurer) WithStandalone() *testApiServerConfigurer {
t.zone = ""
t.global = false
return t
}

func (t *testApiServerConfigurer) WithStore(resourceStore store.ResourceStore) *testApiServerConfigurer {
t.store = resourceStore
return t
Expand Down Expand Up @@ -248,6 +242,7 @@ func tryStartApiServer(t *testApiServerConfigurer) (*api_server.ApiServer, kuma_
if t.zone != "" {
cfg.Mode = config_core.Zone
cfg.Multizone.Zone.Name = t.zone
cfg.Multizone.Zone.GlobalAddress = "grpcs://global:5685"
} else if t.global {
cfg.Mode = config_core.Global
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/api-server/customization/api_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var _ = Describe("API Manager", func() {

// setup
resourceStore := memory.NewStore()
metrics, err := metrics.NewMetrics("Standalone")
metrics, err := metrics.NewMetrics("Zone")
Expect(err).ToNot(HaveOccurred())
wsManager := customization.NewAPIList()

Expand Down
5 changes: 2 additions & 3 deletions pkg/api-server/policies_endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import (
"github.com/emicklei/go-restful/v3"

"github.com/kumahq/kuma/pkg/api-server/types"
"github.com/kumahq/kuma/pkg/config/core"
"github.com/kumahq/kuma/pkg/core/resources/model"
)

func addPoliciesWsEndpoints(ws *restful.WebService, mode core.CpMode, readOnly bool, defs []model.ResourceTypeDescriptor) {
func addPoliciesWsEndpoints(ws *restful.WebService, federatedZone bool, readOnly bool, defs []model.ResourceTypeDescriptor) {
ws.Route(ws.GET("/policies").To(func(req *restful.Request, resp *restful.Response) {
response := types.PoliciesResponse{}
for _, def := range defs {
Expand All @@ -19,7 +18,7 @@ func addPoliciesWsEndpoints(ws *restful.WebService, mode core.CpMode, readOnly b
}
response.Policies = append(response.Policies, types.PolicyEntry{
Name: string(def.Name),
ReadOnly: readOnly || core.Zone == mode || def.ReadOnly,
ReadOnly: readOnly || federatedZone || def.ReadOnly,
Path: def.WsPath,
SingularDisplayName: def.SingularDisplayName,
PluralDisplayName: def.PluralDisplayName,
Expand Down
3 changes: 2 additions & 1 deletion pkg/api-server/resource_endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (

type resourceEndpoints struct {
mode config_core.CpMode
federatedZone bool
zoneName string
resManager manager.ResourceManager
descriptor model.ResourceTypeDescriptor
Expand Down Expand Up @@ -418,7 +419,7 @@ func (r *resourceEndpoints) validateResourceRequest(request *restful.Request, re
if name != resourceMeta.Name {
err.AddViolation("name", "name from the URL has to be the same as in body")
}
if r.mode == config_core.Zone && !r.doesNameLengthFitsGlobal(name) {
if r.federatedZone && !r.doesNameLengthFitsGlobal(name) {
err.AddViolation("name", "the length of the name must be shorter")
}
if string(r.descriptor.Name) != resourceMeta.Type {
Expand Down
2 changes: 1 addition & 1 deletion pkg/api-server/resource_endpoints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ var _ = Describe("Resource Endpoints", func() {
BeforeEach(func() {
resourceStore = store.NewPaginationStore(memory.NewStore())
apiServer, _, stop = StartApiServer(NewTestApiServerConfigurer().WithStore(resourceStore).WithMetrics(func() core_metrics.Metrics {
m, _ := core_metrics.NewMetrics("Standalone")
m, _ := core_metrics.NewMetrics("Zone")
metrics = m
return m
}))
Expand Down
Loading

0 comments on commit 0471cf3

Please sign in to comment.