CloudOps

源文件

gcp/run/service.yaml

离线配置。未部署到任何云账号。

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: insights-api
  labels:
    app: insights-api
    cloud.googleapis.com/location: asia-east1
  annotations:
    run.googleapis.com/ingress: internal
    run.googleapis.com/description: Fictional Thistle Analytics insights API. Not deployed.
spec:
  template:
    metadata:
      annotations:
        autoscaling.knative.dev/maxScale: "10"
        autoscaling.knative.dev/minScale: "0"
        run.googleapis.com/execution-environment: gen2
        run.googleapis.com/cpu-throttling: "true"
    spec:
      serviceAccountName: insights-api-sa@thistle-analytics-demo.iam.gserviceaccount.com
      containerConcurrency: 80
      timeoutSeconds: 60
      containers:
        - name: insights-api
          image: asia-east1-docker.pkg.dev/thistle-analytics-demo/apps/insights-api:0.1.0
          ports:
            - name: http1
              containerPort: 8080
          env:
            - name: INSIGHTS_ENV
              value: demo
            - name: SIGNING_KEY
              valueFrom:
                secretKeyRef:
                  name: insights-api-signing-key
                  key: "1"
          resources:
            limits:
              cpu: "1"
              memory: 512Mi
          startupProbe:
            httpGet:
              path: /healthz
              port: 8080
            periodSeconds: 10
            failureThreshold: 6
            timeoutSeconds: 2
          livenessProbe:
            httpGet:
              path: /readyz
              port: 8080
            periodSeconds: 15
            failureThreshold: 3
            timeoutSeconds: 2
          securityContext:
            runAsNonRoot: true
            runAsUser: 10001
            allowPrivilegeEscalation: false