Skip to content

Commit 620e75e

Browse files
authored
Merge branch 'master' into GT-16/agency-leader-discovery
2 parents d23a2fd + cf46f5b commit 620e75e

File tree

92 files changed

+991
-603
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+991
-603
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
44
- (Bugfix) Fix arangosync members state inspection
55
- (Feature) (ACS) Improve Reconciliation Loop
6+
- (Bugfix) Allow missing Monitoring CRD
7+
- (Feature) (ACS) Add Resource plan
8+
- (Feature) Allow raw json value for license token-v2
9+
- (Update) Replace `beta.kubernetes.io/arch` to `kubernetes.io/arch` in Operator Chart
10+
- (Feature) Add operator shutdown handler for graceful termination
611
- (Feature) Add agency leader discovery.
712

813
## [1.2.12](https://github.com/arangodb/kube-arangodb/tree/1.2.12) (2022-05-10)

chart/arangodb-ingress-proxy/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spec:
3131
requiredDuringSchedulingIgnoredDuringExecution:
3232
nodeSelectorTerms:
3333
- matchExpressions:
34-
- key: beta.kubernetes.io/arch
34+
- key: kubernetes.io/arch
3535
operator: In
3636
values:
3737
- amd64

chart/kube-arangodb/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ spec:
6060
requiredDuringSchedulingIgnoredDuringExecution:
6161
nodeSelectorTerms:
6262
- matchExpressions:
63-
- key: beta.kubernetes.io/arch
63+
- key: kubernetes.io/arch
6464
operator: In
6565
values:
6666
{{- range .Values.operator.architectures }}

