/splunk-operator

Splunk Operator for Kubernetes

Primary LanguageGoApache License 2.0Apache-2.0

Splunk Operator for Kubernetes

License GoDoc Go Report Card CircleCI

The Splunk Operator for Kubernetes (SOK) makes it easy for Splunk Administrators to deploy and operate Enterprise deployments in a Kubernetes infrastructure. Packaged as a container, it uses the operator pattern to manage Splunk-specific custom resources, following best practices to manage all the underlying Kubernetes objects for you.

This repository is used to build the Splunk Operator for Kubernetes (SOK). If you are just looking for documentation on how to deploy and use the latest release, please see the Getting Started Documentation.

Prerequisites

You must have Docker Engine installed to build the Splunk Operator.

This project now uses Go modules, which requires golang 1.12 or later. You must export GO111MODULE=on if cloning these repositories into your $GOPATH (not recommended).

The Kubernetes Operator SDK must also be installed to build this project.

git clone -b v0.10.0 https://github.com/operator-framework/operator-sdk
cd operator-sdk
make install

You may need to add $GOPATH/bin to you path to run the operator-sdk command line tool:

export PATH=${PATH}:${GOPATH}/bin

Cloning this repository

git clone git@github.com:splunk/splunk-operator.git
cd splunk-operator

Building the operator

You can build the operator by just running make.

Other make targets include (more info below):

  • make all: builds the splunk/splunk-operator docker image (same as make image)
  • make image: builds the splunk/splunk-operator docker image
  • make package: generates tarball of the splunk/splunk-operator docker image and installation YAML file
  • make local: builds the splunk-operator-local binary for test and debugging purposes
  • make clean: removes the binary build output and splunk/splunk-operator container image
  • make run: runs the splunk operator locally, monitoring the Kubernetes cluster configured in your current kubectl context
  • make fmt: runs go fmt on all *.go source files in this project
  • make lint: runs the golint utility on all *.go source files in this project

Running the Splunk Operator

Ensure that you have the SplunkEnterprise Custom Resource Definition installed in your cluster:

kubectl apply -f deploy/crds/enterprise_v1alpha1_splunkenterprise_crd.yaml

Use this to run the operator as a local foreground process on your machine:

make run

This will use your current Kubernetes context from ~/.kube/config to manage resources in your current namespace.

Please see the Getting Started Documentation for more information, including instructions on how to install the operator in your cluster.