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

Refine the other operator related names #631

Merged
merged 1 commit into from
Mar 12, 2021
Merged

Refine the other operator related names #631

merged 1 commit into from
Mar 12, 2021

Conversation

zhangtbj
Copy link
Contributor

@zhangtbj zhangtbj commented Mar 1, 2021

Changes

After the PR Rename Shipwright components away from "operator": #610

There are still some codes and comments which uses operator which may make end user or new developer confusion.
If we decide to swtich build operator to Shipwright build controller, we should review all codes and switch them all.

  • Still keep operator-sdk related words as before
  • Modify the code and related properties, etc ...
  • Modify in the documents
  • Modify in the test codes
  • Update the version of the Shipwright build controller from 0.0.1 to 0.3.0

/kind cleanup

Submitter Checklist

  • [ n ] Includes tests if functionality changed/was added
  • [ n ] Includes docs if changes are user-facing
  • [ y ] Set a kind label on this PR
  • [ y ] Release notes block has been filled in, or marked NONE

See the contributor guide
for details on coding conventions, github and prow interactions, and the code review process.

Release Notes

Renamed "build operator" to "build controller" in code and documentation.

@openshift-ci-robot openshift-ci-robot added release-note Label for when a PR has specified a release note do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Mar 1, 2021
@openshift-ci-robot
Copy link

@zhangtbj: The label(s) kind/misc cannot be applied, because the repository doesn't have them

In response to this:

Changes

There are still some codes and comments which uses operator which may make end user or new developer confusion.
If we decide to swtich build operator to Shipwright build controller, we should review all codes and switch them all.

  • Still keep operator-sdk related words as before
  • Modify the code and related properties, etc ...
  • Modify in the documents
  • Modify in the test codes
  • Update the version of the Shipwright build controller from 0.0.1 to 0.3.0

/kind misc

Submitter Checklist

  • Includes tests if functionality changed/was added
  • Includes docs if changes are user-facing
  • Set a kind label on this PR
  • Release notes block has been filled in, or marked NONE

See the contributor guide
for details on coding conventions, github and prow interactions, and the code review process.

Release Notes

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@zhangtbj
Copy link
Contributor Author

zhangtbj commented Mar 1, 2021

/kind cleanup

@openshift-ci-robot openshift-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Mar 1, 2021
version/version.go Outdated Show resolved Hide resolved
@gabemontero
Copy link
Member

@zhangtbj you currently have a release-note set but with no text

was your intent to have a release note, or to not have one? Or is determining that part of the work in progress?

@zhangtbj zhangtbj changed the title WIP: Refine the other operator related names Refine the other operator related names Mar 2, 2021
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 2, 2021
@zhangtbj zhangtbj removed the release-note Label for when a PR has specified a release note label Mar 2, 2021
@zhangtbj
Copy link
Contributor Author

zhangtbj commented Mar 2, 2021

Hi @gabemontero my mistake.

It doesn't require the release notes. Just the internal fix for the renaming.

I remove the release-notes label.

Thanks!

