initial import

This commit is contained in:
SourceFellows
2020-08-21 06:26:40 +02:00
commit e223458dd4
423 changed files with 9871 additions and 0 deletions

View File

@ -0,0 +1,14 @@
{
"configurations": [
{
"name": "Run/Debug on Kubernetes",
"type": "cloudcode.kubernetes",
"request": "launch",
"skaffoldConfig": "${workspaceFolder}/skaffold.yaml",
"watch": true,
"cleanUp": true,
"portForward": true,
"imageRegistry": "gcr.io/gobuch-72abe/google-cloud-sample"
}
]
}

View File

@ -0,0 +1,12 @@
FROM golang:1 as builder
WORKDIR /go/src/app
COPY *.go .
RUN CGO_ENABLED=0 go build .
####################################
FROM alpine
COPY --from=builder /go/src/app/app .
EXPOSE 8080
CMD [ "./app" ]

View File

@ -0,0 +1,10 @@
```
docker build -t minikube-golang-sample .
kubectl create -f manifest.yml
kubectl get pod
kubectl expose deployment golang-sample --type=NodePort
kubectl get service
minikube service golang-sample --url
```

View File

@ -0,0 +1,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: google-cloud-sample
name: google-cloud-sample
spec:
replicas: 2
selector:
matchLabels:
app: google-cloud-sample
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: google-cloud-sample
spec:
containers:
- image: google-cloud-sample
name: google-cloud-sample
resources: {}
ports:
- containerPort: 8080
status: {}

View File

@ -0,0 +1,16 @@
package main
import (
"fmt"
"net/http"
"time"
)
func greet(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello World! %s", time.Now())
}
func main() {
http.HandleFunc("/", greet)
http.ListenAndServe(":8080", nil)
}

View File

@ -0,0 +1,17 @@
# This Service manifest defines:
# - a load balancer for pods matching label "app: go-hello-world"
# - exposing the application to the public Internet (type:LoadBalancer)
# - routes port 80 of the load balancer to the port 8080 of the Pods.
# Syntax reference https://kubernetes.io/docs/concepts/configuration/overview/
apiVersion: v1
kind: Service
metadata:
name: google-cloud-sample-external
spec:
type: LoadBalancer
selector:
app: google-cloud-sample
ports:
- name: http
port: 80
targetPort: 8080

View File

@ -0,0 +1,14 @@
apiVersion: skaffold/v2beta5
kind: Config
metadata:
name: google-cloud-sample
build:
artifacts:
- image: google-cloud-sample
tagPolicy:
sha256: {}
deploy:
kubectl:
manifests:
- deployment-manifest.yml
- service-manifest.yml