提交 b313386b 编辑于 作者: zhou liang's avatar zhou liang
浏览文件

Initial commit

上级
加载中
加载中
加载中
加载中

helm-chart/Chart.yaml

0 → 100644
+38 −0
原始行号 差异行号 差异行
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v2
name: onlineboutique
description: A Helm chart for Kubernetes for Online Boutique

# 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.9.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: "v0.9.0"

helm-chart/README.md

0 → 100644
+39 −0
原始行号 差异行号 差异行
# Helm chart for Online Boutique

If you'd like to deploy Online Boutique via its Helm chart, you could leverage the following instructions.

**Warning:** Online Boutique's Helm chart is currently experimental. If you have feedback or run into issues, let us know inside [GitHub Issue #1319](https://github.com/GoogleCloudPlatform/microservices-demo/issues/1319) or by creating a [new GitHub Issue](https://github.com/GoogleCloudPlatform/microservices-demo/issues/new/choose).

Deploy the default setup of Online Boutique:
```sh
helm upgrade onlineboutique oci://us-docker.pkg.dev/online-boutique-ci/charts/onlineboutique \
    --install
```

Deploy advanced scenario of Online Boutique:
```sh
helm upgrade onlineboutique oci://us-docker.pkg.dev/online-boutique-ci/charts/onlineboutique \
    --install \
    --create-namespace \
    --set images.repository=us-docker.pkg.dev/my-project/containers/onlineboutique \
    --set frontend.externalService=false \
    --set redis.create=false \
    --set cartservice.database.type=spanner \
    --set cartservice.database.connectionString=projects/my-project/instances/onlineboutique/databases/carts \
    --set serviceAccounts.create=true \
    --set authorizationPolicies.create=true \
    --set networkPolicies.create=true \
    --set sidecars.create=true \
    --set frontend.virtualService.create=true \
    --set 'serviceAccounts.annotations.iam\.gke\.io/gcp-service-account=spanner-db-user@my-project.iam.gserviceaccount.com' \
    --set serviceAccounts.annotationsOnlyForCartservice=true \
    -n onlineboutique
```

For the full list of configurations, see [values.yaml](./values.yaml).

You could also find advanced scenarios with these blogs below:
- [Online Boutique sample’s Helm chart, to simplify the setup of advanced and secured scenarios with Service Mesh and GitOps](https://medium.com/google-cloud/246119e46d53)
- [gRPC health probes with Kubernetes 1.24+](https://medium.com/google-cloud/b5bd26253a4c)
- [Use Google Cloud Spanner with the Online Boutique sample](https://medium.com/google-cloud/f7248e077339)
 No newline at end of file
+105 −0
原始行号 差异行号 差异行
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: adservice
spec:
  serviceName: adservice
  selector:
    matchLabels:
      app: adservice
      version: "1"
  replicas: 3
  template:
    metadata:
      labels:
        app: adservice
        version: "1"
        tingyun-agent-injected: "true"
    spec:
      terminationGracePeriodSeconds: 5
      containers:
      - name: server
        image: {{ .Values.images.repository }}/{{ .Values.adService.name }}:{{ .Values.images.tag }}
        imagePullPolicy: Always
        ports:
        - containerPort: 9555
        env:
        - name: PORT
          value: "9555"
        #- name: DISABLE_STATS
        #  value: "1"
        # - name: DISABLE_TRACING
        #   value: "1"
        - name: JAEGER_HOST
          value: "jaeger-collector.observability.svc.cluster.local"
        - name: ZIPKIN_PORT
          value: "9411"
          # value: "14268"
        - name: POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        - name: SERVICE_NAME
          value: "adservice"
        - name: MYSQL_ADDR
          value: "223.193.36.169:4000"
        - name: SQL_USER
          value: "root"
        - name: SQL_PASSWORD
          value: "123456"
        resources:
          requests:
            cpu: 400m
            memory: 360Mi
          limits:
            cpu: 600m
            memory: 600Mi
        #readinessProbe:
        #  initialDelaySeconds: 20
        #  periodSeconds: 15
        #  exec:
        #    command: ["/bin/grpc_health_probe", "-addr=:9555"]
        #livenessProbe:
        #  initialDelaySeconds: 20
        #  periodSeconds: 15
        #  exec:
        #    command: ["/bin/grpc_health_probe", "-addr=:9555"]
---
apiVersion: v1
kind: Service
metadata:
  name: adservice
spec:
  type: ClusterIP
  selector:
    app: adservice
    version: "1"
  ports:
  - name: grpc
    port: 9555
    targetPort: 9555
  - port: 8088
    protocol: TCP
    name: jmx-metrics
+98 −0
原始行号 差异行号 差异行
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: cartservice
spec:
  serviceName: cartservice
  selector:
    matchLabels:
      app: cartservice
      version: "1"
  replicas: 3
  template:
    metadata:
      labels:
        app: cartservice
        version: "1"
        tingyun-agent-injected: "true"
    spec:
      terminationGracePeriodSeconds: 5
      containers:
      - name: server
        image: {{ .Values.images.repository }}/{{ .Values.cartService.name }}:{{ .Values.images.tag }}
        imagePullPolicy: Always
        ports:
        - containerPort: 7070
        env:
        - name: SERVICE_NAME
          value: "cartservice"
        - name: REDIS_ADDR
          value: "redis-cart:6379"
        - name: PORT
          value: "7070"
        - name: LISTEN_ADDR
          value: "0.0.0.0"
        - name: HIPSTER_SICK # Used for GCP demo
          value: "false"
        - name: JAEGER_HOST
          value: "jaeger-collector.observability.svc.cluster.local"
        - name: JAEGER_PORT
          value: "4317"
        - name: POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        - name: TINGYUN_LICENSE_KEY
          value: "aJvUQ0IMBRBEotyK"
        resources:
          requests:
            cpu: 400m
            memory: 128Mi
          limits:
            cpu: 600m
            memory: 256Mi
        #readinessProbe:
        #  initialDelaySeconds: 15
        #  exec:
        #    command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"]
        #livenessProbe:
        #  initialDelaySeconds: 15
        #  periodSeconds: 10
        #  exec:
        #    command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"]
---
apiVersion: v1
kind: Service
metadata:
  name: cartservice
spec:
  type: ClusterIP
  selector:
    app: cartservice
    version: "1"
  ports:
  - name: grpc
    port: 7070
    targetPort: 7070
+104 −0
原始行号 差异行号 差异行
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: checkoutservice
  
spec:
  serviceName: checkoutservice
  selector:
    matchLabels:
      app: checkoutservice
      version: "1"
  replicas: 3
  template:
    metadata:
      labels:
        app: checkoutservice
        version: "1"
        tingyun-agent-injected: "true"
    spec:
      containers:
        - name: server
          image: {{ .Values.images.repository }}/{{ .Values.checkoutService.name }}:{{ .Values.images.tag }}
          imagePullPolicy: Always
          ports:
          - containerPort: 5050
          #readinessProbe:
          #  exec:
          #    command: ["/bin/grpc_health_probe", "-addr=:5050"]
          #livenessProbe:
          #  exec:
          #    command: ["/bin/grpc_health_probe", "-addr=:5050"]
          env:
          - name: PORT
            value: "5050"
          - name: PRODUCT_CATALOG_SERVICE_ADDR
            value: "productcatalogservice:3550"
          - name: SHIPPING_SERVICE_ADDR
            value: "shippingservice:50051"
          - name: PAYMENT_SERVICE_ADDR
            value: "paymentservice:50051"
          - name: EMAIL_SERVICE_ADDR
            value: "emailservice:5000"
          - name: CURRENCY_SERVICE_ADDR
            value: "currencyservice:7000"
          - name: CART_SERVICE_ADDR
            value: "cartservice:7070"
          # - name: DISABLE_STATS
          #   value: "1"
          # - name: DISABLE_TRACING
          #   value: "1"
          - name: POD_IP
            valueFrom:
              fieldRef:
                fieldPath: status.podIP
          - name: POD_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.name
          - name: NODE_NAME
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
          - name: DISABLE_PROFILER
            value: "1"
          - name: JAEGER_SERVICE_ADDR
            value: "jaeger-collector.observability.svc.cluster.local:14268/api/traces"
          - name: SERVICE_NAME
            value: "checkoutservice"
          resources:
            requests:
              cpu: 100m
              memory: 64Mi
            limits:
              cpu: 200m
              memory: 128Mi
---
apiVersion: v1
kind: Service
metadata:
  name: checkoutservice
  
spec:
  type: ClusterIP
  selector:
    app: checkoutservice
    version: "1"
  ports:
  - name: grpc
    port: 5050
    targetPort: 5050