-
Notifications
You must be signed in to change notification settings - Fork 494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
propagate host's AZ to containers #7795
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally OK, but tests needed.
apiserver/allfacades.go
Outdated
@@ -197,7 +197,7 @@ func AllFacades() *facade.Registry { | |||
) | |||
|
|||
reg("Pinger", 1, NewPinger) | |||
reg("Provisioner", 3, provisioner.NewProvisionerAPI) | |||
reg("Provisioner", 4, provisioner.NewProvisionerAPI) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to keep version 3 around as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still use the same type as the change is additive so no new facade type is needed AFAIU.
I will add two entries as follows to have both of them in the facade registry:
reg("Provisioner", 3, provisioner.NewProvisionerAPI)
reg("Provisioner", 4, provisioner.NewProvisionerAPI)
} | ||
machine, err := p.getMachine(canAccess, tag) | ||
if err == nil { | ||
hc, err := machine.HardwareCharacteristics() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This creates a new err which won't be written into the Result below if it is != nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified to include this 601202b#diff-25f5ee83be4cfb0b2df7af7f3462f85aR376
@@ -348,6 +348,37 @@ func (p *ProvisionerAPI) Series(args params.Entities) (params.StringResults, err | |||
return result, nil | |||
} | |||
|
|||
// AvailabilityZone returns a provider-specific availability zone for each given machine entity | |||
func (p *ProvisionerAPI) AvailabilityZone(args params.Entities) (params.StringResults, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -227,6 +227,27 @@ func (m *Machine) Series() (string, error) { | |||
return result.Result, nil | |||
} | |||
|
|||
// AvailabilityZone returns an underlying provider's availability zone | |||
// for a machine | |||
func (m *Machine) AvailabilityZone() (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added tests for api client and apiserver sides, plus a feature test with container creation. Currently trying to figure out a failure in worker/provisioner/container_initialisation_test.go which was not changed in any of the above commits: go test -test.timeout=1500s github.com/juju/juju/worker/provisioner It looks like the behavior has changed slightly and we are now getting a different error message "instance data for machine not found" instead of ".failed to acquire initialization lock:.". To me it makes sense as the following step was added that errors out if there is no instance data for machine 1: 601202b#diff-87adff371122a7eaa0e08277c9d11033R266 I suggest we just change the test name and regex. |
pad.lv/1684325 Currently a provider-specific AZ is not propagated to containers deployed on any provider - during container creation an empty HardwareCharacteristics struct is initialized by a container manager. It is important for certain applications to have this value exposed as an environment variable in the hook context so that they can be configured to be aware of physical placement with respect to failure domains. Given that provisioner has an ability to query machine state via an apiserver facade, it is possible to get an availability zone for a machine with a given tag. For that a new API call is introduced to query that information.
agent and apiserver side tests + a test for availability zone retrieval and a container AZ test
Given that there is an additional step to retrieve host hardware characteristics we error out earlier than before and do not receive the same error message. For this reason the expected result was changed and the test was renamed.
!!build!! |
http://ci.jujucharms.com/blue/organizations/jenkins/github-check-merge-juju-pl/detail/PR-7795/7/pipeline#step-49-log-1552 Unable to reproduce it locally:
I will retry it one more time. |
!!build!! |
|
Don't have write access to merge apparently - need somebody else to merge this and #7795 |
|
Status: merge request accepted. Url: http://ci.jujucharms.com/job/github-merge-juju |
Description of change
pad.lv/1684325
Currently a provider-specific AZ is not propagated to containers
deployed on any provider - during container creation an empty
HardwareCharacteristics struct is initialized by a container manager.
It is important for certain applications to have this value exposed as
an environment variable in a hook context so that they can be
configured to be aware of physical placement with respect to failure
domains.
Given that provisioner has an ability to query machine state via
an apiserver facade, it is possible to get an availability zone for a
machine with a given tag. For that a new API call is introduced to query
that information.
QA steps
http://paste.ubuntu.com/25411705/
Documentation changes
Creates a new facade call AvailabilityZone which allows to query that field from hardware characteristics stored in state for a machine identified by a given tag.
Bug reference
https://bugs.launchpad.net/juju/+bug/1684325
https://bugs.launchpad.net/charm-ceph-osd/+bug/1684330