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

[CSPL-2699]: adding Azure and GCP bucket access using sdk #1340

Open
wants to merge 128 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
64776ef
adding gcp bucket access using sdk
Jun 10, 2024
06b7a3e
adding gcp skd
Jun 10, 2024
b05703a
merge from develop
Aug 20, 2024
f800c3f
merge from develop
Sep 17, 2024
5ed27d1
working code cod
Sep 19, 2024
327c584
working code
Sep 19, 2024
ca499a4
azure blob sdk support
Sep 27, 2024
07a3ed9
azure blob sdk support
Sep 27, 2024
192662a
logging fixed
Sep 27, 2024
c634658
logging fixed
Sep 27, 2024
473e80e
azure code support for AzureAD
Oct 1, 2024
3b524f3
azure code support for AzureAD
Oct 1, 2024
affd976
azure code support for AzureAD
Oct 1, 2024
91b7517
adding validation
Oct 10, 2024
c3ae6b0
go updates
Oct 10, 2024
ba92dd5
Merge branch 'develop' into google-object-storage-support
Oct 10, 2024
d1809e5
pipeline test for azure
Oct 10, 2024
79d5f55
adding gcp pipeline
Oct 10, 2024
7f2040d
fixed buildx
Oct 10, 2024
e1c6513
using buildx
Oct 10, 2024
e38c212
using buildx
Oct 11, 2024
e786f1a
fixed dotenv version
Oct 11, 2024
de4206a
fixed dotenv version
Oct 11, 2024
dc2d3eb
fixed docker login
Oct 11, 2024
d62f876
fixed docker login
Oct 11, 2024
ff5cf32
fixed docker login
Oct 11, 2024
f287293
fixed cluster name
Oct 11, 2024
31c0684
fixed gke cloud auth plugin issue
Oct 11, 2024
28ad9a6
fixed gke cloud auth plugin issue
Oct 11, 2024
2c49786
gcp variable in script
Oct 11, 2024
7343c50
gcp variable in workflow
Oct 11, 2024
afa5185
adding gcp test cases for appframework
Oct 11, 2024
d2f01bd
adding gcp test cases for appframework
Oct 11, 2024
a8f8741
modification to support gcp in test
Oct 11, 2024
43c8f76
modification to support gcp in test
Oct 11, 2024
0e986a7
modification to support gcp in test
Oct 11, 2024
f845819
adding gcp tag in test case
Oct 11, 2024
46b4c6a
adding gcp tag in test case
Oct 11, 2024
3b7d327
adding gcp workload management
Oct 11, 2024
dec28ab
testing something here
Oct 11, 2024
13ad0be
reverting the change
Oct 11, 2024
97c1566
adding back service account
Oct 11, 2024
f3f8656
adding only smoke test
Oct 12, 2024
6401d17
adding gcloud
Oct 12, 2024
76f0bf8
adding only smoke test
Oct 12, 2024
7a9f1c8
adding glcoud cli
Oct 12, 2024
0d585a1
adding bucket
Oct 12, 2024
67c2c25
debugging
Oct 12, 2024
7a56b32
debugging
Oct 12, 2024
6fc6d12
debugging upload
Oct 12, 2024
d454d01
adding index bucket
Oct 12, 2024
9383d30
adding secret logic test
Oct 12, 2024
5fe1e34
adding secret logic test
Oct 12, 2024
25ea86d
adding secret logic test
Oct 13, 2024
dcc88b9
added script to create gcp cluster
Oct 13, 2024
07cafe7
added using credentials for gcp
Oct 13, 2024
33135ca
changing glcoud to gcp as key
Oct 13, 2024
16deadc
changing gcp service account key field
Oct 13, 2024
294db0f
updates test cases
Oct 13, 2024
9e31a48
adding logic to use base64 encode
Oct 15, 2024
8054020
adding logic to use base64 encode
Oct 15, 2024
21581f4
use base64 key
Oct 15, 2024
fd1d7b8
fixed code for gcp
Oct 15, 2024
3089af4
fixed apps listing
Oct 15, 2024
991e9c1
initial doc changes
Oct 15, 2024
de3516a
adding test to create mutliple clusters
Oct 16, 2024
d903e33
fixed test case to be less than 40 characters
Oct 16, 2024
f9178d4
fixed cluster name
Oct 16, 2024
37bd121
testing cluster name
Oct 16, 2024
3ee6d53
fixed cluster name
Oct 16, 2024
038d007
fixed bug in workflow
Oct 16, 2024
fc5f808
adding enterprise license location
Oct 16, 2024
d9af73b
doc changes
Oct 16, 2024
9fd00dd
log message changed for GCP
vivekr-splunk Oct 23, 2024
e22ff1e
setting license path
vivekr-splunk Oct 24, 2024
2130052
commenting all the test cases except one
Oct 25, 2024
0eb5ae4
adding gcp_sanity
Oct 28, 2024
dafc469
doc changes and comment test
Oct 28, 2024
73fb528
workflow changes
Oct 28, 2024
521172b
doc changes
Oct 28, 2024
486a374
adding gcp_sanity
Oct 28, 2024
f86487f
crd changes
Oct 29, 2024
f9de19e
test script changes and formats
Oct 29, 2024
ee2750d
Merge branch 'develop' into google-object-storage-support
Oct 29, 2024
21a610c
adding back C3 test cases for gcp
Oct 29, 2024
54a21d2
adding back m4 test cases
Oct 29, 2024
b8dc404
only one C3 test case to run
Oct 30, 2024
238a1d8
added storage type as gcs
Oct 30, 2024
28b6db9
adding only 3 test cases
Oct 30, 2024
5feb4e4
azure s1 only 1 test case enabled
Oct 30, 2024
d114757
changed path in azure
Oct 30, 2024
6b0e192
removed startAfter as its same prefix
Oct 30, 2024
8c4577c
changing storageType to gcs
Oct 31, 2024
0679088
adding back azure test cases
Oct 31, 2024
fb37d45
adding 2 test in c3 for gcp
Nov 1, 2024
e952347
adding in this c3 gcp_sanity test cases
Nov 1, 2024
1ed9e74
adding only c3 test
Nov 4, 2024
24cabce
removed unused test cases
Nov 5, 2024
0ad3371
rerunning test cases
Nov 6, 2024
3309747
disabling upgrade check
Nov 6, 2024
73b1113
changed the upgrade flow
Nov 6, 2024
6526fae
fixed indexer in upgrade flow
Nov 6, 2024
434185a
document changes to support azure and gcp bucket using native sdk
Nov 7, 2024
0914591
doc changes for gcp
Nov 7, 2024
661ecc4
fixed azure documentation
Nov 7, 2024
483679c
fixed license path
Nov 8, 2024
ac603c9
just increasing timeout for now
Nov 8, 2024
57d3356
gcp test fixed
Nov 13, 2024
a8895b7
added copyright
Nov 13, 2024
407038a
group test cases based on SVA
Nov 14, 2024
a24388d
fixed test focus for cluster name
Nov 14, 2024
fd477e4
removed commented code
Nov 14, 2024
f1c3074
removed commented code
Nov 14, 2024
f25ff4a
removed mock client for http azure
Nov 14, 2024
60c6086
fixed instance type
Nov 14, 2024
8a6180d
adding disk size
Nov 14, 2024
81f43a4
adding cluster-up and cluster-down
Nov 15, 2024
5e5a5a7
updated gke scripts
Nov 15, 2024
1dd5c9b
remove cluster-down
Nov 15, 2024
4d457d8
removed k8s version
Nov 15, 2024
ce7ee29
adding only s1
Nov 15, 2024
3be2a4b
only m4 manager
Nov 15, 2024
46b4360
only m4
Nov 15, 2024
e1071ee
only c3 manager
Nov 15, 2024
4e98992
only c3
Nov 15, 2024
08714d7
only c3 manager
Nov 15, 2024
ba6e3de
only m4
Nov 15, 2024
c262566
only s1 test cases
Nov 15, 2024
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
7 changes: 2 additions & 5 deletions .github/workflows/int-test-azure-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
- develop
- main
- google-object-storage-support
jobs:
build-operator-image:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -38,11 +39,7 @@ jobs:
password: ${{ secrets.AZURE_ACR_DOCKER_PASSWORD }}
- name: Make Splunk Operator Image
run: |
make docker-build IMG=${{ secrets.AZURE_ACR_LOGIN_SERVER }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
- name: Push Splunk Operator Image to the Container Registry
run: |
echo "Uploading Image to the Container Registry :: ${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA"
make docker-push IMG=${{ secrets.AZURE_ACR_LOGIN_SERVER }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
make docker-buildx IMG=${{ secrets.AZURE_ACR_LOGIN_SERVER }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
setup-aks-cluster:
runs-on: ubuntu-latest
needs: build-operator-image
Expand Down
287 changes: 287 additions & 0 deletions .github/workflows/int-test-gcp-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
name: Integration Test on GCP Workflow

on:
push:
branches:
- develop
- main
- google-object-storage-support

jobs:
build-operator-image:
runs-on: ubuntu-latest
env:
SPLUNK_ENTERPRISE_IMAGE: ${{ secrets.SPLUNK_ENTERPRISE_IMAGE }}
SPLUNK_OPERATOR_IMAGE_NAME: splunk/splunk-operator
ARTIFACT_REGISTRY: ${{ secrets.GCP_ARTIFACT_REGISTRY }} # Updated for Artifact Registry
steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Load Environment Variables
id: dotenv
uses: falti/dotenv-action@d4d12eaa0e1dd06d5bdc3d7af3bf4c8c93cb5359
with:
path: .env # Adjust the path if your dotenv file is located elsewhere

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ steps.dotenv.outputs.GO_VERSION }}

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Install Operator SDK
run: |
ARCH=$(case $(uname -m) in
x86_64) echo -n amd64 ;;
aarch64) echo -n arm64 ;;
*) echo -n $(uname -m) ;;
esac)
OS=$(uname | awk '{print tolower($0)}')
OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/${{ steps.dotenv.outputs.OPERATOR_SDK_VERSION }}
curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
chmod +x operator-sdk_${OS}_${ARCH}
sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk

- name: Authenticate to GCP
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}

- name: Login to GCR
uses: docker/login-action@v3
with:
registry: ${{ secrets.GCP_ARTIFACT_REGISTRY }}
username: _json_key
password: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}

- name: Build Splunk Operator Image
run: |
make docker-buildx IMG=${{ secrets.GCP_ARTIFACT_REGISTRY }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA

create-cluster-and-run-tests:
strategy:
matrix:
test_focus:
#- { order: 1, name: "c3_gcp_sanity" }
#- { order: 2, name: "c3_mgr_gcp_sanity" }
#- { order: 3, name: "m4_gcp_sanity" }
#- { order: 4, name: "m4_mgr_gcp_sanity" }
- { order: 5, name: "s1_gcp_sanity" }
runs-on: ubuntu-latest
needs: build-operator-image
env:
CLUSTER_WORKERS: 5
TEST_CLUSTER_PLATFORM: gcp
CLUSTER_PROVIDER: gcp
ARTIFACT_REGISTRY: ${{ secrets.GCP_ARTIFACT_REGISTRY }}
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
GCP_REGION: ${{ secrets.GCP_REGION }}
GCP_ZONE: ${{ secrets.GCP_ZONE }}
GCP_NETWORK: default # Adjust if using a custom network
GCP_SUBNETWORK: default # Adjust if using a custom subnetwork
TEST_FOCUS: ${{ matrix.test_focus.name }}
CLUSTER_NODES: 2
SPLUNK_ENTERPRISE_IMAGE: ${{ secrets.SPLUNK_ENTERPRISE_IMAGE }}
SPLUNK_ENTERPRISE_RELEASE_IMAGE: ${{ secrets.SPLUNK_ENTERPRISE_RELEASE_IMAGE }}
SPLUNK_OPERATOR_IMAGE_NAME: splunk/splunk-operator
SPLUNK_OPERATOR_IMAGE_FILENAME: splunk-operator
TEST_TO_SKIP: "^(?:[^s]+|s(?:$|[^m]|m(?:$|[^o]|o(?:$|[^k]|k(?:$|[^e])))))*$"
TEST_BUCKET: ${{ secrets.TEST_BUCKET }}
TEST_INDEXES_S3_BUCKET: ${{ secrets.TEST_INDEXES_S3_BUCKET }}
GCP_ENTERPRISE_LICENSE_LOCATION: "test_licenses"
ENTERPRISE_LICENSE_LOCATION: "test_licenses"
REGISTRY_REPOSITORY: ${{ secrets.GCP_ARTIFACT_REGISTRY }}
CLUSTER_WIDE: "true"
GCP_SERVICE_ACCOUNT_ENABLED: "false"
PRIVATE_REGISTRY: ${{ secrets.GCP_ARTIFACT_REGISTRY }}
GCP_STORAGE_ACCOUNT: ${{ secrets.GCP_STORAGE_ACCOUNT }}
GCP_STORAGE_ACCOUNT_KEY: ${{ secrets.GCP_STORAGE_ACCOUNT_KEY }}
GCP_TEST_CONTAINER: ${{ secrets.GCP_TEST_CONTAINER}}
GCP_INDEXES_CONTAINER: ${{ secrets.GCP_INDEXES_CONTAINER}}
ECR_REPOSITORY: ${{ secrets.GCP_ARTIFACT_REGISTRY }}
GCP_CONTAINER_REGISTRY_LOGIN_SERVER: ${{ secrets.AZURE_ACR_LOGIN_SERVER }}
steps:
- name: Set Test Cluster Name
run: |
echo "CLUSTER_NAME=gke-${{ matrix.test_focus.order }}-$GITHUB_RUN_ID" >> $GITHUB_ENV
echo "TEST_CLUSTER_NAME=gke-${{ matrix.test_focus.order }}-$GITHUB_RUN_ID" >> $GITHUB_ENV
- name: Checkout Code
uses: actions/checkout@v2

- name: Load Environment Variables
id: dotenv
uses: falti/dotenv-action@d4d12eaa0e1dd06d5bdc3d7af3bf4c8c93cb5359
with:
path: .env

- name: Authenticate to GCP
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
install_components: 'kubectl'

- name: Set GCP Project
run: |
gcloud config set project ${{ env.GCP_PROJECT_ID }}

#- name: Create GKE Cluster
# run: |
# gcloud container clusters create ${{ env.CLUSTER_NAME }} \
# --zone ${{ env.GCP_ZONE }} \
# --num-nodes ${{ env.CLUSTER_WORKERS }} \
# --machine-type n2-standard-8 \
# --enable-ip-alias \
# --disk-size 50 \
# --network ${{ env.GCP_NETWORK }} \
# --subnetwork ${{ env.GCP_SUBNETWORK }} \
# --scopes "https://www.googleapis.com/auth/cloud-platform"
- name: Create GKE Cluster
run: |
export EKS_CLUSTER_K8_VERSION=${{ steps.dotenv.outputs.EKS_CLUSTER_K8_VERSION }}
export GKE_CLUSTER_K8_VERSION=${{ steps.dotenv.outputs.EKS_CLUSTER_K8_VERSION }}
make cluster-up

- name: Get Kubernetes Credentials
run: |
gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --zone ${{ env.GCP_ZONE }} --project ${{ env.GCP_PROJECT_ID }}

- name: Allow Pulling from Artifact Registry
run: |
gcloud auth configure-docker ${{ secrets.GCP_ARTIFACT_REGISTRY }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
install_components: 'kubectl'

- name: Change Splunk Enterprise Image on Main Branches
if: github.ref == 'refs/heads/main'
run: |
echo "SPLUNK_ENTERPRISE_IMAGE=${{ steps.dotenv.outputs.SPLUNK_ENTERPRISE_RELEASE_IMAGE }}" >> $GITHUB_ENV

- name: Authenticate to GCP
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}

- name: Set GCP Project
run: |
gcloud config set project ${{ env.GCP_PROJECT_ID }}

- name: Install Kubectl
uses: azure/setup-kubectl@v3
with:
version: ${{ steps.dotenv.outputs.KUBECTL_VERSION }}

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.x' # Specify the Python version if needed

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ steps.dotenv.outputs.GO_VERSION }}

