Skip to content

Commit ba6dcc0

Browse files
[Docs] Add docs for DeploymentSpec (#1363)
1 parent 7bc9dc3 commit ba6dcc0

11 files changed

+641
-223
lines changed

docs/api/ArangoDeployment.V1.md

Lines changed: 159 additions & 49 deletions
Large diffs are not rendered by default.

pkg/apis/deployment/v1/architecture.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ import (
2929
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
3030
)
3131

32+
// ArangoDeploymentArchitecture defines the list of supported architectures.
33+
// Possible values are:
34+
// - `amd64`: Use processors with the x86-64 architecture.
35+
// - `arm64`: Use processors with the 64-bit ARM architecture.
36+
// The setting expects a list of strings, but you should only specify a single list item for the architecture, except when you want to migrate from one architecture to the other.
37+
// The first list item defines the new default architecture for the deployment that you want to migrate to.
38+
// To use the ARM architecture, you need to enable it in the operator first using --set "operator.architectures={amd64,arm64}". See Installation with Helm.
3239
type ArangoDeploymentArchitecture []ArangoDeploymentArchitectureType
3340

3441
func (a ArangoDeploymentArchitecture) GetDefault() ArangoDeploymentArchitectureType {
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2023 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+
import core "k8s.io/api/core/v1"
24+
25+
// DeploymentCommunicationMethod define communication method used for inter-cluster communication
26+
type DeploymentCommunicationMethod string
27+
28+
const (
29+
// DefaultDeploymentCommunicationMethod define default communication method.
30+
DefaultDeploymentCommunicationMethod = DeploymentCommunicationMethodHeadlessService
31+
// DeploymentCommunicationMethodHeadlessService define old communication mechanism, based on headless service.
32+
DeploymentCommunicationMethodHeadlessService DeploymentCommunicationMethod = "headless"
33+
// DeploymentCommunicationMethodDNS define ClusterIP Service DNS based communication.
34+
DeploymentCommunicationMethodDNS DeploymentCommunicationMethod = "dns"
35+
// DeploymentCommunicationMethodShortDNS define ClusterIP Service DNS based communication. Use namespaced short DNS (used in migration)
36+
DeploymentCommunicationMethodShortDNS DeploymentCommunicationMethod = "short-dns"
37+
// DeploymentCommunicationMethodHeadlessDNS define Headless Service DNS based communication.
38+
DeploymentCommunicationMethodHeadlessDNS DeploymentCommunicationMethod = "headless-dns"
39+
// DeploymentCommunicationMethodIP define ClusterIP Service IP based communication.
40+
DeploymentCommunicationMethodIP DeploymentCommunicationMethod = "ip"
41+
)
42+
43+
// Get returns communication method from pointer. If pointer is nil default is returned.
44+
func (d *DeploymentCommunicationMethod) Get() DeploymentCommunicationMethod {
45+
if d == nil {
46+
return DefaultDeploymentCommunicationMethod
47+
}
48+
49+
switch v := *d; v {
50+
case DeploymentCommunicationMethodHeadlessService, DeploymentCommunicationMethodDNS, DeploymentCommunicationMethodIP, DeploymentCommunicationMethodShortDNS, DeploymentCommunicationMethodHeadlessDNS:
51+
return v
52+
default:
53+
return DefaultDeploymentCommunicationMethod
54+
}
55+
}
56+
57+
// ServiceType returns Service Type for communication method
58+
func (d *DeploymentCommunicationMethod) ServiceType() core.ServiceType {
59+
switch d.Get() {
60+
default:
61+
return core.ServiceTypeClusterIP
62+
}
63+
}
64+
65+
// ServiceClusterIP returns Service ClusterIP for communication method
66+
func (d *DeploymentCommunicationMethod) ServiceClusterIP() string {
67+
switch d.Get() {
68+
case DeploymentCommunicationMethodHeadlessDNS:
69+
return core.ClusterIPNone
70+
default:
71+
return ""
72+
}
73+
}
74+
75+
// String returns string representation of method.
76+
func (d DeploymentCommunicationMethod) String() string {
77+
return string(d)
78+
}
79+
80+
// New returns pointer.
81+
func (d DeploymentCommunicationMethod) New() *DeploymentCommunicationMethod {
82+
return &d
83+
}

pkg/apis/deployment/v1/deployment_spec.go

Lines changed: 135 additions & 83 deletions
Large diffs are not rendered by default.

pkg/apis/deployment/v1/external_access_spec.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,30 @@ import (
3030

3131
// ExternalAccessSpec holds configuration for the external access provided for the deployment.
3232
type ExternalAccessSpec struct {
33-
// Type of external access
33+
34+
// Type specifies the type of Service that will be created to provide access to the ArangoDB deployment from outside the Kubernetes cluster.
35+
// + doc/enum: Auto|Create a Service of type LoadBalancer and fallback to a Service or type NodePort when the LoadBalancer is not assigned an IP address.
36+
// + doc/enum: None|limit access to application running inside the Kubernetes cluster.
37+
// + doc/enum: LoadBalancer|Create a Service of type LoadBalancer for the ArangoDB deployment.
38+
// + doc/enum: NodePort|Create a Service of type NodePort for the ArangoDB deployment.
3439
Type *ExternalAccessType `json:"type,omitempty"`
35-
// Optional port used in case of Auto or NodePort type.
40+
41+
// NodePort define optional port used in case of Auto or NodePort type.
3642
NodePort *int `json:"nodePort,omitempty"`
37-
// Optional IP used to configure a load-balancer on, in case of Auto or LoadBalancer type.
43+
44+
// LoadBalancerIP define optional IP used to configure a load-balancer on, in case of Auto or LoadBalancer type.
3845
LoadBalancerIP *string `json:"loadBalancerIP,omitempty"`
46+
47+
// LoadBalancerSourceRanges define LoadBalancerSourceRanges used for LoadBalancer Service type
3948
// If specified and supported by the platform, this will restrict traffic through the cloud-provider
4049
// load-balancer will be restricted to the specified client IPs. This field will be ignored if the
4150
// cloud-provider does not support the feature.
42-
// More info: https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/
51+
// +docs/link: Cloud Provider Firewall|https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/
4352
LoadBalancerSourceRanges []string `json:"loadBalancerSourceRanges,omitempty"`
53+
4454
// AdvertisedEndpoint is passed to the coordinators/single servers for advertising a specific endpoint
4555
AdvertisedEndpoint *string `json:"advertisedEndpoint,omitempty"`
56+
4657
// ManagedServiceNames keeps names of services which are not managed by KubeArangoDB.
4758
// It is only relevant when type of service is `managed`.
4859
ManagedServiceNames []string `json:"managedServiceNames,omitempty"`

pkg/apis/deployment/v1/storage_engine.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type StorageEngine string
3131

3232
const (
3333
// StorageEngineMMFiles yields a cluster using the mmfiles storage engine
34+
// deprecated
3435
StorageEngineMMFiles StorageEngine = "MMFiles"
3536
// StorageEngineRocksDB yields a cluster using the rocksdb storage engine
3637
StorageEngineRocksDB StorageEngine = "RocksDB"

pkg/apis/deployment/v2alpha1/architecture.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ import (
2929
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
3030
)
3131

32+
// ArangoDeploymentArchitecture defines the list of supported architectures.
33+
// Possible values are:
34+
// - `amd64`: Use processors with the x86-64 architecture.
35+
// - `arm64`: Use processors with the 64-bit ARM architecture.
36+
// The setting expects a list of strings, but you should only specify a single list item for the architecture, except when you want to migrate from one architecture to the other.
37+
// The first list item defines the new default architecture for the deployment that you want to migrate to.
38+
// To use the ARM architecture, you need to enable it in the operator first using --set "operator.architectures={amd64,arm64}". See Installation with Helm.
3239
type ArangoDeploymentArchitecture []ArangoDeploymentArchitectureType
3340

3441
func (a ArangoDeploymentArchitecture) GetDefault() ArangoDeploymentArchitectureType {
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2023 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 v2alpha1
22+
23+
import core "k8s.io/api/core/v1"
24+
25+
// DeploymentCommunicationMethod define communication method used for inter-cluster communication
26+
type DeploymentCommunicationMethod string
27+
28+
const (
29+
// DefaultDeploymentCommunicationMethod define default communication method.
30+
DefaultDeploymentCommunicationMethod = DeploymentCommunicationMethodHeadlessService
31+
// DeploymentCommunicationMethodHeadlessService define old communication mechanism, based on headless service.
32+
DeploymentCommunicationMethodHeadlessService DeploymentCommunicationMethod = "headless"
33+
// DeploymentCommunicationMethodDNS define ClusterIP Service DNS based communication.
34+
DeploymentCommunicationMethodDNS DeploymentCommunicationMethod = "dns"
35+
// DeploymentCommunicationMethodShortDNS define ClusterIP Service DNS based communication. Use namespaced short DNS (used in migration)
36+
DeploymentCommunicationMethodShortDNS DeploymentCommunicationMethod = "short-dns"
37+
// DeploymentCommunicationMethodHeadlessDNS define Headless Service DNS based communication.
38+
DeploymentCommunicationMethodHeadlessDNS DeploymentCommunicationMethod = "headless-dns"
39+
// DeploymentCommunicationMethodIP define ClusterIP Service IP based communication.
40+
DeploymentCommunicationMethodIP DeploymentCommunicationMethod = "ip"
41+
)
42+
43+
// Get returns communication method from pointer. If pointer is nil default is returned.
44+
func (d *DeploymentCommunicationMethod) Get() DeploymentCommunicationMethod {
45+
if d == nil {
46+
return DefaultDeploymentCommunicationMethod
47+
}
48+
49+
switch v := *d; v {
50+
case DeploymentCommunicationMethodHeadlessService, DeploymentCommunicationMethodDNS, DeploymentCommunicationMethodIP, DeploymentCommunicationMethodShortDNS, DeploymentCommunicationMethodHeadlessDNS:
51+
return v
52+
default:
53+
return DefaultDeploymentCommunicationMethod
54+
}
55+
}
56+
57+
// ServiceType returns Service Type for communication method
58+
func (d *DeploymentCommunicationMethod) ServiceType() core.ServiceType {
59+
switch d.Get() {
60+
default:
61+
return core.ServiceTypeClusterIP
62+
}
63+
}
64+
65+
// ServiceClusterIP returns Service ClusterIP for communication method
66+
func (d *DeploymentCommunicationMethod) ServiceClusterIP() string {
67+
switch d.Get() {
68+
case DeploymentCommunicationMethodHeadlessDNS:
69+
return core.ClusterIPNone
70+
default:
71+
return ""
72+
}
73+
}
74+
75+
// String returns string representation of method.
76+
func (d DeploymentCommunicationMethod) String() string {
77+
return string(d)
78+
}
79+
80+
// New returns pointer.
81+
func (d DeploymentCommunicationMethod) New() *DeploymentCommunicationMethod {
82+
return &d
83+
}

0 commit comments

Comments
 (0)