Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Change Log

## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
- Add Operator Maintenance Management feature

## [1.0.6](https://github.com/arangodb/kube-arangodb/tree/1.0.6) (2020-08-19)
- Add Operator Namespaced mode (Alpha)
Expand Down
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,26 @@ covers individual newer features separately.

Feature-wise production readiness table:

| Feature | Operator Version | ArangoDB Version | ArangoDB Edition | State | Enabled | Flag | Remarks |
|---------------------------------|------------------|------------------|-----------------------|------------|---------|------------------------------------------|--------------------------------------------------------------------------|
| Pod Disruption Budgets | 0.3.10 | Any | Community, Enterprise | Alpha | True | N/A | N/A |
| Pod Disruption Budgets | 0.3.11 | Any | Community, Enterprise | Production | True | N/A | N/A |
| Volume Resizing | 0.3.10 | Any | Community, Enterprise | Alpha | True | N/A | N/A |
| Volume Resizing | 0.3.11 | Any | Community, Enterprise | Production | True | N/A | N/A |
| Disabling of liveness probes | 0.3.10 | Any | Community, Enterprise | Alpha | True | N/A | N/A |
| Disabling of liveness probes | 0.3.11 | Any | Community, Enterprise | Production | True | N/A | N/A |
| Volume Claim Templates | 0.3.11 | Any | Community, Enterprise | Alpha | True | N/A | N/A |
| Volume Claim Templates | 1.0.0 | Any | Community, Enterprise | Production | True | N/A | N/A |
| Prometheus Metrics Exporter | 0.3.11 | Any | Community, Enterprise | Alpha | True | N/A | Prometheus required |
| Prometheus Metrics Exporter | 1.0.0 | Any | Community, Enterprise | Production | True | N/A | Prometheus required |
| Sidecar Containers | 0.3.11 | Any | Community, Enterprise | Alpha | True | N/A | N/A |
| Sidecar Containers | 1.0.0 | Any | Community, Enterprise | Production | True | N/A | N/A |
| Operator Single Mode | 1.0.4 | Any | Community, Enterprise | Production | False | --mode.single | Only 1 instance of Operator allowed in namespace when feature is enabled |
| TLS SNI Support | 1.0.3 | >= 3.7.0 | Enterprise | Production | True | --deployment.feature.tls-sni | N/A |
| TLS Runtime Rotation Support | 1.0.4 | > 3.7.0 | Enterprise | Alpha | False | --deployment.feature.tls-rotation | N/A |
| JWT Rotation Support | 1.0.4 | > 3.7.0 | Enterprise | Alpha | False | --deployment.feature.jwt-rotation | N/A |
| Encryption Key Rotation Support | 1.0.4 | > 3.7.0 | Enterprise | Alpha | False | --deployment.feature.encryption-rotation | N/A |
| Feature | Operator Version | ArangoDB Version | ArangoDB Edition | State | Enabled | Flag | Remarks |
|-----------------------------------------|------------------|------------------|-----------------------|------------|---------|------------------------------------------|--------------------------------------------------------------------------|
| Pod Disruption Budgets | 0.3.10 | Any | Community, Enterprise | Alpha | True | N/A | N/A |
| Pod Disruption Budgets | 0.3.11 | Any | Community, Enterprise | Production | True | N/A | N/A |
| Volume Resizing | 0.3.10 | Any | Community, Enterprise | Alpha | True | N/A | N/A |
| Volume Resizing | 0.3.11 | Any | Community, Enterprise | Production | True | N/A | N/A |
| Disabling of liveness probes | 0.3.10 | Any | Community, Enterprise | Alpha | True | N/A | N/A |
| Disabling of liveness probes | 0.3.11 | Any | Community, Enterprise | Production | True | N/A | N/A |
| Volume Claim Templates | 0.3.11 | Any | Community, Enterprise | Alpha | True | N/A | N/A |
| Volume Claim Templates | 1.0.0 | Any | Community, Enterprise | Production | True | N/A | N/A |
| Prometheus Metrics Exporter | 0.3.11 | Any | Community, Enterprise | Alpha | True | N/A | Prometheus required |
| Prometheus Metrics Exporter | 1.0.0 | Any | Community, Enterprise | Production | True | N/A | Prometheus required |
| Sidecar Containers | 0.3.11 | Any | Community, Enterprise | Alpha | True | N/A | N/A |
| Sidecar Containers | 1.0.0 | Any | Community, Enterprise | Production | True | N/A | N/A |
| Operator Single Mode | 1.0.4 | Any | Community, Enterprise | Production | False | --mode.single | Only 1 instance of Operator allowed in namespace when feature is enabled |
| TLS SNI Support | 1.0.3 | >= 3.7.0 | Enterprise | Production | True | --deployment.feature.tls-sni | N/A |
| TLS Runtime Rotation Support | 1.0.4 | > 3.7.0 | Enterprise | Alpha | False | --deployment.feature.tls-rotation | N/A |
| JWT Rotation Support | 1.0.4 | > 3.7.0 | Enterprise | Alpha | False | --deployment.feature.jwt-rotation | N/A |
| Encryption Key Rotation Support | 1.0.4 | > 3.7.0 | Enterprise | Alpha | False | --deployment.feature.encryption-rotation | N/A |
| Operator Maintenance Management Support | 1.0.7 | >= 3.5.0 | Community, Enterprise | Alpha | False | --deployment.feature.maintenance | N/A |

