Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11604 from wallyworld/merge-2.8-20200519
#11604 ## Description Merge 2.8 branch with these commits: #11585 don't write errors when pubsub socket disconnects #11583 k8s pod initialisaton races #11582 increase max wait time for WaitAdance #11573 finish legacy lease removal #11591 increase timeout in machine agent tests #11592 expose engine worker restart time as package variable #11507 add k8s model agent pod #11595 fix caas uniter restart on error #11593 add revoke leases so dead units lose their lease immediately #11594 fix deferreturn and bolt #11599 update deployment name used for model op ## QA Se individual PRs
- Loading branch information
Showing
148 changed files
with
3,735 additions
and
5,238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Copyright 2020 Canonical Ltd. | ||
// Licensed under the AGPLv3, see LICENCE file for details. | ||
|
||
package caasmodeloperator | ||
|
||
import ( | ||
"github.com/juju/errors" | ||
"github.com/juju/version" | ||
|
||
"github.com/juju/juju/api/base" | ||
"github.com/juju/juju/apiserver/params" | ||
) | ||
|
||
// Client is a caas model operator facade client | ||
type Client struct { | ||
facade base.FacadeCaller | ||
} | ||
|
||
// NewClient returns a client used to access the CAAS Operator Provisioner API. | ||
func NewClient(caller base.APICaller) *Client { | ||
facadeCaller := base.NewFacadeCaller(caller, "CAASModelOperator") | ||
return &Client{ | ||
facade: facadeCaller, | ||
} | ||
} | ||
|
||
// ModelOperatorProvisioningInfo represents return api information for | ||
// provisioning a caas model operator | ||
type ModelOperatorProvisioningInfo struct { | ||
APIAddresses []string | ||
ImagePath string | ||
Version version.Number | ||
} | ||
|
||
// ModelOperatorProvisioningInfo returns the information needed for a given model | ||
// when provisioning into a caas env | ||
func (c *Client) ModelOperatorProvisioningInfo() (ModelOperatorProvisioningInfo, error) { | ||
var result params.ModelOperatorInfo | ||
if err := c.facade.FacadeCall("ModelOperatorProvisioningInfo", nil, &result); err != nil { | ||
return ModelOperatorProvisioningInfo{}, err | ||
} | ||
|
||
return ModelOperatorProvisioningInfo{ | ||
APIAddresses: result.APIAddresses, | ||
ImagePath: result.ImagePath, | ||
Version: result.Version, | ||
}, nil | ||
} | ||
|
||
// SetPasswords sets the supplied passwords on their corresponding models | ||
func (c *Client) SetPassword(password string) error { | ||
var result params.ErrorResults | ||
modelTag, modelCon := c.facade.RawAPICaller().ModelTag() | ||
if !modelCon { | ||
return errors.New("not a model connection") | ||
} | ||
|
||
args := params.EntityPasswords{ | ||
Changes: []params.EntityPassword{{ | ||
Tag: modelTag.String(), | ||
Password: password, | ||
}}, | ||
} | ||
err := c.facade.FacadeCall("SetPasswords", args, &result) | ||
if err != nil { | ||
return errors.Trace(err) | ||
} | ||
return result.OneError() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2020 Canonical Ltd. | ||
// Licensed under the AGPLv3, see LICENCE file for details. | ||
|
||
package common | ||
|
||
import ( | ||
"github.com/juju/names/v4" | ||
|
||
"github.com/juju/juju/core/leadership" | ||
) | ||
|
||
// RevokeLeadershipFunc returns a function that revokes leadership for dead units. | ||
func RevokeLeadershipFunc(leadershipRevoker leadership.Revoker) func(names.Tag) { | ||
return func(tag names.Tag) { | ||
if tag.Kind() != names.UnitTagKind { | ||
return | ||
} | ||
appName, _ := names.UnitApplication(tag.Id()) | ||
if err := leadershipRevoker.RevokeLeadership(appName, tag.Id()); err != nil && err != leadership.ErrClaimNotHeld { | ||
logger.Warningf("cannot revoke lease for dead unit %q", tag.Id()) | ||
} | ||
} | ||
} |
Oops, something went wrong.