Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/emre-23/emre into main
Browse files Browse the repository at this point in the history
  • Loading branch information
emre-23 committed Feb 3, 2021
2 parents d0b2e3d + 144da20 commit a146578
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 1 deletion.
23 changes: 23 additions & 0 deletions emre-helm/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
3 changes: 3 additions & 0 deletions emre-helm/1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Default values for emre-helm.
# This is a YAML-formatted file.
appTierReplicas: 5
24 changes: 24 additions & 0 deletions emre-helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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"
62 changes: 62 additions & 0 deletions emre-helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -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 }}
26 changes: 26 additions & 0 deletions emre-helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions emre-helm/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions emre-helm/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Default values for emre-helm.
# This is a YAML-formatted file.
appTierReplicas: 5
deploymentName: main-deployment
serviceName: main-service
2 changes: 1 addition & 1 deletion go_challenge/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit a146578

Please sign in to comment.