mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Bugfix] Fix labels propagation (#1004)
This commit is contained in:
parent
c0c98fd6ec
commit
24d464a790
3 changed files with 20 additions and 11 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
|
||||
- (Feature) Add ArangoSync TLS based rotation
|
||||
- (Bugfix) Fix labels propagation
|
||||
|
||||
## [1.2.13](https://github.com/arangodb/kube-arangodb/tree/1.2.13) (2022-06-07)
|
||||
- (Bugfix) Fix arangosync members state inspection
|
||||
|
|
|
@ -314,7 +314,7 @@ func ensureGroupLabelsMap(kind string, obj meta.Object, spec api.DeploymentSpec,
|
|||
func ensureLabelsMap(kind string, obj meta.Object, spec api.DeploymentSpec,
|
||||
patchCmd func(name string, d []byte) error) bool {
|
||||
expected := spec.Labels
|
||||
ignored := spec.AnnotationsIgnoreList
|
||||
ignored := spec.LabelsIgnoreList
|
||||
|
||||
mode := spec.LabelsMode.Get(getDefaultMode(expected))
|
||||
|
||||
|
|
|
@ -29,13 +29,13 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
kubernetesAnnotationMatch = ".*kubernetes\\.io/.*"
|
||||
arangoAnnotationMatch = ".*arangodb\\.com/.*"
|
||||
kubernetesIOMatch = ".*kubernetes\\.io/.*"
|
||||
arangoDBMatch = ".*arangodb\\.com/.*"
|
||||
)
|
||||
|
||||
var (
|
||||
kubernetesAnnotationRegex *regexp.Regexp
|
||||
arangoAnnotationRegex *regexp.Regexp
|
||||
kubernetesIORegex *regexp.Regexp
|
||||
arangoDBRegex *regexp.Regexp
|
||||
|
||||
reservedLabels = RestrictedList{
|
||||
k8sutil.LabelKeyArangoDeployment,
|
||||
|
@ -124,19 +124,19 @@ func (r RestrictedList) Filter(m map[string]string) map[string]string {
|
|||
}
|
||||
|
||||
func init() {
|
||||
r, err := regexp.Compile(kubernetesAnnotationMatch)
|
||||
r, err := regexp.Compile(kubernetesIOMatch)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
kubernetesAnnotationRegex = r
|
||||
kubernetesIORegex = r
|
||||
|
||||
r, err = regexp.Compile(arangoAnnotationMatch)
|
||||
r, err = regexp.Compile(arangoDBMatch)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
arangoAnnotationRegex = r
|
||||
arangoDBRegex = r
|
||||
}
|
||||
|
||||
func LabelsPatch(mode api.LabelsMode, expected map[string]string, actual map[string]string, ignored ...string) patch.Patch {
|
||||
|
@ -145,6 +145,14 @@ func LabelsPatch(mode api.LabelsMode, expected map[string]string, actual map[str
|
|||
return true
|
||||
}
|
||||
|
||||
if arangoDBRegex.MatchString(k) {
|
||||
return true
|
||||
}
|
||||
|
||||
if kubernetesIORegex.MatchString(k) {
|
||||
return true
|
||||
}
|
||||
|
||||
if NewRestrictedList(ignored...).IsRestricted(k) {
|
||||
return true
|
||||
}
|
||||
|
@ -155,11 +163,11 @@ func LabelsPatch(mode api.LabelsMode, expected map[string]string, actual map[str
|
|||
|
||||
func AnnotationsPatch(mode api.LabelsMode, expected map[string]string, actual map[string]string, ignored ...string) patch.Patch {
|
||||
return getFieldPatch(mode, "annotations", expected, actual, func(k, v string) bool {
|
||||
if kubernetesAnnotationRegex.MatchString(k) {
|
||||
if kubernetesIORegex.MatchString(k) {
|
||||
return true
|
||||
}
|
||||
|
||||
if arangoAnnotationRegex.MatchString(k) {
|
||||
if arangoDBRegex.MatchString(k) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue