Skip to content

Commit 6b73ea4

Browse files
author
Doug Davis
committed
more updates
Signed-off-by: Doug Davis <[email protected]>
1 parent e2bff60 commit 6b73ea4

File tree

4 files changed

+38
-37
lines changed

4 files changed

+38
-37
lines changed

README.md

+9-18
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,17 @@ Why? Couple of reasons:
1515

1616
## Faking it
1717

18-
If you don't want to actually run through the demo yourself but you'd still
19-
like to see what it looks like when you run it, simply clone this repo and
20-
run:
18+
If you don't have an IKS cluster, don't have good internet connectivity,
19+
or for whatever reason just don't want to actually execute all of the steps
20+
of the demo but you'd still like to see what the demo looks like, simple run:
2121
```bash
2222
$ USESAVED=1 ./demo
2323
```
24-
2524
The demo will pause for each step, just press the spacebar to continue.
2625

2726
This will run the demo code but use the output from a saved run. The output
2827
will look just like you're running it live.
2928

30-
This is also good for cases where you don't have internet connectivity but
31-
still want to show it off.
32-
3329
## Demo Setup
3430

3531
This demo assumes you're using [IBM's Kubernetes Service](cloud.ibm.com/iks)
@@ -51,16 +47,13 @@ No other special setup should be needed, so let's move on to the demo
5147

5248
You can run the demo manually or via the `demo` script.
5349

54-
If you want to use the `demo` script make sure you set the `DOMAIN`
55-
environment variable to the domain name of your IKS cluster first:
50+
If you want to use the `demo` script, where it'll do all of the typing
51+
for you but still execute the commands, just run:
5652

5753
```bash
58-
$ export DOMAIN=...
54+
$ ./demo
5955
```
6056

61-
You can get the proper value by looking at the `Ingress Subdomain`
62-
value in the `ibmcloud bx ks cluster-get CLUSTER` output.
63-
6457
For those who want to run the demo manually, let's walk through each step
6558
to explain what's going on.
6659

@@ -207,7 +200,7 @@ of this new resource will kick off a Tekton execution of the referenced
207200
`Task`. So, let's do it:
208201

209202
```bash
210-
$ kapply task.yaml
203+
$ ./kapply task.yaml
211204
task.tekton.dev/build-push created
212205
taskrun.tekton.dev/build-image created
213206
```
@@ -267,7 +260,7 @@ newly created image that's stored in our local Docker Registry.
267260
Let's create it:
268261

269262
```bash
270-
$ kapply service.yaml
263+
$ ./kapply service.yaml
271264
service.serving.knative.dev/hello created
272265
```
273266

@@ -290,11 +283,9 @@ curl -s http://hello-default.kntest.us-south.containers.appdomain.cloud
290283
All done, so let's clean-up:
291284

292285
```bash
293-
$ kubectl delete -f service.yaml
294-
$ kubectl delete -f hub.yaml
286+
$ kubectl delete -f service.yaml -f hub.yaml
295287
```
296288

297-
298289
## Some Notes
299290

300291
As I mentioned previsously, I picked Docker's Registry for a couple of

demo

+28-18
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
#!/bin/bash
22

3+
set -e
4+
35
source .demoscript
46
RETRYONFAIL=1
5-
export DOMAIN=${DOMAIN:-v06.us-south.containers.appdomain.cloud}
7+
D=$(bx ks cluster-get $(kubectl config current-context) | grep "Ingress Subdomain" | sed "s/^.*: *\([^ ]*\) *$/\1/" )
8+
export DOMAIN=${DOMAIN:-$D}
69
export PATH=.:$PATH
710

8-
(
9-
set +e
10-
kubectl delete cm/source
11-
kubectl delete -f hub.yaml -f task.yaml -f service.yaml
12-
kubectl delete buildtemplate/kaniko
13-
) &> /dev/null || true
14-
15-
set -e
16-
17-
if ! kubectl get ns tekton-pipelines &> /dev/null ; then
18-
comment "Installing Tekton"
19-
doit kubectl apply -f \
20-
https://storage.googleapis.com/tekton-releases/latest/release.yaml
11+
comment "Talking to cluster at: ${DOMAIN}"
12+
13+
if [[ -z "${USESAVED}" ]]; then
14+
(
15+
set +e
16+
kubectl delete cm/source
17+
kubectl delete -f hub.yaml -f task.yaml -f service.yaml
18+
kubectl delete buildtemplate/kaniko
19+
) &> /dev/null || true
20+
21+
if ! kubectl get ns tekton-pipelines &> /dev/null ; then
22+
comment "Installing Tekton"
23+
doit kubectl apply -f \
24+
https://storage.googleapis.com/tekton-releases/latest/release.yaml
25+
fi
2126
fi
2227

2328
comment "Create a configMap to hold the source code of the 'hello' app"
@@ -27,7 +32,11 @@ comment "Create the Docker Registry Knative Service"
2732
scroll hub.yaml
2833
doit kubectl apply -f hub.yaml
2934

35+
comment "Wait for the hub to be ready..."
36+
wait curl -fq http://hub-default.$DOMAIN
37+
3038
comment "Create the build 'task' and 'taskrun' - basically, do the build"
39+
scroll task.yaml
3140
doit kapply task.yaml
3241

3342
comment "Wait for the build to finish..."
@@ -36,18 +45,19 @@ doit --untilgrep=True kubectl get taskrun/build-image
3645
comment "Delete the build artifacts"
3746
doit kubectl delete cm/source
3847
doit kubectl delete -f task.yaml
39-
doit --ignorerc "kubectl delete buildtemplate/kaniko &> /dev/null"
48+
# doit --ignorerc "kubectl delete buildtemplate/kaniko &> /dev/null"
4049

4150
comment "Create the 'hello' Knative Service using the image"
51+
scroll service.yaml
4252
doit kapply service.yaml
4353

4454
comment "Wait for the Service to be ready..."
45-
doit --norepaint --untilgrep=True kubectl get ksvc/hello
55+
doit --norepaint --pausetime=2 --untilgrep=True kubectl get ksvc/hello
4656

4757
comment "Curl/test it"
4858
doit --norepaint --untilgrep=Hello curl -s http://hello-default.$DOMAIN
4959

5060
comment "Clean up"
51-
doit kubectl delete -f service.yaml
52-
doit kubectl delete -f hub.yaml
61+
doit kubectl delete -f service.yaml -f hub.yaml
62+
5363
rm cmds

demo.tar

0 Bytes
Binary file not shown.

kapply

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ while [[ -n "${1}" ]]; do
4242
fi
4343
else
4444
# var == env var name
45-
if [[ "${!var}" == "" ]]; then
45+
if [[ "${!var}" == "" && -e .env ]]; then
4646
var=$(cat .env | grep "^${var}=" | sed "s/^[^=]*=//")
4747
else
4848
var=${!var}

0 commit comments

Comments
 (0)