Skip to content
Snippets Groups Projects
Commit ab54f28f authored by Adel YOUSSOUF ALI's avatar Adel YOUSSOUF ALI
Browse files

commit

parent 496cc64e
No related branches found
No related tags found
No related merge requests found
Showing
with 396 additions and 171 deletions
...@@ -4,7 +4,7 @@ const mongoose = require("mongoose"); ...@@ -4,7 +4,7 @@ const mongoose = require("mongoose");
const app = express(); const app = express();
//connecting to the database //connecting to the database
mongoose.connect("mongodb://mongodb:27017/taskdb"); mongoose.connect("mongodb://mongodb-service:27017/taskdb");
//gather data from forms //gather data from forms
app.use(express.urlencoded({ extended: true })); app.use(express.urlencoded({ extended: true }));
......
apiVersion: apps/v1
kind: Deployment
metadata:
name: app-deployment
spec:
replicas: 1
selector:
matchLabels:
app: app
template:
metadata:
labels:
app: app
spec:
containers:
- name: app
image: adelysf/myimage
ports:
- containerPort: 3000
apiVersion: v1
kind: Service
metadata:
name: app-service
spec:
type: NodePort
selector:
app: app
ports:
- protocol: TCP
port: 3000
targetPort: 3000
\ No newline at end of file
apiVersion: v2
name: helmapp
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"
File added
{{/*
Expand the name of the chart.
*/}}
{{- define "helmapp.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 "helmapp.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 "helmapp.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "helmapp.labels" -}}
helm.sh/chart: {{ include "helmapp.chart" . }}
{{ include "helmapp.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "helmapp.selectorLabels" -}}
app.kubernetes.io/name: {{ include "helmapp.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "helmapp.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "helmapp.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "helmapp.fullname" . }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: app
template:
metadata:
labels:
app: app
spec:
containers:
- name: {{ .Chart.Name }}
image: {{ .Values.image.repository }}
ports:
- containerPort: {{ .Values.service.port }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongodb-deployment
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: mongodb
template:
metadata:
labels:
app: mongodb
spec:
containers:
- name: mongodb
image: mongo:latest
ports:
- containerPort: {{ .Values.dbservice.port }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "helmapp.fullname" . }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.port }}
protocol: TCP
selector:
app: app
---
apiVersion: v1
kind: Service
metadata:
name: mongodb-service
spec:
ports:
- port: {{ .Values.dbservice.port }}
targetPort: {{ .Values.dbservice.port }}
protocol: TCP
selector:
app: mongodb
replicaCount: 1
image:
repository: adelysf/myimage
service:
type: NodePort
port: 3000
dbservice:
port: 27017
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongodb-deployment
spec:
replicas: 1
selector:
matchLabels:
app: mongodb
template:
metadata:
labels:
app: mongodb
spec:
containers:
- name: mongodb
image: mongo:latest
ports:
- containerPort: 27017
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: mongodb-service
spec:
selector:
app: mongodb
ports:
- protocol: TCP
port: 27017
targetPort: 27017
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment