From 39fac9a164c79e58b4e7d0d3648b23b85891d3cc Mon Sep 17 00:00:00 2001 From: John Arundel Date: Sun, 16 Sep 2018 12:57:02 +0100 Subject: [PATCH] Rename hello-helmfile and hello-sops --- {helmfile => hello-helmfile}/helmfile.yaml | 4 ++-- hello-pod/Dockerfile | 9 +++++++++ hello-pod/go.mod | 1 + hello-pod/k8s/deployment.yaml | 19 +++++++++++++++++++ hello-pod/k8s/service.yaml | 14 ++++++++++++++ hello-pod/main.go | 18 ++++++++++++++++++ {sops => hello-sops}/k8s/demo/Chart.yaml | 0 .../k8s/demo/production-secrets.yaml | 0 .../k8s/demo/production-values.yaml | 0 .../k8s/demo/staging-secrets.yaml | 0 .../k8s/demo/staging-values.yaml | 0 .../k8s/demo/templates/deployment.yaml | 0 .../k8s/demo/templates/secrets.yaml | 0 {sops => hello-sops}/k8s/demo/values.yaml | 0 {sops => hello-sops}/temp.yaml | 0 15 files changed, 63 insertions(+), 2 deletions(-) rename {helmfile => hello-helmfile}/helmfile.yaml (79%) create mode 100644 hello-pod/Dockerfile create mode 100644 hello-pod/go.mod create mode 100644 hello-pod/k8s/deployment.yaml create mode 100644 hello-pod/k8s/service.yaml create mode 100644 hello-pod/main.go rename {sops => hello-sops}/k8s/demo/Chart.yaml (100%) rename {sops => hello-sops}/k8s/demo/production-secrets.yaml (100%) rename {sops => hello-sops}/k8s/demo/production-values.yaml (100%) rename {sops => hello-sops}/k8s/demo/staging-secrets.yaml (100%) rename {sops => hello-sops}/k8s/demo/staging-values.yaml (100%) rename {sops => hello-sops}/k8s/demo/templates/deployment.yaml (100%) rename {sops => hello-sops}/k8s/demo/templates/secrets.yaml (100%) rename {sops => hello-sops}/k8s/demo/values.yaml (100%) rename {sops => hello-sops}/temp.yaml (100%) diff --git a/helmfile/helmfile.yaml b/hello-helmfile/helmfile.yaml similarity index 79% rename from helmfile/helmfile.yaml rename to hello-helmfile/helmfile.yaml index da1f873..f265545 100644 --- a/helmfile/helmfile.yaml +++ b/hello-helmfile/helmfile.yaml @@ -5,9 +5,9 @@ repositories: releases: - name: demo namespace: demo - chart: ../03-hello-helm/k8s/demo + chart: ../hello-helm/k8s/demo values: - - "../03-hello-helm/k8s/demo/production-values.yaml" + - "../hello-helm/k8s/demo/production-values.yaml" - name: kube-state-metrics namespace: kube-state-metrics diff --git a/hello-pod/Dockerfile b/hello-pod/Dockerfile new file mode 100644 index 0000000..7cff063 --- /dev/null +++ b/hello-pod/Dockerfile @@ -0,0 +1,9 @@ +FROM golang:1.11-alpine AS build + +WORKDIR /src/ +COPY main.go go.* /src/ +RUN CGO_ENABLED=0 go build -o /bin/demo + +FROM scratch +COPY --from=build /bin/demo /bin/demo +ENTRYPOINT ["/bin/demo"] diff --git a/hello-pod/go.mod b/hello-pod/go.mod new file mode 100644 index 0000000..fc1eb4e --- /dev/null +++ b/hello-pod/go.mod @@ -0,0 +1 @@ +module github.com/cloudnativedevops/demo/hello-pod diff --git a/hello-pod/k8s/deployment.yaml b/hello-pod/k8s/deployment.yaml new file mode 100644 index 0000000..b264234 --- /dev/null +++ b/hello-pod/k8s/deployment.yaml @@ -0,0 +1,19 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: demo +spec: + replicas: 3 + selector: + matchLabels: + app: demo + template: + metadata: + labels: + app: demo + spec: + containers: + - name: demo + image: cloudnatived/demo:hello-pod + ports: + - containerPort: 8888 diff --git a/hello-pod/k8s/service.yaml b/hello-pod/k8s/service.yaml new file mode 100644 index 0000000..951184b --- /dev/null +++ b/hello-pod/k8s/service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: demo + labels: + app: demo +spec: + ports: + - port: 8888 + protocol: TCP + targetPort: 8888 + selector: + app: demo + type: LoadBalancer diff --git a/hello-pod/main.go b/hello-pod/main.go new file mode 100644 index 0000000..8d17a29 --- /dev/null +++ b/hello-pod/main.go @@ -0,0 +1,18 @@ +package main + +import ( + "fmt" + "log" + "net/http" + "os" +) + +func handler(w http.ResponseWriter, r *http.Request) { + pod := os.Getenv("HOSTNAME") + fmt.Fprintf(w, "This is pod %s\n", pod) +} + +func main() { + http.HandleFunc("/", handler) + log.Fatal(http.ListenAndServe(":8888", nil)) +} diff --git a/sops/k8s/demo/Chart.yaml b/hello-sops/k8s/demo/Chart.yaml similarity index 100% rename from sops/k8s/demo/Chart.yaml rename to hello-sops/k8s/demo/Chart.yaml diff --git a/sops/k8s/demo/production-secrets.yaml b/hello-sops/k8s/demo/production-secrets.yaml similarity index 100% rename from sops/k8s/demo/production-secrets.yaml rename to hello-sops/k8s/demo/production-secrets.yaml diff --git a/sops/k8s/demo/production-values.yaml b/hello-sops/k8s/demo/production-values.yaml similarity index 100% rename from sops/k8s/demo/production-values.yaml rename to hello-sops/k8s/demo/production-values.yaml diff --git a/sops/k8s/demo/staging-secrets.yaml b/hello-sops/k8s/demo/staging-secrets.yaml similarity index 100% rename from sops/k8s/demo/staging-secrets.yaml rename to hello-sops/k8s/demo/staging-secrets.yaml diff --git a/sops/k8s/demo/staging-values.yaml b/hello-sops/k8s/demo/staging-values.yaml similarity index 100% rename from sops/k8s/demo/staging-values.yaml rename to hello-sops/k8s/demo/staging-values.yaml diff --git a/sops/k8s/demo/templates/deployment.yaml b/hello-sops/k8s/demo/templates/deployment.yaml similarity index 100% rename from sops/k8s/demo/templates/deployment.yaml rename to hello-sops/k8s/demo/templates/deployment.yaml diff --git a/sops/k8s/demo/templates/secrets.yaml b/hello-sops/k8s/demo/templates/secrets.yaml similarity index 100% rename from sops/k8s/demo/templates/secrets.yaml rename to hello-sops/k8s/demo/templates/secrets.yaml diff --git a/sops/k8s/demo/values.yaml b/hello-sops/k8s/demo/values.yaml similarity index 100% rename from sops/k8s/demo/values.yaml rename to hello-sops/k8s/demo/values.yaml diff --git a/sops/temp.yaml b/hello-sops/temp.yaml similarity index 100% rename from sops/temp.yaml rename to hello-sops/temp.yaml