Skip to content

Commit 9108aa5

Browse files
Merge pull request #58 from kameshsampath/revert-v0.3.0
(refactor): revert to v0.3.0
2 parents c2331e9 + 9fbd0d7 commit 9108aa5

8 files changed

Lines changed: 3356 additions & 4 deletions

File tree

documentation/modules/ROOT/pages/_attributes.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
:build-repo: 04-build
88
:eventing-repo: 05-eventing
99
:experimental:
10-
:knative-version: v0.4.0
10+
:knative-version: v0.3.0
1111
:knative-serving-uri: https://github.com/knative/serving
1212
:knative-serving-repo: {knative-serving-uri}/releases/download
1313
:knative-build-repo: https://github.com/knative/build/releases/download

documentation/modules/ROOT/pages/setup.adoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ The `work` folder in `$TUTORIAL_HOME` can be used to download the demo applicati
8686
8787
This tutorial was developed and tested with:
8888
89-
- Knative `v0.4.0`
89+
- Knative `v0.3.0`
9090
- minikube `v0.34.1`
9191
- OpenShift `v3.11`
9292
- minishift `v1.30.0+186b034`
@@ -162,7 +162,6 @@ knative-ingressgateway-75644679c7-5xwx6 1/1 Running 0 6h27m
162162
[source,bash,subs="+macros,+attributes"]
163163
----
164164
kubectl apply --filename {knative-serving-repo}/{knative-version}/serving.yaml
165-
kubectl apply --filename https://raw.githubusercontent.com/knative/serving/{knative-version}/third_party/config/build/clusterrole.yaml
166165
----
167166

168167
[NOTE]

documentation/modules/camelk/pages/_attributes.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
:eventing-repo: 05-eventing
1111
:camelk-repo: 09-camel-k
1212
:experimental:
13-
:knative-version: v0.4.0
13+
:knative-version: v0.3.0
1414
:knative-serving-repo: https://github.com/knative/serving/releases/download
1515
:knative-build-repo: https://github.com/knative/build/releases/download
1616
:knative-eventing-repo: https://github.com/knative/eventing/releases/download

gulpfile.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
"use strict";
2+
3+
const connect = require("gulp-connect");
4+
const fs = require("fs");
5+
const generator = require("@antora/site-generator-default");
6+
const gulp = require("gulp");
7+
const yaml = require("yaml-js");
8+
9+
let filename = "dev-site.yml";
10+
let args = ["--playbook", filename];
11+
12+
gulp.task("build", function(cb) {
13+
/**
14+
* Use the '@antora/site-generator-default' node module to build.
15+
* It's analogous to `$ antora --playbook local-antora-playbook.yml`.
16+
* Having access to the generator in code may be useful for other
17+
* reasons in the future (i.e to implement custom features).
18+
* NOTE: As opposed to building with the CLI, this method doesn't use
19+
* a separate process for each run. So if a build error occurs with the `gulp`
20+
* command it can be useful to check if it also happens with the CLI command.
21+
*/
22+
generator(args, process.env)
23+
.then(() => {
24+
cb();
25+
})
26+
.catch(err => {
27+
console.log(err);
28+
cb();
29+
});
30+
});
31+
32+
gulp.task("preview", ["build"], function() {
33+
/**
34+
* Remove the line gulp.src('README.adoc')
35+
* This is placeholder code to follow the gulp-connect
36+
* example. Could not make it work any other way.
37+
*/
38+
gulp.src("README.adoc").pipe(connect.reload());
39+
});
40+
41+
gulp.task("watch", function() {
42+
let json_content = fs.readFileSync(`${__dirname}/${filename}`, "UTF-8");
43+
let yaml_content = yaml.load(json_content);
44+
let dirs = yaml_content.content.sources.map(source => [
45+
`${source.url}/**/**.yml`,
46+
`${source.url}/**/**.adoc`
47+
]);
48+
dirs.push(["dev-site.yml"]);
49+
gulp.watch(dirs, ["preview"]);
50+
});
51+
52+
gulp.task("connect", function() {
53+
connect.server({
54+
port: 5353,
55+
name: "Dev Server",
56+
livereload: true,
57+
root: "gh-pages"
58+
});
59+
});
60+
61+
gulp.task("default", ["connect", "watch", "build"]);
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: registry-aliases-hosts-update
5+
namespace: kube-system
6+
spec:
7+
selector:
8+
matchLabels:
9+
app: registry-aliases-hosts-update
10+
template:
11+
metadata:
12+
labels:
13+
app: registry-aliases-hosts-update
14+
spec:
15+
initContainers:
16+
- name: update
17+
image: registry.fedoraproject.org/fedora
18+
volumeMounts:
19+
- name: etchosts
20+
mountPath: /host-etc/hosts
21+
readOnly: false
22+
env:
23+
- name: REGISTRY_ALIASES
24+
valueFrom:
25+
configMapKeyRef:
26+
name: registry-aliases
27+
key: registryAliases
28+
command:
29+
- bash
30+
- -ce
31+
- |
32+
NL=$'\n'
33+
TAB=$'\t'
34+
HOSTS="$(cat /host-etc/hosts)"
35+
[ -z "$REGISTRY_SERVICE_HOST" ] && echo "Failed to get hosts entry for default registry" && exit 1;
36+
for H in $REGISTRY_ALIASES; do
37+
echo "$HOSTS" | grep "$H" || HOSTS="$HOSTS$NL$REGISTRY_SERVICE_HOST$TAB$H";
38+
done;
39+
echo "$HOSTS" | diff -u /host-etc/hosts - || echo "$HOSTS" > /host-etc/hosts
40+
echo "Done."
41+
containers:
42+
- name: pause-for-update
43+
image: gcr.io/google_containers/pause-amd64:3.1@sha256:59eec8837a4d942cc19a52b8c09ea75121acc38114a2c68b98983ce9356b8610
44+
terminationGracePeriodSeconds: 30
45+
volumes:
46+
- name: etchosts
47+
hostPath:
48+
path: /etc/hosts

sysadmin/patch-coredns.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
# A script that wil be used to patch the core dns aliases
3+
# e.g say i want dev.local to be mapped to default registry registry.kube-system.cluster.svc.local
4+
#
5+
set -eu
6+
7+
# clean up old files if they exist
8+
rm -f /tmp/coredns-alias-patch.yaml
9+
rm -f /tmp/coredns-alias-prepatch.yaml
10+
11+
REGISTRY_ALIASES=$(kubectl get cm registry-aliases -n kube-system -oyaml | yq r - data.registryAliases)
12+
REGISTRY_SVC=$(kubectl get cm registry-aliases -n kube-system -oyaml | yq r - data.registrySvc)
13+
ALIASES_ENTRIES=""
14+
NL='\n'
15+
SPACES=' '
16+
RW_RULE='rewrite name '
17+
18+
OLDIFS=$IFS
19+
20+
IFS=
21+
22+
# store the previous value for further processing
23+
kubectl get cm coredns -n kube-system -oyaml | yq r - data.Corefile | tee /tmp/coredns-alias-prepatch.yaml 2>&1 > /dev/null
24+
CURR_VALUE=$(cat /tmp/coredns-alias-prepatch.yaml)
25+
26+
nStart=$(grep -n -m 1 "$REGISTRY_SVC" /tmp/coredns-alias-prepatch.yaml | head -n1 | cut -d: -f1 )
27+
nEnd=$(grep -n "$REGISTRY_SVC" /tmp/coredns-alias-prepatch.yaml | tail -n1 | cut -d: -f1 )
28+
29+
#echo "Pattern Start line: $nStart Ending line : $nEnd"
30+
31+
# remove old entries
32+
if [ ! -z $nStart ] && [ ! -z $nEnd ];
33+
then
34+
sed -i "$nStart,${nEnd}d" /tmp/coredns-alias-prepatch.yaml 2>&1 > /dev/null
35+
fi
36+
37+
IFS=$OLDIFS
38+
39+
for H in $REGISTRY_ALIASES;
40+
do
41+
[ ! -z "$ALIASES_ENTRIES" ] && ALIASES_ENTRIES="$ALIASES_ENTRIES$NL"
42+
ALIASES_ENTRIES="$ALIASES_ENTRIES$RW_RULE$H$SPACES$REGISTRY_SVC"
43+
done
44+
45+
IFS=
46+
47+
# Add the rename rewrites after string health
48+
cat /tmp/coredns-alias-prepatch.yaml | sed "/health/a\ $ALIASES_ENTRIES" | tee /tmp/coredns-alias-patch.yaml 2>&1 > /dev/null
49+
50+
yq w -i /tmp/coredns-alias-patch.yaml data.Corefile $(cat /tmp/coredns-alias-patch.yaml)
51+
52+
# echo "Patch to be applied"
53+
#cat /tmp/coredns-alias-patch.yaml
54+
55+
kubectl patch cm coredns -n kube-system --patch $(cat /tmp/coredns-alias-patch.yaml)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
data:
3+
# Add additonal hosts seperated by new-line
4+
registryAliases: >-
5+
dev.local
6+
ko.local
7+
example.com
8+
# default registry address in minikube
9+
registrySvc: registry.kube-system.svc.cluster.local
10+
kind: ConfigMap
11+
metadata:
12+
name: registry-aliases
13+
namespace: kube-system

0 commit comments

Comments
 (0)