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

*: Scaffold for 1.0.1 #79

Closed
wants to merge 6 commits into from
Closed

*: Scaffold for 1.0.1 #79

wants to merge 6 commits into from

Conversation

wking
Copy link
Member

@wking wking commented Nov 11, 2020

Building on #78. With this, we get reasonably close to #65. I'll leave comments in #65 talking over any divergence.

Following [1]:

  $ git checkout --orphan 0.19-scaffolding
  $ git rm -rf .
  $ operator-sdk-v0.19.3 init --domain openshift.io --repo github.com/openshift/cincinnati-operator
  $ operator-sdk-v0.19.3 create api --group cincinnati --version v1beta1 --kind Cincinnati --resource --controller
  $ git add -A .gitignore *
  The following paths are ignored by one of your .gitignore files:
  bin
  hint: Use -f if you really want to add them.
  hint: Turn this message off by running
  hint: "git config advice.addIgnoredFile false"

We don't want to commit bin, so the warning is fine.
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wking

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 Nov 11, 2020
@wking wking force-pushed the sdk-1.0 branch 2 times, most recently from 99e6c6b to 368ed15 Compare November 11, 2020 04:50
Generated with:

  $ git rm -rf .
  $ operator-sdk-v0.19.3 init --domain openshift.io --repo github.com/openshift/cincinnati-operator
  $ operator-sdk-v0.19.3 create api --group updateservice --version v1 --kind UpdateService --resource --controller
  $ sed -i 's/cincinnati-operator/update-service-operator/' config/default/kustomization.yaml
  $ git add -A .gitignore *
  The following paths are ignored by one of your .gitignore files:
  bin
  cover.out
  hint: Use -f if you really want to add them.
  hint: Turn this message off by running
  hint: "git config advice.addIgnoredFile false"

We don't want to commit bin or cover.out, so the warning is fine.
This regenerates the file with the scaffolding for the new API name,
and we can merge it into our main branch to update the type there.
From [1], regenerating a new API is the prefered migration approach,
and running the '... create api ...' call directly in the main branch
gave:

  ...
  vet: functests/utils.go:79:53: SchemeGroupVersion not declared by package v1beta1
  make: *** [vet] Error 1
  Error: failed to create API with version "3-alpha": exit status 2
  ...
  FATA[0006] failed to create API with version "3-alpha": exit status 2

[1]: operator-framework/operator-sdk#560 (comment)
Generated with:

  $ git rm -rf .
  $ operator-sdk-v1.0.1 init --domain openshift.io --repo github.com/openshift/cincinnati-operator
  $ operator-sdk-v1.0.1 create api --group updateservice --version v1 --kind UpdateService --resource --controller
  $ sed -i 's/projectName: cincinnati-operator/projectName: update-service-operator/' PROJECT
  $ sed -i 's/cincinnati-operator/update-service-operator/' config/default/kustomization.yaml
  $ git add -A .gitignore *
  The following paths are ignored by one of your .gitignore files:
  bin
  cover.out
  hint: Use -f if you really want to add them.
  hint: Turn this message off by running
  hint: "git config advice.addIgnoredFile false"

We don't want to commit bin or cover.out, so the warning is fine.
Generated with:

  $ git checkout -b sdk-0.19 origin/master
  $ git merge --allow-unrelated-histories 0.19-scaffolding
  $ git checkout --theirs .gitignore # drop lots of user-editor cruft, see "Which file to place a pattern in..." in https://git-scm.com/docs/gitignore#_description
  $ emacs api/v1beta1/cincinnati_types.go # keep some of the outgoing pkg/apis/cincinnati/v1beta1/cincinnati_types.go content
  $ emacs controllers # keep some of the outgoing pkg/controller content
  $ emacs main.go # incorperate some of the outgoing cmd/manager/main.go content
  $ emacs Dockerfile # keep most of the pre-0.19 content. We will still vendor deps, and don't want to have GOARCH, etc., opinions
  $ emacs Makefile # keep most of the 0.19 content, with a few pre-0.19 rules for openshift/release compatability
  $ emacs README.md # bump SDK references to 0.19
  $ make manifests
  $ git add .gitignore config Dockerfile main.go Makefile README.md
  $ git rm -rf cmd/manager pkg/apis pkg/controller
  $ git checkout HEAD -- go.sum # we'll auto-generate this in a future commit
  $ emacs go.mod # basically a union of the two sets.  Drop the hopefully-obsolete 'replace' block.
  $ make bundle
  $ emacs config/manifests/bases/cincinnati-operator.clusterserviceversion.yaml # keep some of the outgoing deploy/olm-catalog content
  $ make bundle
  $ go mod tidy
  $ go mod vendor
  $ git add -A go.* vendor

