-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a new caas model operator to Juju
- Introduces a new command juju model that will be triggered as a k8s deployment by juju for each model created. - Moves the cass admission logic to this new command - Adds passwords for the operator to the model doc state - New http server worker for simple agents
- Loading branch information
Showing
52 changed files
with
1,999 additions
and
113 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.