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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
- Update UBI Image to 8.4
- Fix ArangoSync Liveness Prove
- Fix ArangoSync Liveness Probe
- Allow runtime update of Sidecar images
- Allow Agent recreation with preserved IDs
- The internal metrics exporter can not be disabled

## [1.2.2](https://github.com/arangodb/kube-arangodb/tree/1.2.2) (2021-09-09)
- Update 'github.com/arangodb/arangosync-client' dependency to v0.7.0
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Feature-wise production readiness table:
| Operator Maintenance Management Support | 1.2.0 | >= 3.6.0 | Community, Enterprise | Production | True | --deployment.feature.maintenance | N/A |
| Operator Internal Metrics Exporter | 1.1.9 | >= 3.6.0 | Community, Enterprise | Alpha | False | --deployment.feature.metrics-exporter | N/A |
| Operator Internal Metrics Exporter | 1.2.0 | >= 3.6.0 | Community, Enterprise | Production | True | --deployment.feature.metrics-exporter | N/A |
| Operator Internal Metrics Exporter | 1.2.3 | >= 3.6.0 | Community, Enterprise | Production | True | --deployment.feature.metrics-exporter | It is always enabled |
| Operator Ephemeral Volumes | 1.2.2 | >= 3.7.0 | Community, Enterprise | Alpha | False | --deployment.feature.ephemeral-volumes | N/A |

## Release notes for 0.3.16
Expand Down
95 changes: 80 additions & 15 deletions pkg/deployment/deployment_core_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2020 ArangoDB GmbH, Cologne, Germany
// Copyright 2020-2021 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.
Expand All @@ -23,18 +23,18 @@
package deployment

import (
"fmt"
"os"
"path/filepath"
"testing"

"github.com/arangodb/kube-arangodb/pkg/util/constants"

"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"

"github.com/stretchr/testify/require"

"github.com/arangodb/kube-arangodb/pkg/util"
core "k8s.io/api/core/v1"

api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
core "k8s.io/api/core/v1"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/constants"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
)

func TestEnsurePod_ArangoDB_Core(t *testing.T) {
Expand Down Expand Up @@ -913,12 +913,14 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
}

testCase.createTestPodData(deployment, api.ServerGroupAgents, firstAgentStatus)
testCase.ExpectedPod.ObjectMeta.Labels[k8sutil.LabelKeyArangoExporter] = testYes
},
ExpectedEvent: "member agent is created",
ExpectedPod: core.Pod{
Spec: core.PodSpec{
Volumes: []core.Volume{
k8sutil.CreateVolumeEmptyDir(k8sutil.ArangodVolumeName),
k8sutil.CreateVolumeWithSecret(k8sutil.ExporterJWTVolumeName, testExporterToken),
},
Containers: []core.Container{
{
Expand All @@ -934,6 +936,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
ImagePullPolicy: core.PullIfNotPresent,
SecurityContext: securityContext.NewSecurityContext(),
},
testArangodbInternalExporterContainer(false, emptyResources),
},
RestartPolicy: core.RestartPolicyNever,
TerminationGracePeriodSeconds: &defaultAgentTerminationTimeout,
Expand All @@ -945,7 +948,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
},
},
{
Name: "DBserver Pod with metrics exporter",
Name: "DBserver Pod with internal metrics exporter",
ArangoDeployment: &api.ArangoDeployment{
Spec: api.DeploymentSpec{
Image: util.NewString(testImage),
Expand Down Expand Up @@ -988,7 +991,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
ImagePullPolicy: core.PullIfNotPresent,
SecurityContext: securityContext.NewSecurityContext(),
},
testCreateExporterContainer(false, emptyResources),
testArangodbInternalExporterContainer(false, emptyResources),
},
RestartPolicy: core.RestartPolicyNever,
TerminationGracePeriodSeconds: &defaultDBServerTerminationTimeout,
Expand All @@ -1008,7 +1011,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
TLS: noTLS,
Metrics: api.MetricsSpec{
Enabled: util.NewBool(true),
Image: util.NewString(testExporterImage),
Image: util.NewString(testImage),
Authentication: api.MetricsAuthenticationSpec{
JWTTokenSecretName: util.NewString(testExporterToken),
},
Expand Down Expand Up @@ -1050,7 +1053,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
ImagePullPolicy: core.PullIfNotPresent,
SecurityContext: securityContext.NewSecurityContext(),
},
testCreateExporterContainer(false, k8sutil.ExtractPodResourceRequirement(resourcesUnfiltered)),
testArangodbInternalExporterContainer(false, k8sutil.ExtractPodResourceRequirement(resourcesUnfiltered)),
},
RestartPolicy: core.RestartPolicyNever,
TerminationGracePeriodSeconds: &defaultDBServerTerminationTimeout,
Expand Down Expand Up @@ -1123,7 +1126,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
ImagePullPolicy: core.PullIfNotPresent,
SecurityContext: securityContext.NewSecurityContext(),
},
testCreateExporterContainer(false, emptyResources),
testArangodbInternalExporterContainer(false, emptyResources),
},
RestartPolicy: core.RestartPolicyNever,
TerminationGracePeriodSeconds: &defaultDBServerTerminationTimeout,
Expand Down Expand Up @@ -1195,7 +1198,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
ImagePullPolicy: core.PullIfNotPresent,
SecurityContext: securityContext.NewSecurityContext(),
},
testCreateExporterContainer(false, emptyResources),
testArangodbInternalExporterContainer(false, emptyResources),
},
RestartPolicy: core.RestartPolicyNever,
TerminationGracePeriodSeconds: &defaultDBServerTerminationTimeout,
Expand Down Expand Up @@ -1289,7 +1292,7 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
Resources: emptyResources,
},
func() core.Container {
c := testCreateExporterContainer(true, emptyResources)
c := testArangodbInternalExporterContainer(true, emptyResources)
c.VolumeMounts = append(c.VolumeMounts, k8sutil.TlsKeyfileVolumeMount())
return c
}(),
Expand Down Expand Up @@ -1435,3 +1438,65 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {

runTestCases(t, testCases...)
}

