Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KO-360: Added validation check for ipv6 #336

Merged
merged 3 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pipeline {

AEROSPIKE_CUSTOM_INIT_REGISTRY="568976754000.dkr.ecr.ap-south-1.amazonaws.com"
AEROSPIKE_CUSTOM_INIT_REGISTRY_NAMESPACE="aerospike"
AEROSPIKE_CUSTOM_INIT_NAME_TAG="aerospike-kubernetes-init:2.2.3"
AEROSPIKE_CUSTOM_INIT_NAME_TAG="aerospike-kubernetes-init:2.2.4-dev1"
}

stages {
Expand Down
8 changes: 2 additions & 6 deletions api/v1/aerospikecluster_mutating_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ func (c *AerospikeCluster) setDefaults(asLog logr.Logger) (admission.Warnings, e
}

// Set defaults for pod spec
if err := c.Spec.PodSpec.SetDefaults(); err != nil {
return warn, err
}
c.Spec.PodSpec.SetDefaults()

// Validation policy
if c.Spec.ValidationPolicy == nil {
Expand Down Expand Up @@ -151,7 +149,7 @@ func (c *AerospikeCluster) setDefaults(asLog logr.Logger) (admission.Warnings, e
}

// SetDefaults applies defaults to the pod spec.
func (p *AerospikePodSpec) SetDefaults() error {
func (p *AerospikePodSpec) SetDefaults() {
var groupID int64

if p.InputDNSPolicy == nil {
Expand All @@ -174,8 +172,6 @@ func (p *AerospikePodSpec) SetDefaults() error {
}
p.SecurityContext = SecurityContext
}

return nil
}

// setDefaultRackConf create the default rack if the spec has no racks configured.
Expand Down
4 changes: 4 additions & 0 deletions api/v1/aerospikecluster_validating_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,10 @@ func (c *AerospikeCluster) validateAerospikeConfig(
)
}

if val, exists := serviceConf["advertise-ipv6"]; exists && val.(bool) {
return fmt.Errorf("advertise-ipv6 is not supported")
}

if _, ok = serviceConf["cluster-name"]; !ok {
return fmt.Errorf("aerospikeCluster name not found in config. Looks like object is not mutated by webhook")
}
Expand Down
2 changes: 1 addition & 1 deletion api/v1/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const (
AerospikeInitContainerNameTagEnvVar = "AEROSPIKE_KUBERNETES_INIT_NAME_TAG"
AerospikeInitContainerDefaultRegistry = "docker.io"
AerospikeInitContainerDefaultRegistryNamespace = "aerospike"
AerospikeInitContainerDefaultNameAndTag = "aerospike-kubernetes-init:2.2.3"
AerospikeInitContainerDefaultNameAndTag = "aerospike-kubernetes-init:2.2.4-dev1"
AerospikeAppLabel = "app"
AerospikeAppLabelValue = "aerospike-cluster"
AerospikeCustomResourceLabel = "aerospike.com/cr"
Expand Down
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ spec:
value: aerospike
- name: AEROSPIKE_KUBERNETES_INIT_NAME_TAG
# this is the name and tag of aerospike-init image
value: aerospike-kubernetes-init:2.2.3
value: aerospike-kubernetes-init:2.2.4-dev1
serviceAccountName: controller-manager

terminationGracePeriodSeconds: 10
2 changes: 1 addition & 1 deletion config/samples/aerospikebackupservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: aerospikebackupservice-sample
namespace: aerospike
spec:
image: aerospike/aerospike-backup-service:2.0.0
image: aerospike/aerospike-backup-service:3.0.0
config:
service:
http:
Expand Down
2 changes: 1 addition & 1 deletion helm-charts/aerospike-backup-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ helm install aerospike-backup-service aerospike/aerospike-backup-service \
| Name | Description | Default |
|------------------------------|-------------------------------------------------------------------------------|--------------------------------------|
| `image.repository` | Aerospike backup service container image repository | `aerospike/aerospike-backup-service` |
| `image.tag` | Aerospike backup service container image tag | `2.0.0` |
| `image.tag` | Aerospike backup service container image tag | `3.0.0` |
| `customLabels` | Custom labels to add on the AerospikeBackupService resource | `{}` (nil) |
| `serviceAccount.create` | Enable ServiceAccount creation for Aerospike backup service. | true |
| `serviceAccount.annotations` | ServiceAccount annotations | `{}` (nil) |
Expand Down
2 changes: 1 addition & 1 deletion helm-charts/aerospike-backup-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ nameOverride: ""
## Image is the image for the backup service.
image:
repository: aerospike/aerospike-backup-service
tag: "2.0.0"
tag: "3.0.0"

## Custom labels that will be applied on the AerospikeBackupService resource
customLabels: {}
Expand Down
2 changes: 1 addition & 1 deletion helm-charts/aerospike-kubernetes-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ aerospikeKubernetesInitRegistry: "docker.io"
aerospikeKubernetesInitRegistryNamespace: "aerospike"

# Name and tag of aerospike-init image
aerospikeKubernetesInitNameTag: "aerospike-kubernetes-init:2.2.3"
aerospikeKubernetesInitNameTag: "aerospike-kubernetes-init:2.2.4-dev1"

## Resources - limits / requests
resources:
Expand Down
2 changes: 1 addition & 1 deletion test/backup/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func getBackupConfigInMap(prefix string) map[string]interface{} {
asdbv1beta1.BackupRoutinesKey: map[string]interface{}{
fmt.Sprintf("%s-%s", prefix, "test-routine"): map[string]interface{}{
"backup-policy": "test-policy",
"interval-cron": "*/1 * * * * *",
"interval-cron": "*/30 * * * * *",
"incr-interval-cron": "@hourly",
"namespaces": []string{"test"},
"source-cluster": fmt.Sprintf("%s-%s", prefix, "test-cluster"),
Expand Down
2 changes: 1 addition & 1 deletion test/backup_service/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/aerospike/aerospike-kubernetes-operator/test"
)

const BackupServiceImage = "abhishekdwivedi3060/aerospike-backup-service:3.0.0.3"
const BackupServiceImage = "aerospike/aerospike-backup-service:3.0.0"
const BackupServiceVersion2Image = "aerospike/aerospike-backup-service:2.0.0"

const (
Expand Down
14 changes: 14 additions & 0 deletions test/cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,20 @@ func negativeDeployClusterValidationTest(
},
)

It(
"ServiceConf: should fail for setting advertise-ipv6",
func() {
aeroCluster := createDummyAerospikeCluster(
clusterNamespacedName, 1,
)
aeroCluster.Spec.AerospikeConfig.Value["service"].(map[string]interface{})["advertise-ipv6"] = true
err := deployCluster(
k8sClient, ctx, aeroCluster,
)
Expect(err).Should(HaveOccurred())
},
)

Context(
"InvalidNamespace", func() {
It(
Expand Down
4 changes: 2 additions & 2 deletions test/cluster/podspec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ var _ = Describe(
"Should be able to set/update aerospike-init custom registry, namespace and name", func() {
operatorEnvVarRegistry := "docker.io"
operatorEnvVarRegistryNamespace := "aerospike"
operatorEnvVarNameAndTag := "aerospike-kubernetes-init:2.2.3"
operatorEnvVarNameAndTag := "aerospike-kubernetes-init:2.2.4-dev1"
customRegistry := getEnvVar(customInitRegistryEnvVar)
customRegistryNamespace := getEnvVar(customInitRegistryNamespaceEnvVar)
customInitNameAndTag := getEnvVar(customInitNameAndTagEnvVar)
Expand Down Expand Up @@ -516,7 +516,7 @@ var _ = Describe(
func() {
operatorEnvVarRegistry := "docker.io"
operatorEnvVarRegistryNamespace := "aerospike"
operatorEnvVarNameAndTag := "aerospike-kubernetes-init:2.2.3"
operatorEnvVarNameAndTag := "aerospike-kubernetes-init:2.2.4-dev1"
incorrectCustomRegistryNamespace := "incorrectnamespace"

By("Using incorrect registry namespace in CR")
Expand Down
2 changes: 1 addition & 1 deletion test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ done
CRED_PATH=${CRED_PATH:-$HOME/.docker/config.json}
REGISTRY=${REGISTRY:-568976754000.dkr.ecr.ap-south-1.amazonaws.com}
REGISTRY_NAMESPACE=${REGISTRY_NAMESPACE:-aerospike}
INIT_IMAGE_NAME_TAG=${INIT_IMAGE_NAME_TAG:-aerospike-kubernetes-init:2.2.3}
INIT_IMAGE_NAME_TAG=${INIT_IMAGE_NAME_TAG:-aerospike-kubernetes-init:2.2.4-dev1}


DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
Expand Down
Loading