Skip to content

Commit

Permalink
Merge pull request #104 from arangodb/title-case-enums
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Renamed all enum values to title case
  • Loading branch information
ewoutp authored Apr 3, 2018
2 parents bb2daf8 + d5cd274 commit 33ef204
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 50 deletions.
4 changes: 2 additions & 2 deletions docs/Manual/GettingStarted/kube-arangodb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ kind: "ArangoDeployment"
metadata:
name: "single-server"
spec:
mode: single
mode: Single
```
Now insert this resource in your Kubernetes cluster using:
Expand Down Expand Up @@ -164,7 +164,7 @@ kind: "ArangoDeployment"
metadata:
name: "cluster"
spec:
mode: cluster
mode: Cluster
```

Now insert this resource in your Kubernetes cluster using:
Expand Down
2 changes: 1 addition & 1 deletion docs/Manual/Programs/kube-arangodb/config_and_secrets.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ kind: "Cluster"
metadata:
name: "example-arangodb-cluster"
spec:
mode: cluster
mode: Cluster
auth:
jwtSecretName: <name-of-JWT-token-secret>
```
33 changes: 17 additions & 16 deletions docs/Manual/Programs/kube-arangodb/deployment_resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ kind: "ArangoDeployment"
metadata:
name: "example-arangodb-cluster"
spec:
mode: cluster
mode: Cluster
```
Example more elaborate deployment definition:
Expand All @@ -24,7 +24,8 @@ kind: "ArangoDeployment"
metadata:
name: "example-arangodb-cluster"
spec:
mode: cluster
mode: Cluster
environment: Production
agents:
count: 3
args:
Expand All @@ -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 `<group>` where `<group>` 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.

Expand All @@ -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.

Expand All @@ -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.

Expand Down Expand Up @@ -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`

Expand Down
2 changes: 1 addition & 1 deletion docs/Manual/Programs/kube-arangodb/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-cluster-no-tls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ kind: "ArangoDeployment"
metadata:
name: "example-simple-cluster-no-tls"
spec:
mode: cluster
mode: Cluster
tls:
caSecretName: None
2 changes: 1 addition & 1 deletion examples/simple-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion examples/single-server-no-auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: "ArangoDeployment"
metadata:
name: "example-simple-single-no-auth"
spec:
mode: single
mode: Single
auth:
jwtSecretName: None

2 changes: 1 addition & 1 deletion examples/single-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ kind: "ArangoDeployment"
metadata:
name: "example-simple-single"
spec:
mode: single
mode: Single
single:
storageClassName: my-local-ssd
14 changes: 7 additions & 7 deletions pkg/apis/deployment/v1alpha/deployment_mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/apis/deployment/v1alpha/deployment_mode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/deployment/v1alpha/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions pkg/apis/deployment/v1alpha/environment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
4 changes: 2 additions & 2 deletions pkg/apis/deployment/v1alpha/storage_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions pkg/apis/deployment/v1alpha/storage_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
2 changes: 1 addition & 1 deletion pkg/deployment/resources/pod_creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 33ef204

Please sign in to comment.