Skip to content
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

Add description to resource capi created #870

Merged
merged 2 commits into from
May 25, 2021

Conversation

jichenjc
Copy link
Contributor

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
part of #868

please note server description not added yet
gophercloud/gophercloud#1505

I need drive that...

Special notes for your reviewer:

  1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

TODOs:

  • squashed commits
  • if necessary:
    • includes documentation
    • adds unit tests

/hold

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 19, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jichenjc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 19, 2021
@hidekazuna
Copy link
Contributor

Adding clusterName to function argument only for description is not good. Can we add clusterName to each Service struct and use it?

@jichenjc
Copy link
Contributor Author

Adding clusterName to function argument only for description is not good. Can we add clusterName to each Service struct and use it?

I think we did this all the time :) e.g do some logging etc to add a param, I am not sure why it's not good
but I agree this might be a good suggestion to include this into Service object

@sbueringer
Copy link
Member

sbueringer commented May 19, 2021

Adding clusterName to function argument only for description is not good. Can we add clusterName to each Service struct and use it?

I think we did this all the time :) e.g do some logging etc to add a param, I am not sure why it's not good
but I agree this might be a good suggestion to include this into Service object

I think I would prefer your current implementation righ tnow. If we put it into the service we have to make all those funcs methods.

@jichenjc
Copy link
Contributor Author

ok, then please check whether current code is ok ..thanks

@sbueringer
Copy link
Member

ok, then please check whether current code is ok ..thanks

Yup will do. Probably will need until next week. Pretty busy right now.

@hidekazuna
Copy link
Contributor

Adding clusterName to function argument only for description is not good. Can we add clusterName to each Service struct and use it?

I think we did this all the time :) e.g do some logging etc to add a param, I am not sure why it's not good
but I agree this might be a good suggestion to include this into Service object

I think I would prefer your current implementation righ tnow. If we put it into the service we have to make all those funcs methods.

Almost(All?) done by #871, PTAL. @jichenjc It is ok not to add clusterName into each Service struct in this PR 😸

PortID: portID,
Name: trunkName,
PortID: portID,
Description: fmt.Sprintf("Created by cluster-api-provider-openstack cluster %s", clusterName),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description value is common among packages. Can we create common func among packages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, I can modify this ~

@jichenjc jichenjc force-pushed the add_description-1 branch 2 times, most recently from d7661df to 3fbd638 Compare May 24, 2021 01:34
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 24, 2021
@hidekazuna
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 24, 2021
Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise lgtm

limitations under the License.
*/

package utils
Copy link
Member

@sbueringer sbueringer May 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having a generic utils package named utils (without further sub packages) is an absolute anti-pattern in go. Please create a sub-package with a less-generic name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree with @sbueringer 😄

@hidekazuna
Copy link
Contributor

/lgtm cancel

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels May 24, 2021
@jichenjc jichenjc force-pushed the add_description-1 branch from b28ad43 to f9910e4 Compare May 25, 2021 00:24
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 25, 2021
pkg/cloud/services/compute/instance.go Outdated Show resolved Hide resolved
@@ -410,7 +411,7 @@ func (s *Service) getOrCreatePort(eventObject runtime.Object, clusterName string
return port, nil
}

func (s *Service) getOrCreateTrunk(eventObject runtime.Object, trunkName, portID string) (*trunks.Trunk, error) {
func getOrCreateTrunk(eventObject runtime.Object, clusterName, trunkName, portID string) (*trunks.Trunk, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrongly rebased. Now we need (s *Service)

@@ -194,7 +195,7 @@ func (s *Service) ReconcileSubnet(openStackCluster *infrav1.OpenStackCluster, cl
var subnet *subnets.Subnet
if len(subnetList) == 0 {
var err error
subnet, err = s.createSubnet(openStackCluster, subnetName)
subnet, err = createSubnet(openStackCluster, clusterName, subnetName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrongly rebased. Now we need s.

@@ -212,13 +213,14 @@ func (s *Service) ReconcileSubnet(openStackCluster *infrav1.OpenStackCluster, cl
return nil
}

func (s *Service) createSubnet(openStackCluster *infrav1.OpenStackCluster, name string) (*subnets.Subnet, error) {
func createSubnet(openStackCluster *infrav1.OpenStackCluster, clusterName string, name string) (*subnets.Subnet, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrongly rebased. Now we need (s *Service)

@@ -65,7 +66,7 @@ func (s *Service) ReconcileRouter(openStackCluster *infrav1.OpenStackCluster, cl
var router *routers.Router
if len(routerList) == 0 {
var err error
router, err = s.createRouter(openStackCluster, routerName)
router, err = createRouter(openStackCluster, clusterName, routerName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrongly rebased. Now we need s.

@jichenjc jichenjc force-pushed the add_description-1 branch from f9910e4 to f3088d8 Compare May 25, 2021 00:40
@sbueringer
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 25, 2021
@sbueringer
Copy link
Member

@jichenjc imho you can squash & merge

@jichenjc jichenjc merged commit 55ec7fa into kubernetes-sigs:master May 25, 2021
@sbueringer
Copy link
Member

sbueringer commented May 25, 2021

@jichenjc I actually meant squash the commit and then merge via Prow with /hold cancel (not via the GitHub button which only admins have access to) :)

@jichenjc
Copy link
Contributor Author

@sbueringer @hidekazuna I found I can squahs and merge this directly which is dangerous .. I think better leave this to a flow such as /hold cancel , /lgtm etc, not sure we can do that ?

If you think I need revert this , please let me know

image

@sbueringer
Copy link
Member

See: #870 (comment)

I think we don't have to revert it. It just added your PR as one commit on the master branch.
The only impact it has is that the release note tool won't pick it up, but that's not a problem.

We just should keep doing it via the regular process the next time.

pierreprinetti pushed a commit to shiftstack/cluster-api-provider-openstack that referenced this pull request Apr 22, 2024
* Add description to resource capi created
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants