diff --git a/.env b/.env index 7c166b57a..5db3472fa 100644 --- a/.env +++ b/.env @@ -4,6 +4,6 @@ GO_VERSION=1.23.0 AWSCLI_URL=https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.8.6.zip KUBECTL_VERSION=v1.29.1 AZ_CLI_VERSION=2.30.0 -EKSCTL_VERSION=v0.143.0 -EKS_CLUSTER_K8_VERSION=1.27 +EKSCTL_VERSION=v0.191.0 +EKS_CLUSTER_K8_VERSION=1.31 SPLUNK_ENTERPRISE_RELEASE_IMAGE=splunk/splunk:9.3.0 diff --git a/go.mod b/go.mod index d6b5b1fd5..e5a11bf46 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/aws/aws-sdk-go v1.47.11 github.com/go-logr/logr v1.4.2 github.com/google/go-cmp v0.6.0 + github.com/joho/godotenv v1.5.1 github.com/minio/minio-go/v7 v7.0.16 github.com/onsi/ginkgo/v2 v2.20.2 github.com/onsi/gomega v1.34.2 diff --git a/go.sum b/go.sum index 14de0e83e..708656411 100644 --- a/go.sum +++ b/go.sum @@ -223,6 +223,8 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= +github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= @@ -518,6 +520,10 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= +golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= @@ -681,6 +687,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= diff --git a/helm-chart/splunk-operator/templates/deployment.yaml b/helm-chart/splunk-operator/templates/deployment.yaml index 2a1ffc076..c1136248c 100644 --- a/helm-chart/splunk-operator/templates/deployment.yaml +++ b/helm-chart/splunk-operator/templates/deployment.yaml @@ -88,6 +88,8 @@ spec: value: {{ include "splunk-operator.operator.fullname" . }} - name: RELATED_IMAGE_SPLUNK_ENTERPRISE value: "{{ .Values.image.repository }}" + - name: CLUSTER_DOMAIN + value: {{ .Values.splunkOperator.clusterDomain | default "cluster.local" }} ports: {{- range .Values.splunkOperator.service.ports }} - containerPort: {{ .port }} diff --git a/test/appframework_aws/c3/appframework_aws_suite_test.go b/test/appframework_aws/c3/appframework_aws_suite_test.go index 355152408..289b6b9ed 100644 --- a/test/appframework_aws/c3/appframework_aws_suite_test.go +++ b/test/appframework_aws/c3/appframework_aws_suite_test.go @@ -22,6 +22,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "github.com/joho/godotenv" "github.com/splunk/splunk-operator/test/testenv" ) @@ -53,11 +54,47 @@ var ( // TestBasic is the main entry point func TestBasic(t *testing.T) { + // Find and load the .env file from the current directory upwards + if err := loadEnvFile(); err != nil { + panic("Error loading .env file: " + err.Error()) + } RegisterFailHandler(Fail) RunSpecs(t, "Running "+testSuiteName) } +//func TestMain(m *testing.M) { +// Run the tests +// os.Exit(m.Run()) +//} + +// loadEnvFile traverses up the directory tree to find a .env file +func loadEnvFile() error { + // Get the current working directory + dir, err := os.Getwd() + if err != nil { + return err + } + + // Traverse up the directory tree + for { + // Check if .env file exists in the current directory + envFile := filepath.Join(dir, ".env") + if _, err := os.Stat(envFile); err == nil { + // .env file found, load it + return godotenv.Load(envFile) + } + + // Move up to the parent directory + parentDir := filepath.Dir(dir) + if parentDir == dir { + // Reached the root directory + return nil + } + dir = parentDir + } +} + var _ = BeforeSuite(func() { var err error testenvInstance, err = testenv.NewDefaultTestEnv(testSuiteName) diff --git a/test/deploy-eks-cluster.sh b/test/deploy-eks-cluster.sh index c5c405a22..faa83a597 100755 --- a/test/deploy-eks-cluster.sh +++ b/test/deploy-eks-cluster.sh @@ -93,6 +93,8 @@ function createCluster() { kubectl annotate serviceaccount -n $namespace $service_account eks.amazonaws.com/role-arn=arn:aws:iam::$account_id:role/${rolename} eksctl create addon --name aws-ebs-csi-driver --cluster ${TEST_CLUSTER_NAME} --service-account-role-arn arn:aws:iam::$account_id:role/${rolename} --force eksctl utils update-cluster-logging --cluster ${TEST_CLUSTER_NAME} + # CSPL-2887 - Patch the default storage class to gp2 + kubectl patch storageclass gp2 -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' else echo "Retrieving kubeconfig for ${TEST_CLUSTER_NAME}" # Cluster exists but kubeconfig may not diff --git a/test/env.sh b/test/env.sh index be3c7c65c..08aed7af0 100644 --- a/test/env.sh +++ b/test/env.sh @@ -11,7 +11,7 @@ : "${ECR_REGISTRY:=}" : "${VPC_PUBLIC_SUBNET_STRING:=}" : "${VPC_PRIVATE_SUBNET_STRING:=}" -: "${EKS_CLUSTER_K8_VERSION:=1.26}" +: "${EKS_CLUSTER_K8_VERSION:=1.31}" # Below env variables required to run license master test cases : "${ENTERPRISE_LICENSE_S3_PATH:=/test_licenses}" : "${TEST_S3_BUCKET:=splk-test-data-bucket}"