Skip to content

Commit 423c939

Browse files
committed
Add standalone ingress config and configure test environment for splunk-caca namespace
- Add local/ingress.yaml for flexible ingress configuration - Update test-environment.yaml to use dedicated splunk-caca namespace - Add RBAC resources (ServiceAccount, Role, RoleBinding) for password generation - Add PersistentVolumeClaim for Splunk data persistence - Update all resources to use splunk-caca namespace consistently
1 parent 05e2d07 commit 423c939

File tree

2 files changed

+81
-7
lines changed

2 files changed

+81
-7
lines changed

local/ingress.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
name: splunk
5+
namespace: splunk-caca
6+
spec:
7+
ingressClassName: nginx
8+
tls:
9+
- hosts:
10+
- splunk.domain.com
11+
rules:
12+
- host: splunk.domain.com
13+
http:
14+
paths:
15+
- path: /
16+
pathType: Prefix
17+
backend:
18+
service:
19+
name: splunk-http
20+
port:
21+
number: 8000

local/test-environment.yaml

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,60 @@
33
# Customize the namespace, ingress, and other settings for your environment
44
#
55
# To retrieve the generated Splunk password after deployment:
6-
# kubectl get secret splunk-secret -n <your-namespace> -o jsonpath='{.data.password}' | base64 -d
6+
# kubectl get secret splunk-secret -n splunk-caca -o jsonpath='{.data.password}' | base64 -d
77

8+
---
9+
# Namespace for CACA test environment
10+
apiVersion: v1
11+
kind: Namespace
12+
metadata:
13+
name: splunk-caca
14+
---
15+
# ServiceAccount for the password generator job
16+
apiVersion: v1
17+
kind: ServiceAccount
18+
metadata:
19+
name: splunk-password-generator
20+
namespace: splunk-caca
21+
---
22+
# Role to allow creating/updating secrets
23+
apiVersion: rbac.authorization.k8s.io/v1
24+
kind: Role
25+
metadata:
26+
name: splunk-secret-manager
27+
namespace: splunk-caca
28+
rules:
29+
- apiGroups: [""]
30+
resources: ["secrets"]
31+
verbs: ["get", "create", "update", "patch"]
32+
---
33+
# RoleBinding to grant the service account permission
34+
apiVersion: rbac.authorization.k8s.io/v1
35+
kind: RoleBinding
36+
metadata:
37+
name: splunk-password-generator
38+
namespace: splunk-caca
39+
subjects:
40+
- kind: ServiceAccount
41+
name: splunk-password-generator
42+
namespace: splunk-caca
43+
roleRef:
44+
kind: Role
45+
name: splunk-secret-manager
46+
apiGroup: rbac.authorization.k8s.io
847
---
948
# Job to generate a random password for Splunk
1049
# This runs before the deployment and creates/updates the secret with a random password
1150
apiVersion: batch/v1
1251
kind: Job
1352
metadata:
1453
name: splunk-password-generator
15-
namespace: default # Change to your namespace
54+
namespace: splunk-caca
1655
spec:
1756
ttlSecondsAfterFinished: 100 # Auto-cleanup after 100 seconds
1857
template:
1958
spec:
20-
serviceAccountName: default # Ensure the service account has permission to create secrets
59+
serviceAccountName: splunk-password-generator # Use the service account with permissions
2160
restartPolicy: Never
2261
containers:
2362
- name: generate-password
@@ -37,13 +76,27 @@ spec:
3776
echo "Password secret created/updated successfully"
3877
echo "Retrieve with: kubectl get secret splunk-secret -o jsonpath='{.data.password}' | base64 -d"
3978
---
79+
# PersistentVolumeClaim for Splunk data
80+
apiVersion: v1
81+
kind: PersistentVolumeClaim
82+
metadata:
83+
name: splunk
84+
namespace: splunk-caca
85+
spec:
86+
accessModes:
87+
- ReadWriteOnce
88+
resources:
89+
requests:
90+
storage: 10Gi # Adjust size as needed
91+
# storageClassName: your-storage-class # Uncomment and specify if needed
92+
---
4093
apiVersion: apps/v1
4194
kind: Deployment
4295
metadata:
4396
name: splunk
4497
labels:
4598
app: splunk
46-
namespace: default # Change to your namespace
99+
namespace: splunk-caca
47100
spec:
48101
replicas: 1
49102
strategy:
@@ -185,7 +238,7 @@ apiVersion: v1
185238
kind: Service
186239
metadata:
187240
name: splunk-http
188-
namespace: default # Change to your namespace
241+
namespace: splunk-caca
189242
labels:
190243
app: splunk
191244
spec:
@@ -200,7 +253,7 @@ apiVersion: v1
200253
kind: Service
201254
metadata:
202255
name: splunk-hec
203-
namespace: default # Change to your namespace
256+
namespace: splunk-caca
204257
labels:
205258
app: splunk
206259
spec:
@@ -215,7 +268,7 @@ apiVersion: v1
215268
kind: Service
216269
metadata:
217270
name: splunk-indexer
218-
namespace: default # Change to your namespace
271+
namespace: splunk-caca
219272
labels:
220273
app: splunk
221274
spec:

0 commit comments

Comments
 (0)