cmd/main.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ import (
3333

3434
"github.com/arangodb/kube-arangodb/pkg/util/globals"
3535

36-
operatorHTTP "github.com/arangodb/kube-arangodb/pkg/util/http"
3736
"github.com/gin-gonic/gin"
3837

38+
operatorHTTP "github.com/arangodb/kube-arangodb/pkg/util/http"
39+
3940
"github.com/arangodb/kube-arangodb/pkg/version"
4041

4142
"github.com/arangodb/kube-arangodb/pkg/operator/scope"
@@ -61,6 +62,9 @@ import (
6162
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
6263
"k8s.io/client-go/tools/record"
6364

65+
v1 "k8s.io/api/core/v1"
66+
"k8s.io/klog"
67+
6468
"github.com/arangodb/kube-arangodb/pkg/crd"
6569
"github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/scheme"
6670
"github.com/arangodb/kube-arangodb/pkg/logging"
@@ -71,8 +75,6 @@ import (
7175
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
7276
"github.com/arangodb/kube-arangodb/pkg/util/probe"
7377
"github.com/arangodb/kube-arangodb/pkg/util/retry"
74-
v1 "k8s.io/api/core/v1"
75-
"k8s.io/klog"
7678
)
7779

7880
const (
@@ -83,6 +85,8 @@ const (
8385
defaultAlpineImage = "alpine:3.7"
8486
defaultMetricsExporterImage = "arangodb/arangodb-exporter:0.1.6"
8587
defaultArangoImage = "arangodb/arangodb:latest"
88+
defaultShutdownDelay = 2 * time.Second
89+
defaultShutdownTimeout = 30 * time.Second
8690

8791
UBIImageEnv util.EnvironmentVariable = "RELATED_IMAGE_UBI"
8892
ArangoImageEnv util.EnvironmentVariable = "RELATED_IMAGE_DATABASE"
@@ -121,6 +125,10 @@ var (
121125
singleMode bool
122126
scope string
123127
}
128+
shutdownOptions struct {
129+
delay time.Duration
130+
timeout time.Duration
131+
}
124132
crdOptions struct {
125133
install bool
126134
}
@@ -180,6 +188,8 @@ func init() {
180188
f.DurationVar(&operatorTimeouts.arangoDCheck, "timeout.arangod-check", globals.DefaultArangoDCheckTimeout, "The version check request timeout to the ArangoDB")
181189
f.DurationVar(&operatorTimeouts.agency, "timeout.agency", globals.DefaultArangoDAgencyTimeout, "The Agency read timeout")
182190
f.DurationVar(&operatorTimeouts.reconciliation, "timeout.reconciliation", globals.DefaultReconciliationTimeout, "The reconciliation timeout to the ArangoDB CR")
191+
f.DurationVar(&shutdownOptions.delay, "shutdown.delay", defaultShutdownDelay, "The delay before running shutdown handlers")
192+
f.DurationVar(&shutdownOptions.timeout, "shutdown.timeout", defaultShutdownTimeout, "Timeout for shutdown handlers")
183193
f.BoolVar(&operatorOptions.scalingIntegrationEnabled, "internal.scaling-integration", true, "Enable Scaling Integration")
184194
f.Int64Var(&operatorKubernetesOptions.maxBatchSize, "kubernetes.max-batch-size", globals.DefaultKubernetesRequestBatchSize, "Size of batch during objects read")
185195
f.Float32Var(&operatorKubernetesOptions.qps, "kubernetes.qps", kclient.DefaultQPS, "Number of queries per second for k8s API")
@@ -421,6 +431,8 @@ func newOperatorConfigAndDeps(id, namespace, name string) (operator.Config, oper
421431
ArangoImage: operatorOptions.arangoImage,
422432
SingleMode: operatorOptions.singleMode,
423433
Scope: scope,
434+
ShutdownDelay: shutdownOptions.delay,
435+
ShutdownTimeout: shutdownOptions.timeout,
424436
}
425437
deps := operator.Dependencies{
426438
LogService: logService,

docs/design/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
- [Status](./status.md)
1010
- [Upgrading](./upgrading.md)
1111
- [Rotating Pods](./rotating.md)
12-
- [Maintenance](./maintenance.md)
12+
- [Maintenance](./maintenance.md)
13+
- [Additional configuration](./additional_configuration.md)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Additional configuration
2+
3+
It is possible to additionally fine-tune operator behavior by
4+
providing arguments via `operator.args` chart template value.
5+
6+
For example, you can specify burst size for k8s API requests or how long the operator
7+
should wait for ArangoDeployment termination after receiving interruption signal:
8+
```
9+
operator:
10+
args: ["--kubernetes.burst=40", --shutdown.timeout=2m"]
11+
```
12+
13+
The full list of available arguments can be retrieved using
14+
```
15+
export OPERATOR_IMAGE=arangodb/kube-arangodb:1.2.9
16+
kubectl run arango-operator-help --image=$OPERATOR_IMAGE -i --rm --restart=Never -- --help
17+
```

pkg/apis/deployment/v1/deployment_status.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ type DeploymentStatus struct {
6464
// HighPriorityPlan to update this deployment. Executed before plan
6565
HighPriorityPlan Plan `json:"highPriorityPlan,omitempty"`
6666

67+
// ResourcesPlan to update this deployment. Executed before plan, after highPlan
68+
ResourcesPlan Plan `json:"resourcesPlan,omitempty"`
69+
6770
// AcceptedSpec contains the last specification that was accepted by the operator.
6871
AcceptedSpec *DeploymentSpec `json:"accepted-spec,omitempty"`
6972

@@ -103,6 +106,8 @@ func (ds *DeploymentStatus) Equal(other DeploymentStatus) bool {
103106
ds.Members.Equal(other.Members) &&
104107
ds.Conditions.Equal(other.Conditions) &&
105108
ds.Plan.Equal(other.Plan) &&
109+
ds.HighPriorityPlan.Equal(other.HighPriorityPlan) &&
110+
ds.ResourcesPlan.Equal(other.ResourcesPlan) &&
106111
ds.AcceptedSpec.Equal(other.AcceptedSpec) &&
107112
ds.SecretHashes.Equal(other.SecretHashes) &&
108113
ds.Agency.Equal(other.Agency) &&

pkg/apis/deployment/v1/plan.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ const (
192192
// Rebalancer
193193
ActionTypeRebalancerGenerate ActionType = "RebalancerGenerate"
194194
ActionTypeRebalancerCheck ActionType = "RebalancerCheck"
195+
196+
// Resources
197+
ActionTypeResourceSync ActionType = "ResourceSync"
195198
)
196199

197200
const (

pkg/apis/deployment/v1/zz_generated.deepcopy.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/deployment/v2alpha1/cluster_synchronization_spec.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
package v2alpha1
2222

23+
import (
24+
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
25+
"github.com/pkg/errors"
26+
)
27+
2328
type ArangoClusterSynchronizationSpec struct {
2429
DeploymentName string `json:"deploymentName,omitempty"`
2530
KubeConfig *ArangoClusterSynchronizationKubeConfigSpec `json:"kubeconfig,omitempty"`
@@ -30,3 +35,15 @@ type ArangoClusterSynchronizationKubeConfigSpec struct {
3035
SecretKey string `json:"secretKey"`
3136
Namespace string `json:"namespace"`
3237
}
38+
39+
func (a *ArangoClusterSynchronizationKubeConfigSpec) Validate() error {
40+
if a == nil {
41+
return errors.Errorf("KubeConfig Spec cannot be nil")
42+
}
43+
44+
return shared.WithErrors(
45+
shared.PrefixResourceError("secretName", shared.ValidateResourceName(a.SecretName)),
46+
shared.PrefixResourceError("secretKey", shared.ValidateResourceName(a.SecretKey)),
47+
shared.PrefixResourceError("namespace", shared.ValidateResourceName(a.Namespace)),
48+
)
49+
}

0 commit comments

Comments
 (0)