Skip to content

Commit df09665

Browse files
committed
Merged master
2 parents 9f8f41a + c68289f commit df09665

22 files changed

+326
-24
lines changed

docs/Manual/Deployment/Kubernetes/ServicesAndLoadBalancer.md

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,50 +39,53 @@ If you want to create external access services manually, follow the instructions
3939
### Single server
4040

4141
For a single server deployment, the operator creates a single
42-
`Service` named `<cluster-name>`. This service has a normal cluster IP
42+
`Service` named `<deployment-name>`. This service has a normal cluster IP
4343
address.
4444

4545
### Full cluster
4646

4747
For a full cluster deployment, the operator creates two `Services`.
4848

49-
- `<cluster-name>_servers` a headless `Service` intended to provide
49+
- `<deployment-name>-int` a headless `Service` intended to provide
5050
DNS names for all pods created by the operator.
5151
It selects all ArangoDB & ArangoSync servers in the cluster.
5252

53-
- `<cluster-name>` a normal `Service` that selects only the coordinators
53+
- `<deployment-name>` a normal `Service` that selects only the coordinators
5454
of the cluster. This `Service` is configured with `ClientIP` session
5555
affinity. This is needed for cursor requests, since they are bound to
5656
a specific coordinator.
5757

5858
When the coordinators are asked to provide endpoints of the cluster
5959
(e.g. when calling `client.SynchronizeEndpoints()` in the go driver)
6060
the DNS names of the individual `Pods` will be returned
61-
(`<pod>.<cluster-name>_servers.<namespace>.svc`)
61+
(`<pod>.<deployment-name>-int.<namespace>.svc`)
6262

6363
### Full cluster with DC2DC
6464

6565
For a full cluster with datacenter replication deployment,
6666
the same `Services` are created as for a Full cluster, with the following
6767
additions:
6868

69-
- `<cluster-name>_sync` a normal `Service` that selects only the syncmasters
69+
- `<deployment-name>-sync` a normal `Service` that selects only the syncmasters
7070
of the cluster.
7171

7272
## Load balancer
7373

74-
To reach the ArangoDB servers from outside the Kubernetes cluster, you
75-
have to deploy additional services.
74+
If you want full control of the `Services` needed to access the ArangoDB deployment
75+
from outside your Kubernetes cluster, set `spec.externalAccess.Type` of the `ArangoDeployment` to `None`
76+
and create a `Service` as specified below.
7677

77-
You can use `LoadBalancer` or `NodePort` services, depending on your
78+
Create a `Service` of type `LoadBalancer` or `NodePort`, depending on your
7879
Kubernetes deployment.
7980

8081
This service should select:
8182

82-
- `arangodb_cluster_name: <cluster-name>`
83+
- `arango_deployment: <deployment-name>`
8384
- `role: coordinator`
8485

85-
For example:
86+
The following example yields a service of type `LoadBalancer` with a specific
87+
load balancer IP address.
88+
With this service, the ArangoDB cluster can now be reached on `https://1.2.3.4:8529`.
8689

