Skip to content

Commit

Permalink
fix sed with envsubst
Browse files Browse the repository at this point in the history
  • Loading branch information
mcluseau authored and jayunit100 committed Oct 1, 2021
1 parent 108460a commit ee052db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions hack/kpng-deployment-ds.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ spec:
effect: "NoSchedule"
containers:
# We'll sed-replace this with a valid kpng image at creat time
- image: KPNG_IMAGE
imagePullPolicy: PULL
- image: ${IMAGE}
imagePullPolicy: ${PULL}
name: kpng
volumeMounts:
- name: empty
Expand All @@ -40,8 +40,8 @@ spec:
- --kubeconfig=/var/lib/kpng/kubeconfig.conf
- to-api
- --listen=unix:///k8s/proxy.sock
- image: IMAGE
imagePullPoliy: PULL
- image: ${IMAGE}
imagePullPoliy: ${PULL}
name: kpng-nftables
securityContext:
capabilities:
Expand All @@ -53,7 +53,7 @@ spec:
- name: modules
mountPath: /lib/modules
readOnly: true
args: [ "local", "--api=unix:///k8s/proxy.sock", "to-BACKEND" ]
args: [ "local", "--api=unix:///k8s/proxy.sock", "to-${BACKEND}" ]
#- --v=2
#- --dry-run
volumes:
Expand All @@ -64,4 +64,4 @@ spec:
path: /lib/modules
- name: kpng-config
configMap:
name: kpng
name: kpng
9 changes: 5 additions & 4 deletions hack/kpng-local-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
: ${PULL:=IfNotPresent}
: ${BACKEND:=nft}

export IMAGE PULL BACKEND

echo -n "this will deploy kpng with docker image $IMAGE, pull policy $PULL and the $BACKEND backend. Press enter to confirm, C-c to cancel"
read

function install_calico {
kubectl apply -f https://raw.githubusercontent.com/jayunit100/k8sprototypes/master/kind/calico.yaml
Expand Down Expand Up @@ -42,10 +45,8 @@ function build {

function install {
# substitute it with your changes...
echo "Applying template with KPNG_IMAGE=$IMAGE"
cat kpng-deployment-ds.yaml.tmpl | sed "s,IMAGE,$IMAGE," > kpng-deployment-ds.yaml.1
cat kpng-deployment-ds.yaml.1 | sed "s,PULL,$PULL," > kpng-deployment-ds.yaml.2
cat kpng-deployment-ds.yaml.2 | sed "s,BACKEND,BACKEND," > kpng-deployment-ds.yaml
echo "Applying template"
envsubst <kpng-deployment-ds.yaml.tmpl >kpng-deployment-ds.yaml

kubectl -n kube-system create sa kpng
kubectl create clusterrolebinding kpng --clusterrole=system:node-proxier --serviceaccount=kube-system:kpng
Expand Down

0 comments on commit ee052db

Please sign in to comment.