From d5cd2748c7d4604bd9b269c337f56e06de0d0f29 Mon Sep 17 00:00:00 2001 From: Ewout Prangsma Date: Tue, 3 Apr 2018 16:50:17 +0200 Subject: [PATCH] Renamed all enum values to title case --- .../GettingStarted/kube-arangodb/README.md | 4 +-- .../kube-arangodb/config_and_secrets.md | 2 +- .../kube-arangodb/deployment_resource.md | 33 ++++++++++--------- docs/Manual/Programs/kube-arangodb/storage.md | 2 +- examples/simple-cluster-no-tls.yaml | 2 +- examples/simple-cluster.yaml | 2 +- examples/single-server-no-auth.yaml | 2 +- examples/single-server.yaml | 2 +- .../deployment/v1alpha/deployment_mode.go | 14 ++++---- .../v1alpha/deployment_mode_test.go | 12 +++---- pkg/apis/deployment/v1alpha/environment.go | 4 +-- .../deployment/v1alpha/environment_test.go | 8 ++--- pkg/apis/deployment/v1alpha/storage_engine.go | 4 +-- .../deployment/v1alpha/storage_engine_test.go | 8 ++--- pkg/deployment/resources/pod_creator.go | 2 +- 15 files changed, 51 insertions(+), 50 deletions(-) diff --git a/docs/Manual/GettingStarted/kube-arangodb/README.md b/docs/Manual/GettingStarted/kube-arangodb/README.md index 9e1327e6f..37e364fbe 100644 --- a/docs/Manual/GettingStarted/kube-arangodb/README.md +++ b/docs/Manual/GettingStarted/kube-arangodb/README.md @@ -61,7 +61,7 @@ kind: "ArangoDeployment" metadata: name: "single-server" spec: - mode: single + mode: Single ``` Now insert this resource in your Kubernetes cluster using: @@ -164,7 +164,7 @@ kind: "ArangoDeployment" metadata: name: "cluster" spec: - mode: cluster + mode: Cluster ``` Now insert this resource in your Kubernetes cluster using: diff --git a/docs/Manual/Programs/kube-arangodb/config_and_secrets.md b/docs/Manual/Programs/kube-arangodb/config_and_secrets.md index df8bc681d..c381afc37 100644 --- a/docs/Manual/Programs/kube-arangodb/config_and_secrets.md +++ b/docs/Manual/Programs/kube-arangodb/config_and_secrets.md @@ -34,7 +34,7 @@ kind: "Cluster" metadata: name: "example-arangodb-cluster" spec: - mode: cluster + mode: Cluster auth: jwtSecretName: ``` diff --git a/docs/Manual/Programs/kube-arangodb/deployment_resource.md b/docs/Manual/Programs/kube-arangodb/deployment_resource.md index f630aebab..069ba56d3 100644 --- a/docs/Manual/Programs/kube-arangodb/deployment_resource.md +++ b/docs/Manual/Programs/kube-arangodb/deployment_resource.md @@ -13,7 +13,7 @@ kind: "ArangoDeployment" metadata: name: "example-arangodb-cluster" spec: - mode: cluster + mode: Cluster ``` Example more elaborate deployment definition: @@ -24,7 +24,8 @@ kind: "ArangoDeployment" metadata: name: "example-arangodb-cluster" spec: - mode: cluster + mode: Cluster + environment: Production agents: count: 3 args: @@ -50,21 +51,21 @@ Below you'll find all settings of the `ArangoDeployment` custom resource. Several settings are for various groups of servers. These are indicated with `` where `` can be any of: -- `agents` for all agents of a `cluster` or `resilientsingle` pair. -- `dbservers` for all dbservers of a `cluster`. -- `coordinators` for all coordinators of a `cluster`. -- `single` for all single servers of a `single` instance or `resilientsingle` pair. -- `syncmasters` for all syncmasters of a `cluster`. -- `syncworkers` for all syncworkers of a `cluster`. +- `agents` for all agents of a `Cluster` or `ResilientSingle` pair. +- `dbservers` for all dbservers of a `Cluster`. +- `coordinators` for all coordinators of a `Cluster`. +- `single` for all single servers of a `Single` instance or `ResilientSingle` pair. +- `syncmasters` for all syncmasters of a `Cluster`. +- `syncworkers` for all syncworkers of a `Cluster`. ### `spec.mode: string` This setting specifies the type of deployment you want to create. Possible values are: -- `cluster` (default) Full cluster. Defaults to 3 agents, 3 dbservers & 3 coordinators. -- `resilientsingle` Resilient single pair. Defaults to 3 agents and 2 single servers. -- `single` Single server only (note this does not provide high availability or reliability). +- `Cluster` (default) Full cluster. Defaults to 3 agents, 3 dbservers & 3 coordinators. +- `ResilientSingle` Resilient single pair. Defaults to 3 agents and 2 single servers. +- `Single` Single server only (note this does not provide high availability or reliability). This setting cannot be changed after the deployment has been created. @@ -73,9 +74,9 @@ This setting cannot be changed after the deployment has been created. This setting specifies the type of environment in which the deployment is created. Possible values are: -- `development` (default) This value optimizes the deployment for development +- `Development` (default) This value optimizes the deployment for development use. It is possible to run a deployment on a small number of nodes (e.g. minikube). -- `production` This value optimizes the deployment for production use. +- `Production` This value optimizes the deployment for production use. It puts required affinity constraints on all pods to avoid agents & dbservers from running on the same machine. @@ -101,8 +102,8 @@ This setting specifies the type of storage engine used for all servers in the cluster. Possible values are: -- `mmfiles` To use the MMfiles storage engine. -- `rocksdb` (default) To use the RocksDB storage engine. +- `MMFiles` To use the MMfiles storage engine. +- `RocksDB` (default) To use the RocksDB storage engine. This setting cannot be changed after the cluster has been created. @@ -211,7 +212,7 @@ The default value is empty. This setting sets the type of message queue used by ArangoSync. Possible values are: -- `direct` (default) for direct HTTP connections between the 2 data centers. +- `Direct` (default) for direct HTTP connections between the 2 data centers. ### `spec.sync.tls.caSecretName: string` diff --git a/docs/Manual/Programs/kube-arangodb/storage.md b/docs/Manual/Programs/kube-arangodb/storage.md index c9eb20da4..88add04cb 100644 --- a/docs/Manual/Programs/kube-arangodb/storage.md +++ b/docs/Manual/Programs/kube-arangodb/storage.md @@ -24,7 +24,7 @@ SSD storage. To accomplish this, one must create `PersistentVolumes` for all servers that need persistent storage (single, agents & dbservers). -E.g. for a `cluster` with 3 agents and 5 dbservers, you must create 8 volumes. +E.g. for a `Cluster` with 3 agents and 5 dbservers, you must create 8 volumes. Note that each volume must have a capacity that is equal to or higher than the capacity needed for each server. diff --git a/examples/simple-cluster-no-tls.yaml b/examples/simple-cluster-no-tls.yaml index 68e000155..8d21dadc1 100644 --- a/examples/simple-cluster-no-tls.yaml +++ b/examples/simple-cluster-no-tls.yaml @@ -3,6 +3,6 @@ kind: "ArangoDeployment" metadata: name: "example-simple-cluster-no-tls" spec: - mode: cluster + mode: Cluster tls: caSecretName: None diff --git a/examples/simple-cluster.yaml b/examples/simple-cluster.yaml index 52fb63621..c924c297a 100644 --- a/examples/simple-cluster.yaml +++ b/examples/simple-cluster.yaml @@ -3,7 +3,7 @@ kind: "ArangoDeployment" metadata: name: "example-simple-cluster" spec: - mode: cluster + mode: Cluster image: arangodb/arangodb:3.3.4 tls: altNames: ["kube-01", "kube-02", "kube-03"] diff --git a/examples/single-server-no-auth.yaml b/examples/single-server-no-auth.yaml index 7ec4a2985..b2153f674 100644 --- a/examples/single-server-no-auth.yaml +++ b/examples/single-server-no-auth.yaml @@ -3,7 +3,7 @@ kind: "ArangoDeployment" metadata: name: "example-simple-single-no-auth" spec: - mode: single + mode: Single auth: jwtSecretName: None diff --git a/examples/single-server.yaml b/examples/single-server.yaml index 7bd91932c..710773b7c 100644 --- a/examples/single-server.yaml +++ b/examples/single-server.yaml @@ -3,6 +3,6 @@ kind: "ArangoDeployment" metadata: name: "example-simple-single" spec: - mode: single + mode: Single single: storageClassName: my-local-ssd diff --git a/pkg/apis/deployment/v1alpha/deployment_mode.go b/pkg/apis/deployment/v1alpha/deployment_mode.go index 0be3a5382..c7d40f9a3 100644 --- a/pkg/apis/deployment/v1alpha/deployment_mode.go +++ b/pkg/apis/deployment/v1alpha/deployment_mode.go @@ -31,11 +31,11 @@ type DeploymentMode string const ( // DeploymentModeSingle yields a single server - DeploymentModeSingle DeploymentMode = "single" + DeploymentModeSingle DeploymentMode = "Single" // DeploymentModeResilientSingle yields an agency and a resilient-single server pair - DeploymentModeResilientSingle DeploymentMode = "resilientsingle" + DeploymentModeResilientSingle DeploymentMode = "ResilientSingle" // DeploymentModeCluster yields an full cluster (agency, dbservers & coordinators) - DeploymentModeCluster DeploymentMode = "cluster" + DeploymentModeCluster DeploymentMode = "Cluster" ) // Validate the mode. @@ -49,22 +49,22 @@ func (m DeploymentMode) Validate() error { } } -// HasSingleServers returns true when the given mode is "single" or "resilientsingle". +// HasSingleServers returns true when the given mode is "Single" or "ResilientSingle". func (m DeploymentMode) HasSingleServers() bool { return m == DeploymentModeSingle || m == DeploymentModeResilientSingle } -// HasAgents returns true when the given mode is "resilientsingle" or "cluster". +// HasAgents returns true when the given mode is "ResilientSingle" or "Cluster". func (m DeploymentMode) HasAgents() bool { return m == DeploymentModeResilientSingle || m == DeploymentModeCluster } -// HasDBServers returns true when the given mode is "cluster". +// HasDBServers returns true when the given mode is "Cluster". func (m DeploymentMode) HasDBServers() bool { return m == DeploymentModeCluster } -// HasCoordinators returns true when the given mode is "cluster". +// HasCoordinators returns true when the given mode is "Cluster". func (m DeploymentMode) HasCoordinators() bool { return m == DeploymentModeCluster } diff --git a/pkg/apis/deployment/v1alpha/deployment_mode_test.go b/pkg/apis/deployment/v1alpha/deployment_mode_test.go index ec1bbeeba..b655281b7 100644 --- a/pkg/apis/deployment/v1alpha/deployment_mode_test.go +++ b/pkg/apis/deployment/v1alpha/deployment_mode_test.go @@ -30,17 +30,17 @@ import ( func TestDeploymentModeValidate(t *testing.T) { // Valid - assert.Nil(t, DeploymentMode("single").Validate()) - assert.Nil(t, DeploymentMode("resilientsingle").Validate()) - assert.Nil(t, DeploymentMode("cluster").Validate()) + assert.Nil(t, DeploymentMode("Single").Validate()) + assert.Nil(t, DeploymentMode("ResilientSingle").Validate()) + assert.Nil(t, DeploymentMode("Cluster").Validate()) // Not valid assert.Error(t, DeploymentMode("").Validate()) assert.Error(t, DeploymentMode(" cluster").Validate()) assert.Error(t, DeploymentMode("singles").Validate()) - assert.Error(t, DeploymentMode("Single").Validate()) - assert.Error(t, DeploymentMode("Resilientsingle").Validate()) - assert.Error(t, DeploymentMode("Cluster").Validate()) + assert.Error(t, DeploymentMode("single").Validate()) + assert.Error(t, DeploymentMode("resilientsingle").Validate()) + assert.Error(t, DeploymentMode("cluster").Validate()) } func TestDeploymentModeHasX(t *testing.T) { diff --git a/pkg/apis/deployment/v1alpha/environment.go b/pkg/apis/deployment/v1alpha/environment.go index 62bbfb9d5..458c829c7 100644 --- a/pkg/apis/deployment/v1alpha/environment.go +++ b/pkg/apis/deployment/v1alpha/environment.go @@ -31,9 +31,9 @@ type Environment string const ( // EnvironmentDevelopment yields a cluster optimized for development - EnvironmentDevelopment Environment = "development" + EnvironmentDevelopment Environment = "Development" // EnvironmentProduction yields a cluster optimized for production - EnvironmentProduction Environment = "production" + EnvironmentProduction Environment = "Production" ) // Validate the environment. diff --git a/pkg/apis/deployment/v1alpha/environment_test.go b/pkg/apis/deployment/v1alpha/environment_test.go index 0c7c44f32..c4dbec753 100644 --- a/pkg/apis/deployment/v1alpha/environment_test.go +++ b/pkg/apis/deployment/v1alpha/environment_test.go @@ -30,12 +30,12 @@ import ( func TestEnvironmentValidate(t *testing.T) { // Valid - assert.Nil(t, Environment("development").Validate()) - assert.Nil(t, Environment("production").Validate()) + assert.Nil(t, Environment("Development").Validate()) + assert.Nil(t, Environment("Production").Validate()) // Not valid assert.Error(t, Environment("").Validate()) assert.Error(t, Environment(" development").Validate()) - assert.Error(t, Environment("Development").Validate()) - assert.Error(t, Environment("Production").Validate()) + assert.Error(t, Environment("development").Validate()) + assert.Error(t, Environment("production").Validate()) } diff --git a/pkg/apis/deployment/v1alpha/storage_engine.go b/pkg/apis/deployment/v1alpha/storage_engine.go index 354c1a3b5..01648f26a 100644 --- a/pkg/apis/deployment/v1alpha/storage_engine.go +++ b/pkg/apis/deployment/v1alpha/storage_engine.go @@ -31,9 +31,9 @@ type StorageEngine string const ( // StorageEngineMMFiles yields a cluster using the mmfiles storage engine - StorageEngineMMFiles StorageEngine = "mmfiles" + StorageEngineMMFiles StorageEngine = "MMFiles" // StorageEngineRocksDB yields a cluster using the rocksdb storage engine - StorageEngineRocksDB StorageEngine = "rocksdb" + StorageEngineRocksDB StorageEngine = "RocksDB" ) // Validate the storage engine. diff --git a/pkg/apis/deployment/v1alpha/storage_engine_test.go b/pkg/apis/deployment/v1alpha/storage_engine_test.go index 81a109173..4a4260a97 100644 --- a/pkg/apis/deployment/v1alpha/storage_engine_test.go +++ b/pkg/apis/deployment/v1alpha/storage_engine_test.go @@ -30,12 +30,12 @@ import ( func TestStorageEngineValidate(t *testing.T) { // Valid - assert.Nil(t, StorageEngine("mmfiles").Validate()) - assert.Nil(t, StorageEngine("rocksdb").Validate()) + assert.Nil(t, StorageEngine("MMFiles").Validate()) + assert.Nil(t, StorageEngine("RocksDB").Validate()) // Not valid assert.Error(t, StorageEngine("").Validate()) assert.Error(t, StorageEngine(" mmfiles").Validate()) - assert.Error(t, StorageEngine("MMFiles").Validate()) - assert.Error(t, StorageEngine("RocksDB").Validate()) + assert.Error(t, StorageEngine("mmfiles").Validate()) + assert.Error(t, StorageEngine("rocksdb").Validate()) } diff --git a/pkg/deployment/resources/pod_creator.go b/pkg/deployment/resources/pod_creator.go index ca68422e3..a27fbb17e 100644 --- a/pkg/deployment/resources/pod_creator.go +++ b/pkg/deployment/resources/pod_creator.go @@ -92,7 +92,7 @@ func createArangodArgs(apiObject metav1.Object, deplSpec api.DeploymentSpec, gro // Storage engine options = append(options, - optionPair{"--server.storage-engine", string(deplSpec.GetStorageEngine())}, + optionPair{"--server.storage-engine", strings.ToLower(string(deplSpec.GetStorageEngine()))}, ) // Logging