Skip to content

Commit 6a3b859

Browse files
authored
[Feature] Headless DNS CommunicationMethod (#1282)
1 parent f9d9ca3 commit 6a3b859

22 files changed

+231
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- (Maintenance) Bump GO Modules
2525
- (Feature) Optional Graceful Restart
2626
- (Maintenance) Manual Recovery documentation
27+
- (Feature) Headless DNS CommunicationMethod
2728

2829
## [1.2.24](https://github.com/arangodb/kube-arangodb/tree/1.2.24) (2023-01-25)
2930
- (Bugfix) Fix deployment creation on ARM64

docs/generated/actions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
| BackupRestoreClean | no | 15m0s | no | Enterprise Only | Clean restore status in case of restore spec change |
1414
| BootstrapSetPassword | no | 10m0s | no | Community & Enterprise | Change password during bootstrap procedure |
1515
| BootstrapUpdate | no | 10m0s | no | Community & Enterprise | Update bootstrap status |
16+
| CleanMemberService | no | 30m0s | no | Community & Enterprise | Removes Server Service |
1617
| CleanOutMember | no | 48h0m0s | no | Community & Enterprise | Run the CleanOut job on member |
1718
| CleanTLSCACertificate | no | 30m0s | no | Enterprise Only | Remove Certificate from CA TrustStore |
1819
| CleanTLSKeyfileCertificate | no | 30m0s | no | Enterprise Only | Remove old TLS certificate from server |
@@ -99,6 +100,7 @@ spec:
99100
BackupRestoreClean: 15m0s
100101
BootstrapSetPassword: 10m0s
101102
BootstrapUpdate: 10m0s
103+
CleanMemberService: 30m0s
102104
CleanOutMember: 48h0m0s
103105
CleanTLSCACertificate: 30m0s
104106
CleanTLSKeyfileCertificate: 30m0s

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ replace (
2020
k8s.io/component-base => k8s.io/component-base v0.22.15
2121
k8s.io/kubernetes => k8s.io/kubernetes v0.22.15
2222
k8s.io/metrics => k8s.io/metrics v0.22.15
23-
24-
gopkg.in/yaml.v3 => gopkg.in/yaml.v3 v3.0.1
2523
)
2624

2725
require (
@@ -54,7 +52,7 @@ require (
5452
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
5553
google.golang.org/grpc v1.47.0
5654
google.golang.org/protobuf v1.28.0
57-
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
55+
gopkg.in/yaml.v3 v3.0.1
5856
k8s.io/api v0.22.15
5957
k8s.io/apiextensions-apiserver v0.18.3
6058
k8s.io/apimachinery v0.22.15

internal/actions.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ actions:
5555
enterprise: true
5656
description: Recreate Server TLS Certificate secret
5757
timeout: 30m
58+
CleanMemberService:
59+
description: Removes Server Service
60+
timeout: 30m
5861
RenewTLSCACertificate:
5962
enterprise: true
6063
description: Recreate Managed CA secret

pkg/apis/deployment/v1/actions.generated.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const (
4141
ActionBootstrapSetPasswordDefaultTimeout time.Duration = ActionsDefaultTimeout
4242
// ActionBootstrapUpdateDefaultTimeout define default timeout for action ActionBootstrapUpdate
4343
ActionBootstrapUpdateDefaultTimeout time.Duration = ActionsDefaultTimeout
44+
// ActionCleanMemberServiceDefaultTimeout define default timeout for action ActionCleanMemberService
45+
ActionCleanMemberServiceDefaultTimeout time.Duration = 1800 * time.Second // 30m0s
4446
// ActionCleanOutMemberDefaultTimeout define default timeout for action ActionCleanOutMember
4547
ActionCleanOutMemberDefaultTimeout time.Duration = 172800 * time.Second // 48h0m0s
4648
// ActionCleanTLSCACertificateDefaultTimeout define default timeout for action ActionCleanTLSCACertificate
@@ -196,6 +198,8 @@ const (
196198
ActionTypeBootstrapSetPassword ActionType = "BootstrapSetPassword"
197199
// ActionTypeBootstrapUpdate in scopes Normal. Update bootstrap status
198200
ActionTypeBootstrapUpdate ActionType = "BootstrapUpdate"
201+
// ActionTypeCleanMemberService in scopes Normal. Removes Server Service
202+
ActionTypeCleanMemberService ActionType = "CleanMemberService"
199203
// ActionTypeCleanOutMember in scopes Normal. Run the CleanOut job on member
200204
ActionTypeCleanOutMember ActionType = "CleanOutMember"
201205
// ActionTypeCleanTLSCACertificate in scopes Normal. Remove Certificate from CA TrustStore
@@ -352,6 +356,8 @@ func (a ActionType) DefaultTimeout() time.Duration {
352356
return ActionBootstrapSetPasswordDefaultTimeout
353357
case ActionTypeBootstrapUpdate:
354358
return ActionBootstrapUpdateDefaultTimeout
359+
case ActionTypeCleanMemberService:
360+
return ActionCleanMemberServiceDefaultTimeout
355361
case ActionTypeCleanOutMember:
356362
return ActionCleanOutMemberDefaultTimeout
357363
case ActionTypeCleanTLSCACertificate:
@@ -512,6 +518,8 @@ func (a ActionType) Priority() ActionPriority {
512518
return ActionPriorityNormal
513519
case ActionTypeBootstrapUpdate:
514520
return ActionPriorityNormal
521+
case ActionTypeCleanMemberService:
522+
return ActionPriorityNormal
515523
case ActionTypeCleanOutMember:
516524
return ActionPriorityNormal
517525
case ActionTypeCleanTLSCACertificate:
@@ -682,6 +690,8 @@ func (a ActionType) Optional() bool {
682690
return false
683691
case ActionTypeBootstrapUpdate:
684692
return false
693+
case ActionTypeCleanMemberService:
694+
return false
685695
case ActionTypeCleanOutMember:
686696
return false
687697
case ActionTypeCleanTLSCACertificate:

pkg/apis/deployment/v1/deployment_spec.go

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,31 @@ func (d *DeploymentCommunicationMethod) Get() DeploymentCommunicationMethod {
5959
}
6060

6161
switch v := *d; v {
62-
case DeploymentCommunicationMethodHeadlessService, DeploymentCommunicationMethodDNS, DeploymentCommunicationMethodIP, DeploymentCommunicationMethodShortDNS:
62+
case DeploymentCommunicationMethodHeadlessService, DeploymentCommunicationMethodDNS, DeploymentCommunicationMethodIP, DeploymentCommunicationMethodShortDNS, DeploymentCommunicationMethodHeadlessDNS:
6363
return v
6464
default:
6565
return DefaultDeploymentCommunicationMethod
6666
}
6767
}
6868

69+
// ServiceType returns Service Type for communication method
70+
func (d *DeploymentCommunicationMethod) ServiceType() core.ServiceType {
71+
switch d.Get() {
72+
default:
73+
return core.ServiceTypeClusterIP
74+
}
75+
}
76+
77+
// ServiceClusterIP returns Service ClusterIP for communication method
78+
func (d *DeploymentCommunicationMethod) ServiceClusterIP() string {
79+
switch d.Get() {
80+
case DeploymentCommunicationMethodHeadlessDNS:
81+
return core.ClusterIPNone
82+
default:
83+
return ""
84+
}
85+
}
86+
6987
// String returns string representation of method.
7088
func (d DeploymentCommunicationMethod) String() string {
7189
return string(d)
@@ -85,7 +103,9 @@ const (
85103
DeploymentCommunicationMethodDNS DeploymentCommunicationMethod = "dns"
86104
// DeploymentCommunicationMethodShortDNS define ClusterIP Service DNS based communication. Use namespaced short DNS (used in migration)
87105
DeploymentCommunicationMethodShortDNS DeploymentCommunicationMethod = "short-dns"
88-
// DeploymentCommunicationMethodIP define ClusterIP Servce IP based communication.
106+
// DeploymentCommunicationMethodHeadlessDNS define Headless Service DNS based communication.
107+
DeploymentCommunicationMethodHeadlessDNS DeploymentCommunicationMethod = "headless-dns"
108+
// DeploymentCommunicationMethodIP define ClusterIP Service IP based communication.
89109
DeploymentCommunicationMethodIP DeploymentCommunicationMethod = "ip"
90110
)
91111

pkg/apis/deployment/v1/member_status.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.

pkg/apis/deployment/v2alpha1/actions.generated.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const (
4141
ActionBootstrapSetPasswordDefaultTimeout time.Duration = ActionsDefaultTimeout
4242
// ActionBootstrapUpdateDefaultTimeout define default timeout for action ActionBootstrapUpdate
4343
ActionBootstrapUpdateDefaultTimeout time.Duration = ActionsDefaultTimeout
44+
// ActionCleanMemberServiceDefaultTimeout define default timeout for action ActionCleanMemberService
45+
ActionCleanMemberServiceDefaultTimeout time.Duration = 1800 * time.Second // 30m0s
4446
// ActionCleanOutMemberDefaultTimeout define default timeout for action ActionCleanOutMember
4547
ActionCleanOutMemberDefaultTimeout time.Duration = 172800 * time.Second // 48h0m0s
4648
// ActionCleanTLSCACertificateDefaultTimeout define default timeout for action ActionCleanTLSCACertificate
@@ -196,6 +198,8 @@ const (
196198
ActionTypeBootstrapSetPassword ActionType = "BootstrapSetPassword"
197199
// ActionTypeBootstrapUpdate in scopes Normal. Update bootstrap status
198200
ActionTypeBootstrapUpdate ActionType = "BootstrapUpdate"
201+
// ActionTypeCleanMemberService in scopes Normal. Removes Server Service
202+
ActionTypeCleanMemberService ActionType = "CleanMemberService"
199203
// ActionTypeCleanOutMember in scopes Normal. Run the CleanOut job on member
200204
ActionTypeCleanOutMember ActionType = "CleanOutMember"
201205
// ActionTypeCleanTLSCACertificate in scopes Normal. Remove Certificate from CA TrustStore
@@ -352,6 +356,8 @@ func (a ActionType) DefaultTimeout() time.Duration {
352356
return ActionBootstrapSetPasswordDefaultTimeout
353357
case ActionTypeBootstrapUpdate:
354358
return ActionBootstrapUpdateDefaultTimeout
359+
case ActionTypeCleanMemberService:
360+
return ActionCleanMemberServiceDefaultTimeout
355361
case ActionTypeCleanOutMember:
356362
return ActionCleanOutMemberDefaultTimeout
357363
case ActionTypeCleanTLSCACertificate:
@@ -512,6 +518,8 @@ func (a ActionType) Priority() ActionPriority {
512518
return ActionPriorityNormal
513519
case ActionTypeBootstrapUpdate:
514520
return ActionPriorityNormal
521+
case ActionTypeCleanMemberService:
522+
return ActionPriorityNormal
515523
case ActionTypeCleanOutMember:
516524
return ActionPriorityNormal
517525
case ActionTypeCleanTLSCACertificate:
@@ -682,6 +690,8 @@ func (a ActionType) Optional() bool {
682690
return false
683691
case ActionTypeBootstrapUpdate:
684692
return false
693+
case ActionTypeCleanMemberService:
694+
return false
685695
case ActionTypeCleanOutMember:
686696
return false
687697
case ActionTypeCleanTLSCACertificate:

pkg/apis/deployment/v2alpha1/deployment_spec.go

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,31 @@ func (d *DeploymentCommunicationMethod) Get() DeploymentCommunicationMethod {
5959
}
6060

6161
switch v := *d; v {
62-
case DeploymentCommunicationMethodHeadlessService, DeploymentCommunicationMethodDNS, DeploymentCommunicationMethodIP, DeploymentCommunicationMethodShortDNS:
62+
case DeploymentCommunicationMethodHeadlessService, DeploymentCommunicationMethodDNS, DeploymentCommunicationMethodIP, DeploymentCommunicationMethodShortDNS, DeploymentCommunicationMethodHeadlessDNS:
6363
return v
6464
default:
6565
return DefaultDeploymentCommunicationMethod
6666
}
6767
}
6868

69+
// ServiceType returns Service Type for communication method
70+
func (d *DeploymentCommunicationMethod) ServiceType() core.ServiceType {
71+
switch d.Get() {
72+
default:
73+
return core.ServiceTypeClusterIP
74+
}
75+
}
76+
77+
// ServiceClusterIP returns Service ClusterIP for communication method
78+
func (d *DeploymentCommunicationMethod) ServiceClusterIP() string {
79+
switch d.Get() {
80+
case DeploymentCommunicationMethodHeadlessDNS:
81+
return core.ClusterIPNone
82+
default:
83+
return ""
84+
}
85+
}
86+
6987
// String returns string representation of method.
7088
func (d DeploymentCommunicationMethod) String() string {
7189
return string(d)
@@ -85,7 +103,9 @@ const (
85103
DeploymentCommunicationMethodDNS DeploymentCommunicationMethod = "dns"
86104
// DeploymentCommunicationMethodShortDNS define ClusterIP Service DNS based communication. Use namespaced short DNS (used in migration)
87105
DeploymentCommunicationMethodShortDNS DeploymentCommunicationMethod = "short-dns"
88-
// DeploymentCommunicationMethodIP define ClusterIP Servce IP based communication.
106+
// DeploymentCommunicationMethodHeadlessDNS define Headless Service DNS based communication.
107+
DeploymentCommunicationMethodHeadlessDNS DeploymentCommunicationMethod = "headless-dns"
108+
// DeploymentCommunicationMethodIP define ClusterIP Service IP based communication.
89109
DeploymentCommunicationMethodIP DeploymentCommunicationMethod = "ip"
90110
)
91111

pkg/apis/deployment/v2alpha1/member_status.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)