diff --git a/examples/kubecon-na-22-demo/Makefile b/examples/kubecon-na-22-demo/Makefile new file mode 100644 index 0000000000..a6dd05be4f --- /dev/null +++ b/examples/kubecon-na-22-demo/Makefile @@ -0,0 +1,43 @@ +JAEGER_VERSION ?= v1.38.0 +LFC_NAMESPACE ?= keptn-lifecycle-controller-system +PODTATO_NAMESPACE ?= podtato-kubectl + +.PHONY: install +install: + make -C ../observability install + make -C ../observability import-grafana-dashboard + +.PHONY: port-forward-jaeger +port-forward-jaeger: + make -C ../observability port-forward-jaeger + +.PHONY: port-forward-grafana +port-forward-grafana: + make -C ../observability port-forward-grafana + +.PHONY: deploy-version-1 +deploy-version-1: + kubectl create namespace "$(PODTATO_NAMESPACE)" --dry-run=client -o yaml | kubectl apply -f - + kubectl apply -k version-1 + +.PHONY: deploy-version-2 +deploy-version-2: + kubectl create namespace "$(PODTATO_NAMESPACE)" --dry-run=client -o yaml | kubectl apply -f - + kubectl apply -k version-2 + +.PHONY: deploy-version-3 +deploy-version-3: + kubectl create namespace "$(PODTATO_NAMESPACE)" --dry-run=client -o yaml | kubectl apply -f - + kubectl apply -k version-3 + +.PHONY: undeploy-podtatohead +undeploy-podtatohead: + kubectl delete ns "$(PODTATO_NAMESPACE)" --ignore-not-found=true + + @echo "######################" + @echo "PodTatoHead undeployed" + @echo "######################" + +.PHONY: uninstall +uninstall: undeploy-podtatohead + make -C ../observability uninstall \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/README.md b/examples/kubecon-na-22-demo/README.md new file mode 100644 index 0000000000..b8d89a979a --- /dev/null +++ b/examples/kubecon-na-22-demo/README.md @@ -0,0 +1,39 @@ +# KubeCon 2022 NA Demo + +This demonstration is based on the [Observability Example](../observability) and should do the following: + +![img.png](assets/big-picture.png) + +## Prepare Secret for Slack Notification +> kubectl create secret generic slack-notification --from-literal=SECURE_DATA='{"slack_hook":"HOOK","text":"Deployed PodTatoHead Application"}' -n podtato-kubectl -oyaml --dry-run > base/slack-secret.yaml + +## Deploy the Observability Part +> make install + +## Port-Forward Grafana +> make port-forward-grafana + +## Port-Forward Jaeger +> make port-forward-jaeger + +## Deploy Version 1 of the PodTatoHead +> make deploy-version-1 + +Now watch the progress on the cluster +> kubectl get keptnworkloadinstances +> kubectl get keptnappversions + +You could also open up a browser and watch the progress in Jaeger/Grafana. You can find the Context ID in the "TraceId" Field of the KeptnAppVersion + +The deployment should fail because of too few cpu resources + +## Deploy Version 2 of the PodTatoHead +> make deploy-version-2 + +* Watch the progress of the deployments +* After some time, you should see that everything is successful + +## Deploy Version 3 +> make deploy-version-3 + +* This should only change one service, you can see that only this changed in the trace diff --git a/examples/kubecon-na-22-demo/assets/big-picture.png b/examples/kubecon-na-22-demo/assets/big-picture.png new file mode 100644 index 0000000000..0afb745c34 Binary files /dev/null and b/examples/kubecon-na-22-demo/assets/big-picture.png differ diff --git a/examples/kubecon-na-22-demo/base/.gitignore b/examples/kubecon-na-22-demo/base/.gitignore new file mode 100644 index 0000000000..d6088d5e79 --- /dev/null +++ b/examples/kubecon-na-22-demo/base/.gitignore @@ -0,0 +1 @@ +slack-secret.yaml diff --git a/examples/kubecon-na-22-demo/base/app-post-deploy.yaml b/examples/kubecon-na-22-demo/base/app-post-deploy.yaml new file mode 100644 index 0000000000..533418a613 --- /dev/null +++ b/examples/kubecon-na-22-demo/base/app-post-deploy.yaml @@ -0,0 +1,11 @@ +apiVersion: lifecycle.keptn.sh/v1alpha1 +kind: KeptnTaskDefinition +metadata: + name: post-deployment-notification + namespace: podtato-kubectl +spec: + function: + httpRef: + url: https://raw.githubusercontent.com/keptn/lifecycle-controller/main/functions-runtime/samples/ts/slack.ts + secureParameters: + secret: slack-secret \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/base/app.yaml b/examples/kubecon-na-22-demo/base/app.yaml new file mode 100644 index 0000000000..a444388dc1 --- /dev/null +++ b/examples/kubecon-na-22-demo/base/app.yaml @@ -0,0 +1,24 @@ +apiVersion: lifecycle.keptn.sh/v1alpha1 +kind: KeptnApp +metadata: + name: podtato-head + namespace: podtato-kubectl +spec: + version: "1.0.0" + workloads: + - name: podtato-head-left-arm + version: 0.2.7 + - name: podtato-head-left-leg + version: 0.2.7 + - name: podtato-head-entry + version: 0.2.7 + - name: podtato-head-right-arm + version: 0.1.0 + - name: podtato-head-left-arm + version: 0.2.7 + - name: podtato-head-hat + version: 0.1.0 + postDeploymentTasks: + - post-deployment-notification + + diff --git a/examples/kubecon-na-22-demo/base/kustomization.yaml b/examples/kubecon-na-22-demo/base/kustomization.yaml new file mode 100644 index 0000000000..9609cac45e --- /dev/null +++ b/examples/kubecon-na-22-demo/base/kustomization.yaml @@ -0,0 +1,6 @@ +resources: + - app.yaml + - manifest.yaml + - app-post-deploy.yaml + - slack-secret.yaml + - provider.yaml \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/base/manifest.yaml b/examples/kubecon-na-22-demo/base/manifest.yaml new file mode 100644 index 0000000000..7d0377f4df --- /dev/null +++ b/examples/kubecon-na-22-demo/base/manifest.yaml @@ -0,0 +1,300 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: podtato-kubectl + annotations: + keptn.sh/lifecycle-toolkit: "enabled" +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-entry + namespace: podtato-kubectl + labels: + app: podtato-head +spec: + selector: + matchLabels: + component: podtato-head-entry + template: + metadata: + labels: + component: podtato-head-entry + spec: + terminationGracePeriodSeconds: 5 + initContainers: + - name: init-myservice + image: busybox:1.28 + command: ['sh', '-c', 'sleep 30'] + containers: + - name: server + image: ghcr.io/podtato-head/entry:0.2.7 + imagePullPolicy: Always + ports: + - containerPort: 9000 + env: + - name: PODTATO_PORT + value: "9000" +--- +apiVersion: v1 +kind: Service +metadata: + name: podtato-head-entry + namespace: podtato-kubectl + labels: + app: podtato-head +spec: + selector: + component: podtato-head-entry + ports: + - name: http + port: 9000 + protocol: TCP + nodePort: 30900 + targetPort: 9000 + type: NodePort + # change to NodePort if no LoadBalancer controller is available + # type: NodePort +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-hat + namespace: podtato-kubectl + labels: + app: podtato-head +spec: + selector: + matchLabels: + component: podtato-head-hat + template: + metadata: + labels: + component: podtato-head-hat + app.kubernetes.io/version: 0.1.0 + annotations: + app.kubernetes.io/part-of: podtato-head + app.kubernetes.io/name: podtato-head-hat + keptn.sh/pre-deployment-tasks: check-entry-service + spec: + terminationGracePeriodSeconds: 5 + containers: + - name: server + image: ghcr.io/podtato-head/hat:0.2.7 + imagePullPolicy: Always + ports: + - containerPort: 9000 + env: + - name: PODTATO_PORT + value: "9000" +--- +apiVersion: v1 +kind: Service +metadata: + name: podtato-head-hat + namespace: podtato-kubectl + labels: + app: podtato-head +spec: + selector: + component: podtato-head-hat + ports: + - name: http + port: 9001 + protocol: TCP + targetPort: 9000 + type: ClusterIP +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-left-leg + namespace: podtato-kubectl + labels: + app: podtato-head +spec: + selector: + matchLabels: + component: podtato-head-left-leg + template: + metadata: + labels: + component: podtato-head-left-leg + annotations: + app.kubernetes.io/part-of: podtato-head + app.kubernetes.io/name: podtato-head-left-leg + keptn.sh/pre-deployment-tasks: check-entry-service + spec: + terminationGracePeriodSeconds: 5 + containers: + - name: server + image: ghcr.io/podtato-head/left-leg:0.2.7 + imagePullPolicy: Always + ports: + - containerPort: 9000 + env: + - name: PODTATO_PORT + value: "9000" +--- +apiVersion: v1 +kind: Service +metadata: + name: podtato-head-left-leg + namespace: podtato-kubectl + labels: + app: podtato-head +spec: + selector: + component: podtato-head-left-leg + ports: + - name: http + port: 9002 + protocol: TCP + targetPort: 9000 + type: ClusterIP +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-left-arm + namespace: podtato-kubectl + labels: + app: podtato-head +spec: + selector: + matchLabels: + component: podtato-head-left-arm + template: + metadata: + labels: + component: podtato-head-left-arm + app.kubernetes.io/part-of: podtato-head + annotations: + app.kubernetes.io/name: podtato-head-left-arm + keptn.sh/pre-deployment-tasks: check-entry-service + spec: + terminationGracePeriodSeconds: 5 + containers: + - name: server + image: ghcr.io/podtato-head/left-arm:0.2.7 + imagePullPolicy: Always + ports: + - containerPort: 9000 + env: + - name: PODTATO_PORT + value: "9000" +--- +apiVersion: v1 +kind: Service +metadata: + name: podtato-head-left-arm + namespace: podtato-kubectl + labels: + app: podtato-head +spec: + selector: + component: podtato-head-left-arm + ports: + - name: http + port: 9003 + protocol: TCP + targetPort: 9000 + type: ClusterIP +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-right-leg + namespace: podtato-kubectl + labels: + app: podtato-head +spec: + selector: + matchLabels: + component: podtato-head-right-leg + template: + metadata: + labels: + component: podtato-head-right-leg + annotations: + app.kubernetes.io/part-of: podtato-head + app.kubernetes.io/name: podtato-head-right-leg + keptn.sh/pre-deployment-tasks: check-entry-service + spec: + terminationGracePeriodSeconds: 5 + containers: + - name: server + image: ghcr.io/podtato-head/right-leg:0.2.7 + imagePullPolicy: Always + ports: + - containerPort: 9000 + env: + - name: PODTATO_PORT + value: "9000" +--- +apiVersion: v1 +kind: Service +metadata: + name: podtato-head-right-leg + namespace: podtato-kubectl + labels: + app: podtato-head +spec: + selector: + component: podtato-head-right-leg + ports: + - name: http + port: 9004 + protocol: TCP + targetPort: 9000 + type: ClusterIP +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-right-arm + namespace: podtato-kubectl + labels: + app: podtato-head +spec: + selector: + matchLabels: + component: podtato-head-right-arm + template: + metadata: + labels: + component: podtato-head-right-arm + annotations: + app.kubernetes.io/part-of: podtato-head + keptn.sh/workload: podtato-head-right-arm + keptn.sh/version: 0.1.0 + keptn.sh/pre-deployment-tasks: check-entry-service + spec: + terminationGracePeriodSeconds: 5 + containers: + - name: server + image: ghcr.io/podtato-head/right-arm:0.2.7 + imagePullPolicy: Always + ports: + - containerPort: 9000 + env: + - name: PODTATO_PORT + value: "9000" +--- +apiVersion: v1 +kind: Service +metadata: + name: podtato-head-right-arm + namespace: podtato-kubectl + labels: + app: podtato-head +spec: + selector: + component: podtato-head-right-arm + ports: + - name: http + port: 9005 + protocol: TCP + targetPort: 9000 + type: ClusterIP diff --git a/examples/kubecon-na-22-demo/base/provider.yaml b/examples/kubecon-na-22-demo/base/provider.yaml new file mode 100644 index 0000000000..c0f1490183 --- /dev/null +++ b/examples/kubecon-na-22-demo/base/provider.yaml @@ -0,0 +1,7 @@ +apiVersion: lifecycle.keptn.sh/v1alpha1 +kind: KeptnEvaluationProvider +metadata: + name: prometheus + namespace: podtato-kubectl +spec: + targetServer: "http://prometheus-k8s.monitoring.svc.cluster.local:9090" \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/version-1/app-pre-deploy-eval.yaml b/examples/kubecon-na-22-demo/version-1/app-pre-deploy-eval.yaml new file mode 100644 index 0000000000..50a12dd1c6 --- /dev/null +++ b/examples/kubecon-na-22-demo/version-1/app-pre-deploy-eval.yaml @@ -0,0 +1,12 @@ +apiVersion: lifecycle.keptn.sh/v1alpha1 +kind: KeptnEvaluationDefinition +metadata: + name: app-pre-deploy-eval-1 + 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: ">4" diff --git a/examples/kubecon-na-22-demo/version-1/app-pre-deploy.yaml b/examples/kubecon-na-22-demo/version-1/app-pre-deploy.yaml new file mode 100644 index 0000000000..6e68c2ad7e --- /dev/null +++ b/examples/kubecon-na-22-demo/version-1/app-pre-deploy.yaml @@ -0,0 +1,12 @@ +apiVersion: lifecycle.keptn.sh/v1alpha1 +kind: KeptnTaskDefinition +metadata: + name: pre-deployment-check-entry + namespace: podtato-kubectl +spec: + function: + httpRef: + url: https://raw.githubusercontent.com/keptn-sandbox/lifecycle-controller/main/functions-runtime/samples/ts/http.ts + parameters: + map: + url: http://podtato-head-entry.podtato-kubectl.svc.cluster.local:9000 \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/version-1/app.yaml b/examples/kubecon-na-22-demo/version-1/app.yaml new file mode 100644 index 0000000000..63a0c92a74 --- /dev/null +++ b/examples/kubecon-na-22-demo/version-1/app.yaml @@ -0,0 +1,22 @@ +apiVersion: lifecycle.keptn.sh/v1alpha1 +kind: KeptnApp +metadata: + name: podtato-head + namespace: podtato-kubectl +spec: + version: "0.1.0" + workloads: + - name: podtato-head-left-arm + version: 0.2.7 + - name: podtato-head-left-leg + version: 0.2.7 + - name: podtato-head-entry + version: 0.2.7 + - name: podtato-head-right-arm + version: 0.1.0 + - name: podtato-head-left-arm + version: 0.2.7 + - name: podtato-head-hat + version: 0.1.0 + preDeploymentEvaluations: + - app-pre-deploy-eval-1 \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/version-1/kustomization.yaml b/examples/kubecon-na-22-demo/version-1/kustomization.yaml new file mode 100644 index 0000000000..f415117d5c --- /dev/null +++ b/examples/kubecon-na-22-demo/version-1/kustomization.yaml @@ -0,0 +1,10 @@ +bases: + - ../base + +resources: + - app-pre-deploy.yaml + - app-pre-deploy-eval.yaml + +patchesStrategicMerge: + - app.yaml + - manifest.yaml \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/version-1/manifest.yaml b/examples/kubecon-na-22-demo/version-1/manifest.yaml new file mode 100644 index 0000000000..587aad6896 --- /dev/null +++ b/examples/kubecon-na-22-demo/version-1/manifest.yaml @@ -0,0 +1,84 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-entry + namespace: podtato-kubectl +spec: + template: + metadata: + labels: + keptn.sh/app: podtato-head + keptn.sh/workload: podtato-head-entry + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-hat + namespace: podtato-kubectl +spec: + template: + metadata: + labels: + app.kubernetes.io/version: 0.1.0 + annotations: + app.kubernetes.io/part-of: podtato-head + app.kubernetes.io/name: podtato-head-hat + keptn.sh/pre-deployment-tasks: pre-deployment-check-entry +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-left-leg + namespace: podtato-kubectl +spec: + template: + metadata: + annotations: + app.kubernetes.io/part-of: podtato-head + app.kubernetes.io/name: podtato-head-left-leg + keptn.sh/pre-deployment-tasks: pre-deployment-check-entry +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-left-arm + namespace: podtato-kubectl +spec: + template: + metadata: + labels: + app.kubernetes.io/part-of: podtato-head + annotations: + app.kubernetes.io/name: podtato-head-left-arm + keptn.sh/pre-deployment-tasks: pre-deployment-check-entry +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-right-leg + namespace: podtato-kubectl +spec: + template: + metadata: + labels: + component: podtato-head-right-leg + annotations: + app.kubernetes.io/part-of: podtato-head + app.kubernetes.io/name: podtato-head-right-leg + keptn.sh/pre-deployment-tasks: pre-deployment-check-entry +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-right-arm + namespace: podtato-kubectl +spec: + template: + metadata: + annotations: + app.kubernetes.io/part-of: podtato-head + keptn.sh/workload: podtato-head-right-arm + keptn.sh/version: 0.1.0 + keptn.sh/pre-deployment-tasks: pre-deployment-check-entry \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/version-2/app-pre-deploy-eval.yaml b/examples/kubecon-na-22-demo/version-2/app-pre-deploy-eval.yaml new file mode 100644 index 0000000000..b4812875f8 --- /dev/null +++ b/examples/kubecon-na-22-demo/version-2/app-pre-deploy-eval.yaml @@ -0,0 +1,11 @@ +apiVersion: lifecycle.keptn.sh/v1alpha1 +kind: KeptnEvaluationDefinition +metadata: + name: app-pre-deploy-eval-2 + 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: ">1" \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/version-2/app-pre-deploy.yaml b/examples/kubecon-na-22-demo/version-2/app-pre-deploy.yaml new file mode 100644 index 0000000000..6e68c2ad7e --- /dev/null +++ b/examples/kubecon-na-22-demo/version-2/app-pre-deploy.yaml @@ -0,0 +1,12 @@ +apiVersion: lifecycle.keptn.sh/v1alpha1 +kind: KeptnTaskDefinition +metadata: + name: pre-deployment-check-entry + namespace: podtato-kubectl +spec: + function: + httpRef: + url: https://raw.githubusercontent.com/keptn-sandbox/lifecycle-controller/main/functions-runtime/samples/ts/http.ts + parameters: + map: + url: http://podtato-head-entry.podtato-kubectl.svc.cluster.local:9000 \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/version-2/app.yaml b/examples/kubecon-na-22-demo/version-2/app.yaml new file mode 100644 index 0000000000..bc180fd78e --- /dev/null +++ b/examples/kubecon-na-22-demo/version-2/app.yaml @@ -0,0 +1,22 @@ +apiVersion: lifecycle.keptn.sh/v1alpha1 +kind: KeptnApp +metadata: + name: podtato-head + namespace: podtato-kubectl +spec: + version: "0.1.1" + workloads: + - name: podtato-head-left-arm + version: 0.2.7 + - name: podtato-head-left-leg + version: 0.2.7 + - name: podtato-head-entry + version: 0.2.7 + - name: podtato-head-right-arm + version: 0.1.0 + - name: podtato-head-left-arm + version: 0.2.7 + - name: podtato-head-hat + version: 0.1.0 + preDeploymentEvaluations: + - app-pre-deploy-eval-2 \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/version-2/kustomization.yaml b/examples/kubecon-na-22-demo/version-2/kustomization.yaml new file mode 100644 index 0000000000..f415117d5c --- /dev/null +++ b/examples/kubecon-na-22-demo/version-2/kustomization.yaml @@ -0,0 +1,10 @@ +bases: + - ../base + +resources: + - app-pre-deploy.yaml + - app-pre-deploy-eval.yaml + +patchesStrategicMerge: + - app.yaml + - manifest.yaml \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/version-2/manifest.yaml b/examples/kubecon-na-22-demo/version-2/manifest.yaml new file mode 100644 index 0000000000..587aad6896 --- /dev/null +++ b/examples/kubecon-na-22-demo/version-2/manifest.yaml @@ -0,0 +1,84 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-entry + namespace: podtato-kubectl +spec: + template: + metadata: + labels: + keptn.sh/app: podtato-head + keptn.sh/workload: podtato-head-entry + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-hat + namespace: podtato-kubectl +spec: + template: + metadata: + labels: + app.kubernetes.io/version: 0.1.0 + annotations: + app.kubernetes.io/part-of: podtato-head + app.kubernetes.io/name: podtato-head-hat + keptn.sh/pre-deployment-tasks: pre-deployment-check-entry +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-left-leg + namespace: podtato-kubectl +spec: + template: + metadata: + annotations: + app.kubernetes.io/part-of: podtato-head + app.kubernetes.io/name: podtato-head-left-leg + keptn.sh/pre-deployment-tasks: pre-deployment-check-entry +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-left-arm + namespace: podtato-kubectl +spec: + template: + metadata: + labels: + app.kubernetes.io/part-of: podtato-head + annotations: + app.kubernetes.io/name: podtato-head-left-arm + keptn.sh/pre-deployment-tasks: pre-deployment-check-entry +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-right-leg + namespace: podtato-kubectl +spec: + template: + metadata: + labels: + component: podtato-head-right-leg + annotations: + app.kubernetes.io/part-of: podtato-head + app.kubernetes.io/name: podtato-head-right-leg + keptn.sh/pre-deployment-tasks: pre-deployment-check-entry +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-right-arm + namespace: podtato-kubectl +spec: + template: + metadata: + annotations: + app.kubernetes.io/part-of: podtato-head + keptn.sh/workload: podtato-head-right-arm + keptn.sh/version: 0.1.0 + keptn.sh/pre-deployment-tasks: pre-deployment-check-entry \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/version-3/app-pre-deploy-eval.yaml b/examples/kubecon-na-22-demo/version-3/app-pre-deploy-eval.yaml new file mode 100644 index 0000000000..b4812875f8 --- /dev/null +++ b/examples/kubecon-na-22-demo/version-3/app-pre-deploy-eval.yaml @@ -0,0 +1,11 @@ +apiVersion: lifecycle.keptn.sh/v1alpha1 +kind: KeptnEvaluationDefinition +metadata: + name: app-pre-deploy-eval-2 + 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: ">1" \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/version-3/app-pre-deploy.yaml b/examples/kubecon-na-22-demo/version-3/app-pre-deploy.yaml new file mode 100644 index 0000000000..6e68c2ad7e --- /dev/null +++ b/examples/kubecon-na-22-demo/version-3/app-pre-deploy.yaml @@ -0,0 +1,12 @@ +apiVersion: lifecycle.keptn.sh/v1alpha1 +kind: KeptnTaskDefinition +metadata: + name: pre-deployment-check-entry + namespace: podtato-kubectl +spec: + function: + httpRef: + url: https://raw.githubusercontent.com/keptn-sandbox/lifecycle-controller/main/functions-runtime/samples/ts/http.ts + parameters: + map: + url: http://podtato-head-entry.podtato-kubectl.svc.cluster.local:9000 \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/version-3/app.yaml b/examples/kubecon-na-22-demo/version-3/app.yaml new file mode 100644 index 0000000000..82b4b5796c --- /dev/null +++ b/examples/kubecon-na-22-demo/version-3/app.yaml @@ -0,0 +1,20 @@ +apiVersion: lifecycle.keptn.sh/v1alpha1 +kind: KeptnApp +metadata: + name: podtato-head + namespace: podtato-kubectl +spec: + version: "0.1.2" + workloads: + - name: podtato-head-left-arm + version: 0.2.7 + - name: podtato-head-left-leg + version: 0.2.7 + - name: podtato-head-entry + version: 0.2.7 + - name: podtato-head-right-arm + version: 0.1.0 + - name: podtato-head-left-arm + version: 0.2.7 + - name: podtato-head-hat + version: 0.1.1 \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/version-3/kustomization.yaml b/examples/kubecon-na-22-demo/version-3/kustomization.yaml new file mode 100644 index 0000000000..f415117d5c --- /dev/null +++ b/examples/kubecon-na-22-demo/version-3/kustomization.yaml @@ -0,0 +1,10 @@ +bases: + - ../base + +resources: + - app-pre-deploy.yaml + - app-pre-deploy-eval.yaml + +patchesStrategicMerge: + - app.yaml + - manifest.yaml \ No newline at end of file diff --git a/examples/kubecon-na-22-demo/version-3/manifest.yaml b/examples/kubecon-na-22-demo/version-3/manifest.yaml new file mode 100644 index 0000000000..45c8c7f7b0 --- /dev/null +++ b/examples/kubecon-na-22-demo/version-3/manifest.yaml @@ -0,0 +1,84 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-entry + namespace: podtato-kubectl +spec: + template: + metadata: + labels: + keptn.sh/app: podtato-head + keptn.sh/workload: podtato-head-entry + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-hat + namespace: podtato-kubectl +spec: + template: + metadata: + labels: + app.kubernetes.io/version: 0.1.1 + annotations: + app.kubernetes.io/part-of: podtato-head + app.kubernetes.io/name: podtato-head-hat + keptn.sh/pre-deployment-tasks: pre-deployment-check-entry +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-left-leg + namespace: podtato-kubectl +spec: + template: + metadata: + annotations: + app.kubernetes.io/part-of: podtato-head + app.kubernetes.io/name: podtato-head-left-leg + keptn.sh/pre-deployment-tasks: pre-deployment-check-entry +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-left-arm + namespace: podtato-kubectl +spec: + template: + metadata: + labels: + app.kubernetes.io/part-of: podtato-head + annotations: + app.kubernetes.io/name: podtato-head-left-arm + keptn.sh/pre-deployment-tasks: pre-deployment-check-entry +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-right-leg + namespace: podtato-kubectl +spec: + template: + metadata: + labels: + component: podtato-head-right-leg + annotations: + app.kubernetes.io/part-of: podtato-head + app.kubernetes.io/name: podtato-head-right-leg + keptn.sh/pre-deployment-tasks: pre-deployment-check-entry +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-right-arm + namespace: podtato-kubectl +spec: + template: + metadata: + annotations: + app.kubernetes.io/part-of: podtato-head + keptn.sh/workload: podtato-head-right-arm + keptn.sh/version: 0.1.0 + keptn.sh/pre-deployment-tasks: pre-deployment-check-entry \ No newline at end of file