Skip to content

Commit 07714c7

Browse files
vivekr-splunkVivek Reddy
andauthored
[CSPL-2699]: adding Azure and GCP bucket access using sdk (#1340)
* adding gcp bucket access using sdk Signed-off-by: Vivek Reddy <[email protected]> * adding gcp skd Signed-off-by: Vivek Reddy <[email protected]> * working code cod Signed-off-by: Vivek Reddy <[email protected]> * working code Signed-off-by: Vivek Reddy <[email protected]> * azure blob sdk support Signed-off-by: Vivek Reddy <[email protected]> * azure blob sdk support Signed-off-by: Vivek Reddy <[email protected]> * logging fixed Signed-off-by: Vivek Reddy <[email protected]> * logging fixed Signed-off-by: Vivek Reddy <[email protected]> * azure code support for AzureAD Signed-off-by: Vivek Reddy <[email protected]> * azure code support for AzureAD Signed-off-by: Vivek Reddy <[email protected]> * azure code support for AzureAD Signed-off-by: Vivek Reddy <[email protected]> * adding validation Signed-off-by: Vivek Reddy <[email protected]> * go updates Signed-off-by: Vivek Reddy <[email protected]> * pipeline test for azure Signed-off-by: Vivek Reddy <[email protected]> * adding gcp pipeline Signed-off-by: Vivek Reddy <[email protected]> * fixed buildx Signed-off-by: Vivek Reddy <[email protected]> * using buildx Signed-off-by: Vivek Reddy <[email protected]> * using buildx Signed-off-by: Vivek Reddy <[email protected]> * fixed dotenv version Signed-off-by: Vivek Reddy <[email protected]> * fixed dotenv version Signed-off-by: Vivek Reddy <[email protected]> * fixed docker login Signed-off-by: Vivek Reddy <[email protected]> * fixed docker login Signed-off-by: Vivek Reddy <[email protected]> * fixed docker login Signed-off-by: Vivek Reddy <[email protected]> * fixed cluster name Signed-off-by: Vivek Reddy <[email protected]> * fixed gke cloud auth plugin issue Signed-off-by: Vivek Reddy <[email protected]> * fixed gke cloud auth plugin issue Signed-off-by: Vivek Reddy <[email protected]> * gcp variable in script Signed-off-by: Vivek Reddy <[email protected]> * gcp variable in workflow Signed-off-by: Vivek Reddy <[email protected]> * adding gcp test cases for appframework Signed-off-by: Vivek Reddy <[email protected]> * adding gcp test cases for appframework Signed-off-by: Vivek Reddy <[email protected]> * modification to support gcp in test Signed-off-by: Vivek Reddy <[email protected]> * modification to support gcp in test Signed-off-by: Vivek Reddy <[email protected]> * modification to support gcp in test Signed-off-by: Vivek Reddy <[email protected]> * adding gcp tag in test case Signed-off-by: Vivek Reddy <[email protected]> * adding gcp tag in test case Signed-off-by: Vivek Reddy <[email protected]> * adding gcp workload management Signed-off-by: Vivek Reddy <[email protected]> * testing something here * reverting the change * adding back service account * adding only smoke test Signed-off-by: Vivek Reddy <[email protected]> * adding gcloud * adding only smoke test Signed-off-by: Vivek Reddy <[email protected]> * adding glcoud cli * adding bucket * debugging * debugging * debugging upload * adding index bucket * adding secret logic test Signed-off-by: Vivek Reddy <[email protected]> * adding secret logic test Signed-off-by: Vivek Reddy <[email protected]> * adding secret logic test Signed-off-by: Vivek Reddy <[email protected]> * added script to create gcp cluster * added using credentials for gcp * changing glcoud to gcp as key * changing gcp service account key field * updates test cases * adding logic to use base64 encode Signed-off-by: Vivek Reddy <[email protected]> * adding logic to use base64 encode Signed-off-by: Vivek Reddy <[email protected]> * use base64 key * fixed code for gcp Signed-off-by: Vivek Reddy <[email protected]> * fixed apps listing * initial doc changes Signed-off-by: Vivek Reddy <[email protected]> * adding test to create mutliple clusters Signed-off-by: Vivek Reddy <[email protected]> * fixed test case to be less than 40 characters * fixed cluster name * testing cluster name * fixed cluster name * fixed bug in workflow * adding enterprise license location * doc changes * log message changed for GCP * setting license path * commenting all the test cases except one * adding gcp_sanity Signed-off-by: Vivek Reddy <[email protected]> * doc changes and comment test Signed-off-by: Vivek Reddy <[email protected]> * workflow changes Signed-off-by: Vivek Reddy <[email protected]> * doc changes Signed-off-by: Vivek Reddy <[email protected]> * adding gcp_sanity Signed-off-by: Vivek Reddy <[email protected]> * crd changes * test script changes and formats * adding back C3 test cases for gcp * adding back m4 test cases * only one C3 test case to run * added storage type as gcs * adding only 3 test cases * azure s1 only 1 test case enabled * changed path in azure * removed startAfter as its same prefix * changing storageType to gcs * adding back azure test cases * adding 2 test in c3 for gcp * adding in this c3 gcp_sanity test cases * adding only c3 test * removed unused test cases * rerunning test cases * disabling upgrade check * changed the upgrade flow * fixed indexer in upgrade flow * document changes to support azure and gcp bucket using native sdk * doc changes for gcp * fixed azure documentation * fixed license path * just increasing timeout for now * gcp test fixed * added copyright * group test cases based on SVA * fixed test focus for cluster name * removed commented code * removed commented code * removed mock client for http azure * fixed instance type Signed-off-by: Vivek Reddy <[email protected]> * adding disk size * adding cluster-up and cluster-down * updated gke scripts * remove cluster-down * removed k8s version * adding only s1 Signed-off-by: Vivek Reddy <[email protected]> * only m4 manager Signed-off-by: Vivek Reddy <[email protected]> * only m4 Signed-off-by: Vivek Reddy <[email protected]> * only c3 manager Signed-off-by: Vivek Reddy <[email protected]> * only c3 Signed-off-by: Vivek Reddy <[email protected]> * only c3 manager Signed-off-by: Vivek Reddy <[email protected]> * only m4 Signed-off-by: Vivek Reddy <[email protected]> * only s1 test cases * adding go mod changes * restoring timeout * comments added * fixed run test configuration * fixing the workflow config for now * adding default storage class gcp * running all the test cases * removed commented code from wf * commented cleanup * review comments * increasing timeout * fixed timeout * ignore mc pod reset detection * only adding 4 test cases * commenting 2 test cases * adding specific time for test case * formatting * removed smoke from gcp test cases --------- Signed-off-by: Vivek Reddy <[email protected]> Co-authored-by: Vivek Reddy <[email protected]>
1 parent 02c0cf3 commit 07714c7

File tree

67 files changed

+15501
-1912
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+15501
-1912
lines changed

.github/workflows/int-test-azure-workflow.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ jobs:
3838
password: ${{ secrets.AZURE_ACR_DOCKER_PASSWORD }}
3939
- name: Make Splunk Operator Image
4040
run: |
41-
make docker-build IMG=${{ secrets.AZURE_ACR_LOGIN_SERVER }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
42-
- name: Push Splunk Operator Image to the Container Registry
43-
run: |
44-
echo "Uploading Image to the Container Registry :: ${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA"
45-
make docker-push IMG=${{ secrets.AZURE_ACR_LOGIN_SERVER }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
41+
make docker-buildx IMG=${{ secrets.AZURE_ACR_LOGIN_SERVER }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
4642
setup-aks-cluster:
4743
runs-on: ubuntu-latest
4844
needs: build-operator-image
Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
name: Integration Test on GCP Workflow
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- main
8+
9+
jobs:
10+
build-operator-image:
11+
runs-on: ubuntu-latest
12+
env:
13+
SPLUNK_ENTERPRISE_IMAGE: ${{ secrets.SPLUNK_ENTERPRISE_IMAGE }}
14+
SPLUNK_OPERATOR_IMAGE_NAME: splunk/splunk-operator
15+
ARTIFACT_REGISTRY: ${{ secrets.GCP_ARTIFACT_REGISTRY }} # Updated for Artifact Registry
16+
steps:
17+
- name: Checkout Code
18+
uses: actions/checkout@v2
19+
20+
- name: Load Environment Variables
21+
id: dotenv
22+
uses: falti/dotenv-action@d4d12eaa0e1dd06d5bdc3d7af3bf4c8c93cb5359
23+
with:
24+
path: .env # Adjust the path if your dotenv file is located elsewhere
25+
26+
- name: Setup Go
27+
uses: actions/setup-go@v2
28+
with:
29+
go-version: ${{ steps.dotenv.outputs.GO_VERSION }}
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/[email protected]
33+
34+
- name: Install Operator SDK
35+
run: |
36+
ARCH=$(case $(uname -m) in
37+
x86_64) echo -n amd64 ;;
38+
aarch64) echo -n arm64 ;;
39+
*) echo -n $(uname -m) ;;
40+
esac)
41+
OS=$(uname | awk '{print tolower($0)}')
42+
OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/${{ steps.dotenv.outputs.OPERATOR_SDK_VERSION }}
43+
curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
44+
chmod +x operator-sdk_${OS}_${ARCH}
45+
sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk
46+
47+
- name: Authenticate to GCP
48+
uses: google-github-actions/auth@v1
49+
with:
50+
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
51+
52+
- name: Login to GCR
53+
uses: docker/login-action@v3
54+
with:
55+
registry: ${{ secrets.GCP_ARTIFACT_REGISTRY }}
56+
username: _json_key
57+
password: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
58+
59+
- name: Build Splunk Operator Image
60+
run: |
61+
make docker-buildx IMG=${{ secrets.GCP_ARTIFACT_REGISTRY }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
62+
63+
create-cluster-and-run-tests:
64+
strategy:
65+
matrix:
66+
test_focus:
67+
- { order: 1, name: "c3_gcp_sanity" }
68+
- { order: 2, name: "c3_mgr_gcp_sanity" }
69+
- { order: 3, name: "m4_gcp_sanity" }
70+
- { order: 4, name: "m4_mgr_gcp_sanity" }
71+
- { order: 5, name: "s1_gcp_sanity" }
72+
runs-on: ubuntu-latest
73+
needs: build-operator-image
74+
env:
75+
CLUSTER_WORKERS: 5
76+
TEST_CLUSTER_PLATFORM: gcp
77+
CLUSTER_PROVIDER: gcp
78+
ARTIFACT_REGISTRY: ${{ secrets.GCP_ARTIFACT_REGISTRY }}
79+
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
80+
GCP_REGION: ${{ secrets.GCP_REGION }}
81+
AWS_S3_REGION: ${{ secrets.GCP_REGION }}
82+
GCP_ZONE: ${{ secrets.GCP_ZONE }}
83+
GCP_NETWORK: default # Adjust if using a custom network
84+
GCP_SUBNETWORK: default # Adjust if using a custom subnetwork
85+
TEST_FOCUS: ${{ matrix.test_focus.name }}
86+
CLUSTER_NODES: 2
87+
SPLUNK_ENTERPRISE_IMAGE: ${{ secrets.SPLUNK_ENTERPRISE_IMAGE }}
88+
SPLUNK_ENTERPRISE_RELEASE_IMAGE: ${{ secrets.SPLUNK_ENTERPRISE_RELEASE_IMAGE }}
89+
SPLUNK_OPERATOR_IMAGE_NAME: splunk/splunk-operator
90+
SPLUNK_OPERATOR_IMAGE_FILENAME: splunk-operator
91+
TEST_TO_SKIP: "^(?:[^s]+|s(?:$|[^m]|m(?:$|[^o]|o(?:$|[^k]|k(?:$|[^e])))))*$"
92+
TEST_BUCKET: ${{ secrets.TEST_BUCKET }}
93+
TEST_S3_BUCKET: ${{ secrets.TEST_BUCKET }}
94+
TEST_INDEXES_S3_BUCKET: ${{ secrets.TEST_INDEXES_S3_BUCKET }}
95+
INDEXES_S3_BUCKET: ${{ secrets.TEST_INDEXES_S3_BUCKET }}
96+
GCP_ENTERPRISE_LICENSE_LOCATION: "test_licenses"
97+
ENTERPRISE_LICENSE_LOCATION: "test_licenses"
98+
ENTERPRISE_LICENSE_S3_PATH: "test_licenses"
99+
REGISTRY_REPOSITORY: ${{ secrets.GCP_ARTIFACT_REGISTRY }}
100+
CLUSTER_WIDE: "true"
101+
GCP_SERVICE_ACCOUNT_ENABLED: "false"
102+
PRIVATE_REGISTRY: ${{ secrets.GCP_ARTIFACT_REGISTRY }}
103+
GCP_STORAGE_ACCOUNT: ${{ secrets.GCP_STORAGE_ACCOUNT }}
104+
GCP_STORAGE_ACCOUNT_KEY: ${{ secrets.GCP_STORAGE_ACCOUNT_KEY }}
105+
GCP_TEST_CONTAINER: ${{ secrets.GCP_TEST_CONTAINER}}
106+
GCP_INDEXES_CONTAINER: ${{ secrets.GCP_INDEXES_CONTAINER}}
107+
ECR_REPOSITORY: ${{ secrets.GCP_ARTIFACT_REGISTRY }}
108+
GCP_CONTAINER_REGISTRY_LOGIN_SERVER: ${{ secrets.AZURE_ACR_LOGIN_SERVER }}
109+
steps:
110+
- name: Set Test Cluster Name
111+
run: |
112+
echo "CLUSTER_NAME=gke-${{ matrix.test_focus.order }}-$GITHUB_RUN_ID" >> $GITHUB_ENV
113+
echo "TEST_CLUSTER_NAME=gke-${{ matrix.test_focus.order }}-$GITHUB_RUN_ID" >> $GITHUB_ENV
114+
- name: Checkout Code
115+
uses: actions/checkout@v2
116+
117+
- name: Load Environment Variables
118+
id: dotenv
119+
uses: falti/dotenv-action@d4d12eaa0e1dd06d5bdc3d7af3bf4c8c93cb5359
120+
with:
121+
path: .env
122+
123+
- name: Authenticate to GCP
124+
uses: google-github-actions/auth@v1
125+
with:
126+
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
127+
128+
- name: Set up Cloud SDK
129+
uses: google-github-actions/setup-gcloud@v1
130+
with:
131+
project_id: ${{ secrets.GCP_PROJECT_ID }}
132+
install_components: 'kubectl'
133+
134+
- name: Set GCP Project
135+
run: |
136+
gcloud config set project ${{ env.GCP_PROJECT_ID }}
137+
138+
- name: Create GKE Cluster
139+
run: |
140+
export EKS_CLUSTER_K8_VERSION=${{ steps.dotenv.outputs.EKS_CLUSTER_K8_VERSION }}
141+
export GKE_CLUSTER_K8_VERSION=${{ steps.dotenv.outputs.EKS_CLUSTER_K8_VERSION }}
142+
make cluster-up
143+
144+
- name: Get Kubernetes Credentials
145+
run: |
146+
gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --zone ${{ env.GCP_ZONE }} --project ${{ env.GCP_PROJECT_ID }}
147+
148+
- name: Allow Pulling from Artifact Registry
149+
run: |
150+
gcloud auth configure-docker ${{ secrets.GCP_ARTIFACT_REGISTRY }}
151+
152+
- name: Set up Cloud SDK
153+
uses: google-github-actions/setup-gcloud@v1
154+
with:
155+
project_id: ${{ secrets.GCP_PROJECT_ID }}
156+
install_components: 'kubectl'
157+
158+
- name: Change Splunk Enterprise Image on Main Branches
159+
if: github.ref == 'refs/heads/main'
160+
run: |
161+
echo "SPLUNK_ENTERPRISE_IMAGE=${{ steps.dotenv.outputs.SPLUNK_ENTERPRISE_RELEASE_IMAGE }}" >> $GITHUB_ENV
162+
163+
- name: Authenticate to GCP
164+
uses: google-github-actions/auth@v1
165+
with:
166+
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
167+
168+
- name: Set GCP Project
169+
run: |
170+
gcloud config set project ${{ env.GCP_PROJECT_ID }}
171+
172+
- name: Install Kubectl
173+
uses: azure/setup-kubectl@v3
174+
with:
175+
version: ${{ steps.dotenv.outputs.KUBECTL_VERSION }}
176+
177+
- name: Install Python
178+
uses: actions/setup-python@v2
179+
with:
180+
python-version: '3.x' # Specify the Python version if needed
181+
182+
- name: Setup Go
183+
uses: actions/setup-go@v2
184+
with:
185+
go-version: ${{ steps.dotenv.outputs.GO_VERSION }}
186+
187+
- name: Install Go Lint
188+
run: |
189+
go version
190+
go install golang.org/x/lint/golint@latest
191+
192+
- name: Install Ginkgo
193+
run: |
194+
make setup/ginkgo
195+
196+
- name: Set up Docker Buildx
197+
uses: docker/[email protected]
198+
199+
- name: Login to GCR
200+
uses: docker/login-action@v3
201+
with:
202+
registry: ${{ secrets.GCP_ARTIFACT_REGISTRY }}
203+
username: _json_key
204+
password: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
205+
206+
- name: Pull Splunk Enterprise Image
207+
run: docker pull ${{ env.SPLUNK_ENTERPRISE_IMAGE }}
208+
209+
- name: Pull Splunk Operator Image Locally
210+
run: |
211+
docker pull ${{ secrets.GCP_ARTIFACT_REGISTRY }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
212+
docker tag ${{ secrets.GCP_ARTIFACT_REGISTRY }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA ${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
213+
echo "SPLUNK_OPERATOR_IMAGE=${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA" >> $GITHUB_ENV
214+
215+
- name: Tag and Push Splunk Enterprise Image to Artifact Registry
216+
run: |
217+
docker tag ${{ env.SPLUNK_ENTERPRISE_IMAGE }} ${{ secrets.GCP_ARTIFACT_REGISTRY }}/${{ env.SPLUNK_ENTERPRISE_IMAGE }}
218+
docker push ${{ secrets.GCP_ARTIFACT_REGISTRY }}/${{ env.SPLUNK_ENTERPRISE_IMAGE }}
219+
220+
- name: Get Kubernetes Credentials
221+
run: |
222+
gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --zone ${{ env.GCP_ZONE }} --project ${{ env.GCP_PROJECT_ID }}
223+
224+
- name: Get GKE Credentials
225+
uses: google-github-actions/get-gke-credentials@v1
226+
with:
227+
cluster_name: ${{ env.CLUSTER_NAME }}
228+
location: ${{ env.GCP_ZONE }}
229+
230+
- name: Install Metrics Server
231+
run: |
232+
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
233+
234+
- name: Install Kubernetes Dashboard
235+
run: |
236+
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.5/aio/deploy/recommended.yaml
237+
238+
- name: Setup Kustomize
239+
run: |
240+
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
241+
sudo mv kustomize /usr/local/bin/
242+
243+
- name: Verify kubectl Configuration
244+
run: |
245+
kubectl config current-context
246+
247+
- name: Apply StorageClass
248+
run: |
249+
kubectl apply -f test/gcp-storageclass.yaml
250+
251+
- name: Run Integration Tests
252+
run: |
253+
export GCP_SERVICE_ACCOUNT_KEY=${{ secrets.GCP_SERVICE_ACCOUNT_KEY_BASE64 }}
254+
make int-test
255+
256+
- name: Collect Test Logs
257+
if: ${{ always() }}
258+
run: |
259+
mkdir -p /tmp/pod_logs
260+
find ./test -name "*.log" -exec cp {} /tmp/pod_logs \;
261+
262+
- name: Archive Pod Logs
263+
if: ${{ always() }}
264+
uses: actions/upload-artifact@v4
265+
with:
266+
name: splunk-pods-logs-artifacts-${{ matrix.test_focus.name }}
267+
path: /tmp/pod_logs/**
268+
- name: Cleanup Test Case Artifacts
269+
if: ${{ always() }}
270+
run: |
271+
export EKS_CLUSTER_K8_VERSION=${{ steps.dotenv.outputs.EKS_CLUSTER_K8_VERSION }}
272+
export GKE_CLUSTER_K8_VERSION=${{ steps.dotenv.outputs.EKS_CLUSTER_K8_VERSION }}
273+
tools/cleanup.sh
274+
- name: Cleanup up EKS cluster
275+
if: ${{ always() }}
276+
run: |
277+
make cluster-down

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ docker-buildx: test ## Build and push docker image for the manager for cross-pla
156156
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
157157
- docker buildx create --name project-v3-builder
158158
docker buildx use project-v3-builder
159-
- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross
159+
- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
160160
- docker buildx rm project-v3-builder
161161
rm Dockerfile.cross
162162

api/v4/common_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,10 @@ type VolumeSpec struct {
308308
// Secret object name
309309
SecretRef string `json:"secretRef"`
310310

311-
// Remote Storage type. Supported values: s3, blob. s3 works with aws or minio providers, whereas blob works with azure provider.
311+
// 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.
312312
Type string `json:"storageType"`
313313

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

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

0 commit comments

Comments
 (0)