## Release notes for 0.3.16

Expand Down
35 changes: 35 additions & 0 deletions pkg/apis/deployment/v1/database_spec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// DISCLAIMER
//
// Copyright 2020 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
// Author Adam Janikowski
//

package v1

type DatabaseSpec struct {
Maintenance *bool `json:"maintenance,omitempty"`
}

func (m *DatabaseSpec) GetMaintenance() bool {
if m == nil || m.Maintenance == nil {
return false
}

return *m.Maintenance
}
5 changes: 5 additions & 0 deletions pkg/apis/deployment/v1/deployment_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ type DeploymentSpec struct {

ID *ServerIDGroupSpec `json:"id,omitempty"`

Database *DatabaseSpec `json:"database,omitempty"`

Single ServerGroupSpec `json:"single"`
Agents ServerGroupSpec `json:"agents"`
DBServers ServerGroupSpec `json:"dbservers"`
Expand Down Expand Up @@ -295,6 +297,9 @@ func (s *DeploymentSpec) SetDefaultsFrom(source DeploymentSpec) {
if s.AllowUnsafeUpgrade == nil {
s.AllowUnsafeUpgrade = util.NewBoolOrNil(source.AllowUnsafeUpgrade)
}
if s.Database == nil {
s.Database = source.Database.DeepCopy()
}

s.License.SetDefaultsFrom(source.License)
s.ExternalAccess.SetDefaultsFrom(source.ExternalAccess)
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/deployment/v1/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ const (
ActionTypeJWTPropagated ActionType = "JWTPropagated"
// ActionTypeClusterMemberCleanup removes member from cluster
ActionTypeClusterMemberCleanup ActionType = "ClusterMemberCleanup"
// ActionTypeEnableMaintenance enables maintenance on cluster.
ActionTypeEnableMaintenance ActionType = "EnableMaintenance"
// ActionTypeEnableMaintenance disables maintenance on cluster.
ActionTypeDisableMaintenance ActionType = "DisableMaintenance"
)

const (
Expand Down
26 changes: 26 additions & 0 deletions pkg/apis/deployment/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 18 additions & 34 deletions pkg/deployment/agency/agency.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,25 @@

package agency

type ArangoPlanDatabases map[string]ArangoPlanCollections

func (a ArangoPlanDatabases) IsDBServerInDatabases(name string) bool {
for _, collections := range a {
if collections.IsDBServerInCollections(name) {
return true
}
}
return false
}

type ArangoPlanCollections map[string]ArangoPlanCollection

func (a ArangoPlanCollections) IsDBServerInCollections(name string) bool {
for _, collection := range a {
if collection.IsDBServerInShards(name) {
return true
import (
"context"

"github.com/arangodb/go-driver/agency"
"github.com/pkg/errors"
)

type Fetcher func(ctx context.Context, i interface{}, keyParts ...string) error

func NewFetcher(a agency.Agency) Fetcher {
return func(ctx context.Context, i interface{}, keyParts ...string) error {
if err := a.ReadKey(ctx, []string{
ArangoKey,
PlanKey,
PlanCollectionsKey,
}, i); err != nil {
return errors.WithStack(err)
}
}
return false
}

type ArangoPlanCollection struct {
Shards ArangoPlanShard `json:"shards"`
}

func (a ArangoPlanCollection) IsDBServerInShards(name string) bool {
for _, dbservers := range a.Shards {
for _, dbserver := range dbservers {
if dbserver == name {
return true
}
}
return nil
}
return false
}

type ArangoPlanShard map[string][]string
78 changes: 78 additions & 0 deletions pkg/deployment/agency/database.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//
// DISCLAIMER
//
// Copyright 2020 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
// Author Adam Janikowski
//

package agency

import (
"context"

"github.com/pkg/errors"
)

func GetAgencyCollections(ctx context.Context, f Fetcher) (*ArangoPlanDatabases, error) {
ret := &ArangoPlanDatabases{}

if err := f(ctx, ret, ArangoKey, PlanKey, PlanCollectionsKey); err != nil {
return nil, errors.WithStack(err)
}

return ret, nil
}

type ArangoPlanDatabases map[string]ArangoPlanCollections

func (a ArangoPlanDatabases) IsDBServerInDatabases(name string) bool {
for _, collections := range a {
if collections.IsDBServerInCollections(name) {
return true
}
}
return false
}

type ArangoPlanCollections map[string]ArangoPlanCollection

func (a ArangoPlanCollections) IsDBServerInCollections(name string) bool {
for _, collection := range a {
if collection.IsDBServerInShards(name) {
return true
}
}
return false
}

type ArangoPlanCollection struct {
Shards ArangoPlanShard `json:"shards"`
}

func (a ArangoPlanCollection) IsDBServerInShards(name string) bool {
for _, dbservers := range a.Shards {
for _, dbserver := range dbservers {
if dbserver == name {
return true
}
}
}
return false
}

type ArangoPlanShard map[string][]string
91 changes: 91 additions & 0 deletions pkg/deployment/agency/maintenance.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
//
// DISCLAIMER
//
// Copyright 2020 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
// Author Adam Janikowski
//

package agency

import (
"context"
"net/http"

"github.com/arangodb/go-driver"
)

type Maintenance struct {
Result string `json:"result"`
}

func (m Maintenance) Enabled() bool {
return m.Result == "Maintenance"
}

func GetMaintenanceMode(ctx context.Context, client driver.Client) (Maintenance, error) {
conn := client.Connection()
r, err := conn.NewRequest(http.MethodGet, "/_admin/cluster/maintenance")
if err != nil {
return Maintenance{}, err
}

resp, err := conn.Do(ctx, r)
if err != nil {
return Maintenance{}, err
}

if err := resp.CheckStatus(http.StatusOK); err != nil {
return Maintenance{}, err
}

var m Maintenance

if err := resp.ParseBody("", &m); err != nil {
return Maintenance{}, err
}

return m, nil
}

func SetMaintenanceMode(ctx context.Context, client driver.Client, enabled bool) error {
data := "on"
if !enabled {
data = "off"
}

conn := client.Connection()
r, err := conn.NewRequest(http.MethodPut, "/_admin/cluster/maintenance")
if err != nil {
return err
}

if _, err := r.SetBody(data); err != nil {
return err
}

resp, err := conn.Do(ctx, r)
if err != nil {
return err
}

if err := resp.CheckStatus(http.StatusOK); err != nil {
return err
}

return nil
}
2 changes: 2 additions & 0 deletions pkg/deployment/features/encryption.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
// Author Adam Janikowski
//

package features

Expand Down
Loading