-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from SmartColumbusOS/linkett-adapter-deploy
Linkett adapter deploy repo
- Loading branch information
Showing
8 changed files
with
218 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
description: Adapter API to expose work order data for Linkett | ||
name: linkett-adapter | ||
version: 0.1.0 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
library( | ||
identifier: '[email protected]', | ||
retriever: modernSCM([$class: 'GitSCMSource', | ||
remote: 'https://github.com/SmartColumbusOS/pipeline-lib', | ||
credentialsId: 'jenkins-github-user']) | ||
) | ||
|
||
properties([ | ||
pipelineTriggers([scos.dailyBuildTrigger()]), | ||
parameters([ | ||
booleanParam(defaultValue: false, description: 'Deploy to development environment?', name: 'DEV_DEPLOYMENT'), | ||
string(defaultValue: 'latest', description: 'Image tag to deploy to dev environment', name: 'DEV_IMAGE_TAG') | ||
]) | ||
]) | ||
|
||
def applicationName = "linkett-adapter" | ||
def doStageIf = scos.&doStageIf | ||
def doStageIfDeployingToDev = doStageIf.curry(env.DEV_DEPLOYMENT == "true") | ||
def doStageIfMergedToMaster = doStageIf.curry(scos.changeset.isMaster && env.DEV_DEPLOYMENT == "false") | ||
def doStageIfRelease = doStageIf.curry(scos.changeset.isRelease) | ||
|
||
node ('infrastructure') { | ||
ansiColor('xterm') { | ||
scos.doCheckoutStage() | ||
|
||
doStageIfDeployingToDev('Deploy to Dev') { | ||
deployTo(applicationName, 'dev', "--set image.tag=${env.DEV_IMAGE_TAG} --recreate-pods") | ||
} | ||
|
||
doStageIfMergedToMaster('Deploy to Staging') { | ||
deployTo(applicationName, 'staging') | ||
scos.applyAndPushGitHubTag('staging') | ||
} | ||
|
||
doStageIfRelease('Deploy to Production') { | ||
deployTo(applicationName, 'prod') | ||
scos.applyAndPushGitHubTag('prod') | ||
} | ||
} | ||
} | ||
|
||
def deployTo(applicationName, environment, extraArgs = '') { | ||
scos.withEksCredentials(environment) { | ||
sh("""#!/bin/bash | ||
set -e | ||
helm init --client-only | ||
helm upgrade --install ${applicationName} . \ | ||
--namespace=linkett \ | ||
${extraArgs} | ||
""".trim()) | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# linkett_adapter-deploy | ||
linkett_adapter-deploy |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "linkett-adapter.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 "linkett-adapter.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 "linkett-adapter.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "linkett-adapter.labels" -}} | ||
app.kubernetes.io/name: {{ include "linkett-adapter.name" . }} | ||
helm.sh/chart: {{ include "linkett-adapter.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end -}} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "linkett-adapter.fullname" . }} | ||
labels: | ||
{{ include "linkett-adapter.labels" . | indent 4 }} | ||
spec: | ||
serviceAccountName: {{ .Chart.Name }} | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ include "linkett-adapter.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: {{ include "linkett-adapter.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
spec: | ||
serviceAccountName: {{ .Chart.Name }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
ports: | ||
- name: http | ||
containerPort: 80 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: /api/v1/healthcheck | ||
port: http | ||
readinessProbe: | ||
httpGet: | ||
path: /api/v1/healthcheck | ||
port: http | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ .Chart.Name }} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
kind: Role | ||
metadata: | ||
name: {{ .Chart.Name }} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
kind: RoleBinding | ||
metadata: | ||
name: {{ .Chart.Name }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: {{ .Chart.Name }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ .Chart.Name }} | ||
namespace: {{ .Release.Namespace }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "linkett-adapter.fullname" . }} | ||
labels: | ||
{{ include "linkett-adapter.labels" . | indent 4 }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: http | ||
protocol: TCP | ||
name: http | ||
selector: | ||
app.kubernetes.io/name: {{ include "linkett-adapter.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
replicaCount: 1 | ||
|
||
image: | ||
repository: 199837183662.dkr.ecr.us-east-2.amazonaws.com/scos/linkett-adapter | ||
tag: 0.1.0 | ||
pullPolicy: Always | ||
|
||
nameOverride: "" | ||
fullnameOverride: "" | ||
|
||
service: | ||
type: ClusterIP | ||
port: 80 | ||
|
||
resources: | ||
limits: | ||
cpu: 100m | ||
memory: 128Mi | ||
requests: | ||
cpu: 100m | ||
memory: 128Mi | ||
|
||
|
||
nodeSelector: {} | ||
|
||
tolerations: [] | ||
|
||
affinity: {} |