- name: Install Go Lint
run: |
go version
go install golang.org/x/lint/golint@latest

- name: Install Ginkgo
run: |
make setup/ginkgo

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Login to GCR
uses: docker/login-action@v3
with:
registry: ${{ secrets.GCP_ARTIFACT_REGISTRY }}
username: _json_key
password: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}

- name: Pull Splunk Enterprise Image
run: docker pull ${{ env.SPLUNK_ENTERPRISE_IMAGE }}

- name: Pull Splunk Operator Image Locally
run: |
docker pull ${{ secrets.GCP_ARTIFACT_REGISTRY }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
docker tag ${{ secrets.GCP_ARTIFACT_REGISTRY }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA ${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
echo "SPLUNK_OPERATOR_IMAGE=${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA" >> $GITHUB_ENV

- name: Tag and Push Splunk Enterprise Image to Artifact Registry
run: |
docker tag ${{ env.SPLUNK_ENTERPRISE_IMAGE }} ${{ secrets.GCP_ARTIFACT_REGISTRY }}/${{ env.SPLUNK_ENTERPRISE_IMAGE }}
docker push ${{ secrets.GCP_ARTIFACT_REGISTRY }}/${{ env.SPLUNK_ENTERPRISE_IMAGE }}

- name: Get Kubernetes Credentials
run: |
gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --zone ${{ env.GCP_ZONE }} --project ${{ env.GCP_PROJECT_ID }}

- name: Get GKE Credentials
uses: google-github-actions/get-gke-credentials@v1
with:
cluster_name: ${{ env.CLUSTER_NAME }}
location: ${{ env.GCP_ZONE }}

- name: Install Metrics Server
run: |
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml

- name: Install Kubernetes Dashboard
run: |
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.5/aio/deploy/recommended.yaml

- name: Setup Kustomize
run: |
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
sudo mv kustomize /usr/local/bin/

- name: Verify kubectl Configuration
run: |
kubectl config current-context

- name: Run Integration Tests
run: |
export GCP_SERVICE_ACCOUNT_KEY=${{ secrets.GCP_SERVICE_ACCOUNT_KEY_BASE64 }}
make int-test

- name: Collect Test Logs
if: ${{ always() }}
run: |
mkdir -p /tmp/pod_logs
find ./test -name "*.log" -exec cp {} /tmp/pod_logs \;

- name: Archive Pod Logs
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: splunk-pods-logs-artifacts-${{ matrix.test_focus.name }}
path: /tmp/pod_logs/**
- name: Cleanup Test Case Artifacts
if: ${{ always() }}
run: |
export EKS_CLUSTER_K8_VERSION=${{ steps.dotenv.outputs.EKS_CLUSTER_K8_VERSION }}
export GKE_CLUSTER_K8_VERSION=${{ steps.dotenv.outputs.EKS_CLUSTER_K8_VERSION }}
tools/cleanup.sh
make cleanup
make clean
- name: Cleanup up EKS cluster
if: ${{ always() }}
run: |
make cluster-down
#- name: Delete GKE Cluster
# if: always()
# run: |
# gcloud container clusters delete ${{ env.CLUSTER_NAME }} --zone ${{ env.GCP_ZONE }} --project ${{ env.GCP_PROJECT_ID }} --quiet
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ docker-buildx: test ## Build and push docker image for the manager for cross-pla
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
- docker buildx create --name project-v3-builder
docker buildx use project-v3-builder
- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross
- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
- docker buildx rm project-v3-builder
rm Dockerfile.cross

Expand Down
4 changes: 2 additions & 2 deletions api/v4/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,10 @@ type VolumeSpec struct {
// Secret object name
SecretRef string `json:"secretRef"`

// Remote Storage type. Supported values: s3, blob. s3 works with aws or minio providers, whereas blob works with azure provider.
// Remote Storage type. Supported values: s3, blob, gcs. s3 works with aws or minio providers, whereas blob works with azure provider, gcs works for gcp.
Type string `json:"storageType"`

// App Package Remote Store provider. Supported values: aws, minio, azure.
// App Package Remote Store provider. Supported values: aws, minio, azure, gcp.
Provider string `json:"provider"`

// Region of the remote storage volume where apps reside. Used for aws, if provided. Not used for minio and azure.
Expand Down
Loading
Loading