Skip to content

Commit d5b5e00

Browse files
authored
[Bugfix] Ensure proper ArangoDeployment Spec usage in ArangoSync (#1232)
1 parent 51622c8 commit d5b5e00

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- (Bugfix) Fix deployment creation on ARM64
55
- (DebugPackage) Add Agency Dump & State
66
- (Bugfix) Fix After leaked GoRoutines
7+
- (Bugfix) Ensure proper ArangoDeployment Spec usage in ArangoSync
78

89
## [1.2.23](https://github.com/arangodb/kube-arangodb/tree/1.2.23) (2023-01-12)
910
- (Bugfix) Remove PDBs if group count is 0

pkg/debug_package/generators/kubernetes/agency.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func agencyDump(logger zerolog.Logger, files chan<- shared.File) error {
5757
}
5858

5959
for _, deployment := range deployments {
60-
if !deployment.Spec.Mode.HasAgents() {
60+
if !deployment.GetAcceptedSpec().Mode.HasAgents() {
6161
continue
6262
}
6363

pkg/deployment/deployment.go

Lines changed: 2 additions & 2 deletions
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.
@@ -141,7 +141,7 @@ func (d *Deployment) IsSyncEnabled() bool {
141141
d.currentObjectLock.RLock()
142142
defer d.currentObjectLock.RUnlock()
143143

144-
if d.currentObject.Spec.Sync.IsEnabled() {
144+
if d.currentObject.GetAcceptedSpec().Sync.IsEnabled() {
145145
return true
146146
}
147147

pkg/handlers/job/handler.go

Lines changed: 6 additions & 4 deletions
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.
@@ -142,13 +142,15 @@ func (h *handler) prepareK8sJob(job *appsApi.ArangoJob) (*batch.Job, error) {
142142
return &k8sJob, err
143143
}
144144

145-
if deployment.Spec.TLS.IsSecure() {
145+
spec := deployment.GetAcceptedSpec()
146+
147+
if spec.TLS.IsSecure() {
146148
k8sJob.Spec.Template.Spec.Volumes = []core.Volume{
147149
{
148150
Name: shared.TlsKeyfileVolumeName,
149151
VolumeSource: core.VolumeSource{
150152
Secret: &core.SecretVolumeSource{
151-
SecretName: deployment.Spec.TLS.GetCASecretName(),
153+
SecretName: spec.TLS.GetCASecretName(),
152154
},
153155
},
154156
},
@@ -162,7 +164,7 @@ func (h *handler) prepareK8sJob(job *appsApi.ArangoJob) (*batch.Job, error) {
162164
}
163165

164166
initContainer := k8sutil.ArangodWaiterInitContainer(api.ServerGroupReservedInitContainerNameWait, deployment.Name, executable,
165-
h.operator.Image(), deployment.Spec.TLS.IsSecure(), &core.SecurityContext{})
167+
h.operator.Image(), spec.TLS.IsSecure(), &core.SecurityContext{})
166168

167169
k8sJob.Spec.Template.Spec.InitContainers = append(k8sJob.Spec.Template.Spec.InitContainers, initContainer)
168170

pkg/replication/sync_client.go

Lines changed: 3 additions & 3 deletions
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.
@@ -114,7 +114,7 @@ func (dr *DeploymentReplication) createArangoSyncEndpoint(epSpec api.EndpointSpe
114114
dr.log.Err(err).Str("deployment", deploymentName).Debug("Failed to get deployment")
115115
return nil, errors.WithStack(err)
116116
}
117-
dnsName := k8sutil.CreateSyncMasterClientServiceDNSNameWithDomain(depl, depl.Spec.ClusterDomain)
117+
dnsName := k8sutil.CreateSyncMasterClientServiceDNSNameWithDomain(depl, depl.GetAcceptedSpec().ClusterDomain)
118118
return client.Endpoint{"https://" + net.JoinHostPort(dnsName, strconv.Itoa(shared.ArangoSyncMasterPort))}, nil
119119
}
120120
return client.Endpoint(epSpec.MasterEndpoint), nil
@@ -176,7 +176,7 @@ func (dr *DeploymentReplication) getEndpointSecretNames(epSpec api.EndpointSpec)
176176
dr.log.Err(err).Str("deployment", deploymentName).Debug("Failed to get deployment")
177177
return "", "", "", "", errors.WithStack(err)
178178
}
179-
return clientAuthCertKeyfileSecretName, userSecretName, depl.Spec.Sync.Authentication.GetJWTSecretName(), depl.Spec.Sync.TLS.GetCASecretName(), nil
179+
return clientAuthCertKeyfileSecretName, userSecretName, depl.GetAcceptedSpec().Sync.Authentication.GetJWTSecretName(), depl.GetAcceptedSpec().Sync.TLS.GetCASecretName(), nil
180180
}
181181
return clientAuthCertKeyfileSecretName, userSecretName, "", epSpec.TLS.GetCASecretName(), nil
182182
}

0 commit comments

Comments
 (0)