google-cloud-platformgoogle-cloud-runskaffoldgoogle-cloud-deploy

Google Cloud Deploy is not setting cpu-throttling when deploying to Google Cloud Run


We are deploying with Google Cloud Deploy to Google Cloud Run. With the following configuration files:

clouddeploy.yaml

apiVersion: deploy.cloud.google.com/v1
kind: DeliveryPipeline
metadata:
  name: service-backend-pipeline
description: service backend delivery pipeline
serialPipeline:
 stages:
 - targetId: staging
   profiles:
    - staging

---
apiVersion: deploy.cloud.google.com/v1
kind: Target
metadata:
  name: staging
description: staging environment
requireApproval: false
multiTarget:
  targetIds: [api-staging, worker-staging]
---
apiVersion: deploy.cloud.google.com/v1
kind: Target
metadata:
  name: api-staging
description: api staging
run:
  location: projects/project_id_here/locations/region_here
deployParameters:
  service_name: service-api-staging
  startup_cpu_boost: 'true'
  cpu_throttling: 'true'
---
apiVersion: deploy.cloud.google.com/v1
kind: Target
metadata:
  name: worker-staging
description: worker staging
run:
  location: projects/project_id_here/locations/region_here
deployParameters:
  service_name: service-api-worker-staging
  startup_cpu_boost: 'false'
  cpu_throttling: 'false'

skaffold.yaml

apiVersion: skaffold/v4beta6
kind: Config
metadata:
  name: cloud-run-app
profiles:
  - name: staging
    manifests:
      rawYaml:
        - ops/staging.yaml
deploy:
  cloudrun: {}

ops/staging.yaml

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: api-staging # from-param: ${service_name}

spec:
  template:
    metadata:
      annotations:
        run.googleapis.com/startup-cpu-boost: 'true' # from-param: ${startup_cpu_boost}
        run.googleapis.com/cpu-throttling: 'true' # from-param ${cpu_throttling}
    spec:
      containers:
      - env:
        image: image-api

We get succesfully two generated manifests.yaml. But the worker-staging has

run.googleapis.com/startup-cpu-boost: 'true'
run.googleapis.com/cpu-throttling: 'false' <-- this value should be 'true'

and the api-staging has

run.googleapis.com/startup-cpu-boost: 'true'
run.googleapis.com/cpu-throttling: 'true'

This only happens with the cpu-throttling, all other values we're able to set correctly. It looks like skaffold is not performing the from-param correctly. How can we solve this so we can set 2 different CPU throttling settings in one profile?


Solution

  • Thanks for trying out the deployment parameters feature!

    It looks like there's actually a colon missing:

    # from-param ${cpu_throttling}

    should be

    # from-param: ${cpu_throttling}

    I realize this is a very easy mistake to make and we'll see if we can come up with better ways to detect this and warn you when something like this happens.