Skip to content

Commit

Permalink
replacing sed with go template
Browse files Browse the repository at this point in the history
  • Loading branch information
medyagh committed May 6, 2019
1 parent fe3f7a0 commit 69a1148
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
10 changes: 0 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,6 @@ ifeq ($(GOOS),windows)
IS_EXE = ".exe"
endif

ifeq ($(GOARCH),amd64)
ARCHTAG ?= -amd64
ARCHTAG_NONE ?=
else
ARCHTAG ?= -$(GOARCH)
ARCHTAG_NONE ?= -$(GOARCH)
endif

DEPLOYS=\
deploy/addons/addon-manager.yaml \
Expand All @@ -117,9 +110,6 @@ DEPLOYS=\
deploy/addons/metrics-server/metrics-server-deployment.yaml \
deploy/addons/storage-provisioner/storage-provisioner.yaml

%.yaml: %.template
sed "s|\-ARCHTAG_NONE|$(ARCHTAG_NONE)|g;s|\-ARCHTAG|$(ARCHTAG)|g" $< > $@

out/minikube$(IS_EXE): out/minikube-$(GOOS)-$(GOARCH)$(IS_EXE)
cp $< $@

Expand Down
2 changes: 1 addition & 1 deletion deploy/addons/addon-manager.template
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
hostNetwork: true
containers:
- name: kube-addon-manager
image: {{default "k8s.gcr.io" .ImageRepository}}/kube-addon-manager-ARCHTAG_NONE:v9.0
image: {{default "k8s.gcr.io" .ImageRepository}}/kube-addon-manager-{{default "ARCHTAG_NONE" .ArchTag}}:v9.0
env:
- name: KUBECONFIG
value: /var/lib/minikube/kubeconfig
Expand Down
4 changes: 2 additions & 2 deletions deploy/addons/ingress/ingress-dp.template
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
# Any image is permissible as long as:
# 1. It serves a 404 page at /
# 2. It serves 200 on a /healthz endpoint
image: {{default "gcr.io/google_containers" .ImageRepository}}/defaultbackend-ARCHTAG_NONE:1.4
image: {{default "gcr.io/google_containers" .ImageRepository}}/defaultbackend-{{default "ARCHTAG_NONE" .ArchTag}}:1.4
imagePullPolicy: IfNotPresent
livenessProbe:
httpGet:
Expand Down Expand Up @@ -87,7 +87,7 @@ spec:
serviceAccountName: nginx-ingress
terminationGracePeriodSeconds: 60
containers:
- image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller-ARCHTAG_NONE:0.23.0
- image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller-{{default "ARCHTAG_NONE" .ArchTag}}:0.23.0
name: nginx-ingress-controller
imagePullPolicy: IfNotPresent
readinessProbe:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ spec:
hostNetwork: true
containers:
- name: storage-provisioner
image: {{default "gcr.io/k8s-minikube" .ImageRepository}}/storage-provisioner-ARCHTAG_NONE:v1.8.1
image: {{default "gcr.io/k8s-minikube" .ImageRepository}}/storage-provisioner-{{default "ARCHTAG_NONE" .ArchTag}}:v1.8.1
command: ["/storage-provisioner"]
imagePullPolicy: IfNotPresent
volumeMounts:
Expand Down
3 changes: 3 additions & 0 deletions pkg/minikube/assets/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"os"
"path"
"path/filepath"
"runtime"
"strconv"

"github.com/pkg/errors"
Expand Down Expand Up @@ -382,8 +383,10 @@ func addMinikubeDirToAssets(basedir, vmpath string, assets *[]CopyableFile) erro
func GenerateTemplateData(cfg config.KubernetesConfig) interface{} {
opts := struct {
ImageRepository string
ArchTag string
}{
ImageRepository: cfg.ImageRepository,
ArchTag: runtime.GOARCH,
}

return opts
Expand Down

0 comments on commit 69a1148

Please sign in to comment.