-
Notifications
You must be signed in to change notification settings - Fork 480
feat: splunk scaler docs #1413
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
Merged
Merged
feat: splunk scaler docs #1413
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,292 @@ | ||
+++ | ||
title = "Splunk" | ||
availability = "v2.15+" | ||
maintainer = "Community" | ||
category = "Data & Storage" | ||
description = "Scale applications based on Splunk saved search results." | ||
go_file = "splunk_scaler" | ||
+++ | ||
|
||
### Trigger Specification | ||
|
||
This specification describes the `splunk` trigger that scales based on the result of a [saved search](https://docs.splunk.com/Documentation/Splunk/9.2.1/Search/Savingsearches). | ||
|
||
The trigger always requires the following information: | ||
|
||
```yaml | ||
triggers: | ||
- type: splunk | ||
metadata: | ||
host: https://splunk.default.svc.cluster.local:8089 | ||
targetValue: "1" | ||
activationValue: "10" | ||
savedSearchName: my-saved-search-name | ||
valueField: count | ||
``` | ||
|
||
**Parameter list:** | ||
|
||
- `host` - Search API host and port. Example: `https://localhost:8089`. | ||
- `unsafeSsl` - Whether to trust invalid certificates or not. (Values: `"true"`, `"false"`, Default: `"false"`, Optional) | ||
- `targetValue` - Value to reach to start scaling (This value can be a integer or float). | ||
- `activationValue` - Target value for activating the scaler. Learn more about activation [here](./../concepts/scaling-deployments.md#activating-and-scaling-thresholds). | ||
- `savedSearchName` - Name of saved search that returns metric data for scaling. | ||
- `valueField` - The name of the field in the search results containing the metric value. Example: `index=_internal | tail | stats count`, the `valueField` is `count`. | ||
|
||
### Authentication Parameters | ||
|
||
You can authenticate by using a username/password or an API token. You will need to use `TriggerAuthentication` CRD to configure the authentication. | ||
|
||
> **Note:** | ||
> | ||
> `TriggerAuthentication` is required to use this scaler due to the hard requirement of providing a `username` for the Splunk API. | ||
|
||
**Parameter list:** | ||
|
||
- `username` - Splunk username authorized to access the search API. | ||
- `apiToken` - Splunk API token for supplied `username`. Conflicts with `password`. | ||
- `password` - Password for supplied `username`. Conflicts with `apiToken`. | ||
|
||
The user will need access to the saved search. | ||
|
||
### Examples | ||
|
||
### Username/password | ||
|
||
```yaml | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: splunk-creds | ||
data: | ||
username: YWRtaW4= # "admin" | ||
password: cGFzc3dvcmQ= # "password" | ||
--- | ||
apiVersion: keda.sh/v1alpha1 | ||
kind: TriggerAuthentication | ||
metadata: | ||
name: splunk-auth | ||
spec: | ||
secretTargetRef: | ||
- parameter: username | ||
name: splunk-creds | ||
key: username | ||
- parameter: password | ||
name: splunk-creds | ||
key: password | ||
--- | ||
apiVersion: keda.sh/v1alpha1 | ||
kind: ScaledObject | ||
metadata: | ||
name: splunk-scaledobject | ||
spec: | ||
pollingInterval: 15 | ||
minReplicaCount: 1 | ||
maxReplicaCount: 3 | ||
scaleTargetRef: | ||
name: nginx | ||
triggers: | ||
- type: splunk | ||
authenticationRef: | ||
name: splunk-auth | ||
metadata: | ||
host: https://splunk.default.svc.cluster.local:8089 | ||
targetValue: "11" | ||
activationValue: "15" | ||
savedSearchName: my-saved-search-name | ||
valueField: count | ||
``` | ||
|
||
### API Token | ||
|
||
```yaml | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: splunk-creds | ||
data: | ||
username: YWRtaW4= # admin | ||
apiToken: <base64 encoded api token> | ||
--- | ||
apiVersion: keda.sh/v1alpha1 | ||
kind: TriggerAuthentication | ||
metadata: | ||
name: splunk-auth | ||
spec: | ||
secretTargetRef: | ||
- parameter: username | ||
name: splunk-creds | ||
key: username | ||
- parameter: apiToken | ||
name: splunk-creds | ||
key: apiToken | ||
--- | ||
apiVersion: keda.sh/v1alpha1 | ||
kind: ScaledObject | ||
metadata: | ||
name: splunk-scaledobject | ||
spec: | ||
pollingInterval: 15 | ||
minReplicaCount: 1 | ||
maxReplicaCount: 3 | ||
scaleTargetRef: | ||
name: nginx | ||
triggers: | ||
- type: splunk | ||
authenticationRef: | ||
name: splunk-auth | ||
metadata: | ||
host: https://splunk.default.svc.cluster.local:8089 | ||
targetValue: "11" | ||
activationValue: "15" | ||
savedSearchName: my-saved-search-name | ||
valueField: count | ||
``` | ||
|
||
### Full example using Splunk deployment | ||
|
||
```yaml | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: splunkconf | ||
data: | ||
default.yml: | | ||
splunk: | ||
conf: | ||
- key: savedsearches | ||
value: | ||
directory: /opt/splunk/etc/users/admin/search/local | ||
content: | ||
my-saved-search-name: | ||
action.email.useNSSubject: 1 | ||
action.webhook.enable_allowlist: 0 | ||
alert.track: 0 | ||
cron_schedule: '*/1 * * * *' | ||
dispatch.earliest_time: -15m | ||
dispatch.latest_time: now | ||
display.general.type: statistics | ||
display.page.search.tab: statistics | ||
display.visualizations.show: 0 | ||
enableSched: 1 | ||
request.ui_dispatch_app: search | ||
request.ui_dispatch_view: search | ||
search: index=_internal | tail | stats count | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: splunk-creds | ||
data: | ||
username: YWRtaW4= # "admin" | ||
password: cGFzc3dvcmQ= # "password" | ||
--- | ||
apiVersion: keda.sh/v1alpha1 | ||
kind: TriggerAuthentication | ||
metadata: | ||
name: splunk-auth | ||
spec: | ||
secretTargetRef: | ||
- parameter: username | ||
name: splunk-creds | ||
key: username | ||
- parameter: password | ||
name: splunk-creds | ||
key: password | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: splunk | ||
spec: | ||
ports: | ||
- port: 8000 | ||
targetPort: web | ||
name: web-svc | ||
- port: 8089 | ||
targetPort: 8089 | ||
name: api-svc | ||
selector: | ||
app: splunk | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: splunk | ||
namespace: default | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: splunk | ||
template: | ||
metadata: | ||
labels: | ||
app: splunk | ||
spec: | ||
containers: | ||
- name: splunk | ||
image: splunk/splunk:9.2 | ||
ports: | ||
- containerPort: 8000 | ||
name: web | ||
- containerPort: 8089 | ||
name: api | ||
env: | ||
- name: SPLUNK_START_ARGS | ||
value: --accept-license | ||
- name: SPLUNK_PASSWORD | ||
value: password | ||
volumeMounts: | ||
- name: splunkconf-volume | ||
mountPath: /tmp/defaults | ||
volumes: | ||
- name: splunkconf-volume | ||
configMap: | ||
name: splunkconf | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nginx | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: nginx | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
ports: | ||
- containerPort: 8080 | ||
--- | ||
apiVersion: keda.sh/v1alpha1 | ||
kind: ScaledObject | ||
metadata: | ||
name: splunk-scaledobject | ||
spec: | ||
pollingInterval: 15 | ||
minReplicaCount: 1 | ||
maxReplicaCount: 3 | ||
scaleTargetRef: | ||
name: nginx | ||
triggers: | ||
- type: splunk | ||
authenticationRef: | ||
name: splunk-auth | ||
metadata: | ||
host: https://splunk.default.svc.cluster.local:8089 | ||
unsafeSsl: "true" | ||
targetValue: "5" | ||
activationValue: "5" | ||
savedSearchName: my-saved-search-name | ||
valueField: count | ||
``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.