Browse Source

package eShop with Helm

pull/1/head
Nicolas Massé 3 years ago
parent
commit
20d2767fdb
  1. 27
      charts/eshop/Chart.yaml
  2. 19
      charts/eshop/README.md
  3. 24
      charts/eshop/templates/config.yaml
  4. 173
      charts/eshop/templates/eshop-api.yaml
  5. 173
      charts/eshop/templates/eshop-web.yaml
  6. 79
      charts/eshop/values.schema.json
  7. 9
      charts/eshop/values.yaml

27
charts/eshop/Chart.yaml

@ -0,0 +1,27 @@
apiVersion: v2
name: eshop
type: application
version: 1.0.0
appVersion: 2.2.0
description: A Helm chart to deploy eShopOnWeb
keywords:
- dotnet
sources:
- https://github.com/nmasse-itix/eShopOnWeb-gitops
home: https://github.com/nmasse-itix/eShopOnWeb
maintainers:
- name: Nicolas Massé
email: nmasse@redhat.com
url: https://www.itix.fr/
- name: Sébastien Lallemand
email: slallemand@redhat.com
annotations:
charts.openshift.io/name: Microsoft eShopOnWeb ASP.NET Core Reference Application
charts.openshift.io/providerType: community
charts.openshift.io/supportedOpenShiftVersions: '>=4.13'
charts.openshift.io/testedOpenShiftVersion: '4.13'
charts.openshift.io/supportURL: https://github.com/nmasse-itix/eShopOnWeb-gitops/issues
charts.openshift.io/provider: Red Hat SSA France
charts.openshift.io/archs: x86_64
icon: https://raw.githubusercontent.com/dotnet-architecture/eShopOnWeb/main/src/Web/wwwroot/images/brand.png
kubeVersion: '>=1.25'

19
charts/eshop/README.md

@ -0,0 +1,19 @@
# eShopOnWeb Helm Chart
A Helm chart for deploying [eShopOnWeb](https://github.com/nmasse-itix/eShopOnWeb) on OpenShift.
## Pre-requisites
None.
## Values
Below is a table of each value used to configure this chart.
| Value | Description | Default | Additional Information |
| ----- | ----------- | ------- | ---------------------- |
| `database.serverHostname` | SQL Server hostname | `sql-server` | |
| `database.name` | Database Name | `eShop` | |
| `database.schema` | Database Schema | `eShop` | |
| `database.username` | Username to access the database | `eShop` | |
| `database.password` | Password to access the database | `R3dH4t1!` | |

24
charts/eshop/templates/config.yaml

@ -0,0 +1,24 @@
apiVersion: v1
kind: Secret
metadata:
name: eshop-config
type: Opaque
stringData:
appsettings.json: |
{
"ConnectionStrings": {
"CatalogConnection": "Server={{ .Values.database.serverHostname }},1433;Integrated Security=False;Initial Catalog={{ .Values.database.name }};User Id={{ .Values.database.username }};Password={{ .Values.database.password }};Trusted_Connection=false;Encrypt=false",
"IdentityConnection": "Server={{ .Values.database.serverHostname }},1433;Integrated Security=False;Initial Catalog={{ .Values.database.name }};User Id={{ .Values.database.username }};Password={{ .Values.database.password }};Trusted_Connection=false;Encrypt=false"
},
"baseUrls": {
"apiBase": "https://{{ .Values.ingress.apiHostname }}/api/",
"webBase": "https://{{ .Values.ingress.webHostname }}/"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

173
charts/eshop/templates/eshop-api.yaml

@ -0,0 +1,173 @@
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
annotations:
app.openshift.io/vcs-uri: https://github.com/nmasse-itix/eShopOnWeb.git
labels:
app: eshop
app.kubernetes.io/component: eshop-api
app.kubernetes.io/instance: eshop-api
app.kubernetes.io/name: eshop-api
app.kubernetes.io/part-of: eshop
app.openshift.io/runtime: dotnet
app.openshift.io/runtime-version: 7.0-ubi8
name: eshop-api
spec:
lookupPolicy:
local: false
---
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
annotations:
app.openshift.io/connects-to: '[{"apiVersion":"apps/v1","kind":"Deployment","name":"sql-server"}]'
app.openshift.io/vcs-uri: https://github.com/nmasse-itix/eShopOnWeb.git
labels:
app: eshop-api
app.kubernetes.io/component: eshop-api
app.kubernetes.io/instance: eshop-api
app.kubernetes.io/name: eshop-api
app.kubernetes.io/part-of: eshop
app.openshift.io/runtime: dotnet
app.openshift.io/runtime-version: 7.0-ubi8
name: eshop-api
spec:
failedBuildsHistoryLimit: 5
nodeSelector: null
output:
to:
kind: ImageStreamTag
name: eshop-api:latest
postCommit: {}
resources: {}
runPolicy: Serial
source:
contextDir: /
git:
uri: https://github.com/nmasse-itix/eShopOnWeb.git
type: Git
strategy:
sourceStrategy:
env:
- name: DOTNET_STARTUP_PROJECT
value: src/PublicApi/PublicApi.csproj
from:
kind: ImageStreamTag
name: dotnet:7.0-ubi8
namespace: openshift
type: Source
successfulBuildsHistoryLimit: 5
triggers:
- type: ConfigChange
- imageChange: {}
type: ImageChange
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
alpha.image.policy.openshift.io/resolve-names: '*'
app.openshift.io/connects-to: '[{"apiVersion":"apps/v1","kind":"Deployment","name":"sql-server"}]'
app.openshift.io/route-disabled: "false"
app.openshift.io/vcs-uri: https://github.com/nmasse-itix/eShopOnWeb.git
image.openshift.io/triggers: '[{"from":{"kind":"ImageStreamTag","name":"eshop-api:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\"eshop-api\")].image","pause":"false"}]'
labels:
app: eshop
app.kubernetes.io/component: eshop-api
app.kubernetes.io/instance: eshop-api
app.kubernetes.io/name: eshop-api
app.kubernetes.io/part-of: eshop
app.openshift.io/runtime: dotnet
app.openshift.io/runtime-version: 7.0-ubi8
name: eshop-api
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: eshop-api
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: eshop-api
deployment: eshop-api
spec:
containers:
- image: eshop-api:latest
imagePullPolicy: IfNotPresent
name: eshop-api
ports:
- containerPort: 8080
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /opt/app-root/app/appsettings.json
name: config
subPath: appsettings.json
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- name: config
secret:
defaultMode: 420
secretName: eshop-config
---
apiVersion: v1
kind: Service
metadata:
annotations:
app.openshift.io/connects-to: '[{"apiVersion":"apps/v1","kind":"Deployment","name":"sql-server"}]'
labels:
app: eshop
app.kubernetes.io/component: eshop-api
app.kubernetes.io/instance: eshop-api
app.kubernetes.io/name: eshop-api
app.kubernetes.io/part-of: eshop
app.openshift.io/runtime: dotnet
app.openshift.io/runtime-version: 7.0-ubi8
name: eshop-api
spec:
ports:
- port: 8080
protocol: TCP
targetPort: 8080
selector:
app: eshop-api
sessionAffinity: None
type: ClusterIP
---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
annotations:
app.openshift.io/connects-to: '[{"apiVersion":"apps/v1","kind":"Deployment","name":"sql-server"}]'
labels:
app: eshop
app.kubernetes.io/component: eshop-api
app.kubernetes.io/instance: eshop-api
app.kubernetes.io/name: eshop-api
app.kubernetes.io/part-of: eshop
app.openshift.io/runtime: dotnet
app.openshift.io/runtime-version: 7.0-ubi8
name: eshop-api
spec:
host: {{ .Values.ingress.apiHostname | quote }}
tls:
termination: edge
to:
kind: Service
name: eshop-api
weight: 100
wildcardPolicy: None

173
charts/eshop/templates/eshop-web.yaml

@ -0,0 +1,173 @@
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
annotations:
app.openshift.io/vcs-uri: https://github.com/nmasse-itix/eShopOnWeb.git
labels:
app: eshop
app.kubernetes.io/component: eshop-web
app.kubernetes.io/instance: eshop-web
app.kubernetes.io/name: eshop-web
app.kubernetes.io/part-of: eshop
app.openshift.io/runtime: dotnet
app.openshift.io/runtime-version: 7.0-ubi8
name: eshop-web
spec:
lookupPolicy:
local: false
---
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
annotations:
app.openshift.io/connects-to: '[{"apiVersion":"apps/v1","kind":"Deployment","name":"sql-server"}]'
app.openshift.io/vcs-uri: https://github.com/nmasse-itix/eShopOnWeb.git
labels:
app: eshop-web
app.kubernetes.io/component: eshop-web
app.kubernetes.io/instance: eshop-web
app.kubernetes.io/name: eshop-web
app.kubernetes.io/part-of: eshop
app.openshift.io/runtime: dotnet
app.openshift.io/runtime-version: 7.0-ubi8
name: eshop-web
spec:
failedBuildsHistoryLimit: 5
nodeSelector: null
output:
to:
kind: ImageStreamTag
name: eshop-web:latest
postCommit: {}
resources: {}
runPolicy: Serial
source:
contextDir: /
git:
uri: https://github.com/nmasse-itix/eShopOnWeb.git
type: Git
strategy:
sourceStrategy:
env:
- name: DOTNET_STARTUP_PROJECT
value: src/Web/Web.csproj
from:
kind: ImageStreamTag
name: dotnet:7.0-ubi8
namespace: openshift
type: Source
successfulBuildsHistoryLimit: 5
triggers:
- type: ConfigChange
- imageChange: {}
type: ImageChange
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
alpha.image.policy.openshift.io/resolve-names: '*'
app.openshift.io/connects-to: '[{"apiVersion":"apps/v1","kind":"Deployment","name":"sql-server"}]'
app.openshift.io/route-disabled: "false"
app.openshift.io/vcs-uri: https://github.com/nmasse-itix/eShopOnWeb.git
image.openshift.io/triggers: '[{"from":{"kind":"ImageStreamTag","name":"eshop-web:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\"eshop-web\")].image","pause":"false"}]'
labels:
app: eshop
app.kubernetes.io/component: eshop-web
app.kubernetes.io/instance: eshop-web
app.kubernetes.io/name: eshop-web
app.kubernetes.io/part-of: eshop
app.openshift.io/runtime: dotnet
app.openshift.io/runtime-version: 7.0-ubi8
name: eshop-web
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: eshop-web
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: eshop-web
deployment: eshop-web
spec:
containers:
- image: eshop-web:latest
imagePullPolicy: IfNotPresent
name: eshop-web
ports:
- containerPort: 8080
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /opt/app-root/app/appsettings.json
name: config
subPath: appsettings.json
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- name: config
secret:
defaultMode: 420
secretName: eshop-config
---
apiVersion: v1
kind: Service
metadata:
annotations:
app.openshift.io/connects-to: '[{"apiVersion":"apps/v1","kind":"Deployment","name":"sql-server"}]'
labels:
app: eshop
app.kubernetes.io/component: eshop-web
app.kubernetes.io/instance: eshop-web
app.kubernetes.io/name: eshop-web
app.kubernetes.io/part-of: eshop
app.openshift.io/runtime: dotnet
app.openshift.io/runtime-version: 7.0-ubi8
name: eshop-web
spec:
ports:
- port: 8080
protocol: TCP
targetPort: 8080
selector:
app: eshop-web
sessionAffinity: None
type: ClusterIP
---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
annotations:
app.openshift.io/connects-to: '[{"apiVersion":"apps/v1","kind":"Deployment","name":"sql-server"}]'
labels:
app: eshop
app.kubernetes.io/component: eshop-web
app.kubernetes.io/instance: eshop-web
app.kubernetes.io/name: eshop-web
app.kubernetes.io/part-of: eshop
app.openshift.io/runtime: dotnet
app.openshift.io/runtime-version: 7.0-ubi8
name: eshop-web
spec:
host: {{ .Values.ingress.webHostname | quote }}
tls:
termination: edge
to:
kind: Service
name: eshop-web
weight: 100
wildcardPolicy: None

79
charts/eshop/values.schema.json

@ -0,0 +1,79 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"additionalProperties": false,
"properties": {
"database": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"title": "Database Name",
"description": "Name of the database",
"default": "eShop"
},
"username": {
"title": "Username",
"description": "Username to access the database",
"type": "string",
"default": "eShop"
},
"password": {
"title": "Password",
"description": "Password to access the database",
"type": "string",
"default": "R3dH4t1!"
},
"schema": {
"title": "Schema Name",
"type": "string",
"description": "Name of the schema to create",
"default": "eShop"
},
"serverHostname": {
"title": "SQL Server hostname",
"type": "string",
"description": "Microsoft SQL Server hostname",
"default": "sql-server"
}
},
"required": [
"name",
"password",
"schema",
"serverHostname",
"username"
],
"title": "Database"
},
"ingress": {
"type": "object",
"additionalProperties": false,
"properties": {
"webHostname": {
"title": "Web Public Hostname",
"type": "string",
"minLength": 3,
"description": "Public hostname on which the Web component will be reachable"
},
"apiHostname": {
"title": "API Public Hostname",
"type": "string",
"minLength": 3,
"description": "Public hostname on which the Web component will be reachable"
}
},
"required": [
"apiHostname",
"webHostname"
],
"title": "Ingress"
}
},
"required": [
"database",
"ingress"
],
"title": "eShopOnWeb Application"
}

9
charts/eshop/values.yaml

@ -0,0 +1,9 @@
database:
name: "eShop"
username: "eShop"
password: "R3dH4t1!"
schema: "eShop"
serverHostname: "sql-server"
ingress:
webHostname: ""
apiHostname: ""
Loading…
Cancel
Save