Skip to content

SLI resource added using keptn add-resource on project level overrides SLI resource added using keptn add-resource on stage/service level #67

@vadasambar

Description

@vadasambar

Summary
If we add SLI on service level

keptn add-resource --project="e2e-project" --stage="staging" --service="podtatoserver" --resource=test/data/podtatohead.sli.yaml --resourceUri=datadog/sli.yaml

And kubectl exec -it resource-service-xxx -nkeptn -- sh

/data/config/e2e-project/podtatoserver/datadog $ ls
sli.yaml

You can see sli.yaml added under the above path
Now, if you try to add a project level SLI file

keptn add-resource --project="e2e-project"  --resource=test/data/podtatohead.sli.yaml --resourceUri=datadog/sli.yaml

podtatoserver folder in resource-service in the path /data/config/e2e-project/podtatoserver/datadog is removed and you see

/data/config/e2e-project/datadog $ ls
sli.yaml

Environment

  • Keptn Version (keptn version):
$ keptn version

Keptn CLI version: 0.18.1
...
Keptn cluster version: 0.18.1
...
  • Kubernetes Cloud Provider (e.g., GKE, AKS): minikube
  • Kubernetes version (kubectl version):
$ kubectl version --short
Client Version: v1.23.1
Server Version: v1.24.3
  • Client OS (e.g., Linux, macOS, Windows): Linux
    * Client Browser: N/A Not applicable for this issue

Affected Component

  • Web UI / Bridge
  • CLI
  • REST API or webhooks
  • User experience
  • Developer experience
  • Deployment/manegement with Helm

To Reproduce

Steps to reproduce the behavior:

  1. Install keptn 0.18.1 using
minikube start --cpus=2 --memory=5GB -p dd-bug # memory can be less than 5GB
echo "Adding keptn repo"
helm repo add keptn https://charts.keptn.sh
echo "Installing keptn"
kubectl create ns keptn
kubectl config set-context --current --namespace=keptn
minikube tunnel &> /dev/null &
helm upgrade --install keptn keptn/keptn -f examples/keptn-values.yaml --version 0.18.1 --wait
kubectl port-forward svc/api-gateway-nginx 5000:80 -nkeptn &
keptn auth --endpoint=localhost:5000
kubectl config set-context --current --namespace=keptn
# # Kill the port-forward started in the background
# # If you want to port-forward again, just run
# # kubectl port-forward svc/api-gateway-nginx 5000:80 -nkeptn
ps aux | grep 'kubectl port-forward svc/api-gateway-nginx 5000' | grep -v 'grep' | awk '{print $2}' | xargs -I{} kill -9 {}
ps aux | grep 'minikube tunnel' | grep -v 'grep' | awk '{print $2}' | xargs -I{} kill -9 {}
  1. Install gitea related services
password=$(date +%s | sha256sum | base64 | head -c 32)
export GITEA_ADMIN_PASSWORD=$password
export GITEA_ADMIN_USERNAME=GiteaAdmin
export GITEA_NAMESPACE=gitea
export GITEA_ENDPOINT="http://gitea-http.${GITEA_NAMESPACE}:3000"
helm repo add gitea-charts https://dl.gitea.io/charts/
helm repo update
helm install -n ${GITEA_NAMESPACE} gitea gitea-charts/gitea \
--create-namespace \
--set memcached.enabled=false \
--set postgresql.enabled=false \
--set gitea.config.database.DB_TYPE=sqlite3 \
--set gitea.admin.username=${GITEA_ADMIN_USERNAME} \
--set gitea.admin.password=${GITEA_ADMIN_PASSWORD} \
--set gitea.config.server.OFFLINE_MODE=true \
--set gitea.config.server.ROOT_URL=${GITEA_ENDPOINT}/ \
--wait 
helm install keptn-gitea-provisioner-service https://github.com/keptn-sandbox/keptn-gitea-provisioner-service/releases/download/0.1.0/keptn-gitea-provisioner-service-0.1.0.tgz \
--set gitea.endpoint=${GITEA_ENDPOINT} \
--set gitea.admin.create=true \
--set gitea.admin.username=${GITEA_ADMIN_USERNAME} \
--set gitea.admin.password=${GITEA_ADMIN_PASSWORD} \
--wait -ndefault
  1. Create a project
# you need to be at the root of datadog-service
keptn create project e2e-project --shipyard=test/shipyard/podtatohead.deployment.yaml
  1. Create service level SLI
keptn create service podtatoserver --project=e2e-project

keptn add-resource --project="e2e-project" --stage="staging" --service="podtatoserver" --resource=test/data/podtatohead.sli.yaml --resourceUri=datadog/sli.yaml

Check the SLI is reflected in resource-service
kubectl exec -it resource-service-xxx -nkeptn -- sh (replace resource-service-xxx with the name of your resource-service pod in keptn namespace)

/data/config/e2e-project/podtatoserver/datadog $ ls
sli.yaml

You should see ^
5. Create a project level SLI

keptn add-resource --project="e2e-project"  --resource=test/data/podtatohead.sli.yaml --resourceUri=datadog/sli.yaml

podtatoserver folder in resource-service in the path /data/config/e2e-project/podtatoserver/datadog is removed and you should see

/data/config/e2e-project/datadog $ ls
sli.yaml

Expected behavior
Adding project level SLI should not override service level SLI

Current behavior
Project level SLI overrides service level SLI

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions