Problem/Motivation

Add the identifier to tags in K8s to distinguish multiple Cloud Orchestrator access.

Issue fork cloud-3208670

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sekinet created an issue. See original summary.

sekinet’s picture

StatusFileSize
new28.18 KB
sekinet’s picture

StatusFileSize
new29.93 KB
sekinet’s picture

StatusFileSize
new29.93 KB
sekinet’s picture

Status: Active » Needs review

@yas I have created a patch. Could you please check it?

sekinet’s picture

StatusFileSize
new41.49 KB
yas’s picture

@sekinet

Thank you for the refactoring. It looks good to me.

@xiaohua-guan

What do you think?

xiaohua guan’s picture

@yas @sekinet

I posted my comment. Please check it.

sekinet’s picture

@xiaohua-guan @yas
Thank you for your confirmation. Could you please check that I have corrected it?

sekinet’s picture

StatusFileSize
new41.41 KB
yas’s picture

Status: Needs review » Needs work
StatusFileSize
new543.39 KB

@sekinet

Thank you for the update. I tested the patch and had the following error.

An error occurred when calling K8s API: PUT /namespaces/admin-project-20210322-005514
Status Code: 422
Error reason: Invalid
Message: Namespace "admin-project-20210322-005514" is invalid: metadata.annotations: Invalid value: "k8s_created_by_uid__5f711c16-73c7-4326-89cc-95dc4e36a3c0__cloudopt_k8s_1": name part must be no more than 63 characters
The Namespace admin-project-20210322-005514 could not be updated.

29.png

I think we need to consider the length of UUID. e.g.

  • Shorten the tag key prefix from k8s_created_by_uid to k8s_created_uid.
  • Just use the last hex such as 95dc4e36a3c0 in our case.
  • Restrict and validate the length of the name in K8s cloud service provider creation form by considering the tag prefix and UUID.
sekinet’s picture

StatusFileSize
new42.84 KB
yas’s picture

@sekinet

Thank you for the update. I have one comment. Thanks

sekinet’s picture

StatusFileSize
new49.35 KB
sekinet’s picture

Status: Needs work » Needs review

@yas Thank you for your comments. It has been fixed.

yas’s picture

Status: Needs review » Needs work

@sekinet

Thank you for the update --- Did you update / push the patch into your working branch? I couldn't find the change that I requested.

As I commented above, I suggest the following:

  1. Since getTagCreatedByUid is common, so we should move it to CloudContentEntityTrait::getTagCreatedByUid($bundle, $cloud_context). ($bundle should be basically equal to a module name.)
  2. We can change the description in each cloud service provider form in e.g. k8s_form_cloud_config_k8s_add_form_alter(). We need to implement in the tag supported modules such as aws_cloud, k8s, and openstack.
sekinet’s picture

StatusFileSize
new82.59 KB
sekinet’s picture

Status: Needs work » Needs review
StatusFileSize
new82.93 KB
yas’s picture

Status: Needs review » Needs work

@sekinet

Thank you for the update. I posted my comments. Please check the ones. Thanks

sekinet’s picture

StatusFileSize
new141.14 KB
sekinet’s picture

StatusFileSize
new143.01 KB
sekinet’s picture

Status: Needs work » Needs review

@yas Thank you for your comments. Could you please confirm that I have fixed the patch?

yas’s picture

Status: Needs review » Needs work

@sekinet

Thank you for the update. I posted my comments above. Basically we can use a global service container such as \Drupal::service('cloud') in *.module so that we don't have to introduce the new method CloudContentEntityTrait::getCloudService().

sekinet’s picture

StatusFileSize
new152.88 KB
sekinet’s picture

Status: Needs work » Needs review

@yas Thank you for your comments. Could you please confirm that I have fixed the patch?

yas’s picture

Status: Needs review » Needs work

@sekinet

As per our discussion, please let us change the status to Needs work to double-check AWS tag creation.

sekinet’s picture

Status: Needs work » Needs review
StatusFileSize
new156.22 KB

@yas After rechecking the AWS tag creation, I created a patch because it needed to be fixed. Could you please check it?

sekinet’s picture

StatusFileSize
new156.32 KB
yas’s picture

Status: Needs review » Reviewed & tested by the community

@sekinet

Thank you for the update. I tested the patch and it looks good to me. I'll change the status of this issue to RTBC. Please let us hold this patch until we create the 4.x branch. Thanks

yas’s picture

Title: Add the identifier to tags in K8s to distinguish multiple Cloud Orchestrator access » Refactor getTagCreatedByUid() to distinguish multiple Cloud Orchestrator access
sekinet’s picture

Status: Reviewed & tested by the community » Needs review
sekinet’s picture

Status: Needs review » Needs work
sekinet’s picture

Status: Needs work » Needs review
StatusFileSize
new343.29 KB

Status: Needs review » Needs work

The last submitted patch, 34: 3208670-34.diff, failed testing. View results

sekinet’s picture

Status: Needs work » Needs review
StatusFileSize
new350.86 KB
yas’s picture

Status: Needs review » Needs work

@sekinet

Thank you for adding the test cases. It looks good to me but one thing that I want ask you is to keep the blank lines in SecurityGroupTest for the code readability if you don't have any specific reasons that you removed the ones. Thanks

sekinet’s picture

Status: Needs work » Needs review
StatusFileSize
new332.55 KB

@yas Thank you for your comment. I've fixed it, could you please check it?

yas’s picture

Status: Needs review » Reviewed & tested by the community

@sekinet

Thank you for the update. It looks good to me to now. I'll change the status of this issue to RTBC. Please let us hold this patch until we create the 4.x branch. Thanks

sekinet’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new460.46 KB

@yas Added refactor and test cases for openstack. Could you please check it?

sekinet’s picture

Status: Needs review » Needs work
sekinet’s picture

StatusFileSize
new462.37 KB
sekinet’s picture

StatusFileSize
new467.43 KB
sekinet’s picture

StatusFileSize
new467.32 KB
sekinet’s picture

Status: Needs work » Needs review

@yas Thank you for your comments. I've made the fix, Could you please check it?

yas’s picture

@sekinet

Thank you for the update. It looks good.

@xiaohua-guan

Could you please review the patch? Thanks

sekinet’s picture

StatusFileSize
new476.08 KB
xiaohua guan’s picture

@yas @sekinet

It looks good to me now. Thanks.

sekinet’s picture

StatusFileSize
new475.58 KB
sekinet’s picture

StatusFileSize
new477 KB
yas’s picture

@sekinet

Thank you for the update. It looks good to me.

@baldwinlouie

What do you think? Thanks

baldwinlouie’s picture

Status: Needs review » Needs work

@yas and @sekinet

This is a great patch. I have the above comments.

sekinet’s picture

StatusFileSize
new476.38 KB
sekinet’s picture

Status: Needs work » Needs review

@baldwinlouie @yas

Thanks to both of you for your comments.
I have fixed it. I also fixed the test module as well because it can be done in $this->cloudService->getTagCreatedByUid()

could you please check it?

yas’s picture

Status: Needs review » Reviewed & tested by the community

@baldwinlouie

Thank you for your reivew.

@sekinet

Thank you for the update. It looks good now. I'll change the status to RTBC. I'll merge the patch to 4.x branch when it's ready.

yas’s picture

Status: Reviewed & tested by the community » Needs work

@sekinet

The patch is now behind against HEAD. Could you please rebase and resolve the conflicts? I'll change the status to Needs work. Thanks

sekinet’s picture

StatusFileSize
new473.39 KB
sekinet’s picture

Status: Needs work » Needs review

@yas I've rebased and resolved the conflicts. Could you please confirm?

yas’s picture

Status: Needs review » Reviewed & tested by the community

@sekinet

Thank you for the update. It looks good. I'll change the status to RTBC. I'll merge the patch to 4.x branch when it's ready.

yas’s picture

Version: 3.x-dev » 4.x-dev
yas’s picture

Status: Reviewed & tested by the community » Needs work

@sekinet

@all

The patch is now behind against HEAD on 4.x branch. I'll take over to fix and change the status to Needs work. Thanks

sekinet’s picture

Status: Needs work » Needs review

@yas I've rebased and resolved the conflicts. Could you please check it?

yas’s picture

Status: Needs review » Reviewed & tested by the community

@sekinet

Thank you for the rebase. It looks good. The tests have been passed successfully, so I'll merge the patch to 4.x and close this issue as Fixed.

  • yas committed 37cc35f on 4.x authored by sekinet
    Issue #3208670 by sekinet, yas, Xiaohua Guan, baldwinlouie: Refactor...
yas’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.