google-cloud-node icon indicating copy to clipboard operation
google-cloud-node copied to clipboard

API working but the more cloud run configuration was not working if adding the RAM and CPU.. etc configuration.

Open Sky-bits opened this issue 2 years ago • 0 comments

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • which product (packages/*):
  • OS:
  • Node.js version:
  • npm version:
  • google-cloud-node version:

Steps to reproduce

@google-cloud/run

I am using the google official node js package

'@google-cloud/run'); https://www.npmjs.com/package/@google-cloud/run

I wan to create Cloud run service from the my code side. I have already node docker image that was i am using. I have query about create cloud run service from code.

steps related to reproducing the bug.

create new node js project

  1. install @google-cloud/run
  2. start the node js scripts

here is sample code

`

const { v2 ,CloudRun } = require('@google-cloud/run');

const { ServicesClient } = v2;`

// auth following with services account key

const runClient = new ServicesClient({ credentials: credentials_read });

const projectId = 'gxxxxx06'; const serviceName = 'by-sanjay'; const location = 'us-central1'

async function createCloudRunService(projectId, region, serviceName, image) {

const parent = projects/${projectId}/locations/${location} const serviceId = 'saas-sst-created-from-;

// exit(); const service = { apiVersion: 'serving.knative.dev/v1', kind: 'Service', metadata: { name: serviceId, }, template: { containers: [ { image: 'us-docker.pkg.dev/cloudrun/container/hello', ports: [ { containerPort: 8088, }, ], env: [ { name: 'test', value: 'test', }

          ],
        resources: {
            limits: {
              memory: '512Mi',
              cpu: '1.0',
            },
            memory: '128Mi',
            cpuIdle	:	true,
            scaling: { minInstanceCount: 0, maxInstanceCount: 5 },
          },
          http: {
            // Allow unauthenticated requests
            unauthenticated: true,
          },
          containerConcurrency: 1, // Set the maximum number of concurrent requests
          cpu: '0',
          scaling: { minInstanceCount: 0, maxInstanceCount: 1 },

          scale: {
            replicas: 1,
          }

     }
    ],

}

}

// Construct request const request = { parent, service, serviceId, };

Create Cloud run Run request const [operation] = await runClient.createService(request); const [response] = await operation.promise(); console.log("This is the end of the files ::-- ",response)

` Thanks!

Issue

  1. I have I can't able to create cloud run 128Mi. it taking by default 512 Mi, from the Gcp cloud console i was able to create cloud with 128Mi.

  2. how to pass the config parameter like allow unauthenticated request,

  3. Currency node cloud-run package assign CPU allocated but i want set based on the how to set CPU based on CPU allocation and pricing CPU is only allocated during request processing.

  4. how to link the domain does this feature into API version ??.

Sky-bits avatar Jun 22 '23 10:06 Sky-bits