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

Promote Develop to main for Splunk Operator Release 2.3.0 #1199

Merged
merged 5 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
6 changes: 3 additions & 3 deletions docs/Helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ helm repo update

The ```splunk``` chart repository contains the ```splunk/splunk-operator``` chart to deploy the Splunk Operator and the ```splunk/splunk-enterprise``` chart to deploy Splunk Enterprise custom resources.

Currently only latest version splunk operator is hosted on `https://splunk.github.io/splunk-operator`. For previous version of helm chart, checkout release branch code. For example, for 2.0.0 release, please follow the below steps:
Upgrading to latest version of splunk operator using helm chart will not upgrade CRDs. User need to deploy the latest CRDs manually. this is [limitation](https://helm.sh/docs/chart_best_practices/custom_resource_definitions/) from helm

```
git clone https://github.com/splunk/splunk-operator.git .
git checkout release/2.0.0
helm install splunk-s1 helm-chart/splunk-enterprise ...
git checkout release/2.3.0
make install
```

Helm provides a long list of commands to manage your deployment, we'll be going over a few useful ones in the sections to come. You can learn more about supported commands [here](https://helm.sh/docs/helm/helm/).
Expand Down
85 changes: 80 additions & 5 deletions docs/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ entries:
splunk-enterprise:
- apiVersion: v2
appVersion: 2.3.0
created: "2023-06-15T11:57:34.729912-07:00"
created: "2023-07-07T15:18:57.351488-07:00"
dependencies:
- condition: splunk-operator.enabled
name: splunk-operator
repository: file://splunk-operator/helm-chart/splunk-operator
version: 2.3.0
description: A Helm chart for Splunk Enterprise managed by the Splunk Operator
digest: c18bcc16332114dbc46abf2b809aa26ab8576a10dae3da4241d502b3fdd9079d
digest: 2fa1bf4cc3bb2223a19fb583d12eac7e8bf4b9ad8e97370e2cfbb11e31e7a7e1
maintainers:
- email: vivekr@splunk.com
name: Vivek Reddy
Expand All @@ -23,12 +23,57 @@ entries:
urls:
- https://splunk.github.io/splunk-operator/splunk-enterprise-2.3.0.tgz
version: 2.3.0
- apiVersion: v2
appVersion: 2.2.1
created: "2023-07-07T15:18:57.32849-07:00"
dependencies:
- condition: splunk-operator.enabled
name: splunk-operator
repository: file://splunk-operator/helm-chart/splunk-operator
version: 2.2.1
description: A Helm chart for Splunk Enterprise managed by the Splunk Operator
digest: 92255e644355cf02d7a16411f3ce753585d53646f11c6116e30aeb7bbd634135
name: splunk-enterprise
type: application
urls:
- https://splunk.github.io/splunk-operator/splunk-enterprise-2.2.1.tgz
version: 2.2.1
- apiVersion: v2
appVersion: 2.2.0
created: "2023-07-07T15:18:57.315879-07:00"
dependencies:
- condition: splunk-operator.enabled
name: splunk-operator
repository: file://splunk-operator/helm-chart/splunk-operator
version: 2.2.0
description: A Helm chart for Splunk Enterprise managed by the Splunk Operator
digest: 4830561eecf721c4abd3b764a9922c132f1448f92882c1544c2fd4ae38e83afc
name: splunk-enterprise
type: application
urls:
- https://splunk.github.io/splunk-operator/splunk-enterprise-2.2.0.tgz
version: 2.2.0
- apiVersion: v2
appVersion: 2.1.0
created: "2023-07-07T15:18:57.293892-07:00"
dependencies:
- condition: splunk-operator.enabled
name: splunk-operator
repository: file://splunk-operator/helm-chart/splunk-operator
version: 1.0.0
description: A Helm chart for Splunk Enterprise managed by the Splunk Operator
digest: e7476dd43a633c43189214a90d6712a7e8ce9763277fe1769aa12b00a7210d24
name: splunk-enterprise
type: application
urls:
- https://splunk.github.io/splunk-operator/splunk-enterprise-1.0.0.tgz
version: 1.0.0
splunk-operator:
- apiVersion: v2
appVersion: 2.3.0
created: "2023-06-15T11:57:34.756231-07:00"
created: "2023-07-07T15:18:57.398576-07:00"
description: A Helm chart for the Splunk Operator for Kubernetes
digest: a4eba8f2af1d624794bb37a75d462e26ea5dbbf729276f5c4e2b65610f397d8a
digest: 60ff3c0f8c1bd6e1edb8cd977a3e03672dc356707d15f876e7740f782d1fa9aa
maintainers:
- email: vivekr@splunk.com
name: Vivek Reddy
Expand All @@ -41,4 +86,34 @@ entries:
urls:
- https://splunk.github.io/splunk-operator/splunk-operator-2.3.0.tgz
version: 2.3.0
generated: "2023-06-15T11:57:34.671074-07:00"
- apiVersion: v2
appVersion: 2.2.1
created: "2023-07-07T15:18:57.385543-07:00"
description: A Helm chart for the Splunk Operator for Kubernetes
digest: 8868b9ae2ebde0c667b13c97d71d904a31b5a9f2c803b199bc77324f1727e1fd
name: splunk-operator
type: application
urls:
- https://splunk.github.io/splunk-operator/splunk-operator-2.2.1.tgz
version: 2.2.1
- apiVersion: v2
appVersion: 2.2.0
created: "2023-07-07T15:18:57.371568-07:00"
description: A Helm chart for the Splunk Operator for Kubernetes
digest: 49c72276bd7ff93465b0545d8b0814f684cade7d2cd191b6d73d4c3660bd1fb4
name: splunk-operator
type: application
urls:
- https://splunk.github.io/splunk-operator/splunk-operator-2.2.0.tgz
version: 2.2.0
- apiVersion: v2
appVersion: 2.1.0
created: "2023-07-07T15:18:57.36171-07:00"
description: A Helm chart for the Splunk Operator for Kubernetes
digest: 34e5463f8f5442655d05cb616b50391b738a0827b30d8440b4c7fce99a291d9a
name: splunk-operator
type: application
urls:
- https://splunk.github.io/splunk-operator/splunk-operator-1.0.0.tgz
version: 1.0.0
generated: "2023-07-07T15:18:57.277398-07:00"
Binary file added docs/splunk-enterprise-1.0.0.tgz
Binary file not shown.
Binary file added docs/splunk-enterprise-2.2.0.tgz
Binary file not shown.
Binary file added docs/splunk-enterprise-2.2.1.tgz
Binary file not shown.
Binary file modified docs/splunk-enterprise-2.3.0.tgz
Binary file not shown.
Binary file added docs/splunk-operator-1.0.0.tgz
Binary file not shown.
Binary file added docs/splunk-operator-2.2.0.tgz
Binary file not shown.
Binary file added docs/splunk-operator-2.2.1.tgz
Binary file not shown.
Binary file modified docs/splunk-operator-2.3.0.tgz
Binary file not shown.
Binary file modified helm-chart/splunk-enterprise/charts/splunk-operator-2.3.0.tgz
Binary file not shown.
3 changes: 2 additions & 1 deletion pkg/splunk/enterprise/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"archive/tar"
"io"
"os"
"path/filepath"
)

