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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ vendor/
deps/
.vscode/
**/*.enterprise.go
**/*.enterprise.go
**/enterprise/**
enterprise.mk
local/
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- (Feature) Add CRD Installer
- (Bugfix) Assign imagePullSecrets to LocalStorage
- (Update) Bump K8S API to 1.21.10
- (Feature) (ACS) Add ACS handler

## [1.2.8](https://github.com/arangodb/kube-arangodb/tree/1.2.8) (2022-02-24)
- Do not check License V2 on Community images
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ metadata:
release: {{ .Release.Name }}
rules:
- apiGroups: ["database.arangodb.com"]
resources: ["arangodeployments", "arangodeployments/status","arangomembers", "arangomembers/status"]
resources: ["arangodeployments", "arangodeployments/status","arangomembers", "arangomembers/status", "arangoclustersynchronizations", "arangoclustersynchronizations/status"]
verbs: ["*"]
- apiGroups: [""]
resources: ["pods", "services", "endpoints", "persistentvolumeclaims", "events", "secrets", "serviceaccounts"]
Expand Down
7 changes: 1 addition & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ require (
github.com/arangodb/go-driver v1.2.1
github.com/arangodb/go-driver/v2 v2.0.0-20211021031401-d92dcd5a4c83
github.com/arangodb/go-upgrade-rules v0.0.0-20180809110947-031b4774ff21
//github.com/arangodb/rebalancer v0.1.1
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9
github.com/ghodss/yaml v1.0.0
Expand All @@ -55,11 +54,6 @@ require (
k8s.io/klog v1.0.0
)

require (
github.com/arangodb/rebalancer v0.1.1
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
)

require (
github.com/arangodb/go-velocypack v0.0.0-20200318135517-5af53c29c67e // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand Down Expand Up @@ -102,6 +96,7 @@ require (
golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602 // indirect
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect
Expand Down
8 changes: 8 additions & 0 deletions pkg/apis/deployment/v1/cluster_synchronization_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,12 @@
package v1

type ArangoClusterSynchronizationSpec struct {
DeploymentName string `json:"deploymentName,omitempty"`
KubeConfig *ArangoClusterSynchronizationKubeConfigSpec `json:"kubeconfig,omitempty"`
}

type ArangoClusterSynchronizationKubeConfigSpec struct {
SecretName string `json:"secretName"`
SecretKey string `json:"secretKey"`
Namespace string `json:"namespace"`
}
10 changes: 10 additions & 0 deletions pkg/apis/deployment/v1/cluster_synchronization_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,15 @@

package v1

import "k8s.io/apimachinery/pkg/types"

type ArangoClusterSynchronizationStatus struct {
Deployment *ArangoClusterSynchronizationDeploymentStatus `json:"deployment,omitempty"`
Conditions ConditionList `json:"conditions,omitempty"`
}

type ArangoClusterSynchronizationDeploymentStatus struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
UID types.UID `json:"uid"`
}
53 changes: 51 additions & 2 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.

7 changes: 7 additions & 0 deletions pkg/apis/deployment/v2alpha1/cluster_synchronization_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,11 @@
package v2alpha1

type ArangoClusterSynchronizationSpec struct {
DeploymentName *string `json:"deploymentName,omitempty"`
KubeConfig *ArangoClusterSynchronizationKubeConfigSpec `json:"kubeconfig,omitempty"`
}

type ArangoClusterSynchronizationKubeConfigSpec struct {
SecretName string `json:"secretName"`
Namespace string `json:"namespace"`
}
12 changes: 12 additions & 0 deletions pkg/apis/deployment/v2alpha1/cluster_synchronization_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,17 @@

package v2alpha1

import "k8s.io/apimachinery/pkg/types"

type ArangoClusterSynchronizationStatus struct {
Deployment *ArangoClusterSynchronizationDeploymentStatus `json:"deployment,omitempty"`
KubeConfig *ArangoClusterSynchronizationKubeConfigStatus `json:"kubeconfig,omitempty"`
}

type ArangoClusterSynchronizationDeploymentStatus struct {
UID types.UID `json:"UID"`
}

type ArangoClusterSynchronizationKubeConfigStatus struct {
Conditions ConditionList `json:"conditions,omitempty"`
}
79 changes: 77 additions & 2 deletions pkg/apis/deployment/v2alpha1/zz_generated.deepcopy.go

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

34 changes: 34 additions & 0 deletions pkg/deployment/acs/acs.community.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// DISCLAIMER
//
// Copyright 2016-2022 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
//go:build !enterprise
// +build !enterprise

package acs

import (
"context"

api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
inspectorInterface "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector"
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
)

func Inspect(ctx context.Context, deployment *api.ArangoDeployment, client kclient.Client, cachedStatus inspectorInterface.Inspector) error {
return nil
}
28 changes: 28 additions & 0 deletions pkg/deployment/acs/sutil/conditions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// DISCLAIMER
//
// Copyright 2016-2022 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
//

package sutil

import api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"

const (
DeploymentReadyCondition api.ConditionType = "DeploymentReady"
KubernetesConnectedCondition api.ConditionType = "KubernetesConnected"
)
9 changes: 7 additions & 2 deletions pkg/deployment/deployment_inspector.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ import (
"github.com/arangodb/kube-arangodb/pkg/apis/deployment"

api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
"github.com/arangodb/kube-arangodb/pkg/deployment/acs"
"github.com/arangodb/kube-arangodb/pkg/metrics"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var (
Expand Down Expand Up @@ -84,7 +85,7 @@ func (d *Deployment) inspectDeployment(lastInterval util.Interval) util.Interval
var updated *api.ArangoDeployment
err = globals.GetGlobalTimeouts().Kubernetes().RunWithTimeout(ctxReconciliation, func(ctxChild context.Context) error {
var err error
updated, err = d.deps.Client.Arango().DatabaseV1().ArangoDeployments(d.GetNamespace()).Get(ctxChild, deploymentName, metav1.GetOptions{})
updated, err = d.deps.Client.Arango().DatabaseV1().ArangoDeployments(d.GetNamespace()).Get(ctxChild, deploymentName, meta.GetOptions{})
return err
})
if k8sutil.IsNotFound(err) {
Expand Down Expand Up @@ -174,6 +175,10 @@ func (d *Deployment) inspectDeploymentWithError(ctx context.Context, lastInterva
}
}

if err := acs.Inspect(ctx, d.apiObject, d.deps.Client, cachedStatus); err != nil {
d.deps.Log.Warn().Err(err).Msgf("Unable to handle ACS objects")
}

// Cleanup terminated pods on the beginning of loop
if x, err := d.resources.CleanupTerminatedPods(ctx, cachedStatus); err != nil {
return minInspectionInterval, errors.Wrapf(err, "Pod cleanup failed")
Expand Down
Loading