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

docs: Improve podtato example with HTTP service lookup #113

Merged
merged 6 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions examples/podtatohead-deployment/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/slack-secret.yaml
thisthat marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 5 additions & 0 deletions examples/podtatohead-deployment/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Create Secret for Slack here

```
kubectl create secret generic slack-notification --from-literal=SECURE_DATA='{"slack_hook":"<WebHook>","text":"Deployed PodTatoHead Entry Service"}' -n podtato-kubectl -oyaml --dry-run > secret.yaml
```
12 changes: 12 additions & 0 deletions examples/podtatohead-deployment/check_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: lifecycle.keptn.sh/v1alpha1
kind: KeptnTaskDefinition
metadata:
name: check-entry-service
namespace: podtato-kubectl
spec:
function:
httpRef:
url: https://raw.githubusercontent.com/keptn-sandbox/lifecycle-controller/doc/add_dns_function/functions-runtime/samples/ts/http.ts
parameters:
map:
url: http://podtato-head-entry.podtato-kubectl.svc.cluster.local:9000
18 changes: 11 additions & 7 deletions examples/podtatohead-deployment/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ spec:
keptn.sh/app: podtato-head
keptn.sh/workload: podtato-head-entry
keptn.sh/version: 0.1.0
keptn.sh/pre-deployment-tasks: pre-deployment-hello
keptn.sh/post-deployment-tasks: post-deployment-hello
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:latest
Expand Down Expand Up @@ -74,7 +78,7 @@ spec:
keptn.sh/app: podtato-head
keptn.sh/workload: podtato-head-hat
keptn.sh/version: 0.1.0
keptn.sh/pre-deployment-tasks: pre-deployment-hello
keptn.sh/pre-deployment-tasks: check-entry-service
spec:
terminationGracePeriodSeconds: 5
containers:
Expand Down Expand Up @@ -123,7 +127,7 @@ spec:
keptn.sh/app: podtato-head
keptn.sh/workload: podtato-head-left-leg
keptn.sh/version: 0.1.0
keptn.sh/pre-deployment-tasks: pre-deployment-hello
keptn.sh/pre-deployment-tasks: check-entry-service
spec:
terminationGracePeriodSeconds: 5
containers:
Expand Down Expand Up @@ -171,8 +175,8 @@ spec:
annotations:
keptn.sh/app: podtato-head
keptn.sh/workload: podtato-head-left-arm
keptn.sh/version: 0.1.0
keptn.sh/pre-deployment-tasks: pre-deployment-hello
keptn.sh/version: 0.1.1
keptn.sh/pre-deployment-tasks: check-entry-service
spec:
terminationGracePeriodSeconds: 5
containers:
Expand Down Expand Up @@ -221,7 +225,7 @@ spec:
keptn.sh/app: podtato-head
keptn.sh/workload: podtato-head-right-leg
keptn.sh/version: 0.1.0
keptn.sh/pre-deployment-tasks: pre-deployment-hello
keptn.sh/pre-deployment-tasks: check-entry-service
spec:
terminationGracePeriodSeconds: 5
containers:
Expand Down Expand Up @@ -270,7 +274,7 @@ spec:
keptn.sh/app: podtato-head
keptn.sh/workload: podtato-head-right-arm
keptn.sh/version: 0.1.0
keptn.sh/pre-deployment-tasks: pre-deployment-hello
keptn.sh/pre-deployment-tasks: check-entry-service
spec:
terminationGracePeriodSeconds: 5
containers:
Expand Down
10 changes: 0 additions & 10 deletions examples/podtatohead-deployment/pre-deployment-tasks.yaml

This file was deleted.

11 changes: 11 additions & 0 deletions functions-runtime/samples/ts/http.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
let text = Deno.env.get("DATA");
let data;
data = JSON.parse(text);

try {
let resp = await fetch(data.url);
}
catch (error){
console.error("Could not fetch url");
Deno.exit(1);
}