Skip to content

Commit

Permalink
Bug fix for 3.4.0 (#317)
Browse files Browse the repository at this point in the history
* Fixed /config/apply API method for backup service

* Added support for active-rack (#312)

* Updated submodule to fetch 7.2 schemas

* Changed order of recluster and set roster command in reconcile flow

* Added duplicate volume name check in BackupService webhook

* KO-348: Skip setting hostPort in Aerospike container for podOnly network and multiPodPerHost: false (#316)

* Fixed tls and non-tls network policy hostPort flow

* Fixed the setting of the error phase while the wrong server image is given.

---------
Co-authored-by: Abhisek Dwivedi <[email protected]>
Co-authored-by: Tanmay Jain <[email protected]>
Co-authored-by: Jwalant Modi <[email protected]>
Co-authored-by: Tanmay Jain <[email protected]>
  • Loading branch information
abhishekdwivedi3060 authored Oct 16, 2024
1 parent aa051f7 commit 74a853c
Show file tree
Hide file tree
Showing 36 changed files with 361 additions and 67 deletions.
23 changes: 23 additions & 0 deletions api/v1beta1/aerospikebackupservice_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1beta1
import (
"fmt"

set "github.com/deckarep/golang-set/v2"
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
Expand Down Expand Up @@ -60,6 +61,10 @@ func (r *AerospikeBackupService) ValidateCreate() (admission.Warnings, error) {
return nil, err
}

if err := r.validateBackupServiceSecrets(); err != nil {
return nil, err
}

return nil, nil
}

Expand All @@ -73,6 +78,10 @@ func (r *AerospikeBackupService) ValidateUpdate(_ runtime.Object) (admission.War
return nil, err
}

if err := r.validateBackupServiceSecrets(); err != nil {
return nil, err
}

return nil, nil
}

Expand Down Expand Up @@ -116,3 +125,17 @@ func (r *AerospikeBackupService) validateBackupServiceConfig() error {

return config.Validate()
}

func (r *AerospikeBackupService) validateBackupServiceSecrets() error {
volumeNameSet := set.NewSet[string]()

for _, secret := range r.Spec.SecretMounts {
if volumeNameSet.Contains(secret.VolumeMount.Name) {
return fmt.Errorf("duplicate volume name %s found in secrets field", secret.VolumeMount.Name)
}

volumeNameSet.Add(secret.VolumeMount.Name)
}

return nil
}
6 changes: 4 additions & 2 deletions config/samples/aerospikebackup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ spec:
# routineName: aerospike-aerospikebackup-test-routine
config:
aerospike-cluster:
aerospike-aerospikebackup-test-cluster: # Name format: <backup-namespace>-<backup-name>-<cluster-name>
# Name format: The name must begin with the prefix <backup-namespace>-<backup-name>
aerospike-aerospikebackup-test-cluster:
credentials:
password: admin123
user: admin
seed-nodes:
- host-name: aerocluster.aerospike.svc.cluster.local
port: 3000
backup-routines:
aerospike-aerospikebackup-test-routine: # Name format: <backup-namespace>-<backup-name>-<routine-name>
# Name format: The name must begin with the prefix <backup-namespace>-<backup-name>
aerospike-aerospikebackup-test-routine:
backup-policy: test-policy
interval-cron: "@daily"
incr-interval-cron: "@hourly"
Expand Down
1 change: 1 addition & 0 deletions config/samples/aerospikebackupservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ spec:
type: aws-s3
path: "s3://aerospike-kubernetes-operator-test"
s3-region: us-east-1
s3-endpoint-override: ""
s3-profile: default

secrets:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/all_flash_cluster_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ metadata:

spec:
size: 2
image: aerospike/aerospike-server-enterprise:7.1.0.0
image: aerospike/aerospike-server-enterprise:7.2.0.1

storage:
filesystemVolumePolicy:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/dim_nostorage_cluster_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: aerospike
spec:
size: 2
image: aerospike/aerospike-server-enterprise:7.1.0.0
image: aerospike/aerospike-server-enterprise:7.2.0.1

podSpec:
multiPodPerHost: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ metadata:

spec:
size: 2
image: aerospike/aerospike-server-enterprise:7.1.0.0
image: aerospike/aerospike-server-enterprise:7.2.0.1
podSpec:
multiPodPerHost: true

Expand Down
2 changes: 1 addition & 1 deletion config/samples/hdd_dim_storage_cluster_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:

spec:
size: 2
image: aerospike/aerospike-server-enterprise:7.1.0.0
image: aerospike/aerospike-server-enterprise:7.2.0.1

storage:
filesystemVolumePolicy:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/host_network_cluster_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:

spec:
size: 2
image: aerospike/aerospike-server-enterprise:7.1.0.0
image: aerospike/aerospike-server-enterprise:7.2.0.1

storage:
filesystemVolumePolicy:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/ldap_cluster_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ metadata:
namespace: aerospike
spec:
size: 2
image: aerospike/aerospike-server-enterprise:7.1.0.0
image: aerospike/aerospike-server-enterprise:7.2.0.1

podSpec:
multiPodPerHost: true
Expand Down
2 changes: 1 addition & 1 deletion config/samples/pmem_cluster_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:

spec:
size: 2
image: aerospike/aerospike-server-enterprise:7.1.0.0
image: aerospike/aerospike-server-enterprise:7.2.0.1

storage:
filesystemVolumePolicy:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/podspec_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:

spec:
size: 2
image: aerospike/aerospike-server-enterprise:7.1.0.0
image: aerospike/aerospike-server-enterprise:7.2.0.1

storage:
filesystemVolumePolicy:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/rack_enabled_cluster_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:

spec:
size: 2
image: aerospike/aerospike-server-enterprise:7.1.0.0
image: aerospike/aerospike-server-enterprise:7.2.0.1
rackConfig:
namespaces:
- test
Expand Down
2 changes: 1 addition & 1 deletion config/samples/sc_mode_cluster_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:

spec:
size: 4
image: aerospike/aerospike-server-enterprise:7.1.0.0
image: aerospike/aerospike-server-enterprise:7.2.0.1

rosterNodeBlockList:
- 1A0
Expand Down
2 changes: 1 addition & 1 deletion config/samples/secrets/password_DC1.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
admin123
admin123
2 changes: 1 addition & 1 deletion config/samples/shadow_device_cluster_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
spec:
# Add fields here
size: 2
image: aerospike/aerospike-server-enterprise:7.1.0.0
image: aerospike/aerospike-server-enterprise:7.2.0.1

storage:
filesystemVolumePolicy:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/shadow_file_cluster_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
spec:
# Add fields here
size: 2
image: aerospike/aerospike-server-enterprise:7.1.0.0
image: aerospike/aerospike-server-enterprise:7.2.0.1

storage:
filesystemVolumePolicy:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/ssd_storage_cluster_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:

spec:
size: 2
image: aerospike/aerospike-server-enterprise:7.1.0.0
image: aerospike/aerospike-server-enterprise:7.2.0.1

storage:
filesystemVolumePolicy:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/tls_cluster_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:

spec:
size: 4
image: aerospike/aerospike-server-enterprise:7.1.0.0
image: aerospike/aerospike-server-enterprise:7.2.0.1

storage:
filesystemVolumePolicy:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/xdr_dst_cluster_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:

spec:
size: 2
image: aerospike/aerospike-server-enterprise:7.1.0.0
image: aerospike/aerospike-server-enterprise:7.2.0.1

storage:
filesystemVolumePolicy:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/xdr_src_cluster_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:

spec:
size: 2
image: aerospike/aerospike-server-enterprise:7.1.0.0
image: aerospike/aerospike-server-enterprise:7.2.0.1

storage:
filesystemVolumePolicy:
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/aerospike/aerospike-kubernetes-operator
go 1.22

require (
github.com/aerospike/aerospike-management-lib v1.4.0
github.com/aerospike/aerospike-management-lib v1.5.0
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/evanphx/json-patch v4.12.0+incompatible
github.com/go-logr/logr v1.4.2
Expand All @@ -23,7 +23,7 @@ require (
github.com/aerospike/aerospike-backup-service v0.0.0-20240822110128-dc2b4811b9d3
github.com/aerospike/aerospike-client-go/v7 v7.6.1
github.com/deckarep/golang-set/v2 v2.3.1
github.com/sirupsen/logrus v1.9.0
github.com/sirupsen/logrus v1.9.1
golang.org/x/crypto v0.24.0
golang.org/x/net v0.26.0
gomodules.xyz/jsonpatch/v2 v2.4.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ github.com/aerospike/aerospike-backup-service v0.0.0-20240822110128-dc2b4811b9d3
github.com/aerospike/aerospike-backup-service v0.0.0-20240822110128-dc2b4811b9d3/go.mod h1:PFWhqxcMsEEyoOZtQ70b+X8xWbbemDYuitT24EPBizk=
github.com/aerospike/aerospike-client-go/v7 v7.6.1 h1:VZK6S9YKq2w6ptTk3kXXjTxG2U9M9Y7Oi3YQ+3T7wQQ=
github.com/aerospike/aerospike-client-go/v7 v7.6.1/go.mod h1:uCbSYMpjlRcH/9f26VSF/luzDDXrcDaV8c6/WIcKtT4=
github.com/aerospike/aerospike-management-lib v1.4.0 h1:wT0l3kwzXv5DV5Cd+hD0BQq3hjSIyaPX1HaUb1304TI=
github.com/aerospike/aerospike-management-lib v1.4.0/go.mod h1:3JKrmC/mLSV8SygbrPQPNV8T7bFaTMjB8wfnX25gB+4=
github.com/aerospike/aerospike-management-lib v1.5.0 h1:uAEaBU+PkzbtwsSrPVokLIUeJaDrFSMtwqeCKba3xIs=
github.com/aerospike/aerospike-management-lib v1.5.0/go.mod h1:hsEptY/AmTmHoJnItJNmfJ4yCMG8LIB8YPnIpIyvGXI=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ=
Expand Down Expand Up @@ -112,8 +112,8 @@ github.com/reugn/go-quartz v0.12.0 h1:RsrklW++R5Swc7mCPYseXM06PTWN4N7/f1rsYkhHiw
github.com/reugn/go-quartz v0.12.0/go.mod h1:no4ktgYbAAuY0E1SchR8cTx1LF4jYIzdgaQhzRPSkpk=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sirupsen/logrus v1.9.1 h1:Ou41VVR3nMWWmTiEUnj0OlsgOSCUFgsPAOl6jRIcVtQ=
github.com/sirupsen/logrus v1.9.1/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
47 changes: 24 additions & 23 deletions helm-charts/aerospike-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,31 @@ helm install aerospike ./aerospike-cluster/ \

## Configurations

| Name | Description | Default |
| ---------- |---------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------|
| `replicas` | Aerospike cluster size | `3` |
| `image.repository` | Aerospike server container image repository | `aerospike/aerospike-server-enterprise` |
| `image.tag` | Aerospike server container image tag | `7.1.0.0` |
| `imagePullSecrets` | Secrets containing credentials to pull Aerospike container image from a private registry | `{}` (nil) |
| `customLabels` | Custom labels to add on the aerospikecluster resource | `{}` (nil) |
| `aerospikeAccessControl` | Aerospike access control configuration. Define users and roles to be created on the cluster. | `{}` (nil) |
| `aerospikeConfig` | Aerospike configuration | `{}` (nil) |
| `aerospikeNetworkPolicy` | Network policy (client access configuration) | `{}` (nil) |
| Name | Description | Default |
| -- |---------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------|
| `replicas` | Aerospike cluster size | `3` |
| `image.repository` | Aerospike server container image repository | `aerospike/aerospike-server-enterprise` |
| `image.tag` | Aerospike server container image tag | `7.2.0.1` |
| `imagePullSecrets` | Secrets containing credentials to pull Aerospike container image from a private registry | `{}` (nil) |
| `customLabels` | Custom labels to add on the aerospikecluster resource | `{}` (nil) |
| `aerospikeAccessControl` | Aerospike access control configuration. Define users and roles to be created on the cluster. | `{}` (nil) |
| `aerospikeConfig` | Aerospike configuration | `{}` (nil) |
| `aerospikeNetworkPolicy` | Network policy (client access configuration) | `{}` (nil) |
| `commonName` | Base string for naming pods, services, stateful sets, etc. | Release name truncated to 63 characters (without hyphens) |
| `podSpec` | Aerospike pod spec configuration | `{}` (nil) |
| `rackConfig` | Aerospike rack configuration | `{}` (nil) |
| `storage` | Aerospike pod storage configuration | `{}` (nil) |
| `validationPolicy` | Validation policy | `{}` (nil) |
| `operatorClientCert` | Client certificates to connect to Aerospike | `{}` (nil) |
| `seedsFinderServices` | Service (e.g. loadbalancer) for Aerospike cluster discovery | `{}` (nil) |
| `maxUnavailable` | maxUnavailable defines percentage/number of pods that can be allowed to go down or unavailable before application disruption | `1` |
| `disablePDB` | Disable the PodDisruptionBudget creation for the Aerospike cluster | `false` |
| `enableDynamicConfigUpdate` | enableDynamicConfigUpdate enables dynamic config update flow of the operator | `false` |
| `rosterNodeBlockList` | rosterNodeBlockList is a list of blocked nodeIDs from roster in a strong-consistency setup | `[]` |
| `k8sNodeBlockList` | k8sNodeBlockList is a list of Kubernetes nodes which are not used for Aerospike pods | `[]` |
| `paused` | Pause reconciliation of the cluster | `false` |
| `devMode` | Deploy Aerospike cluster in dev mode | `false` |
| `podSpec` | Aerospike pod spec configuration | `{}` (nil) |
| `rackConfig` | Aerospike rack configuration | `{}` (nil) |
| `storage` | Aerospike pod storage configuration | `{}` (nil) |
| `validationPolicy` | Validation policy | `{}` (nil) |
| `operatorClientCert` | Client certificates to connect to Aerospike | `{}` (nil) |
| `seedsFinderServices` | Service (e.g. loadbalancer) for Aerospike cluster discovery | `{}` (nil) |
| `maxUnavailable` | maxUnavailable defines percentage/number of pods that can be allowed to go down or unavailable before application disruption | `1` |
| `disablePDB` | Disable the PodDisruptionBudget creation for the Aerospike cluster | `false` |
| `enableDynamicConfigUpdate` | enableDynamicConfigUpdate enables dynamic config update flow of the operator | `false` |
| `rosterNodeBlockList` | rosterNodeBlockList is a list of blocked nodeIDs from roster in a strong-consistency setup | `[]` |
| `k8sNodeBlockList` | k8sNodeBlockList is a list of Kubernetes nodes which are not used for Aerospike pods | `[]` |
| `paused` | Pause reconciliation of the cluster | `false` |
| `devMode` | Deploy Aerospike cluster in dev mode | `false` |
| `operations` | Operations is a list of on-demand operations to be performed on the Aerospike cluster. | `[]` |

### Default values in "dev" mode (`devMode=true`):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
size: {{ .Values.replicas }}

# Aerospike server docker image
image: {{ .Values.image.repository | default "aerospike/aerospike-server-enterprise" }}:{{ .Values.image.tag | default "7.1.0.0" }}
image: {{ .Values.image.repository | default "aerospike/aerospike-server-enterprise" }}:{{ .Values.image.tag | default "7.2.0.1" }}

## maxUnavailable defines percentage/number of pods that can be allowed to go down or unavailable
## before application disruption.
Expand Down Expand Up @@ -127,5 +127,10 @@ spec:
k8sNodeBlockList: {{- toYaml . | nindent 4 }}
{{- end }}

## operations is a list of on-demand operations to be performed on the Aerospike cluster.
{{- with .Values.operations }}
operations: {{- toYaml . | nindent 4 }}
{{- end }}

## Pause reconciliation of the cluster
paused: {{ .Values.paused }}
8 changes: 7 additions & 1 deletion helm-charts/aerospike-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ replicas: 3
## Aerospike server docker image
image:
repository: aerospike/aerospike-server-enterprise
tag: 7.1.0.0
tag: 7.2.0.1

## In case the above image is pulled from a registry that requires
## authentication, a secret containing credentials can be added
Expand Down Expand Up @@ -120,5 +120,11 @@ k8sNodeBlockList: []
## Pause reconciliation of the cluster
paused: false

operations: []
# - kind: "WarmRestart"
# id: "1"
# podList:
# - podName: "aerospike-cluster-0"

## Dev Mode
devMode: false
Loading

0 comments on commit 74a853c

Please sign in to comment.