var cpMakeTar = func(src localPath, dest remotePath, writer io.Writer) error {
Expand Down Expand Up @@ -85,7 +86,7 @@ func recursiveTar(srcDir, srcFile localPath, destDir, destFile remotePath, tw *t
if err := tw.WriteHeader(hdr); err != nil {
return err
}

fpath = filepath.Clean(fpath)
f, err := os.Open(fpath)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions pkg/splunk/enterprise/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ func createAppDownloadDir(ctx context.Context, path string) error {
scopedLog := reqLogger.WithName("createAppDownloadDir").WithValues("path", path)
_, err := os.Stat(path)
if errors.Is(err, os.ErrNotExist) {
errDir := os.MkdirAll(path, 0755)
errDir := os.MkdirAll(path, 0700)
if errDir != nil {
scopedLog.Error(errDir, "Unable to create directory at path")
return errDir
Expand All @@ -447,7 +447,7 @@ func getAvailableDiskSpace(ctx context.Context) (uint64, error) {
if err != nil {
scopedLog.Error(err, "There is no default volume configured for the App framework, use the temporary location", "dir", TmpAppDownloadDir)
splcommon.AppDownloadVolume = TmpAppDownloadDir
err = os.MkdirAll(splcommon.AppDownloadVolume, 0755)
err = os.MkdirAll(splcommon.AppDownloadVolume, 0700)
if err != nil {
scopedLog.Error(err, "Unable to create the directory", "dir", splcommon.AppDownloadVolume)
return 0, err
Expand Down
23 changes: 12 additions & 11 deletions tools/k8s_collectors/k8s-splunk-collector-helper.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
from __future__ import print_function
import os
import shlex
import sys, getopt
import subprocess

def executeShellCommand(command):
stream = subprocess.popen(command).wait()
def executeKubectlCommand(command):
stream = subprocess.Popen(["kubectl", command]).wait()
vivekr-splunk marked this conversation as resolved.
Show resolved Hide resolved
output = stream.read()
return output


def runAndCollectDiag(collectDir, podDiagsDir, pod):
output = executeShellCommand("kubectl exec --stdin %s -- /opt/splunk/bin/splunk diag;" % pod)
output = executeKubectlCommand("exec --stdin %s -- /opt/splunk/bin/splunk diag;" % pod)
for line in output.splitlines():
words = line.split()
if len(words) > 4 and "Splunk diagnosis file created:" in line:
Expand All @@ -21,11 +22,11 @@ def runAndCollectDiag(collectDir, podDiagsDir, pod):
if len(dirs) >= 2 and len(dirs[3]) > 0:
diagFile = dirs[3]

#Copy the diag over
executeShellCommand("kubectl cp %s:%s %s/%s/%s" % (pod, diagFileFullPath, collectDir, podDiagsDir, diagFile))
#Copy the diag over
executeKubectlCommand("cp %s:%s %s/%s/%s" % (pod, diagFileFullPath, collectDir, podDiagsDir, diagFile))

#Delete the diag
executeShellCommand("kubectl exec --stdin %s -- rm -rf %s" % (pod, diagFileFullPath))
executeKubectlCommand("exec --stdin %s -- rm -rf %s" % (pod, diagFileFullPath))

def main(argv):
#Define required variables
Expand All @@ -49,10 +50,10 @@ def main(argv):
collectDir = arg

# Collect logs from the operator
output = executeShellCommand("kubectl logs deployment/splunk-operator-controller-manager manager > %s/%s/operator.log" % (collectDir, podLogsDir))
output = executeShellCommand("kubectl logs -l app.kubernetes.io/managed-by=splunk-operator --tail -1 > %s/%s/splunkEnterprisePods.log" % (collectDir, podLogsDir))
output = executeKubectlCommand("logs deployment/splunk-operator-controller-manager manager > %s/%s/operator.log" % (collectDir, podLogsDir))
output = executeKubectlCommand("logs -l app.kubernetes.io/managed-by=splunk-operator --tail -1 > %s/%s/splunkEnterprisePods.log" % (collectDir, podLogsDir))

output = executeShellCommand("kubectl get pods")
output = executeKubectlCommand("kubectl get pods")
for line in output.splitlines():
words = line.split()
if "splunk" in words[0]:
Expand All @@ -61,11 +62,11 @@ def main(argv):
#ensure container is specified for the operator
if "operator" in pod:
opPod = pod + " -c manager"
executeShellCommand("kubectl logs %s > %s/%s/%s.log" % (opPod, collectDir, podLogsDir, pod))
executeKubectlCommand("logs %s > %s/%s/%s.log" % (opPod, collectDir, podLogsDir, pod))
continue

# Collect logs from pod
executeShellCommand("kubectl logs %s > %s/%s/%s.log" % (pod, collectDir, podLogsDir, pod))
executeKubectlCommand("logs %s > %s/%s/%s.log" % (pod, collectDir, podLogsDir, pod))

# Collect diag and save diag from all Splunk Instances
if collectDiag == "true":
Expand Down
Loading