Commit Graph

118 Commits

Author SHA1 Message Date
Diogo Guerra 11bcc17568 Drop bay and baymodel from magnum
- Drop bay and baymodel tests
- Drop bay and baymodel from controllers

Depends-On: Ib85e4fda8e4ac467bd49590dc72ba5913bb9a19d

Story: 2009104
Task: 42957
Task: 42959

Signed-off-by: Diogo Guerra <diogo.filipe.tomas.guerra@cern.ch>
Change-Id: Ida2e42c86400438951d9804e3ce122c56a46b94f
2023-05-09 13:59:57 +00:00
Feilong Wang 16344a5a95 Add separated CA cert for etcd and front-proxy
Support creating different for k8s, etcd and front-proxy for
security hardening. We're following some best practices[1][2] but
adjusted based on the current Magnum deployment approach.

[1] https://kubernetes.io/docs/setup/best-practices/certificates/
[2] https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/

Task: 40687
Story: 2008031

Change-Id: I523a4a85867f82d234ba1f3e6fad8b8cd2291182
2021-04-01 17:31:34 +00:00
Sharma-Ritika 2a61e7dc1f [goal] Prepare pep8 testing for Ubuntu Focal
As per victoria cycle testing runtime and community goal,
we need to migrate upstream CI/CD to Ubuntu Focal(20.04).

Add noqa doe C901 and F811 pep8 for Focal, failure can be
seen in - https://review.opendev.org/#/c/743130

Depends-On: https://review.opendev.org/#/c/738328/

Change-Id: I95fa40551d842ce652ab937b8848c64f09a3e131
Story: #2007865
Task: #40190
2020-09-09 13:31:45 +05:30
Feilong Wang 946c1d67c7 Add master_lb_enabled to cluster
Adding the master_lb_enabled option when creating a cluster,
which will benefit both the cloud provider side and the end
user side. For cloud prodiver, they don't have to maintain
separate cluster templates with or w/o master_lb_enabled enabled.
For end user, they can easily use one single template to create
different clusters with different configs.

Task: 39680
Story: 2007634

Change-Id: I0b586f05168ece84fd340ef7493a56688191053d
2020-07-21 11:07:33 +12:00
Feilong Wang 32989b4f7b Allow setting network, subnet and FIP when creating cluster
When using a public cluster template, user still need the capability
to reuse their existing network/subnet, and they also need to be
able to turn of/off the floatingip to overwrite the setting in the
public template. This patch supports that by adding those three
items as parameters when creating cluster.

Story: 2006208
Task: 35797

Change-Id: I11579ff6b83d133c71c2cbf49ee4b20996dfb918
2019-07-31 20:41:20 +12:00
Theodoros Tsioutsias 3f80cbab06 ng-4: Adapt cluster object
This commit removes the fields node_addresses, master_addresses,
node_count and master_count from the cluster object since this info
will be stored in the nodegroups. At the same time, provides the way
to adapt existing clusters to the new schema.

story: 2005266

Change-Id: Iaf2cef3cc50b956c9b6d7bae13dbb716ae54eaf7
2019-03-29 10:31:48 +00:00
Theodoros Tsioutsias 18c77a288d ng-2: Adapt existing cluster APIs and conductor
This changes the existing cluster APIs and the cluster conductor to
take into consideration nodegroups:

* create: now creates the default nodegroups for the cluster
* update: updates the default nodegroups of the cluster
* delete: deletes also the nodegroups that belong to the cluster
* cluster_resize: takes into account the nodegroup provided by the API

story: 2005266

Change-Id: I5478c83ca316f8f09625607d5ae9d9f3c02eb65a
2019-03-28 10:31:01 +00:00
Erik Olof Gunnar Andersson 41cd85794f Use MultiType and types.text instead of str
The goal of this is to fix python3 compatibility issues.


story: 2003236
task: 23698
Change-Id: I555c7faecfcccaaa3649ef8c631b99a01e747c0b
2019-01-18 11:01:57 +00:00
Erik Olof Gunnar Andersson f2fd732ce2 Trivial code cleanups
Cleaning up comments and logging to make sure they properly adhere
to Openstack standards.

* Consistently use """ instead of ''' for comments.
* Always lazy-load logging parameters.
* Fixed bad log line in cert_manager.

Change-Id: I547f5dfa61609a899aef9b1470be8d8a6d8e4b81
2018-10-02 19:41:34 +00:00
Ricardo Rocha 84006f63d7 Allow flavor_id on cluster create
Add flavor_id as an option during cluster create. If not given,
the default is taken from the cluster template.

Add flavor_id in the Cluster object and use that instead
of the one from ClusterTemplate.

Update both magnum and magnum cli documentation to reflect the above changes.

Partial-Bug: #1699245
Change-Id: Ib60c05cce1cf2639ca4740abdd264403033433f9
2017-12-15 16:32:40 +00:00
Ricardo Rocha 446b159349 Allow master_flavor_id on cluster create
Add master_flavor_id as an option during cluster create. If not given,
the default is taken from the cluster template.

Add master_flavor_id in the Cluster object and use that instead
of the one from ClusterTemplate.

Update both magnum and magnum cli documentation to reflect the above changes.

Partial-Bug: #1699247
Change-Id: Id1d973167b381538121583a0a9691304b39e98de
2017-09-27 09:30:18 +00:00
Jenkins 04b4df0d74 Merge "Allow labels on cluster create" 2017-09-07 07:49:12 +00:00
chestack afa32e8672 Trivial typo fix
found it when work on something else

Change-Id: Ie13544fb4fb5ab8a8ebf0e2c0c6b02d87cebb189
2017-08-23 16:12:22 +08:00
Ricardo Rocha 3d04ed4cbb Allow labels on cluster create
Add labels as an option during cluster create. If not given,
the default is taken from the cluster template.

Add labels in the Cluster object and use that instead
of the one from ClusterTemplate.

Update both magnum and magnum cli documentation to reflect the above changes.

Partial-Bug: #1697651
Implements: blueprint flatten-attributes
Change-Id: I8990c78433dcbbca5bc4aa121678b02636346802
2017-08-21 12:27:52 +00:00
coldmoment ba8ad5e37f Add a hacking rule for string interpolation at logging
String interpolation should be delayed to be handled
by the logging code, rather than being done at the point
of the logging call.
See the oslo i18n guideline
* https://docs.openstack.org/oslo.i18n/latest/user/guidelines.html#adding-variables-to-log-messages
and
* https://github.com/openstack-dev/hacking/blob/master/hacking/checks/other.py#L39

Change-Id: I8a4f5f896865aebbff88ee894f0081e58cfce9ef
2017-07-15 14:49:45 +08:00
Mark Goddard f055d1691d Fix cluster inheritence of docker_volume_size
Following [1], cluster objects have a docker_volume_size attribute.
If not explicitly set on creation, the value of this attribute should
default to the value of the same field on the cluster's template.

When not provided, the API Cluster object's docker_volume_size field
takes the value wsme.Unset, rather than None.

[1]
79039bb419

Change-Id: Iad5231643c01ec9698c932b59806781034390795
Depends-On: I510ff10d708a237be0cb88d3ff7094d7c81f5875
Closes-Bug: #1702314
2017-07-04 17:44:38 +01:00
Ricardo Rocha 79039bb419 Allow docker_volume_size on cluster create
Add docker_volume_size as an option during cluster create. If not given,
the default is taken from the cluster template.

Add docker_volume_size in the Cluster object and use that instead
of the one from ClusterTemplate.

Update both magnum and magnum cli documentation to reflect the above changes.

Partial-Bug: #1697648
Implements: blueprint flatten-attributes
Change-Id: Ic6d77e6fdf5b068fa5319b238f4fd98b4d499be4
2017-06-23 11:31:27 +00:00
Mark Goddard f1326626b9 Pass a mutable target to oslo policy enforcer
Magnum API previously passed magnum.objects.cluster.Cluster objects as
the target argument to magnum.common.policy.enforce(). However, enforce()
expects target to be a mutable mapping, as it adds an entry for
trustee_domain_id which is used by the magnum policy.json. This causes
cluster detailed GET requests to fail with the following message:

AttributeError: 'Cluster' object has no attribute 'trustee_domain_id'

This change uses the as_dict() method of the magnum RPC objects to
provide a mutable mapping to the policy enforcer.

Change-Id: I54b136243afff9e0fadae3be4b36cad1679e5721
Closes-Bug: #1689797
2017-05-10 17:47:38 +01:00
yuanpeng 71d25456d2 Remove log translations
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: If1f4bd2f6be967368f52fb367c5a428d3eb58a9d
Closes-Bug:#1674551
2017-03-30 17:05:10 +08:00
Vijendar Komalla ee509ae323 Fix for cluster-update rollback issue
Currently cluster-update is rolling back in case of update
failure irrespective of whether the rollback flag set to
True or False. This change fixes the issue by setting the
right parameter type in cluster patch method.

Change-Id: I6c28c583e7e3b98622634ac2381513b442eb57b6
Closes-Bug: #1664781
2017-02-15 13:44:12 -06:00
Jaycen Grant 06f056f606 Allow keypair to be added during cluster create
Keypair can now be added during Cluster create command. This allows
Clusters to be created from the same ClusterTemplate but have
different keypair values when created. If not specified on create
then the value from the ClusterTemplate will be used. Adds keypair_id
to Cluster object and uses of keypair_id will use the value from Cluster
instead of ClusterTemplate.

Added release note for new features in magnum and magnum CLI.

Change-Id: I177a5aa06f881156944a9f74c9ccc3cd2abac492
Implements: blueprint keypair-override-on-create
2016-10-06 17:25:09 +00:00
Jaycen Grant 729c2d0ab4 Rename Bay DB, Object, and internal usage to Cluster
This is patch 3 of 3 to change the internal usage of the terms
Bay and BayModel.  This patch updates Bay to Cluster in DB and
Object as well as all the usages.  No functionality should be
changed by this patch, just naming and db updates.

Change-Id: Ife04b0f944ded03ca932d70e09e6766d09cf5d9f
Implements: blueprint rename-bay-to-cluster
2016-09-08 13:01:12 -07:00
Jaycen Grant 0b7c6401dd Rename BayModel DB, Object, and internal usage to ClusterTemplate
This patch is the first of 3 patches to change the internal
usage of the terms Bay and BayModel. This patch updates
BayModel to ClusterTemplate. No functionality should be
changed by this patch, just naming and db updates.

Change-Id: I0803e81be6482962be2878a8ea2c7480f89111ac
Implements: blueprint rename-bay-to-cluster
2016-09-01 14:47:39 -07:00
Jenkins 5258fddf9d Merge "Include version info in bay/cluster show operation" 2016-08-31 19:15:49 +00:00
Vijendar Komalla 50bc376c4d Include version info in bay/cluster show operation
Currently bay-show operation does not return bay/cluster
version information. This change contain changes to return
bay/cluster version and container version info.

Change-Id: Ie12b6583e6d85faa3607f87295c04d72698034a5
Closes-Bug: #1613413
2016-08-31 09:39:42 -05:00
yatin 272903ff9e Revert "Update mesos slave to mesos agent"
This reverts commit 15162ce33a.

Mesos services were not working, so reverted the patch
which renamed slave to agent.

Change-Id: I94a9a36e649f48f8e31386226226261ef459ce25
Closes-Bug: #1617407
2016-08-30 08:49:45 +05:30
yatin karel d82d8b2420 Get mandatory patch attrs from WSME properties
Attributes which are mandatory (ie, required for object creation) should
not be removable. However, some attributes (such as baymodel.server_type)
are not required for object creation, but should not be removable if they
are set. This commit does the following:

- rename JsonPatchType.mandatory_attrs to non_removable_attrs to better
  describe its meaning,
- change its return type to set-of-strings for faster lookup
- ensure all mandatory attributes on the type being patched are
  included in the set of non-removable attributes,
- add a new field, JsonPatchType._extra_non_removable_attrs, which
  should be a set of attributes that are not required for creation but
  should not be removed if set.

Since the object to be patched does not exist at patch-validation time,
we leave the validation logic in methods of JsonPatchType and
subclasses. This means introspecting the types to be patched.

This patch is copied from ironic [1].
[1] https://review.openstack.org/#/c/240202/9

Change-Id: Ifcfc4e48a05d75b919a33ef463754c199da94a8e
Close-Bug: #1530771
2016-08-23 10:23:19 +05:30
Jaycen Grant eaddb942fd Rename Bay to Cluster in api
This is the first of several patches to add new Cluster commands
that will replace the Bay terminalogy in Magnum. This patch adds
the new Cluster and ClusterTemplate commands in addition to the
Bay and Baymodel commands.  Additional patches will be created
for client, docs, and additional functional tests.

Change-Id: Ie686281a6f98a1a9931158d2a79eee6ac21ed9a1
Implements: blueprint rename-bay-to-cluster
2016-08-17 22:24:45 +00:00
Wenzhi Yu 63b5c21c8d Rollback bay on update failure
There is a rollback mechanism in heat after the stack
update failed. There should be a rollback mechanism in
magnum after bay update failed.

This patch add new microversion 1.3 to add rollback
support for Magnum bay, user can enable rollback on bay
update failure by specifying microversion 1.3 in header(
{'OpenStack-API-Version': 'container-infra 1.3'}) and
passing 'rollback=True'(http://XXX/v1/bays/XXX/?rollback=True)
when issuing bay update reqeust.

Change-Id: Idd02769f98078702404a11dc9f7a3339ce4e22eb
Partially-Implements: blueprint bay-rollback-on-update-failure
2016-08-15 17:09:23 +08:00
Vijendar Komalla bf30b9b4cb Support for async bay operations
Current implementation of magnum bay operations are synchronous
and as a result API requests are blocked until response from HEAT
service is received. With this change bay-create, bay-update and
bay-delete calls will be asynchronous.
Please note that with this change bay-create/bay-update api calls
will return bay uuid instead of bay object and also microversion
1.2 is added for new behavior.

Change-Id: I4ca1f9f386b6417726154c466e7a9104b6e6e5e1
Closes-Bug: #1588425
2016-08-11 09:28:34 -05:00
Jenkins 4799c13cd0 Merge "Add microversioning support for methods" 2016-08-04 08:40:05 +00:00
Jaycen Grant e6a71b9e6d Add microversioning support for methods
Adds the functionality to allow versioning of api methods
based by adding a decorator api_version("min_version",
"max_version"). This is similar to how nova implemented api
versioning but updated to work with pecan.

Change-Id: Ie18d92531487f7c107b5132b3d35f38bd0a37aa0
Implements: blueprint api-versioning
2016-08-03 13:28:48 -07:00
Eli Qiao e4a8242b96 API: restrict length of bay's name to 242
Restrict the length of bay's name to avoid passing a invalid long name
to heat stack.

Reason of 242 is:
stack_name = '%s-%s' % (bay.name, short_id.generate_id())
255 - len(short_id.generate_id()) - 1 = 242

Closes-bug: #1606785
Change-Id: If22a9018ece718f014c40e8059b945ae1a411f5b
2016-08-02 09:12:29 +08:00
Rajiv Kumar c89829622c Bay name must start with alphabets only
Bay name should start with only small or capital letter. Names
can contain small letter([a-z]), capital letter([A-Z]), hypen(-),
digits([0-1]), underscore (_) and periods (.). Names should follow
^[a-zA-Z][a-zA-Z0-9_.-]*$ regular expression.

Change-Id: I7581f0a99cee5708601b11c571a774acbeace3bd
Closes-Bug: #1605561
2016-07-28 08:28:17 +05:30
Rajiv Kumar 15162ce33a Update mesos slave to mesos agent
Mesos community has renamed slave to agent. This change reflect
this renaming in the code.

Change-Id: Ic97a827345b62f812ed63180cd1f5820e2200682
Closes-Bug: #1516188
2016-07-18 08:51:17 +05:30
Jenkins f8fa49d144 Merge "Allow k8s cluster without LBaaS" 2016-07-08 15:50:18 +00:00
yuyafei 85a2fdd70b Correct reraising of exception
When an exception was caught and rethrown, it should call 'raise'
without any arguments because it shows the place where an exception
occured initially instead of place where the exception re-raised.

Change-Id: If180215bda5592c0cba92cb2c9b3a61c13d62ccf
2016-07-08 12:25:23 +08:00
Drago Rosson 2ea72d739d Allow k8s cluster without LBaaS
This patch adds an environment file and a couple of template resources
to allow the LBaaS resources to be conditionally enabled/disabled.

Change-Id: I40ef0839dca84f398efb02022fa7c1de821fb1a3
Partially-Implements: blueprint decouple-lbaas
Partially-Implements: blueprint bay-with-no-floating-ips
2016-07-06 15:01:00 -05:00
PanFengyun f5150078ee Bay_create_timeout should be set to 60 default
Bay_create_timeout default is 0 and means that magnum create bay
without timeout. But heat create stack with timeout absolutely.
So it is impossible to create bay without timeout. And I had send
a patch which allow heat to create stack without timeout, but the
core of heat did not agree with it.
The patch is: https://review.openstack.org/#/c/334138/

Change-Id: Iebc9915dcf2894a2dbed912244a2c7c308b4d9d7
Closes-bug: #1590636
2016-07-03 23:26:32 +08:00
Wenzhi Yu dae88dda59 Auto generate Bay/BayModel name
Add a feature to Magnum to auto-generate human readable names,
like Docker does for un-named containers. Use this feature if
no name is specified upon the creation of a Bay/Baymodel.

Change-Id: I290fb4ad0692c63e6e40af3ec705f205c5ec66d3
Partially-Implements: blueprint auto-generate-name
2016-06-17 19:02:55 +08:00
Wenzhi Yu c01420e29a Set 'nested_depth=2' when calling heat.resources.list
Since Heat bug[1] have already been fixed, now we can set
'nested_depth=2' when calling heat().resources.list(), see
the TODO comment inline[2].

This is a follow up patch for patch 318416, see[3] for detail.

[1]https://bugs.launchpad.net/heat/+bug/1588130
[2]678f74c12e/magnum/api/controllers/v1/bay.py (L283)
[3]https://review.openstack.org/#/c/318416/

Change-Id: I7d9712510ace9de9c965d24583f8d31961114b16
2016-06-10 19:44:06 +08:00
Wenzhi Yu 678f74c12e Put fault info of bay resources into bay-show outputs
In order to debug a failing bay creation, users need to know about
interaction with heat, heat architecture and how to debug it.
It would be much better if magnum could propagate some of the error
description into the bay-show status.

This patch proposes a way to do this:
If a bay was in error status('CREATE_FAILED', 'UPDATE_FAILED',
'DELETE_FAILED'), we collect fault info from heat resources of the
bay and put the fault info into 'bay-show' command outputs.

Change-Id: I458f1619243bf44f5f0e7dd2a5d6cd10ed2d0fde
Partially-Implements: blueprint explain-errors
2016-06-07 08:42:06 +08:00
Jenkins a7b12b02a7 Merge "Pass target in enforce" 2016-03-10 22:10:37 +00:00
Hua Wang bf84fdf99a Pass target in enforce
As described in [1], we should pass bay or baymodel as target in
enforce. Otherwise we can not user generic-checks. We need this
check for some situations, for example only allow the user who
creates a bay can delete the bay.

http://docs.openstack.org/developer/oslo.policy/api/
oslo_policy.html#generic-checks

Change-Id: I60f8870dd1a2bb07efbadf5f16a453f0a2e0cb3d
Closes-Bug: #1553914
2016-03-09 16:40:05 +08:00
Aaron-DH bc5a61d212 Remove method which has no rpc calls
API like bay-list/container-list/magnum-service-list etc..
there is no rpc call and only access the database in these methods
move them to api controller.

Change-Id: Icdee1c5d3d835efd57238fb4cb8e897485da9b6d
Closes-Bug:#1552131
2016-03-08 14:43:51 +08:00
wangqun 4d39d8cc94 Fix baymodel with invalid parameter can created.
Now, when we create baymodel with the invalid flavor_id and
master_flavor_id parameters, the baymodel can be created
successfully.

We need to validate the flavor_id and master_flavor before
creating baymodel.

Change-Id: Id6768d8246c97d56e529cbc1cab6c8c7d28ca43a
Closed-Bug: #1547345
2016-03-02 15:44:09 -05:00
Hua Wang 138483a0bd Rename get_rpc_resource to get_resource
Rename get_rpc_resource to get_resource. Because there is no rpc
call in this method.

Change-Id: I4dfba86b9932c9def08959f7fb1df98b7bc41436
Closes-Bug: #1549650
2016-02-26 10:06:00 +08:00
Hua Wang 725bd5c99d Create a trustee user for each bay
Docker registry, k8s load balancer and volume driver have a similar
need to use trust, so we need to create a trustee for each bay.

Change-Id: If034e74ce2ea80a7faa886d4edf789e576c30eb5
Partially-Implements: blueprint create-trustee-user-for-each-bay
2016-02-18 18:16:35 +08:00
Jenkins 3279334987 Merge "API: Move validate_properties to REST API layer" 2016-02-14 08:40:42 +00:00
Eli Qiao f9a087e912 API: Move validate_properties to REST API layer
We restrict that only node_count can be modified, this can be moved into
REST API layer before we send request to conductor though rpc.

Besides, remove some bad test case in REST API layer
Change-Id: I5a73488d0c7529ea2e1416a9e41b4893f220a25a
2016-02-05 16:57:02 +08:00