Skip to content

Commit ee5dcb5

Browse files
committed
Turn on TLS by default
1 parent fd7b559 commit ee5dcb5

File tree

7 files changed

+22
-14
lines changed

7 files changed

+22
-14
lines changed

docs/user/custom_resource.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ and restarting it.
142142
This setting specifies the name of a kubernetes `Secret` that contains
143143
a standard CA certificate + private key used to sign certificates for individual
144144
ArangoDB servers.
145-
The default value is empty. TBD
145+
When no name is specified, it defaults to `<deployment-name>-ca`.
146+
To disable authentication, set this value to `None`.
146147

147148
If you specify a name of a `Secret` that does not exist, a self-signed CA certificate + key is created
148149
and stored in a `Secret` with given name.

docs/user/tls.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# TLS
22

3-
The ArangoDB operator allows you to create ArangoDB deployments that use
3+
The ArangoDB operator will by default create ArangoDB deployments that use
44
secure TLS connections.
55

66
It uses a single CA certificate (stored in a Kubernetes secret) and
77
one certificate per ArangoDB server (stored in a Kubernetes secret per server).
88

9+
To disable TLS, set `spec.tls.caSecretName` to `None`.
10+
911
## Install CA certificate
1012

1113
If the CA certificate is self-signed, it will not be trusted by browsers,
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: "example-simple-cluster-no-tls"
5+
spec:
6+
mode: cluster
7+
tls:
8+
caSecretName: None

examples/simple-cluster-tls.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.

pkg/apis/deployment/v1alpha/deployment_spec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func (s *DeploymentSpec) SetDefaults(deploymentName string) {
9292
}
9393
s.RocksDB.SetDefaults()
9494
s.Authentication.SetDefaults(deploymentName + "-jwt")
95-
s.TLS.SetDefaults("")
95+
s.TLS.SetDefaults(deploymentName + "-ca")
9696
s.Sync.SetDefaults(s.Image, s.ImagePullPolicy, deploymentName+"-sync-jwt", deploymentName+"-sync-ca")
9797
s.Single.SetDefaults(ServerGroupSingle, s.Mode.HasSingleServers(), s.Mode)
9898
s.Agents.SetDefaults(ServerGroupAgents, s.Mode.HasAgents(), s.Mode)

pkg/apis/deployment/v1alpha/tls_spec.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,14 @@ type TLSSpec struct {
4242
TTL time.Duration `json:"ttl,omitempty"`
4343
}
4444

45+
const (
46+
// CASecretNameDisabled is the value of CASecretName to use for disabling authentication.
47+
CASecretNameDisabled = "None"
48+
)
49+
4550
// IsSecure returns true when a CA secret has been set, false otherwise.
4651
func (s TLSSpec) IsSecure() bool {
47-
return s.CASecretName != ""
52+
return s.CASecretName != CASecretNameDisabled
4853
}
4954

5055
// GetAltNames splits the list of AltNames into DNS names, IP addresses & email addresses.

pkg/apis/deployment/v1alpha/tls_spec_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ func TestTLSSpecValidate(t *testing.T) {
4343
}
4444

4545
func TestTLSSpecIsSecure(t *testing.T) {
46-
assert.False(t, TLSSpec{CASecretName: ""}.IsSecure())
46+
assert.True(t, TLSSpec{CASecretName: ""}.IsSecure())
4747
assert.True(t, TLSSpec{CASecretName: "foo"}.IsSecure())
48+
assert.False(t, TLSSpec{CASecretName: "None"}.IsSecure())
4849
}
4950

5051
func TestTLSSpecSetDefaults(t *testing.T) {

0 commit comments

Comments
 (0)