using:

  $ go version
  go version go1.15.2 linux/amd64
  $ kustomize version
  {Version:kustomize/v3.8.6 GitCommit:c1747439cd8bc956028ad483cdb30d9273c18b24 BuildDate:2020-10-29T23:07:50Z GoOs:linux GoArch:amd64}
  $ controller-gen --version
  Version: v0.3.0

'oc' has a kustomize subcommand, but even in the master oc branch,
that is currently v2 [1], while 'kustomize edit ...' needs v3 to avoid
[2]:

  cd config/manager && /cli/oc kustomize edit set image controller=controller:latest
  Error: specify one path to a kustomization directory

The 'docker build . -t ${IMG}' -> 'docker build -t ${IMG} .' change is
for Podman compatibility [3].

Commenting out the 'test' prerequisite allows us to run 'make
docker-build' without having functests try to run tests in whatever
cluster you may be pointed at.

The increased memory limits are based on peak measurements of ~11m CPU
and ~94MiB in a 4.6.4 amd64 cluster with a single Cincinnati object.

[1]: https://github.com/openshift/oc/blob/1bd1f5ff4aa98d6e4184c2948928b6111fa99191/vendor/modules.txt#L1293
[2]: https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/openshift_cincinnati-operator/76/pull-ci-openshift-cincinnati-operator-master-operator-e2e/1326532618765733888
[3]: operator-framework/operator-sdk#4226
Generated with:

  $ git merge 0.19-scaffolding-v1
  $ emacs main.go api/v1/updateservice_types.go controllers/updateservice_controller.go # resolve conflicts
  $ emacs README.md Dockerfile controllers/*.go functests/*.go config/manifests/bases/cincinnati-operator.clusterserviceversion.yaml # remaining api/v1beta1 -> api/v1 migration and renames
  $ emacs config/samples/updateservice_v1_updateservice.yaml # copy some content from the outgoing Cincinnati sample
  $ git rm -f config/samples/cincinnati_v1beta1_cincinnati.yaml controllers/suite_test.go
  $ rm -rf bundle
  $ make generate manifests bundle
  $ git add -A README.md main.go api bundle config controllers functests
Generated with:

  $ git merge v1-scaffolding
  $ emacs README.md # bump SDK version
  $ emacs Makefile config/default/kustomization.yaml # resolve conflicts
  $ emacs go.mod # take largest version from either side
  $ git checkout --ours go.sum
  $ go mod tidy
  $ go mod vendor
  $ rm -rf bundle
  $ git mv config/manifests/bases/cincinnati-operator.clusterserviceversion.yaml config/manifests/bases/openshift-update-service.clusterserviceversion.yaml
  $ make manifests bundle
  $ git add -A README.md Makefile config go.* vendor
  $ git commit
@openshift-merge-robot
Copy link
Contributor

@wking: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/operator-e2e 78a20c3 link /test operator-e2e

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@wking
Copy link
Member Author

wking commented Nov 12, 2020

#65 landed the bulk of this. I'll file separate PRs for anything unique to this PR that I want to keep.

/close

@openshift-ci-robot
Copy link

@wking: Closed this PR.

In response to this:

#65 landed the bulk of this. I'll file separate PRs for anything unique to this PR that I want to keep.

/close

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.

@wking
Copy link
Member Author

wking commented Nov 16, 2020

Changes in this branch as a graph, to make the separate scaffolding branch approach more clear:

$ git --no-pager log --graph --oneline -7 origin/pr/79
*   78a20c3 (wking/sdk-1.0, origin/pr/79) Merge branch 'v1-scaffolding' into sdk-1.0
|\  
| * 0731f08 *: Scaffold for 1.0.1
* | 84cc70a (wking/v1-crds, origin/pr/78) Merge branch '0.19-scaffolding-v1' into v1-crds
|\| 
| * ce911fe *: Pivot from v1beta1 Cincinnati to v1 UpdateService
* | 99b6cb6 (wking/sdk-0.19, origin/pr/76) Merge branch '0.19-scaffolding' into sdk-0.19
|\| 
| * cfc6956 *: Scaffold for 0.19.3
*   db872f1 (wking/master) Merge pull request #75 from wking/drop-functest-sh
|\  

Details in the commit messages for each of those, explaining what was happening.

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants