Skip to content

Commit 95355be

Browse files
authored
[Feature] Customizable Annotations and Labels settings (#610)
1 parent 0cbc1e1 commit 95355be

File tree

10 files changed

+468
-565
lines changed

10 files changed

+468
-565
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ dashboard/assets.go: $(DASHBOARDSOURCES) $(DASHBOARDDIR)/Dockerfile.build
268268
.PHONY: bin
269269
bin: $(BIN)
270270

271+
.PHONY: test-bin
272+
test-bin: $(TESTBIN)
273+
271274
$(BIN): $(SOURCES) dashboard/assets.go VERSION
272275
@mkdir -p $(BINDIR)
273276
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -installsuffix netgo -ldflags "-X main.projectVersion=$(VERSION) -X main.projectBuild=$(COMMIT)" -o $(BIN) $(REPOPATH)

pkg/apis/deployment/v1/const.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2020 ArangoDB GmbH, Cologne, Germany
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
//
20+
21+
package v1
22+
23+
type LabelsMode string
24+
25+
const (
26+
// LabelsDisabledMode disable annotations/labels override. Default if there is no annotations/labels set in ArangoDeployment
27+
LabelsDisabledMode LabelsMode = "disabled"
28+
// LabelsAppendMode add new annotations/labels without affecting old ones
29+
LabelsAppendMode LabelsMode = "append"
30+
// LabelsReplaceMode replace existing annotations/labels
31+
LabelsReplaceMode LabelsMode = "replace"
32+
)
33+
34+
func (a LabelsMode) New() *LabelsMode {
35+
return &a
36+
}
37+
38+
func (a *LabelsMode) Get(def LabelsMode) LabelsMode {
39+
if a == nil {
40+
return def
41+
}
42+
43+
return *a
44+
}

pkg/apis/deployment/v1/deployment_spec.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,18 @@ type DeploymentSpec struct {
6464

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

67-
// Annotations specified the annotations added to all resources
67+
// Annotations specified the annotations added to Pods in this group.
6868
Annotations map[string]string `json:"annotations,omitempty"`
69-
// Labels specified the labels added to all resources
69+
// AnnotationsIgnoreList list regexp or plain definitions which annotations should be ignored
70+
AnnotationsIgnoreList []string `json:"annotationsIgnoreList,omitempty"`
71+
// AnnotationsMode Define annotations mode which should be use while overriding annotations
72+
AnnotationsMode *LabelsMode `json:"annotationsMode,omitempty"`
73+
// Labels specified the labels added to Pods in this group.
7074
Labels map[string]string `json:"labels,omitempty"`
75+
// LabelsIgnoreList list regexp or plain definitions which labels should be ignored
76+
LabelsIgnoreList []string `json:"labelsIgnoreList,omitempty"`
77+
// LabelsMode Define labels mode which should be use while overriding labels
78+
LabelsMode *LabelsMode `json:"labelsMode,omitempty"`
7179

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

pkg/apis/deployment/v1/server_group_spec.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,16 @@ type ServerGroupSpec struct {
5858
Tolerations []core.Toleration `json:"tolerations,omitempty"`
5959
// Annotations specified the annotations added to Pods in this group.
6060
Annotations map[string]string `json:"annotations,omitempty"`
61+
// AnnotationsIgnoreList list regexp or plain definitions which annotations should be ignored
62+
AnnotationsIgnoreList []string `json:"annotationsIgnoreList,omitempty"`
63+
// AnnotationsMode Define annotations mode which should be use while overriding annotations
64+
AnnotationsMode *LabelsMode `json:"annotationsMode,omitempty"`
6165
// Labels specified the labels added to Pods in this group.
6266
Labels map[string]string `json:"labels,omitempty"`
67+
// LabelsIgnoreList list regexp or plain definitions which labels should be ignored
68+
LabelsIgnoreList []string `json:"labelsIgnoreList,omitempty"`
69+
// LabelsMode Define labels mode which should be use while overriding labels
70+
LabelsMode *LabelsMode `json:"labelsMode,omitempty"`
6371
// Envs allow to specify additional envs in this group.
6472
Envs ServerGroupEnvVars `json:"envs,omitempty"`
6573
// ServiceAccountName specifies the name of the service account used for Pods in this group.

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

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

0 commit comments

Comments
 (0)