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

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

Open
6 tasks
vadasambar opened this issue Sep 14, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@vadasambar
Copy link
Collaborator

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

@vadasambar vadasambar added the bug Something isn't working label Sep 14, 2022
@vadasambar
Copy link
Collaborator Author

vadasambar commented Sep 22, 2022

This might not be related to datadog-service or might not be a bug at all. We need to confirm if this bug is in-fact related to datadog-service using the 0.18.1 version of the service (since the 0.18.1 version of the service was not released when this issue was created).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant