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

chore: Introduce failing observability example for podtatohead #204

Merged
merged 4 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
22 changes: 22 additions & 0 deletions examples/observability/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,28 @@ deploy-podtatohead:
kubectl create namespace "$(PODTATO_NAMESPACE)" --dry-run=client -o yaml | kubectl apply -f -
kubectl annotate namespace "$(PODTATO_NAMESPACE)" keptn.sh/lifecycle-controller=enabled --overwrite
kubectl apply -f ./assets/podtatohead-deployment-evaluation/.
kubectl apply -f ./assets/podtatohead-evaluationdefinitions/keptnevaluationdefinition1.yaml
kubectl apply -f ./assets/podtatohead-evaluationdefinitions/keptnevaluationdefinition2.yaml
kubectl wait --for=condition=available deployment/podtato-head-entry -n podtato-kubectl --timeout=120s
@echo "Watch Workload Deployment Progress: kubectl get keptnworkloadinstances -n podtato-kubectl -w"

.PHONY: deploy-podtatohead-failed-post
deploy-podtatohead-failed-post:
kubectl create namespace "$(PODTATO_NAMESPACE)" --dry-run=client -o yaml | kubectl apply -f -
kubectl annotate namespace "$(PODTATO_NAMESPACE)" keptn.sh/lifecycle-controller=enabled --overwrite
kubectl apply -f ./assets/podtatohead-deployment-evaluation/.
kubectl apply -f ./assets/podtatohead-evaluationdefinitions/keptnevaluationdefinition1.yaml
kubectl apply -f ./assets/podtatohead-evaluationdefinitions/keptnevaluationdefinition3.yaml
kubectl wait --for=condition=available deployment/podtato-head-entry -n podtato-kubectl --timeout=120s
@echo "Watch Workload Deployment Progress: kubectl get keptnworkloadinstances -n podtato-kubectl -w"

.PHONY: deploy-podtatohead-failed-pre
deploy-podtatohead-failed-pre:
kubectl create namespace "$(PODTATO_NAMESPACE)" --dry-run=client -o yaml | kubectl apply -f -
kubectl annotate namespace "$(PODTATO_NAMESPACE)" keptn.sh/lifecycle-controller=enabled --overwrite
kubectl apply -f ./assets/podtatohead-deployment-evaluation/.
kubectl apply -f ./assets/podtatohead-evaluationdefinitions/keptnevaluationdefinition3.yaml
kubectl apply -f ./assets/podtatohead-evaluationdefinitions/keptnevaluationdefinition4.yaml
kubectl wait --for=condition=available deployment/podtato-head-entry -n podtato-kubectl --timeout=120s
@echo "Watch Workload Deployment Progress: kubectl get keptnworkloadinstances -n podtato-kubectl -w"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ spec:
version: 0.1.0
postDeploymentTasks:
- post-deployment-hello
preDeploymentEvaluations: #Comment out this two lines if you do not have a prometheus installation
- my-prometheus-definition
preDeploymentEvaluations: #Comment out this four lines if you do not have a prometheus installation
- my-prometheus-definition1
postDeploymentEvaluations:
- my-prometheus-definition2
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ metadata:
name: prometheus
namespace: podtato-kubectl
spec:
targetServer: "http://prometheus-k8s.monitoring.svc.cluster.local:9090" #string
targetServer: "http://prometheus-k8s.monitoring.svc.cluster.local:9090"
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ spec:
labels:
component: podtato-head-hat
keptn.sh/pre-deployment-tasks: check-entry-service
keptn.sh/pre-deployment-evaluations: my-prometheus-definition
keptn.sh/post-deployment-evaluations: my-prometheus-definition
keptn.sh/pre-deployment-evaluations: my-prometheus-definition1
keptn.sh/post-deployment-evaluations: my-prometheus-definition1
annotations:
keptn.sh/app: podtato-head
keptn.sh/workload: podtato-head-hat
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: lifecycle.keptn.sh/v1alpha1
kind: KeptnEvaluationDefinition
metadata:
name: my-prometheus-definition1
namespace: podtato-kubectl
spec:
source: prometheus
objectives:
- name: available-cpus ## this query should pass
query: "sum(kube_pod_container_resource_limits{resource='cpu'}) - sum(kube_node_status_capacity{resource='cpu'})"
evaluationTarget: "<1"

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: lifecycle.keptn.sh/v1alpha1
kind: KeptnEvaluationDefinition
metadata:
name: my-prometheus-definition2
namespace: podtato-kubectl
spec:
source: prometheus
objectives:
- name: consumed-memory ## this query should pass
query: "sum(kube_node_status_capacity{resource='memory'})"
evaluationTarget: "<1000000000000"

Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apiVersion: lifecycle.keptn.sh/v1alpha1
kind: KeptnEvaluationDefinition
metadata:
name: my-prometheus-definition
name: my-prometheus-definition2
namespace: podtato-kubectl
spec:
source: prometheus
objectives:
- name: available-cpus
- name: available-cpus ## this query should fail
query: "sum(kube_pod_container_resource_limits{resource='cpu'}) - sum(kube_node_status_capacity{resource='cpu'})"
evaluationTarget: ">1" #string: can only be starting with < or >
- name: consumed-memory
evaluationTarget: ">1"
- name: consumed-memory ## this query should pass
query: "sum(kube_node_status_capacity{resource='memory'})"
evaluationTarget: "<1000000000000" #string: can only be starting with < or >
evaluationTarget: "<1000000000000"

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: lifecycle.keptn.sh/v1alpha1
kind: KeptnEvaluationDefinition
metadata:
name: my-prometheus-definition1
namespace: podtato-kubectl
spec:
source: prometheus
objectives:
- name: available-cpus ## this query should fail
query: "sum(kube_pod_container_resource_limits{resource='cpu'}) - sum(kube_node_status_capacity{resource='cpu'})"
evaluationTarget: ">1000"