Skip to content

Commit 56f7926

Browse files
author
igor.grzankowski
committed
Use sidecar in distroless int workflow.
1 parent 2fa5b7a commit 56f7926

File tree

2 files changed

+99
-54
lines changed

2 files changed

+99
-54
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: splunk-operator-controller-manager
5+
namespace: splunk-operator
6+
spec:
7+
replicas: 1
8+
selector:
9+
matchLabels:
10+
control-plane: controller-manager
11+
template:
12+
metadata:
13+
labels:
14+
control-plane: controller-manager
15+
spec:
16+
containers:
17+
- name: manager
18+
image: ${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA-distroless
19+
env:
20+
- name: WATCH_NAMESPACE
21+
value: ""
22+
- name: RELATED_IMAGE_SPLUNK_ENTERPRISE
23+
value: splunk/splunk:9.4.0
24+
- name: debug-sidecar
25+
image: busybox:latest
26+
command: [ "/bin/bash", "-c", "tail -f /dev/null" ]
27+
volumeMounts:
28+
- name: app-staging
29+
mountPath: /opt/splunk/appframework/
30+
volumes:
31+
- name: app-staging
32+
persistentVolumeClaim:
33+
claimName: splunk-operator-app-download

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

Lines changed: 66 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,40 @@ jobs:
1515
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
1616
S3_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
1717
steps:
18-
- uses: actions/checkout@v2
19-
- name: Dotenv Action
20-
id: dotenv
21-
uses: falti/dotenv-action@d4d12eaa0e1dd06d5bdc3d7af3bf4c8c93cb5359
22-
- name: Setup Go
23-
uses: actions/setup-go@v2
24-
with:
25-
go-version: ${{ steps.dotenv.outputs.GO_VERSION }}
26-
- name: Set up Docker Buildx
27-
uses: docker/[email protected]
28-
- name: Install Operator SDK
29-
run: |
30-
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
31-
export OS=$(uname | awk '{print tolower($0)}')
32-
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/${{ steps.dotenv.outputs.OPERATOR_SDK_VERSION }}
33-
sudo curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
34-
sudo chmod +x operator-sdk_${OS}_${ARCH}
35-
sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk
36-
- name: Configure AWS credentials
37-
uses: aws-actions/configure-aws-credentials@v1
38-
with:
39-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
40-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
41-
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
42-
- name: Login to Amazon ECR
43-
id: login-ecr
44-
uses: aws-actions/amazon-ecr-login@v1
45-
- name: Build and push Splunk Operator Image
46-
run: |
47-
export PLATFORMS=linux/arm64,linux/amd64
48-
export BASE_IMAGE=gcr.io/distroless/static-debian12
49-
export BASE_IMAGE_VERSION=latest
50-
export IMG=${{ secrets.ECR_REPOSITORY }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
51-
make docker-buildx PLATFORMS=$PLATFORMS BASE_IMAGE=$BASE_IMAGE BASE_IMAGE_VERSION=$BASE_IMAGE_VERSION IMG=$IMG
18+
- uses: actions/checkout@v2
19+
- name: Dotenv Action
20+
id: dotenv
21+
uses: falti/dotenv-action@d4d12eaa0e1dd06d5bdc3d7af3bf4c8c93cb5359
22+
- name: Setup Go
23+
uses: actions/setup-go@v2
24+
with:
25+
go-version: ${{ steps.dotenv.outputs.GO_VERSION }}
26+
- name: Set up Docker Buildx
27+
uses: docker/[email protected]
28+
- name: Install Operator SDK
29+
run: |
30+
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
31+
export OS=$(uname | awk '{print tolower($0)}')
32+
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/${{ steps.dotenv.outputs.OPERATOR_SDK_VERSION }}
33+
sudo curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
34+
sudo chmod +x operator-sdk_${OS}_${ARCH}
35+
sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk
36+
- name: Configure AWS credentials
37+
uses: aws-actions/configure-aws-credentials@v1
38+
with:
39+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
40+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
41+
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
42+
- name: Login to Amazon ECR
43+
id: login-ecr
44+
uses: aws-actions/amazon-ecr-login@v1
45+
- name: Build and push Splunk Operator Image
46+
run: |
47+
export PLATFORMS=linux/arm64,linux/amd64
48+
export BASE_IMAGE=gcr.io/distroless/static-debian12
49+
export BASE_IMAGE_VERSION=latest
50+
export IMG=${{ secrets.ECR_REPOSITORY }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
51+
make docker-buildx PLATFORMS=$PLATFORMS BASE_IMAGE=$BASE_IMAGE BASE_IMAGE_VERSION=$BASE_IMAGE_VERSION IMG=$IMG
5252
int-tests-arm-ubuntu:
5353
strategy:
5454
fail-fast: false
@@ -76,7 +76,6 @@ jobs:
7676
SPLUNK_OPERATOR_IMAGE_NAME: splunk/splunk-operator
7777
SPLUNK_OPERATOR_IMAGE_FILENAME: splunk-operator
7878
TEST_FOCUS: "${{ matrix.test }}"
79-
# This regex matches any string not containing integration keyword
8079
TEST_TO_SKIP: "^(?:[^i]+|i(?:$|[^n]|n(?:$|[^t]|t(?:$|[^e]|e(?:$|[^g]|g(?:$|[^r]|r(?:$|[^a]|a(?:$|[^t]|t(?:$|[^i]|i(?:$|[^o]|o(?:$|[^n])))))))))))*$"
8180
TEST_CLUSTER_PLATFORM: eks
8281
EKS_VPC_PRIVATE_SUBNET_STRING: ${{ secrets.EKS_VPC_PRIVATE_SUBNET_STRING }}
@@ -100,12 +99,12 @@ jobs:
10099
echo "CLUSTER_WORKERS=5" >> $GITHUB_ENV
101100
echo "CLUSTER_NODES=2" >> $GITHUB_ENV
102101
fi
103-
- name: Checkcout code
102+
- name: Checkout Code
104103
uses: actions/checkout@v2
105104
- name: Dotenv Action
106105
id: dotenv
107106
uses: falti/dotenv-action@d4d12eaa0e1dd06d5bdc3d7af3bf4c8c93cb5359
108-
- name: Change splunk enterprise to release image on main branches
107+
- name: Change Splunk Enterprise to Release Image on Main Branches
109108
if: github.ref == 'refs/heads/main'
110109
run: |
111110
echo "SPLUNK_ENTERPRISE_IMAGE=${{ steps.dotenv.outputs.SPLUNK_ENTERPRISE_RELEASE_IMAGE }}" >> $GITHUB_ENV
@@ -141,15 +140,15 @@ jobs:
141140
eksctl version
142141
- name: Set up Docker Buildx
143142
uses: docker/[email protected]
144-
- name: Configure Docker Hub credentials
143+
- name: Configure Docker Hub Credentials
145144
uses: docker/login-action@v1
146145
with:
147146
username: ${{ secrets.DOCKERHUB_USERNAME }}
148147
password: ${{ secrets.DOCKERHUB_TOKEN}}
149-
- name: Set Splunk Operator image
148+
- name: Set Splunk Operator Image
150149
run: |
151-
echo "SPLUNK_OPERATOR_IMAGE=${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA-distroless" >> $GITHUB_ENV
152-
- name: Configure AWS credentials
150+
echo "SPLUNK_OPERATOR_IMAGE=${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA-distroless" >> $GITHUB_ENV
151+
- name: Configure AWS Credentials
153152
uses: aws-actions/configure-aws-credentials@v1
154153
with:
155154
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
@@ -160,49 +159,62 @@ jobs:
160159
uses: aws-actions/amazon-ecr-login@v1
161160
- name: Pull Splunk Enterprise Image
162161
run: docker pull ${{ env.SPLUNK_ENTERPRISE_IMAGE }}
163-
- name: Create EKS cluster
162+
- name: Create EKS Cluster
164163
run: |
165164
export EKS_CLUSTER_K8_VERSION=${{ steps.dotenv.outputs.EKS_CLUSTER_K8_VERSION }}
166165
export EKS_INSTANCE_TYPE=${{ steps.dotenv.outputs.EKS_INSTANCE_TYPE_ARM64 }}
167166
make cluster-up
168-
- name: install metric server
167+
168+
- name: Deploy Application with Sidecar
169+
run: |
170+
kubectl apply -f deployment-with-sidecar.yaml
171+
172+
- name: Install Metric Server
169173
run: |
170174
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
171-
- name: install k8s dashboard
175+
176+
- name: Install K8s Dashboard
172177
run: |
173178
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.5/aio/deploy/recommended.yaml
179+
174180
- name: Setup Kustomize
175181
run: |
176182
sudo snap install kustomize
177183
mkdir -p ./bin
178184
cp /snap/bin/kustomize ./bin/kustomize
179-
- name: Run Integration test
185+
186+
- name: Run Integration Test
180187
run: |
181188
make int-test
189+
182190
- name: Collect Test Logs
183191
if: ${{ always() }}
184192
run: |
185193
mkdir -p /tmp/pod_logs
186194
find ./test -name "*.log" -exec cp {} /tmp/pod_logs \;
195+
187196
- name: Archive Pod Logs
188197
if: ${{ always() }}
189198
uses: actions/[email protected]
190199
with:
191200
name: "splunk-pods-logs--artifacts-${{ matrix.test }}"
192201
path: "/tmp/pod_logs/**"
193-
- name: Cleanup Test Case artifacts
202+
203+
- name: Cleanup Test Case Artifacts
194204
if: ${{ always() }}
195205
run: |
196206
make cleanup
197207
make clean
198-
- name: Cleanup up EKS cluster
208+
209+
- name: Cleanup EKS Cluster
199210
if: ${{ always() }}
200211
run: |
201212
make cluster-down
202-
#- name: Test Report
203-
# uses: dorny/test-reporter@v1
204-
# if: success() || failure() # run this step even if previous step failed
205-
# with:
206-
# name: Integration Tests # Name of the check run which will be created
207-
# path: inttest-*.xml # Path to test results
208-
# reporter: jest-junit # Format of test results
213+
214+
# - name: Test Report
215+
# uses: dorny/test-reporter@v1
216+
# if: success() || failure() # run this step even if previous step failed
217+
# with:
218+
# name: Integration Tests # Name of the check run which will be created
219+
# path: inttest-*.xml # Path to test results
220+
# reporter: jest-junit # Format of test results

0 commit comments

Comments
 (0)