From 18ddd8fb69392ed9eaff1e3abb2aa7fb0ea44f38 Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Tue, 8 Feb 2022 23:27:48 +0300 Subject: [PATCH] added catalog service --- etc/k8s/eshoponabp/charts/catalog/Chart.yaml | 6 ++ .../catalog/templates/catalog-deployment.yaml | 64 +++++++++++++++++++ .../catalog/templates/catalog-ingress.yaml | 27 ++++++++ .../catalog/templates/catalog-service.yaml | 18 ++++++ etc/k8s/eshoponabp/charts/catalog/values.yaml | 35 ++++++++++ etc/k8s/eshoponabp/values.yaml | 31 ++++++++- 6 files changed, 179 insertions(+), 2 deletions(-) create mode 100644 etc/k8s/eshoponabp/charts/catalog/Chart.yaml create mode 100644 etc/k8s/eshoponabp/charts/catalog/templates/catalog-deployment.yaml create mode 100644 etc/k8s/eshoponabp/charts/catalog/templates/catalog-ingress.yaml create mode 100644 etc/k8s/eshoponabp/charts/catalog/templates/catalog-service.yaml create mode 100644 etc/k8s/eshoponabp/charts/catalog/values.yaml diff --git a/etc/k8s/eshoponabp/charts/catalog/Chart.yaml b/etc/k8s/eshoponabp/charts/catalog/Chart.yaml new file mode 100644 index 00000000..e8109a51 --- /dev/null +++ b/etc/k8s/eshoponabp/charts/catalog/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: catalog +appVersion: "1.0" +description: eShopOnAbp Catalog Microservice +version: 1.0.0 +type: application \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/catalog/templates/catalog-deployment.yaml b/etc/k8s/eshoponabp/charts/catalog/templates/catalog-deployment.yaml new file mode 100644 index 00000000..937a3593 --- /dev/null +++ b/etc/k8s/eshoponabp/charts/catalog/templates/catalog-deployment.yaml @@ -0,0 +1,64 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }} +spec: + selector: + matchLabels: + app: {{ .Release.Name }}-{{ .Chart.Name }} + template: + metadata: + labels: + app: {{ .Release.Name }}-{{ .Chart.Name }} + spec: + containers: + - image: {{ .Values.image.repository }}:{{ .Values.image.tag }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + name: {{ .Release.Name }}-{{ .Chart.Name }} + ports: + - name: http + containerPort: 80 + - name: https + containerPort: 443 + - name: grpc + containerPort: 81 + protocol: TCP + env: + - name: App__SelfUrl + value: "{{ .Values.config.selfUrl }}" + - name: App__CorsOrigins + value: "{{ .Values.config.corsOrigins }}" + - name: "ConnectionStrings__CatalogService" + value: {{ .Values.config.connectionStrings.catalogService }} + - name: "ConnectionStrings__AdministrationService" + value: {{ .Values.config.connectionStrings.administrationService }} + - name: "DOTNET_ENVIRONMENT" + value: "{{ .Values.config.dotnetEnv }}" + - name: "Redis__Configuration" + value: "{{ .Values.config.redisHost }}" + - name: "RabbitMQ__Connections__Default__HostName" + value: "{{ .Values.config.rabbitmqHost }}" + - name: "ElasticSearch__Url" + value: "{{ .Values.config.elasticsearchHost }}" + - name: "AuthServer__Authority" + value: "{{ .Values.config.authServer.authority }}" + - name: "AuthServer__RequireHttpsMetadata" + value: "{{ .Values.config.authServer.requireHttpsMetadata }}" + - name: "AuthServer__SwaggerClientId" + value: "{{ .Values.config.swaggerClientId }}" + - name: "AuthServer__SwaggerClientSecret" + value: "{{ .Values.config.swaggerClientSecret }}" + - name: "StringEncryption__DefaultPassPhrase" + value: "{{ .Values.config.stringEncryptionDefaultPassPhrase }}" + - name: "Kestrel__Endpoints__Http__Url" + value: "{{ .Values.config.kestrel.httpUrl }}" + - name: "Kestrel__Endpoints__Http__Protocols" + value: "{{ .Values.config.kestrel.httpProtocols }}" + - name: "Kestrel__Endpoints__gRPC__Url" + value: "{{ .Values.config.kestrel.grpcUrl }}" + - name: "Kestrel__Endpoints__gRPC__Protocols" + value: "{{ .Values.config.kestrel.grpcProtocols }}" + {{- if .Values.env }} +{{ toYaml .Values.env | indent 8 }} + {{- end }} + diff --git a/etc/k8s/eshoponabp/charts/catalog/templates/catalog-ingress.yaml b/etc/k8s/eshoponabp/charts/catalog/templates/catalog-ingress.yaml new file mode 100644 index 00000000..e843265f --- /dev/null +++ b/etc/k8s/eshoponabp/charts/catalog/templates/catalog-ingress.yaml @@ -0,0 +1,27 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress + annotations: + kubernetes.io/ingress.class: "nginx" + nginx.ingress.kubernetes.io/rewrite-target: / + nginx.ingress.kubernetes.io/force-ssl-redirect: "true" + nginx.ingress.kubernetes.io/proxy-buffer-size: 32k + nginx.ingress.kubernetes.io/proxy-buffers-number: "8" + cert-manager.io/cluster-issuer: letsencrypt +spec: + tls: + - hosts: + - {{ .Values.ingress.host }} + secretName: {{ .Values.ingress.tlsSecret }} + rules: + - host: "{{ .Values.ingress.host }}" + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ .Release.Name }}-{{ .Chart.Name }} + port: + number: 80 \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/catalog/templates/catalog-service.yaml b/etc/k8s/eshoponabp/charts/catalog/templates/catalog-service.yaml new file mode 100644 index 00000000..278771cd --- /dev/null +++ b/etc/k8s/eshoponabp/charts/catalog/templates/catalog-service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + name: {{ .Release.Name }}-{{ .Chart.Name }} + name: {{ .Release.Name }}-{{ .Chart.Name }} +spec: + ports: + - name: "80" + port: 80 + - name: "443" + port: 443 + - port: {{ .Values.config.grpcPort }} + targetPort: grpc + protocol: TCP + name: grpc + selector: + app: {{ .Release.Name }}-{{ .Chart.Name }} diff --git a/etc/k8s/eshoponabp/charts/catalog/values.yaml b/etc/k8s/eshoponabp/charts/catalog/values.yaml new file mode 100644 index 00000000..d45c8b9e --- /dev/null +++ b/etc/k8s/eshoponabp/charts/catalog/values.yaml @@ -0,0 +1,35 @@ +config: + selfUrl: # https://eshop-st-catalog + corsOrigins: # https://eshop-st-gateway-web,https://eshop-st-gateway-public-web,https://eshop-st-public,https://eshop-st-web + connectionStrings: + catalogService: # + administrationService: # + authServer: + authority: http://eshop-st-authserver + requireHttpsMetadata: "false" + swaggerClientId: WebGateway_Swagger + swaggerClientSecret: "1q2w3e*" + dotnetEnv: Staging + redisHost: es-st-redis + rabbitmqHost: es-st-rabbitmq + elasticsearchHost: es-st-elasticsearch + stringEncryptionDefaultPassPhrase: gsKnGZ041HLL4IM8 + grpcPort: 81 + kestrel: + httpUrl: # + httpProtocols: Http1AndHttp2 + grpcUrl: # + grpcProtocols: Http2 + + +ingress: + host: eshop-st-catalog + tlsSecret: eshop-demo-tls + +image: + repository: eshoponabp/service-catalog + tag: latest + pullPolicy: IfNotPresent + +env: {} + \ No newline at end of file diff --git a/etc/k8s/eshoponabp/values.yaml b/etc/k8s/eshoponabp/values.yaml index 77c4d2c0..3ea5fc64 100644 --- a/etc/k8s/eshoponabp/values.yaml +++ b/etc/k8s/eshoponabp/values.yaml @@ -170,13 +170,13 @@ gateway-web-public: basket: config: selfUrl: https://eshop-st-basket - corsOrigins: https://eshop-st-gateway-web, https://eshop-st-gateway-web-public, https://eshop-st-public-web + corsOrigins: https://eshop-st-gateway-web,https://eshop-st-gateway-web-public,https://eshop-st-public-web connectionStrings: administrationService: "Host=es-st-postgresdb;Port=5432;Database=EShopOnAbp_Administration;User ID=postgres;password=myPassw0rd;Pooling=false" authServer: authority: http://eshop-st-authserver requireHttpsMetadata: "false" - swaggerClientId: "WebGateway_Swagger" + swaggerClientId: WebGateway_Swagger swaggerClientSecret: "1q2w3e*" dotnetEnv: Staging redisHost: es-st-redis @@ -188,6 +188,33 @@ basket: repository: "eshoponabp/service-basket" tag: latest +# basket-service sub-chart override +catalog: + config: + selfUrl: https://eshop-st-catalog + corsOrigins: https://eshop-st-gateway-web,https://eshop-st-gateway-web-public,https://eshop-st-public-web,https://eshop-st-web + connectionStrings: + catalogService: "mongodb://mongodb:27017/EShopOnAbp_Catalog" + administrationService: "Host=es-st-postgresdb;Port=5432;Database=EShopOnAbp_Administration;User ID=postgres;password=myPassw0rd;Pooling=false" + authServer: + authority: http://eshop-st-authserver + requireHttpsMetadata: "false" + swaggerClientId: WebGateway_Swagger + swaggerClientSecret: "1q2w3e*" + dotnetEnv: Staging + redisHost: es-st-redis + rabbitmqHost: es-st-rabbitmq + elasticsearchHost: es-st-elasticsearch + kestrel: + httpUrl: http://eshop-st-catalog + httpProtocols: Http1AndHttp2 + grpcUrl: http://eshop-st-catalog + grpcProtocols: Http2 + ingress: + host: eshop-st-catalog + image: + repository: "eshoponabp/service-catalog" + tag: latest # Default values for eshoponabp. # This is a YAML-formatted file.