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
Expand Up @@ -14,6 +14,7 @@
- (Refactor) Configurable throttle inspector
- (Bugfix) Skip Replace operation on DBServer if they need to be scaled down
- (Feature) Upgrade procedure steps
- (Refactor) Remove API and Core cross-dependency

## [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
5 changes: 3 additions & 2 deletions cmd/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import (
"github.com/arangodb/go-driver/jwt"
"github.com/arangodb/go-driver/v2/connection"
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util/constants"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
Expand Down Expand Up @@ -222,10 +223,10 @@ func getDeploymentAndCredentials(ctx context.Context,
// getArangoEndpoint returns ArangoDB endpoint with scheme and port for the given dnsName.
func getArangoEndpoint(secure bool, dnsName string) string {
if secure {
return "https://" + net.JoinHostPort(dnsName, strconv.Itoa(k8sutil.ArangoPort))
return "https://" + net.JoinHostPort(dnsName, strconv.Itoa(shared.ArangoPort))
}

return "http://" + net.JoinHostPort(dnsName, strconv.Itoa(k8sutil.ArangoPort))
return "http://" + net.JoinHostPort(dnsName, strconv.Itoa(shared.ArangoPort))
}

// getAgencyLeader returns the leader ID of the agency.
Expand Down
3 changes: 2 additions & 1 deletion cmd/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util/constants"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
Expand Down Expand Up @@ -187,7 +188,7 @@ type cmdLifecyclePreStopRunPort struct {

// Wait until port 8529 is closed.
func (c *cmdLifecyclePreStopRunPort) run(cmd *cobra.Command, args []string) error {
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(k8sutil.ArangoPort))
address := net.JoinHostPort("127.0.0.1", strconv.Itoa(shared.ArangoPort))

// Get environment
namespace := os.Getenv(constants.EnvOperatorPodNamespace)
Expand Down
6 changes: 3 additions & 3 deletions cmd/lifecycle_probes.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import (
"path"

"github.com/arangodb/go-driver/jwt"
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/deployment/pod"
"github.com/arangodb/kube-arangodb/pkg/util/constants"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
Expand All @@ -57,7 +57,7 @@ func init() {
f.BoolVarP(&probeInput.SSL, "ssl", "", false, "Determines if SSL is enabled")
f.BoolVarP(&probeInput.Auth, "auth", "", false, "Determines if authentication is enabled")
f.StringVarP(&probeInput.Endpoint, "endpoint", "", "/_api/version", "Endpoint (path) to call for lifecycle probe")
f.StringVarP(&probeInput.JWTPath, "jwt", "", k8sutil.ClusterJWTSecretVolumeMountDir, "Path to the JWT tokens")
f.StringVarP(&probeInput.JWTPath, "jwt", "", shared.ClusterJWTSecretVolumeMountDir, "Path to the JWT tokens")
}

func probeClient() *http.Client {
Expand All @@ -80,7 +80,7 @@ func probeEndpoint(endpoint string) string {
proto = "https"
}

return fmt.Sprintf("%s://%s:%d%s", proto, "127.0.0.1", k8sutil.ArangoPort, endpoint)
return fmt.Sprintf("%s://%s:%d%s", proto, "127.0.0.1", shared.ArangoPort, endpoint)
}

func readJWTFile(file string) ([]byte, error) {
Expand Down
7 changes: 3 additions & 4 deletions pkg/apis/deployment/v1/architecture.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ package v1
import (
"runtime"

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

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/pkg/errors"
core "k8s.io/api/core/v1"
)
Expand Down Expand Up @@ -77,7 +76,7 @@ func (a ArangoDeploymentArchitectureType) AsNodeSelectorRequirement() core.NodeS
return core.NodeSelectorTerm{
MatchExpressions: []core.NodeSelectorRequirement{
{
Key: k8sutil.NodeArchAffinityLabel,
Key: shared.NodeArchAffinityLabel,
Operator: "In",
Values: []string{string(a)},
},
Expand All @@ -90,7 +89,7 @@ func GetArchsFromNodeSelector(selectors []core.NodeSelectorTerm) map[ArangoDeplo
for _, selector := range selectors {
if selector.MatchExpressions != nil {
for _, req := range selector.MatchExpressions {
if req.Key == k8sutil.NodeArchAffinityLabel || req.Key == k8sutil.NodeArchAffinityLabelBeta {
if req.Key == shared.NodeArchAffinityLabel || req.Key == shared.NodeArchAffinityLabelBeta {
for _, arch := range req.Values {
result[ArangoDeploymentArchitectureType(arch)] = true
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/deployment/v1/authentication_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
package v1

import (
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
)

// AuthenticationSpec holds authentication specific configuration settings
Expand Down Expand Up @@ -53,7 +53,7 @@ func (s AuthenticationSpec) Validate(required bool) error {
return errors.WithStack(errors.Wrap(ValidationError, "JWT secret is required"))
}
if s.IsAuthenticated() {
if err := k8sutil.ValidateResourceName(s.GetJWTSecretName()); err != nil {
if err := shared.ValidateResourceName(s.GetJWTSecretName()); err != nil {
return errors.WithStack(err)
}
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/deployment/v1/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package v1
import (
"github.com/arangodb/kube-arangodb/pkg/util/errors"

"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
)

const (
Expand Down Expand Up @@ -76,7 +76,7 @@ func (s PasswordSecretNameList) GetSecretName(user string) PasswordSecretName {

// getSecretNameForUserPassword returns the default secret name for the given user
func getSecretNameForUserPassword(deploymentname, username string) PasswordSecretName {
return PasswordSecretName(k8sutil.FixupResourceName(deploymentname + "-" + username + "-password"))
return PasswordSecretName(shared.FixupResourceName(deploymentname + "-" + username + "-password"))
}

// Validate the specification.
Expand All @@ -92,7 +92,7 @@ func (b *BootstrapSpec) Validate() error {
return errors.Newf("magic value None not allowed for %s", username)
}
} else {
if err := k8sutil.ValidateResourceName(string(secretname)); err != nil {
if err := shared.ValidateResourceName(string(secretname)); err != nil {
return errors.WithStack(err)
}
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/apis/deployment/v1/deployment_metrics_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
package v1

import (
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
v1 "k8s.io/api/core/v1"
)

Expand All @@ -44,9 +44,9 @@ func (m MetricsMode) New() *MetricsMode {
func (m MetricsMode) GetMetricsEndpoint() string {
switch m {
case MetricsModeInternal:
return k8sutil.ArangoExporterInternalEndpoint
return shared.ArangoExporterInternalEndpoint
default:
return k8sutil.ArangoExporterDefaultEndpoint
return shared.ArangoExporterDefaultEndpoint
}
}

Expand Down Expand Up @@ -94,7 +94,7 @@ func (s *MetricsSpec) IsTLS() bool {

func (s *MetricsSpec) GetPort() uint16 {
if s == nil || s.Port == nil {
return k8sutil.ArangoExporterPort
return shared.ArangoExporterPort
}

return *s.Port
Expand Down Expand Up @@ -156,7 +156,7 @@ func (s *MetricsSpec) SetDefaultsFrom(source MetricsSpec) {
func (s *MetricsSpec) Validate() error {

if s.HasJWTTokenSecretName() {
if err := k8sutil.ValidateResourceName(s.GetJWTTokenSecretName()); err != nil {
if err := shared.ValidateResourceName(s.GetJWTTokenSecretName()); err != nil {
return err
}
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/apis/deployment/v1/deployment_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import (

core "k8s.io/api/core/v1"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/handlers/utils"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
)

var (
Expand Down Expand Up @@ -547,12 +547,12 @@ func (s DeploymentSpec) Checksum() (string, error) {
func (s DeploymentSpec) GetCoreContainers(group ServerGroup) utils.StringList {
groupSpec := s.GetServerGroupSpec(group)
if len(groupSpec.SidecarCoreNames) == 0 {
return utils.StringList{k8sutil.ServerContainerName}
return utils.StringList{shared.ServerContainerName}
}

result := make(utils.StringList, 0, len(groupSpec.SidecarCoreNames)+1)
if !utils.StringList(groupSpec.SidecarCoreNames).Has(k8sutil.ServerContainerName) {
result = append(result, k8sutil.ServerContainerName)
if !utils.StringList(groupSpec.SidecarCoreNames).Has(shared.ServerContainerName) {
result = append(result, shared.ServerContainerName)
}
result = append(result, groupSpec.SidecarCoreNames...)

Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/deployment/v1/license_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
package v1

import (
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
)

// LicenseSpec holds the license related information
Expand All @@ -43,7 +43,7 @@ func (s LicenseSpec) GetSecretName() string {
// Validate validates the LicenseSpec
func (s LicenseSpec) Validate() error {
if s.HasSecretName() {
if err := k8sutil.ValidateResourceName(s.GetSecretName()); err != nil {
if err := shared.ValidateResourceName(s.GetSecretName()); err != nil {
return err
}
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/apis/deployment/v1/member_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ package v1
import (
"time"

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

"k8s.io/apimachinery/pkg/types"

driver "github.com/arangodb/go-driver"
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -174,5 +173,5 @@ func (s MemberStatus) IsNotReadySince(timestamp time.Time) bool {

// ArangoMemberName create member name from given member
func (s MemberStatus) ArangoMemberName(deploymentName string, group ServerGroup) string {
return k8sutil.CreatePodHostName(deploymentName, group.AsRole(), s.ID)
return shared.CreatePodHostName(deploymentName, group.AsRole(), s.ID)
}
4 changes: 2 additions & 2 deletions pkg/apis/deployment/v1/rocksdb_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
package v1

import (
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
)

// RocksDBEncryptionSpec holds rocksdb encryption at rest specific configuration settings
Expand Down Expand Up @@ -55,7 +55,7 @@ func (s RocksDBSpec) IsEncrypted() bool {

// Validate the given spec
func (s RocksDBSpec) Validate() error {
if err := k8sutil.ValidateOptionalResourceName(s.Encryption.GetKeySecretName()); err != nil {
if err := shared.ValidateOptionalResourceName(s.Encryption.GetKeySecretName()); err != nil {
return errors.WithStack(err)
}
return nil
Expand Down
5 changes: 2 additions & 3 deletions pkg/apis/deployment/v1/server_group_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"github.com/arangodb/kube-arangodb/pkg/util"
arangodOptions "github.com/arangodb/kube-arangodb/pkg/util/arangod/options"
arangosyncOptions "github.com/arangodb/kube-arangodb/pkg/util/arangosync/options"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
)

// ServerGroupShutdownMethod enum of possible shutdown methods
Expand Down Expand Up @@ -492,12 +491,12 @@ func (s ServerGroupSpec) Validate(group ServerGroup, used bool, mode DeploymentM
return errors.WithStack(errors.Wrapf(ValidationError, "Invalid count value %d. Expected 1", s.GetCount()))
}
if name := s.GetServiceAccountName(); name != "" {
if err := k8sutil.ValidateOptionalResourceName(name); err != nil {
if err := shared.ValidateOptionalResourceName(name); err != nil {
return errors.WithStack(errors.Wrapf(ValidationError, "Invalid serviceAccountName: %s", err))
}
}
if name := s.GetStorageClassName(); name != "" {
if err := k8sutil.ValidateOptionalResourceName(name); err != nil {
if err := shared.ValidateOptionalResourceName(name); err != nil {
return errors.WithStack(errors.Wrapf(ValidationError, "Invalid storageClassName: %s", err))
}
}
Expand Down
18 changes: 8 additions & 10 deletions pkg/apis/deployment/v1/server_group_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,19 @@ import (
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
sharedv1 "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"

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

core "k8s.io/api/core/v1"
)

var (
restrictedVolumeNames = []string{
k8sutil.ArangodVolumeName,
k8sutil.TlsKeyfileVolumeName,
k8sutil.RocksdbEncryptionVolumeName,
k8sutil.ExporterJWTVolumeName,
k8sutil.ClusterJWTSecretVolumeName,
k8sutil.LifecycleVolumeName,
k8sutil.FoxxAppEphemeralVolumeName,
k8sutil.TMPEphemeralVolumeName,
shared.ArangodVolumeName,
shared.TlsKeyfileVolumeName,
shared.RocksdbEncryptionVolumeName,
shared.ExporterJWTVolumeName,
shared.ClusterJWTSecretVolumeName,
shared.LifecycleVolumeName,
shared.FoxxAppEphemeralVolumeName,
shared.TMPEphemeralVolumeName,
}
)

Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/deployment/v1/sync_authentication_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
package v1

import (
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
)

// SyncAuthenticationSpec holds dc2dc sync authentication specific configuration settings
Expand All @@ -44,10 +44,10 @@ func (s SyncAuthenticationSpec) GetClientCASecretName() string {

// Validate the given spec
func (s SyncAuthenticationSpec) Validate() error {
if err := k8sutil.ValidateResourceName(s.GetJWTSecretName()); err != nil {
if err := shared.ValidateResourceName(s.GetJWTSecretName()); err != nil {
return errors.WithStack(err)
}
if err := k8sutil.ValidateResourceName(s.GetClientCASecretName()); err != nil {
if err := shared.ValidateResourceName(s.GetClientCASecretName()); err != nil {
return errors.WithStack(err)
}
return nil
Expand Down
5 changes: 2 additions & 3 deletions pkg/apis/deployment/v1/sync_external_access_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ import (
"net/url"
"strconv"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util/errors"

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

// SyncExternalAccessSpec holds configuration for the external access provided for the sync deployment.
Expand Down Expand Up @@ -69,7 +68,7 @@ func (s SyncExternalAccessSpec) Validate() error {
}
}
for _, name := range s.AccessPackageSecretNames {
if err := k8sutil.ValidateResourceName(name); err != nil {
if err := shared.ValidateResourceName(name); err != nil {
return errors.WithStack(errors.Newf("Invalid name '%s' in accessPackageSecretNames: %s", name, err))
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/deployment/v1/sync_monitoring_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
package v1

import (
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
)

// MonitoringSpec holds monitoring specific configuration settings
Expand All @@ -38,7 +38,7 @@ func (s MonitoringSpec) GetTokenSecretName() string {

// Validate the given spec
func (s MonitoringSpec) Validate() error {
if err := k8sutil.ValidateOptionalResourceName(s.GetTokenSecretName()); err != nil {
if err := shared.ValidateOptionalResourceName(s.GetTokenSecretName()); err != nil {
return errors.WithStack(err)
}
return nil
Expand Down
Loading