@gabemontero gabemontero added the release-note-none Label for when a PR does not need a release note label Mar 2, 2021
@openshift-ci-robot openshift-ci-robot added release-note Label for when a PR has specified a release note release-note-none Label for when a PR does not need a release note and removed release-note-none Label for when a PR does not need a release note release-note Label for when a PR has specified a release note labels Mar 2, 2021
// but it disables the prometheus metrics and leader election. This intended
// to for testing.
func (t *TestBuild) StartBuildOperator() (chan struct{}, error) {
func (t *TestBuild) StartBuildController() (chan struct{}, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I did a similar comment somewhere else, this function actually starts a manager, which is an interface in the controller-runtime pkg. I think StartManager is a better name, rather than a search/replace approach.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!, two cents:

  • I think the logic should be: start a controller and controller starts a manager, so manager should be included in the controller, and the goal of this file is used to start a controller for test, not start a manager as a internal usage.
  • I am not sure if we want to add more config beside of manager in future to enrich the test.

So I prefer to keep StartBuildController.

But I am fine for both names.

Copy link
Contributor

Choose a reason for hiding this comment

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

Technically speaking this function does the following:

  • Add all controllers to the manager, so we add four
  • Starts all registered Controllers and blocks until the Stop channel is closed

For me StartBuildController is missleading, can we call this StartControllers?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for renaming, either Manager or Controllers

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 and fixed. Thanks all

@qu1queee
Copy link
Contributor

qu1queee commented Mar 2, 2021

Note: If possible it would be nice if #632 can go first, that PR should have higher priority in general, but no strong opinions if that doesnt happen. Thanks for this missing enhancements @zhangtbj

@HeavyWombat
Copy link
Contributor

Note: If possible it would be nice if #632 can go first, that PR should have higher priority in general, but no strong opinions if that doesnt happen. Thanks for this missing enhancements @zhangtbj

@zhangtbj @qu1queee Quick question: Since we removed any "operator" references from the End to End test anyway in #632, we could also consider removing any changes done here in the test/e2e directory from this PR.

@qu1queee
Copy link
Contributor

qu1queee commented Mar 3, 2021

@HeavyWombat thats a question for @zhangtbj

@@ -119,7 +119,7 @@ jobs:
make install-controller-kind
kubectl -n shipwright-build rollout status deployment shipwright-build-controller --timeout=1m || true
- name: Test
run: TEST_E2E_OPERATOR=managed_outside TEST_NAMESPACE=shipwright-build TEST_IMAGE_REPO=registry.registry.svc.cluster.local:32222/shipwright-io/build-e2e make test-e2e
run: TEST_E2E_CONTROLLER=managed_outside TEST_NAMESPACE=shipwright-build TEST_IMAGE_REPO=registry.registry.svc.cluster.local:32222/shipwright-io/build-e2e make test-e2e
Copy link
Contributor

Choose a reason for hiding this comment

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

We tackled that in #632. Like commented somewhere else too, I would opt for leaving the end to end tests untouched in this PR here.

Copy link
Contributor Author

@zhangtbj zhangtbj Mar 5, 2021

Choose a reason for hiding this comment

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

Thank you Matthias, agree. But it is hard to extract the change in multiple files. Let us merge the #632 PR first, then I will resolve the conflict here.

Makefile Outdated
Comment on lines 38 to 39
# E2E test controller behavior, can be start_local or managed_outside
TEST_E2E_CONTROLLER ?= start_local
Copy link
Contributor

Choose a reason for hiding this comment

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

E2E related

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Matthias, I think this PR can be wait until your PR is merged: #632

Then I can rebase and refactor the e2e related change later.

Makefile Outdated
TEST_WATCH_NAMESPACE=${TEST_NAMESPACE} \
TEST_E2E_OPERATOR=${TEST_E2E_OPERATOR} \
TEST_E2E_CONTROLLER=${TEST_E2E_CONTROLLER} \
Copy link
Contributor

Choose a reason for hiding this comment

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

E2E related

@@ -119,7 +119,7 @@ The following table contains a set of environment variables that control the beh
| `TEST_NAMESPACE` | `default` | Target namespace to execute tests upon, default is `default`. |
| `TEST_E2E_FLAGS` | `-failFast -flakeAttempts=2 -p -randomizeAllSpecs -slowSpecThreshold=300 -timeout=20m -trace -v` | Ginkgo flags. See all Ginkgo flags here: [The Ginkgo CLI](https://onsi.github.io/ginkgo/#the-ginkgo-cli). Especially of interest are `--focus` and `--skip` to run selective tests. |
| `TEST_E2E_CREATE_GLOBALOBJECTS` | `true` | Boolean, if `false`, the custom resource definitions and (cluster) build strategies are not created and deleted by the e2e test code |
| `TEST_E2E_OPERATOR` | `start_local` | String with allowed values `start_local` (will start the local operator and print its logs add the end of the test run) and `managed_outside` (will assume that the operator is running through whatever means) |
| `TEST_E2E_CONTROLLER` | `start_local` | String with allowed values `start_local` (will start the local Shipwright build controller and print its logs add the end of the test run) and `managed_outside` (will assume that the Shipwright build controller is running through whatever means) |
Copy link
Contributor

Choose a reason for hiding this comment

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

E2E related

@@ -17,7 +17,7 @@ import (
)

var (
operatorCmd *exec.Cmd
controllerCmd *exec.Cmd
Copy link
Contributor

Choose a reason for hiding this comment

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

E2E related

@@ -10,13 +10,13 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

operator "github.com/shipwright-io/build/pkg/apis/build/v1alpha1"
controller "github.com/shipwright-io/build/pkg/apis/build/v1alpha1"
Copy link
Contributor

Choose a reason for hiding this comment

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

E2E related

// but it disables the prometheus metrics and leader election. This intended
// to for testing.
func (t *TestBuild) StartBuildOperator() (chan struct{}, error) {
func (t *TestBuild) StartBuildController() (chan struct{}, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for renaming, either Manager or Controllers

// so that we can nuke the instance later inside the AfterEach Ginkgo
// block
tb.StopBuildOperator, err = tb.StartBuildOperator()
tb.StopBuildController, err = tb.StartBuildController()
if err != nil {
fmt.Println("fail to start the Build powerful operator", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fmt.Println("fail to start the Build powerful operator", err)
fmt.Println("fail to start the powerful Build controllers", err)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Matthias!
Fixed

Copy link
Member

@adambkaplan adambkaplan left a comment

Choose a reason for hiding this comment

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

Given that this PR is updating documentation, I request that a release note be added, such as:

Renamed "build operator" to "build controller" in code and documentation.

// Version describes the version of build
var Version = "0.0.1"
// Version describes the version of Shipwright build controller
var Version = "devel"
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we are overwriting this value in make build or make release. If not, we should do so via go flags.

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 changed it as a go flags in our main.go, now it can be set in the different release deployment, like:

➜  build git:(operator_refine) ✗ go run cmd/manager/main.go --version v0.3.0
{"level":"info","ts":1614919747.8687959,"logger":"build","msg":"Shipwright Build Controller Version: v0.3.0"}
{"level":"info","ts":1614919747.868852,"logger":"build","msg":"Go Version: go1.14.13"}
{"level":"info","ts":1614919747.868873,"logger":"build","msg":"Go OS/Arch: darwin/amd64"}

At the same time, I also remove the operator-sdk version in the printVersion func.

Thanks!

@openshift-ci-robot openshift-ci-robot added release-note Label for when a PR has specified a release note needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed release-note-none Label for when a PR does not need a release note needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Mar 5, 2021
@zhangtbj
Copy link
Contributor Author

zhangtbj commented Mar 8, 2021

Hi @HeavyWombat and @qu1queee ,

After the PR is merged: #632

I rebased this PR and remove the E2E related code change.

Please review again. Thanks!

@HeavyWombat HeavyWombat self-requested a review March 9, 2021 13:59
Copy link
Contributor

@HeavyWombat HeavyWombat left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 9, 2021
@qu1queee qu1queee self-requested a review March 9, 2021 14:43
Copy link
Contributor

@qu1queee qu1queee left a comment

Choose a reason for hiding this comment

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

/approve

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qu1queee

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 11, 2021
@qu1queee
Copy link
Contributor

/retest

1 similar comment
@zhangtbj
Copy link
Contributor Author

/retest

@zhangtbj
Copy link
Contributor Author

Seems the ci/prow/4.4-unit test hangs, but I cannot see the logs or the content in the link (network issue), is there any way to rerun or restart it?

@qu1queee
Copy link
Contributor

/retest

@openshift-merge-robot openshift-merge-robot merged commit 4ba23af into shipwright-io:master Mar 12, 2021
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note Label for when a PR has specified a release note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants