diff --git a/Makefile b/Makefile index 85e5138ba..03942bd78 100644 --- a/Makefile +++ b/Makefile @@ -61,9 +61,9 @@ all: build build: $(BINDIR)/$(BINNAME) $(BINDIR)/$(BINNAME)-server $(BINDIR)/$(BINNAME): $(SRC) - GO111MODULE=on go build $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $(BINDIR)/$(BINNAME) ./cmd/helm + GO111MODULE=on go build -o $(BINDIR)/$(BINNAME) ./cmd/helm $(BINDIR)/$(BINNAME)-server: $(SRC) - GO111MODULE=on go build $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $(BINDIR)/$(BINNAME)-server ./cmd/service + GO111MODULE=on go build -o $(BINDIR)/helm3-server ./cmd/service # ------------------------------------------------------------------------------ # test diff --git a/configmap.yaml b/configmap.yaml new file mode 100644 index 000000000..c50f41a1b --- /dev/null +++ b/configmap.yaml @@ -0,0 +1,38 @@ +apiVersion: v1 +data: + repositories.yaml: | + apiVersion: "" + generated: "0001-01-01T00:00:00Z" + repositories: + - caFile: "" + certFile: "" + keyFile: "" + name: gojektech-incubator + password: "" + url: https://charts.gojek.tech/incubator/ + username: "" + - caFile: "" + certFile: "" + keyFile: "" + name: stable + password: "" + url: https://kubernetes-charts.storage.googleapis.com + username: "" + - caFile: "" + certFile: "" + keyFile: "" + name: gojek-incubator + password: "" + url: http://chartmuseum.golabs.io/incubator + username: "" + - caFile: "" + certFile: "" + keyFile: "" + name: bitnami + password: "" + url: https://charts.bitnami.com/bitnami + username: "" +kind: ConfigMap +metadata: + creationTimestamp: null + name: repositories diff --git a/deployment.yaml b/deployment.yaml new file mode 100644 index 000000000..30c003b16 --- /dev/null +++ b/deployment.yaml @@ -0,0 +1,42 @@ +apiVersion: apps/v1beta2 +kind: Deployment +metadata: + namespace: default + name: helm-service + labels: + app: helm-service +spec: + replicas: 1 + selector: + matchLabels: + app: helm-service + template: + metadata: + labels: + app: helm-service + spec: + containers: + - name: helm-service + image: "helm-service" + command: ["helm-service"] + imagePullPolicy: Never + env: + - name: HELM_REPOSITORIES + valueFrom: + configMapKeyRef: + name: repositories + key: repositories.yaml + volumeMounts: + - name: persistent-volume + mountPath: "/usr/share/helm" + - name: config + mountPath: "/config" + readOnly: true + volumes: + - name: persistent-volume + persistentVolumeClaim: + claimName: persistent-volume-claim + - name: config + configMap: + name: repositories + diff --git a/pkg/server.go b/pkg/server.go new file mode 100644 index 000000000..f86f0bb58 --- /dev/null +++ b/pkg/server.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + "net/http" +) + +func main() { + startServer() +} + +func startServer() { + router := http.NewServeMux() + router.HandleFunc("/ping", pingFunc) + + err := http.ListenAndServe(fmt.Sprintf(":%d", 8080), router) + if err != nil { + fmt.Println("error starting server", err) + } +} + +func pingFunc(w http.ResponseWriter, r *http.Request) { + fmt.Println("pong") +} diff --git a/volume.yaml b/volume.yaml new file mode 100644 index 000000000..f3e6aa049 --- /dev/null +++ b/volume.yaml @@ -0,0 +1,26 @@ +kind: PersistentVolume +apiVersion: v1 +metadata: + name: persistent-volume + labels: + type: local +spec: + storageClassName: manual + capacity: + storage: 2Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/data/persistent-volume" +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: persistent-volume-claim +spec: + accessModes: + - ReadWriteOnce + storageClassName: manual + resources: + requests: + storage: 1Gi