Giter VIP home page Giter VIP logo

Comments (21)

yuri-sergiichuk avatar yuri-sergiichuk commented on August 13, 2024 1

@stephenashank yep! Thanks for your efforts and sorry for being late with the response.

from google-compute-engine-plugin.

rachely3n avatar rachely3n commented on August 13, 2024

How did you set up the network in the first place?

from google-compute-engine-plugin.

rachely3n avatar rachely3n commented on August 13, 2024

Update?

from google-compute-engine-plugin.

jhartnett avatar jhartnett commented on August 13, 2024

That's a pretty vague question. How did I set up the network in Google? How did I set up network in the Jenkins plugin config? What information are you looking for?

from google-compute-engine-plugin.

rachely3n avatar rachely3n commented on August 13, 2024

Are you setting it up via the UI in the instance configuration form? Using JCasC?
With the UI, there are auto-populated options that should work out of the box.

from google-compute-engine-plugin.

rachely3n avatar rachely3n commented on August 13, 2024

Also, it would also help for me to see what your instance configuration is.

from google-compute-engine-plugin.

jhartnett avatar jhartnett commented on August 13, 2024

I set set up the network in the Jenkins UI. It does have a drop down for subnetworks but the only that appears is 'default'. There aren't any other options.

The instance is Centos7 n1-standard-4. The service account has 'Compute Network Admin'.

Screenshot at Jun 03 14-17-54

from google-compute-engine-plugin.

rachely3n avatar rachely3n commented on August 13, 2024

private static final String NETWORK_NAME = format("projects/%s/global/networks/default");
private static final String SUBNETWORK_NAME = "default";

If you see there, it seems what is in your config matches values we use for integration testing.

@stephenashank can you take a look?

from google-compute-engine-plugin.

jhartnett avatar jhartnett commented on August 13, 2024

In our production project we do not have a subnet called 'default'. Is that a requirement?

In our staging project we have a subnet called 'default'. When I tried to bring in a new slave, I would get this error:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Invalid value for field 'resource.networkInterfaces[0]': ''. Subnetwork should be specified for custom subnetmode network",
"reason" : "invalid"
} ],
"message" : "Invalid value for field 'resource.networkInterfaces[0]': ''. Subnetwork should be specified for custom subnetmode network"
}

from google-compute-engine-plugin.

stephenashank avatar stephenashank commented on August 13, 2024

I was able to reproduce your problem in the UI: even when I had created a new subnetwork under the default network, it was not showing up in the list despite the service account having the Compute Network Admin role.

So I looked closer and realized that as it stands now, selecting the default subnetwork is required when default is chosen as the network, because no additional items are retrieved, we just assume that default will be used:

if (network.endsWith("default")) {
items.add(new ListBoxModel.Option("default", "default", true));
return items;
}

from google-compute-engine-plugin.

rachely3n avatar rachely3n commented on August 13, 2024

Weird, how did you reproduce that? It works fine for me in the UI.

from google-compute-engine-plugin.

stephenashank avatar stephenashank commented on August 13, 2024

I was only able to see subnetworks that were not default when I removed the block above.

To reproduce I did this: in cloud console, select VPC network then VPC networks and click on the default network. Then click Add subnet to create a custom subnet. Make sure to add it to the region that you are using for configuration, and choose any IP range that is allowed.

Then, I reopened the Jenkins configuration which already had the default network selected, and clicked on the dropdown. I expected to see both of the subnets for the network and region (default and the one I created) but only saw default.

from google-compute-engine-plugin.

rachely3n avatar rachely3n commented on August 13, 2024

Should be fixed as soon as we issue the next release.

from google-compute-engine-plugin.

rachely3n avatar rachely3n commented on August 13, 2024

Cut a release! Let me know how it goes @jhartnett. It is release 3.3.0.

from google-compute-engine-plugin.

yuri-sergiichuk avatar yuri-sergiichuk commented on August 13, 2024

I do have a concern about the current implementation because after updating to the latest v3.3.0 I receive the following response from the plugin while trying to start a slave:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
  "code" : 400,
  "errors" : [ {
    "domain" : "global",
    "message" : "Invalid value for field 'resource.networkInterfaces[0].subnetwork': 'No subnetworks exist in the given network and region.'. The URL is malformed.",
    "reason" : "invalid"
  } ],
  "message" : "Invalid value for field 'resource.networkInterfaces[0].subnetwork': 'No subnetworks exist in the given network and region.'. The URL is malformed."
}
	at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:146)
	at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
	at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:321)
	at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1067)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
	at com.google.jenkins.plugins.computeengine.client.ComputeClient.insertInstance(ComputeClient.java:359)
	at com.google.jenkins.plugins.computeengine.InstanceConfiguration.provision(InstanceConfiguration.java:284)
	at com.google.jenkins.plugins.computeengine.ComputeEngineCloud.doProvision(ComputeEngineCloud.java:411)

In my project, I still have a Legacy VPC network and thus there are no dedicated sub-networks in it. I have downgraded the plugin version to v3.2.0 to be able to start slaves again.

from google-compute-engine-plugin.

craigdbarber avatar craigdbarber commented on August 13, 2024

@stephenashank it looks like the previous PR which was submitted for this issue is now interfering with customers using legacy VPCs. Could you PTAL. Thanks.

from google-compute-engine-plugin.

stephenashank avatar stephenashank commented on August 13, 2024

I was able to track down the issue:

// Don't include subnetwork name if using default
if (!networkConfiguration.getSubnetwork().equals("default")) {
nic.setSubnetwork(stripSelfLinkPrefix(networkConfiguration.getSubnetwork()));
}

Previously when using a legacy VPC, I'm guessing the default subnetwork would be used in the NetworkConfiguration for the instance, and then in the block above when constructing the network interface, the subnetwork would be omitted. I should be able to fix this by allowing users to select an empty value for subnetwork, and then omitting it from the network interface in that case as well. Does that work for your use case @yuri-sergiichuk?

from google-compute-engine-plugin.

yuri-sergiichuk avatar yuri-sergiichuk commented on August 13, 2024

In my case, with the plugin v3.2.0, the subnetwork is automatically set to default. Is it what you're asking?

from google-compute-engine-plugin.

stephenashank avatar stephenashank commented on August 13, 2024

Yes that answered my question. The behavior should be restored for legacy VPCs with release 3.3.2 which was just deployed. It can take up to 8 hours to reach the update center, so please check that out when you can.

from google-compute-engine-plugin.

stephenashank avatar stephenashank commented on August 13, 2024

@yuri-sergiichuk Was your issue resolved?

from google-compute-engine-plugin.

stephenashank avatar stephenashank commented on August 13, 2024

No worries. In that case I will close this out.

from google-compute-engine-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.