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
4 changes: 2 additions & 2 deletions chart/kube-arangodb/templates/deployment-operator/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ rules:
resources: ["arangodeployments"]
verbs: ["*"]
- apiGroups: [""]
resources: ["pods", "services", "endpoints", "persistentvolumeclaims", "events", "secrets"]
resources: ["pods", "services", "endpoints", "persistentvolumeclaims", "events", "secrets", "serviceaccounts"]
verbs: ["*"]
- apiGroups: ["apps"]
resources: ["deployments", "replicasets"]
verbs: ["get"]
- apiGroups: ["policy"]
resources: ["poddisruptionbudgets"]
verbs: ["get", "create", "delete"]
verbs: ["*"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need all?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need also "list", "update", "watch" - to be able to update/set annotations. Anyway, Operator manages PDB's for ArangoDeployments so it should be able to do all operations.

I can put other verbs here also, but it will be the same result as putting '*' there.

- apiGroups: ["backup.arangodb.com"]
resources: ["arangobackuppolicies", "arangobackups"]
verbs: ["get", "list", "watch"]
Expand Down
8 changes: 8 additions & 0 deletions docs/Manual/Deployment/Kubernetes/DeploymentResource.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ Possible values are:

This setting specifies the list of image pull secrets for the docker image to use for all ArangoDB servers.

### `spec.annotations: map[string]string`

This setting set specified annotations to all ArangoDeployment owned resources (pods, services, PVC's, PDB's).

### `spec.storageEngine: string`

This setting specifies the type of storage engine used for all servers
Expand Down Expand Up @@ -517,6 +521,10 @@ rules:
If you are using a different service account, please grant these rights
to that service account.

### `spec.<group>.annotations: map[string]string`

This setting set annotations overrides for pods in this group. Annotations are merged with `spec.annotations`.

### `spec.<group>.priorityClassName: string`

Priority class name for pods of this group. Will be forwarded to the pod spec. [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/)
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/backup/v1/backup_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ func (a *ArangoBackupPolicy) NewBackup(d *deployment.ArangoDeployment) *ArangoBa
Name: fmt.Sprintf("%s-%s", d.Name, utils.RandomString(8)),
Namespace: a.Namespace,

Labels: d.Labels,
Labels: d.Labels,
Annotations: d.Annotations,

Finalizers: []string{
FinalizerArangoBackup,
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/backup/v1alpha/backup_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ func (a *ArangoBackupPolicy) NewBackup(d *deployment.ArangoDeployment) *ArangoBa
Name: fmt.Sprintf("%s-%s", d.Name, utils.RandomString(8)),
Namespace: a.Namespace,

Labels: d.Labels,
Labels: d.Labels,
Annotations: d.Annotations,

Finalizers: []string{
FinalizerArangoBackup,
Expand Down
12 changes: 10 additions & 2 deletions pkg/apis/deployment/v1/deployment_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ type DeploymentSpec struct {
DowntimeAllowed *bool `json:"downtimeAllowed,omitempty"`
DisableIPv6 *bool `json:"disableIPv6,omitempty"`

NetworkAttachedVolumes *bool `json:"networkAttachedVolumes,omitempty"`
NetworkAttachedVolumes *bool `json:"networkAttachedVolumes,omitempty"`

RestoreFrom *string `json:"restoreFrom,omitempty"`
// Annotations specified the annotations added to all resources
Annotations map[string]string `json:"annotations,omitempty"`

RestoreFrom *string `json:"restoreFrom,omitempty"`

ExternalAccess ExternalAccessSpec `json:"externalAccess"`
RocksDB RocksDBSpec `json:"rocksdb"`
Expand Down Expand Up @@ -105,6 +108,11 @@ func (s DeploymentSpec) GetEnvironment() Environment {
return EnvironmentOrDefault(s.Environment)
}

// GetAnnotations returns the annotations of this group
func (s DeploymentSpec) GetAnnotations() map[string]string {
return s.Annotations
}

// GetStorageEngine returns the value of storageEngine.
func (s DeploymentSpec) GetStorageEngine() StorageEngine {
return StorageEngineOrDefault(s.StorageEngine)
Expand Down
81 changes: 68 additions & 13 deletions pkg/apis/deployment/v1/server_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,32 @@

package v1

import time "time"
import "time"

type ServerGroup int

const (
ServerGroupUnknown ServerGroup = 0
ServerGroupSingle ServerGroup = 1
ServerGroupAgents ServerGroup = 2
ServerGroupDBServers ServerGroup = 3
ServerGroupCoordinators ServerGroup = 4
ServerGroupSyncMasters ServerGroup = 5
ServerGroupSyncWorkers ServerGroup = 6

ServerGroupSingleString = "single"
ServerGroupAgentsString = "agent"
ServerGroupDBServersString = "dbserver"
ServerGroupCoordinatorsString = "coordinator"
ServerGroupSyncMastersString = "syncmaster"
ServerGroupSyncWorkersString = "syncworker"

ServerGroupSingleAbbreviatedString = "sngl"
ServerGroupAgentsAbbreviatedString = "agnt"
ServerGroupDBServersAbbreviatedString = "prmr"
ServerGroupCoordinatorsAbbreviatedString = "crdn"
ServerGroupSyncMastersAbbreviatedString = "syma"
ServerGroupSyncWorkersAbbreviatedString = "sywo"
)

var (
Expand All @@ -51,17 +66,17 @@ var (
func (g ServerGroup) AsRole() string {
switch g {
case ServerGroupSingle:
return "single"
return ServerGroupSingleString
case ServerGroupAgents:
return "agent"
return ServerGroupAgentsString
case ServerGroupDBServers:
return "dbserver"
return ServerGroupDBServersString
case ServerGroupCoordinators:
return "coordinator"
return ServerGroupCoordinatorsString
case ServerGroupSyncMasters:
return "syncmaster"
return ServerGroupSyncMastersString
case ServerGroupSyncWorkers:
return "syncworker"
return ServerGroupSyncWorkersString
default:
return "?"
}
Expand All @@ -71,17 +86,17 @@ func (g ServerGroup) AsRole() string {
func (g ServerGroup) AsRoleAbbreviated() string {
switch g {
case ServerGroupSingle:
return "sngl"
return ServerGroupSingleAbbreviatedString
case ServerGroupAgents:
return "agnt"
return ServerGroupAgentsAbbreviatedString
case ServerGroupDBServers:
return "prmr"
return ServerGroupDBServersAbbreviatedString
case ServerGroupCoordinators:
return "crdn"
return ServerGroupCoordinatorsAbbreviatedString
case ServerGroupSyncMasters:
return "syma"
return ServerGroupSyncMastersAbbreviatedString
case ServerGroupSyncWorkers:
return "sywo"
return ServerGroupSyncWorkersAbbreviatedString
default:
return "?"
}
Expand Down Expand Up @@ -140,3 +155,43 @@ func (g ServerGroup) IsExportMetrics() bool {
return false
}
}

// ServerGroupFromAbbreviatedRole returns ServerGroup from abbreviated role
func ServerGroupFromAbbreviatedRole(label string) ServerGroup {
switch label {
case ServerGroupSingleAbbreviatedString:
return ServerGroupSingle
case ServerGroupAgentsAbbreviatedString:
return ServerGroupAgents
case ServerGroupDBServersAbbreviatedString:
return ServerGroupDBServers
case ServerGroupCoordinatorsAbbreviatedString:
return ServerGroupCoordinators
case ServerGroupSyncMastersAbbreviatedString:
return ServerGroupSyncMasters
case ServerGroupSyncWorkersAbbreviatedString:
return ServerGroupSyncWorkers
default:
return ServerGroupUnknown
}
}

// ServerGroupFromAbbreviatedRole returns ServerGroup from role
func ServerGroupFromRole(label string) ServerGroup {
switch label {
case ServerGroupSingleString:
return ServerGroupSingle
case ServerGroupAgentsString:
return ServerGroupAgents
case ServerGroupDBServersString:
return ServerGroupDBServers
case ServerGroupCoordinatorsString:
return ServerGroupCoordinators
case ServerGroupSyncMastersString:
return ServerGroupSyncMasters
case ServerGroupSyncWorkersString:
return ServerGroupSyncWorkers
default:
return ServerGroupUnknown
}
}
7 changes: 7 additions & 0 deletions pkg/apis/deployment/v1/server_group_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ type ServerGroupSpec struct {
Resources v1.ResourceRequirements `json:"resources,omitempty"`
// Tolerations specifies the tolerations added to Pods in this group.
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
// Annotations specified the annotations added to Pods in this group.
Annotations map[string]string `json:"annotations,omitempty"`
// ServiceAccountName specifies the name of the service account used for Pods in this group.
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
// NodeSelector speficies a set of selectors for nodes
Expand Down Expand Up @@ -133,6 +135,11 @@ func (s ServerGroupSpec) GetNodeSelector() map[string]string {
return s.NodeSelector
}

// GetAnnotations returns the annotations of this group
func (s ServerGroupSpec) GetAnnotations() map[string]string {
return s.Annotations
}

// GetArgs returns the value of args.
func (s ServerGroupSpec) GetArgs() []string {
return s.Args
Expand Down
26 changes: 20 additions & 6 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.

12 changes: 10 additions & 2 deletions pkg/apis/deployment/v1alpha/deployment_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ type DeploymentSpec struct {
DowntimeAllowed *bool `json:"downtimeAllowed,omitempty"`
DisableIPv6 *bool `json:"disableIPv6,omitempty"`

NetworkAttachedVolumes *bool `json:"networkAttachedVolumes,omitempty"`
NetworkAttachedVolumes *bool `json:"networkAttachedVolumes,omitempty"`

RestoreFrom *string `json:"restoreFrom,omitempty"`
// Annotations specified the annotations added to Pods in this group.
Annotations map[string]string `json:"annotations,omitempty"`

RestoreFrom *string `json:"restoreFrom,omitempty"`

ExternalAccess ExternalAccessSpec `json:"externalAccess"`
RocksDB RocksDBSpec `json:"rocksdb"`
Expand Down Expand Up @@ -105,6 +108,11 @@ func (s DeploymentSpec) GetEnvironment() Environment {
return EnvironmentOrDefault(s.Environment)
}

// GetAnnotations returns the annotations of this group
func (s DeploymentSpec) GetAnnotations() map[string]string {
return s.Annotations
}

// GetStorageEngine returns the value of storageEngine.
func (s DeploymentSpec) GetStorageEngine() StorageEngine {
return StorageEngineOrDefault(s.StorageEngine)
Expand Down
Loading