8790
```yaml
8891
kind: Service
@@ -91,7 +94,27 @@ metadata:
9194
name: arangodb-cluster-exposed
9295
spec:
9396
selector:
94-
arangodb_cluster_name: arangodb-cluster
97+
arango_deployment: arangodb-cluster
98+
role: coordinator
99+
type: LoadBalancer
100+
loadBalancerIP: 1.2.3.4
101+
ports:
102+
- protocol: TCP
103+
port: 8529
104+
targetPort: 8529
105+
```
106+
107+
The following example yields a service of type `NodePort` with the ArangoDB
108+
cluster exposed on port 30529 of all nodes of the Kubernetes cluster.
109+
110+
```yaml
111+
kind: Service
112+
apiVersion: v1
113+
metadata:
114+
name: arangodb-cluster-exposed
115+
spec:
116+
selector:
117+
arango_deployment: arangodb-cluster
95118
role: coordinator
96119
type: NodePort
97120
ports:

examples/production-cluster.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: "database.arangodb.com/v1alpha"
2+
kind: "ArangoDeployment"
3+
metadata:
4+
name: "production-cluster"
5+
spec:
6+
mode: Cluster
7+
image: arangodb/arangodb:3.3.10
8+
environment: Production

pkg/apis/deployment/v1alpha/environment.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ func (e Environment) Validate() error {
4747
}
4848
}
4949

50+
// IsProduction returns true when the given environment is a production environment.
51+
func (e Environment) IsProduction() bool {
52+
return e == EnvironmentProduction
53+
}
54+
5055
// NewEnvironment returns a reference to a string with given value.
5156
func NewEnvironment(input Environment) *Environment {
5257
return &input

pkg/deployment/reconcile/action.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ package reconcile
2424

2525
import (
2626
"context"
27+
"time"
2728
)
2829

2930
// Action executes a single Plan item.
@@ -35,4 +36,6 @@ type Action interface {
3536
// CheckProgress checks the progress of the action.
3637
// Returns true if the action is completely finished, false otherwise.
3738
CheckProgress(ctx context.Context) (bool, error)
39+
// Timeout returns the amount of time after which this action will timeout.
40+
Timeout() time.Duration
3841
}

pkg/deployment/reconcile/action_add_member.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ package reconcile
2424

2525
import (
2626
"context"
27+
"time"
2728

2829
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1alpha"
2930
"github.com/rs/zerolog"
@@ -64,3 +65,8 @@ func (a *actionAddMember) CheckProgress(ctx context.Context) (bool, error) {
6465
// Nothing todo
6566
return true, nil
6667
}
68+
69+
// Timeout returns the amount of time after which this action will timeout.
70+
func (a *actionAddMember) Timeout() time.Duration {
71+
return addMemberTimeout
72+
}

pkg/deployment/reconcile/action_cleanout_member.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ package reconcile
2424

2525
import (
2626
"context"
27+
"time"
2728

2829
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1alpha"
2930
"github.com/rs/zerolog"
@@ -114,3 +115,8 @@ func (a *actionCleanoutMember) CheckProgress(ctx context.Context) (bool, error)
114115
// Cleanout completed
115116
return true, nil
116117
}
118+
119+
// Timeout returns the amount of time after which this action will timeout.
120+
func (a *actionCleanoutMember) Timeout() time.Duration {
121+
return cleanoutMemberTimeout
122+
}

pkg/deployment/reconcile/action_remove_member.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ package reconcile
2424

2525
import (
2626
"context"
27+
"time"
2728

2829
"github.com/pkg/errors"
2930
"github.com/rs/zerolog"
@@ -94,3 +95,8 @@ func (a *actionRemoveMember) CheckProgress(ctx context.Context) (bool, error) {
9495
// Nothing todo
9596
return true, nil
9697
}
98+
99+
// Timeout returns the amount of time after which this action will timeout.
100+
func (a *actionRemoveMember) Timeout() time.Duration {
101+
return removeMemberTimeout
102+
}

pkg/deployment/reconcile/action_renew_tls_certificate.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ package reconcile
2424

2525
import (
2626
"context"
27+
"time"
2728

2829
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1alpha"
2930
"github.com/rs/zerolog"
@@ -69,3 +70,8 @@ func (a *renewTLSCertificateAction) Start(ctx context.Context) (bool, error) {
6970
func (a *renewTLSCertificateAction) CheckProgress(ctx context.Context) (bool, error) {
7071
return true, nil
7172
}
73+
74+
// Timeout returns the amount of time after which this action will timeout.
75+
func (a *renewTLSCertificateAction) Timeout() time.Duration {
76+
return renewTLSCertificateTimeout
77+
}

pkg/deployment/reconcile/action_rotate_member.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ package reconcile
2424

2525
import (
2626
"context"
27+
"time"
2728

2829
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1alpha"
2930
"github.com/rs/zerolog"
@@ -116,3 +117,8 @@ func (a *actionRotateMember) CheckProgress(ctx context.Context) (bool, error) {
116117
}
117118
return true, nil
118119
}
120+
121+
// Timeout returns the amount of time after which this action will timeout.
122+
func (a *actionRotateMember) Timeout() time.Duration {
123+
return rotateMemberTimeout
124+
}

pkg/deployment/reconcile/action_shutdown_member.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,8 @@ func (a *actionShutdownMember) CheckProgress(ctx context.Context) (bool, error)
111111
// Member still not shutdown, retry soon
112112
return false, nil
113113
}
114+
115+
// Timeout returns the amount of time after which this action will timeout.
116+
func (a *actionShutdownMember) Timeout() time.Duration {
117+
return shutdownMemberTimeout
118+
}

0 commit comments

Comments
 (0)