diff --git a/emre-helm/.helmignore b/emre-helm/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/emre-helm/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/emre-helm/1 b/emre-helm/1 new file mode 100644 index 0000000..9089635 --- /dev/null +++ b/emre-helm/1 @@ -0,0 +1,3 @@ +# Default values for emre-helm. +# This is a YAML-formatted file. +appTierReplicas: 5 diff --git a/emre-helm/Chart.yaml b/emre-helm/Chart.yaml new file mode 100644 index 0000000..b4e724d --- /dev/null +++ b/emre-helm/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: emre-helm +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/emre-helm/templates/_helpers.tpl b/emre-helm/templates/_helpers.tpl new file mode 100644 index 0000000..b0e27fc --- /dev/null +++ b/emre-helm/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "emre-helm.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "emre-helm.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "emre-helm.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "emre-helm.labels" -}} +helm.sh/chart: {{ include "emre-helm.chart" . }} +{{ include "emre-helm.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "emre-helm.selectorLabels" -}} +app.kubernetes.io/name: {{ include "emre-helm.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "emre-helm.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "emre-helm.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/emre-helm/templates/deployment.yaml b/emre-helm/templates/deployment.yaml new file mode 100644 index 0000000..25e9131 --- /dev/null +++ b/emre-helm/templates/deployment.yaml @@ -0,0 +1,26 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ $.Values.deploymentName }} +spec: + replicas: {{ $.Values.appTierReplicas }} + selector: + matchLabels: + app: main + revisionHistoryLimit: 0 + progressDeadlineSeconds: 30 + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 2 + maxUnavailable: 2 + template: + metadata: + labels: + app: main + spec: + containers: + - name: main + image: 23emre/main:allishere + ports: + - containerPort: 11130 diff --git a/emre-helm/templates/service.yaml b/emre-helm/templates/service.yaml new file mode 100644 index 0000000..ddbfd18 --- /dev/null +++ b/emre-helm/templates/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: main + name: {{ $.Values.serviceName }} +spec: + type: LoadBalancer + selector: + app: main + ports: + - port: 11130 + targetPort: 11130 diff --git a/emre-helm/values.yaml b/emre-helm/values.yaml new file mode 100644 index 0000000..9781978 --- /dev/null +++ b/emre-helm/values.yaml @@ -0,0 +1,5 @@ +# Default values for emre-helm. +# This is a YAML-formatted file. +appTierReplicas: 5 +deploymentName: main-deployment +serviceName: main-service diff --git a/go_challenge/main.go b/go_challenge/main.go index b7fca78..20393e3 100644 --- a/go_challenge/main.go +++ b/go_challenge/main.go @@ -12,5 +12,5 @@ func index(w http.ResponseWriter, r *http.Request) { func main() { http.HandleFunc("/", index) fmt.Println("Server is starting...") - http.ListenAndServe(":80", nil) + http.ListenAndServe(":11130", nil) }