Skip to content

Commit

Permalink
Adding fix while setting error phase and update server image tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmayja committed Oct 15, 2024
1 parent e56812a commit bf3b063
Show file tree
Hide file tree
Showing 27 changed files with 75 additions and 59 deletions.
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
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
2 changes: 1 addition & 1 deletion 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.1-0.20240905074352-532f7cf2e66b
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 Down
4 changes: 2 additions & 2 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.1-0.20240905074352-532f7cf2e66b h1:x7zrG9VzAdGU4MUOVBhB8OZ8VWUgko1qqfA5ikyocWw=
github.com/aerospike/aerospike-management-lib v1.4.1-0.20240905074352-532f7cf2e66b/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
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
11 changes: 9 additions & 2 deletions internal/controller/cluster/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/record"
"k8s.io/client-go/util/retry"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
Expand Down Expand Up @@ -463,9 +464,15 @@ func (r *SingleClusterReconciler) updateStatus() error {

func (r *SingleClusterReconciler) setStatusPhase(phase asdbv1.AerospikeClusterPhase) error {
if r.aeroCluster.Status.Phase != phase {
r.aeroCluster.Status.Phase = phase
if err := retry.RetryOnConflict(retry.DefaultRetry, func() error {
if err := r.Client.Get(context.TODO(), utils.GetNamespacedName(r.aeroCluster), r.aeroCluster); err != nil {
return err
}

r.aeroCluster.Status.Phase = phase

if err := r.Client.Status().Update(context.Background(), r.aeroCluster); err != nil {
return r.Client.Status().Update(context.Background(), r.aeroCluster)
}); err != nil {
r.Log.Error(err, fmt.Sprintf("Failed to set cluster status to %s", phase))
return err
}
Expand Down
2 changes: 1 addition & 1 deletion test/cluster/batch_restart_pods_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
const batchClusterName = "batch-restart"

var (
unavailableImage = fmt.Sprintf("%s:%s", baseImage, "7.1.0.99")
unavailableImage = fmt.Sprintf("%s:%s", baseImage, "7.2.0.99")
availableImage1 = nextImage
)

Expand Down
6 changes: 3 additions & 3 deletions test/cluster/cluster_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ import (

const (
baseImage = "aerospike/aerospike-server-enterprise"
nextServerVersion = "7.1.0.0_1"
latestServerVersion = "7.1.0.0"
nextServerVersion = "7.2.0.1_1"
latestServerVersion = "7.2.0.1"
invalidVersion = "3.0.0.4"

post6Version = "7.0.0.0"
pre6Version = "5.7.0.17"
version6 = "6.0.0.5"

latestSchemaVersion = "7.1.0"
latestSchemaVersion = "7.2.0"
)

var (
Expand Down
7 changes: 1 addition & 6 deletions test/cluster/dynamic_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,7 @@ var _ = Describe(
},
)
aeroCluster.Spec.EnableDynamicConfigUpdate = ptr.To(true)
aeroCluster.Spec.Image = "aerospike.jfrog.io/docker/aerospike/aerospike-server-enterprise-rc:7.2.0.0-rc2"
aeroCluster.Spec.PodSpec.ImagePullSecrets = []v1.LocalObjectReference{
{
Name: "regcred",
},
}

aeroCluster.Spec.RackConfig.Racks = append(aeroCluster.Spec.RackConfig.Racks,
asdbv1.Rack{
ID: 1,
Expand Down

0 comments on commit bf3b063

Please sign in to comment.