You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by Ruben Rubio Rey <tk...@gmail.com> on 2015/02/20 03:30:21 UTC
JClouds GCE Metadata no credentials
Hi everyone,
I am trying to create an instance in GCE with a volume attached.
Because of I am customizing the volumes I am using instanceAPI
GoogleComputeEngineApi gce = context.unwrapApi(GoogleComputeEngineApi.class);
NewInstance instance = NewInstance.create(NAME, machineType,
networkType, uriImage);
InstanceApi instanceApi = gce.instancesInZone(ZONE);
instanceApi.create(instance);
Then I want to get the credentials of that image. As I am Strategy to
create the instance depending on the supplier, so for me it convenient to
get a Nodemetadata
nodePreBuiltId is somerhing like
https://www.googleapis.com/compute/v1/projects/soy-sound-613/zones/asia-east1-a/instances/m456-7ae
List<String> idList = new ArrayList<>();
idList.add(nodePreBuiltId);
nodes = computeService.listNodesByIds(idList);
this returns the NodeMetaData, but the credentials are null.
How can I retrieve the instance credentials in this case ?
Regards,
Ruben
Re: JClouds GCE Metadata no credentials
Posted by Ruben Rubio Rey <tk...@gmail.com>.
Hi Ignasi,
Thanks for the idea. I agree it is the best way to solve the problem
Regards,
Ruben
On Fri, Feb 20, 2015 at 9:18 PM, Ignasi Barrera <na...@apache.org> wrote:
> Unfortunately the GCE API does not return the node credentials (few
> provider APIs do), so you won't be able to get them.
>
> When using the ComputeService, jclouds persists the credentials for
> each node it provisions in an internal credential store, so they can
> be used later to bootstrap the nodes, but since you are creating the
> instances manually, the credentials are not persisted.
>
> What you can do is to configure the credentials when you create the
> instance so you know them in advance. You can do that by configuring
> the instance metadata the same way the GCE ComputeService
> implementation does:
>
> https://github.com/jclouds/jclouds-labs-google/blob/master/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java#L139-L143
>
>
> HTH!
>
> I.
>
> On 20 February 2015 at 03:30, Ruben Rubio Rey <tk...@gmail.com> wrote:
> > Hi everyone,
> >
> > I am trying to create an instance in GCE with a volume attached.
> >
> >
> > Because of I am customizing the volumes I am using instanceAPI
> >
> > GoogleComputeEngineApi gce =
> > context.unwrapApi(GoogleComputeEngineApi.class);
> > NewInstance instance = NewInstance.create(NAME, machineType, networkType,
> > uriImage);
> > InstanceApi instanceApi = gce.instancesInZone(ZONE);
> > instanceApi.create(instance);
> >
> > Then I want to get the credentials of that image. As I am Strategy to
> create
> > the instance depending on the supplier, so for me it convenient to get a
> > Nodemetadata
> >
> > nodePreBuiltId is somerhing like
> >
> https://www.googleapis.com/compute/v1/projects/soy-sound-613/zones/asia-east1-a/instances/m456-7ae
> >
> > List<String> idList = new ArrayList<>();
> > idList.add(nodePreBuiltId);
> > nodes = computeService.listNodesByIds(idList);
> >
> > this returns the NodeMetaData, but the credentials are null.
> >
> > How can I retrieve the instance credentials in this case ?
> >
> > Regards,
> > Ruben
> >
>
Re: JClouds GCE Metadata no credentials
Posted by Ignasi Barrera <na...@apache.org>.
Unfortunately the GCE API does not return the node credentials (few
provider APIs do), so you won't be able to get them.
When using the ComputeService, jclouds persists the credentials for
each node it provisions in an internal credential store, so they can
be used later to bootstrap the nodes, but since you are creating the
instances manually, the credentials are not persisted.
What you can do is to configure the credentials when you create the
instance so you know them in advance. You can do that by configuring
the instance metadata the same way the GCE ComputeService
implementation does:
https://github.com/jclouds/jclouds-labs-google/blob/master/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java#L139-L143
HTH!
I.
On 20 February 2015 at 03:30, Ruben Rubio Rey <tk...@gmail.com> wrote:
> Hi everyone,
>
> I am trying to create an instance in GCE with a volume attached.
>
>
> Because of I am customizing the volumes I am using instanceAPI
>
> GoogleComputeEngineApi gce =
> context.unwrapApi(GoogleComputeEngineApi.class);
> NewInstance instance = NewInstance.create(NAME, machineType, networkType,
> uriImage);
> InstanceApi instanceApi = gce.instancesInZone(ZONE);
> instanceApi.create(instance);
>
> Then I want to get the credentials of that image. As I am Strategy to create
> the instance depending on the supplier, so for me it convenient to get a
> Nodemetadata
>
> nodePreBuiltId is somerhing like
> https://www.googleapis.com/compute/v1/projects/soy-sound-613/zones/asia-east1-a/instances/m456-7ae
>
> List<String> idList = new ArrayList<>();
> idList.add(nodePreBuiltId);
> nodes = computeService.listNodesByIds(idList);
>
> this returns the NodeMetaData, but the credentials are null.
>
> How can I retrieve the instance credentials in this case ?
>
> Regards,
> Ruben
>