func testArangodbInternalExporterContainer(secure bool, resources core.ResourceRequirements, ports ...int32) core.Container {

var port int32 = k8sutil.ArangoExporterPort
if len(ports) > 0 {
port = ports[0]
}

return core.Container{
Name: k8sutil.ExporterContainerName,
Image: testImage,
Command: createTestInternalExporterCommand(secure, port),
Ports: []core.ContainerPort{
{
Name: string(api.MetricsModeExporter),
ContainerPort: port,
Protocol: core.ProtocolTCP,
},
},
LivenessProbe: createTestExporterLivenessProbe(secure),
Resources: resources,
ImagePullPolicy: core.PullIfNotPresent,
SecurityContext: &core.SecurityContext{
Capabilities: &core.Capabilities{
Drop: []core.Capability{
"ALL",
},
},
},
VolumeMounts: []core.VolumeMount{
k8sutil.LifecycleVolumeMount(),
k8sutil.ExporterJWTVolumeMount(),
},
}
}

func createTestInternalExporterCommand(secure bool, port int32) []string {
binaryPath, err := os.Executable()
if err != nil {
return []string{}
}
exePath := filepath.Join(k8sutil.LifecycleVolumeMountDir, filepath.Base(binaryPath))

args := []string{exePath, "exporter"}
if secure {
args = append(args, "--arangodb.endpoint=https://localhost:8529/_admin/metrics")
} else {
args = append(args, "--arangodb.endpoint=http://localhost:8529/_admin/metrics")
}

args = append(args, "--arangodb.jwt-file=/secrets/exporter/jwt/token")

if port != k8sutil.ArangoExporterPort {
args = append(args, fmt.Sprintf("--server.address=:%d", port))
}

if secure {
args = append(args, "--ssl.keyfile=/secrets/tls/tls.keyfile")
}

return args
}
2 changes: 1 addition & 1 deletion pkg/deployment/deployment_definitions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ var (

metricsSpec = api.MetricsSpec{
Enabled: util.NewBool(true),
Image: util.NewString(testExporterImage),
Image: util.NewString(testImage),
Authentication: api.MetricsAuthenticationSpec{
JWTTokenSecretName: util.NewString(testExporterToken),
},
Expand Down
16 changes: 7 additions & 9 deletions pkg/deployment/deployment_encryption_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2020 ArangoDB GmbH, Cologne, Germany
// Copyright 2020-2021 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.
Expand All @@ -18,6 +18,7 @@
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
// Author Adam Janikowski
// Author Tomasz Mielech
//

package deployment
Expand All @@ -26,16 +27,13 @@ import (
"fmt"
"testing"

"github.com/arangodb/kube-arangodb/pkg/util/constants"

"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"

"github.com/stretchr/testify/require"

"github.com/arangodb/kube-arangodb/pkg/util"
core "k8s.io/api/core/v1"

api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
core "k8s.io/api/core/v1"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/constants"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
)

func TestEnsurePod_ArangoDB_Encryption(t *testing.T) {
Expand Down Expand Up @@ -184,7 +182,7 @@ func TestEnsurePod_ArangoDB_Encryption(t *testing.T) {
Resources: emptyResources,
},
func() core.Container {
c := testCreateExporterContainer(true, emptyResources)
c := testArangodbInternalExporterContainer(true, emptyResources)
c.VolumeMounts = append(c.VolumeMounts, k8sutil.TlsKeyfileVolumeMount())
return c
}(),
Expand Down
Loading