Skip to content

Commit

Permalink
1.4.12 (#714)
Browse files Browse the repository at this point in the history
* 1.4.12

* fixed limit/request test

Co-authored-by: harshit-splunk <[email protected]>
  • Loading branch information
rockb1017 and hvaghani221 authored Feb 5, 2022
1 parent 2b0cccf commit 588aebd
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 32 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci_build_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ jobs:
run: |
kubectl apply -f test/test_setup.yaml
sleep 80
echo "logging pod logs"
kubectl logs -l app=splunk-kubernetes-logging
echo "metrics pod logs"
kubectl logs -l app=splunk-kubernetes-metrics
echo "objects pod logs"
kubectl logs -l app=splunk-kubernetes-objects
- uses: actions/setup-python@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion PLUGIN_VERSIONS.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
FLUENTD_HEC_VERSION=1.2.9
FLUENTD_HEC_VERSION=1.2.10
K8S_METRICS_VERISION=1.1.9
K8S_METRICS_AGGR_VERSION=1.1.9
KUBE_OBJECT_VERSION=1.1.9
5 changes: 3 additions & 2 deletions ci_scripts/deploy_connector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ helm install ci-sck --set global.splunk.hec.token=$CI_SPLUNK_HEC_TOKEN \
--set kubelet.serviceMonitor.https=true \
-f ci_scripts/sck_values.yml helm-artifacts/splunk-connect-for-kubernetes*.tgz
#wait for deployment to finish
until kubectl get pod | grep Running | [[ $(wc -l) == 4 ]]; do
sleep 1;
# 2 logging, 2 metrics, 1 aggregator, 1 object
until kubectl get pod | grep Running | [[ $(wc -l) == 7 ]]; do
sleep 5;
done
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ image:
# The name of the image to pull
name: splunk/fluentd-hec
# The tag of the image to pull
tag: 1.2.9
tag: 1.2.10
# The policy that specifies when the user wants the images to be pulled
pullPolicy: IfNotPresent
# Indicates if the image should be pulled using authentication from a secret
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ spec:
selector:
matchLabels:
name: {{ template "splunk-kubernetes-metrics.fullname" . }}
component: collector
template:
metadata:
name: {{ template "splunk-kubernetes-metrics.fullname" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ spec:
matchLabels:
app: {{ template "splunk-kubernetes-metrics.name" . }}
release: {{ .Release.Name }}
component: aggregator
template:
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/splunk-connect-for-kubernetes/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ splunk-kubernetes-logging:
# The name of the image to pull
name: splunk/fluentd-hec
# The tag of the image to pull
tag: 1.2.9
tag: 1.2.10
# The policy that specifies when the user wants the images to be pulled
pullPolicy: IfNotPresent
# Indicates if the image should be pulled using authentication from a secret
Expand Down
2 changes: 1 addition & 1 deletion manifests/splunk-kubernetes-logging/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
key: node-role.kubernetes.io/master
containers:
- name: splunk-fluentd-k8s-logs
image: docker.io/splunk/fluentd-hec:1.2.9
image: docker.io/splunk/fluentd-hec:1.2.10
imagePullPolicy: IfNotPresent
securityContext:
runAsUser: 0
Expand Down
1 change: 1 addition & 0 deletions manifests/splunk-kubernetes-metrics/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ spec:
selector:
matchLabels:
name: splunk-kubernetes-metrics
component: collector
template:
metadata:
name: splunk-kubernetes-metrics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ spec:
selector:
matchLabels:
app: splunk-kubernetes-metrics
component: aggregator
template:
metadata:
labels:
Expand Down
34 changes: 15 additions & 19 deletions test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,13 @@
logger.addHandler(handler)


def check_events_from_splunk(
index="circleci_events",
start_time="-1h@h",
end_time="now",
url="",
user="",
query="",
password="",
):
def check_events_from_splunk(index="ci_events",
start_time="-1h@h",
end_time="now",
url="",
user="",
query="",
password=""):
"""
send a search request to splunk and return the events from the result
"""
Expand All @@ -53,16 +51,14 @@ def check_events_from_splunk(

return events


def check_metrics_from_splunk(
index="circleci_metrics",
start_time="-1h@h",
end_time="now",
url="",
user="",
password="",
metric_name="",
):
def check_metrics_from_splunk(index="ci_metrics",
start_time="-1h@h",
end_time="now",
url="",
user="",
password="",
metric_name=""):

"""
send a search api request to splunk to check for values associated with a given metric and dimension
"""
Expand Down
17 changes: 16 additions & 1 deletion test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import pytest
import time
import os

from .common import check_events_from_splunk

def pytest_addoption(parser):
parser.addoption(
Expand All @@ -32,6 +32,21 @@ def pytest_addoption(parser):
)
parser.addoption("--nodes-count", help="splunk username", default="1")

# Print events ingested in splunk for debugging
def pytest_unconfigure(config):
indexes = ["main", "ci_events", "ns-anno", "pod-anno"]
for index in indexes:
search_query = "index=" + index + " | fields *"
events = check_events_from_splunk(start_time="-1h@h",
url=config.getoption("--splunkd-url"),
user=config.getoption("--splunk-user"),
query=["search {0}".format(
search_query)],
password=config.getoption("--splunk-password"))
print("index=" + index + " event count=" + str(len(events)))
for event in events:
print(event)


@pytest.fixture(scope="function")
def setup(request):
Expand Down
12 changes: 6 additions & 6 deletions test/k8s_metrics_tests/test_metric_aggr_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_container_limit_and_requests(setup, index_metrics):
url=setup["splunkd_url"],
user=setup["splunk_user"],
password=setup["splunk_password"],
func="avg",
func="latest",
)
actual_data = container_limit_request[resource][metric]
for container_name in containers:
Expand Down Expand Up @@ -108,7 +108,7 @@ def test_pod_and_cluster_limit_and_requests(setup, index_metrics):
url=setup["splunkd_url"],
user=setup["splunk_user"],
password=setup["splunk_password"],
func="avg",
func="latest",
)

actual_data = container_limit_request[resource][metric]
Expand Down Expand Up @@ -142,7 +142,7 @@ def test_pod_and_cluster_limit_and_requests(setup, index_metrics):
url=setup["splunkd_url"],
user=setup["splunk_user"],
password=setup["splunk_password"],
func="avg",
func="latest",
)
logger.info(
"{} metric received by splunk: {}".format(
Expand All @@ -167,7 +167,7 @@ def test_namespace_limit_and_requests(setup, index_metrics):
url=setup["splunkd_url"],
user=setup["splunk_user"],
password=setup["splunk_password"],
func="avg",
func="latest",
)
logger.info(
"Splunk received {} events for metric {}".format(
Expand Down Expand Up @@ -200,7 +200,7 @@ def test_multi_container_pod_limit_and_request(setup, index_metrics):
url=setup["splunkd_url"],
user=setup["splunk_user"],
password=setup["splunk_password"],
func="avg",
func="latest",
)
if not "pod-wo-index-wo-ns-index-dup" in container_events:
pytest.fail("pod 'pod-wo-index-wo-ns-index-dup' not found" )
Expand All @@ -215,7 +215,7 @@ def test_multi_container_pod_limit_and_request(setup, index_metrics):
url=setup["splunkd_url"],
user=setup["splunk_user"],
password=setup["splunk_password"],
func="avg",
func="latest",
)

for pod_name, metric_value in pod_events.items():
Expand Down

0 comments on commit 588aebd

Please sign in to comment.