Skip to content

Conversation

@jmsplunk
Copy link
Collaborator

@jmsplunk jmsplunk commented Jan 14, 2026

Description

  • Create the KVService CR in existing splunk CRs if not there
  • Update the ownerReference if the KVService CR already exists
  • Delete the KVService CR when the last owner gets deleted

Key Changes

  • Add the KVService CR creation/deletion logic in util.go
  • Use the defined functions in every existing v4 CRs
  • Add unit tests in util_test.go

Testing and Verification

Testing was conducted using old naming strategy that includes the namespace. Right now, we decided to use a fixed name since we are going to expose the CRD to the customer and we want to ask them to use a fixed name for easy management.

# Step 1: Create Standalone. Check KVService CR and ownerreference
# Step 2: Create LicenseManager. Check KVService CR and ownerreference
# Step 3: Delete Standalone CR - KVService Remains and ownerreference should only contains license manager
# Step 4: Delete LicenseManager CR - KVService Deleted
Step1
root@ip-10-236-5-61:~/splunk-operator# kubectl apply -n splunk-operator -f - <<EOF
apiVersion: enterprise.splunk.com/v4
kind: Standalone
metadata:
  name: test-kvstore
spec:
  replicas: 1
EOF
standalone.enterprise.splunk.com/test-kvstore created
  
 root@ip-10-236-5-61:~/splunk-operator# kubectl get kvservice splunk-splunk-operator-kvservice -n splunk-operator -o jsonpath='{.metadata.ownerReferences[*].kind}'
Standalone
Step2
root@ip-10-236-5-61:~/splunk-operator# kubectl apply -n splunk-operator -f - <<EOF-f - <<EOF
apiVersion: enterprise.splunk.com/v4
kind: LicenseManager
metadata:
  name: test-lm
spec: {}
EOF
licensemanager.enterprise.splunk.com/test-lm created

 root@ip-10-236-5-61:~/splunk-operator# kubectl get kvservice splunk-splunk-operator-kvservice -n splunk-operator -o jsonpath='{.metadata.ownerReferences[*].kind}'
Standalone LicenseManager
Step 3
root@ip-10-236kubectl delete standalone test-kvstore -n splunk-operatorvstore -n splunk-operator
standalone.enterprise.splunk.com "test-kvstore" deleted from splunk-operator namespace
  
root@ip-10-236-5-61:~/splunk-operator# kubectl get kvservice splunk-splunk-operator-kvservice -n splunk-operator -o jsonpath='{.metadata.ownerReferences[*].kind}'
LicenseManager
Step4 
root@ip-10-236-5-61:~/splkubectl delete licensemanager test-lm -n splunk-operatorplunk-operator
licensemanager.enterprise.splunk.com "test-lm" deleted from splunk-operator namespace
root@ip-10-236-5-61:~/splunk-operator# kubectl get kvservice -n splunk-operator
No resources found in splunk-operator namespace.

Related Issues

Jira tickets, GitHub issues, Support tickets...

PR Checklist

  • Code changes adhere to the project's coding standards.
  • Relevant unit and integration tests are included.
  • Documentation has been updated accordingly.
  • All tests pass locally.
  • The PR description follows the project's guidelines.

@jmsplunk jmsplunk self-assigned this Jan 16, 2026
@jmsplunk jmsplunk requested a review from sgontla January 16, 2026 07:11
@jmsplunk jmsplunk marked this pull request as ready for review January 16, 2026 07:12
@jmsplunk jmsplunk changed the title SPL-290980: create the KVService CR in existing spluk CRs SPL-290980: create the KVService CR in existing splunk CRs Jan 20, 2026
@jmsplunk jmsplunk changed the title SPL-290980: create the KVService CR in existing splunk CRs SPL-290980: create the KVService CR in the existing splunk CRs Jan 20, 2026
@jmsplunk jmsplunk merged commit 328860e into feature/epic_SPL-290563 Jan 22, 2026
32 of 33 checks passed
@jmsplunk jmsplunk deleted the SPL-290980 branch January 22, 2026 22:14
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants