This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "database/sql" | |
| "errors" | |
| "fmt" | |
| "log" | |
| "os" | |
| "time" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: mysql | |
| namespace: hellogopher # Use the hellogopher namespace | |
| spec: | |
| selector: | |
| matchLabels: | |
| app: mysql | |
| strategy: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: v1 | |
| kind: Namespace | |
| metadata: | |
| name: hellogopher |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: mysql | |
| spec: | |
| selector: | |
| matchLabels: | |
| app: mysql | |
| strategy: | |
| type: Recreate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "net/http" | |
| "time" | |
| ) | |
| func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: apps/v1 #Which version of the Kubernetes API you're using to create this object | |
| kind: Deployment # What kind of object you want to create [deployment, service etc] | |
| metadata: # Data that helps uniquely identify the object, including a name string, UID, and optional namespace | |
| name: hellogopher | |
| spec: # What state you desire for the object | |
| selector: # Define what selectors the Deployment uses to find the PODS that are related to it | |
| matchLabels: # matchLabels is a map of {key,value} pairs. | |
| app: hellogopher | |
| replicas: 1 # Tells the deployment to run 1 pod | |
| template: # When creating new pods, this template will be used |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: apps/v1 #Which version of the Kubernetes API you're using to create this object | |
| kind: Deployment # What kind of object you want to create [deployment, service etc] | |
| metadata: # Data that helps uniquely identify the object, including a name string, UID, and optional namespace | |
| name: hellogopher | |
| spec: # What state you desire for the object | |
| selector: # Define what selectors the Deployment uses to find the PODS that are related to it | |
| matchLabels: # matchLabels is a map of {key,value} pairs. | |
| app: hellogopher | |
| replicas: 1 # Tells the deployment to run 1 pod | |
| template: # When creating new pods, this template will be used |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: apps/v1 #Which version of the Kubernetes API you're using to create this object | |
| kind: Deployment # What kind of object you want to create [deployment, service etc] | |
| metadata: # Data that helps uniquely identify the object, including a name string, UID, and optional namespace | |
| name: hellogopher | |
| spec: # What state you desire for the object | |
| selector: # Define what selectors the Deployment uses to find the PODS that are related to it | |
| matchLabels: # matchLabels is a map of {key,value} pairs. | |
| app: hellogopher | |
| replicas: 1 # Tells the deployment to run 1 pod | |
| template: # When creating new pods, this template will be used |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: apps/v1 #Which version of the Kubernetes API you're using to create this object | |
| kind: Deployment # What kind of object you want to create [deployment, service etc] | |
| metadata: # Data that helps uniquely identify the object, including a name string, UID, and optional namespace | |
| name: hellogopher |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM golang:alpine as builder | |
| WORKDIR /app | |
| COPY . . | |
| RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o hellogopher -ldflags="-w -s" | |
| ENTRYPOINT [ "./hellogopher" ] |