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

OTA-559: pkg/manifest: Add 'overrides' handling #1502

Merged
merged 1 commit into from Apr 26, 2023

Conversation

wking
Copy link
Member

@wking wking commented Apr 18, 2023

Centralize this aspect of manifest filtering, so it can be shared between the cluster-version operator (where it currently lives) and oc (where we want manifest extraction to understand this sort of condition).

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 18, 2023
@openshift-ci-robot
Copy link

openshift-ci-robot commented Apr 18, 2023

@wking: This pull request references OTA-559 which is a valid jira issue.

In response to this:

Centralize this aspect of manifest filtering, so it can be shared between the cluster-version operator (where it currently lives) and oc (where we want manifest extraction to understand this sort of condition).

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.

@openshift-ci openshift-ci bot requested review from deads2k and sttts April 18, 2023 23:57
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 18, 2023
@wking wking force-pushed the overrides branch 2 times, most recently from b8a3ca7 to 2f6d5dd Compare April 19, 2023 03:42
@petr-muller
Copy link
Member

/cc

@openshift-ci openshift-ci bot requested a review from petr-muller April 19, 2023 10:16
@wking wking force-pushed the overrides branch 2 times, most recently from 3cb4486 to 6af9515 Compare April 20, 2023 04:09
Centralize this aspect of manifest filtering, so it can be shared
between the cluster-version operator (where it currently lives [1])
and 'oc' (where we want manifest extraction to understand this sort of
condition [2]).

[1]: https://github.com/openshift/cluster-version-operator/blob/cce97c25292b263a5a549b2bb8ce82ed7f2d4923/pkg/cvo/sync_worker.go#L959-L987
[2]: https://issues.redhat.com/browse/OTA-559
Copy link
Member

@petr-muller petr-muller left a comment

Choose a reason for hiding this comment

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

LGTM with a nit, address if you want
/hold

}

if override := m.getOverrideForManifest(overrides); override != nil && override.Unmanaged {
return fmt.Errorf("overridden")
Copy link
Member

Choose a reason for hiding this comment

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

nit: we could surface what is being overriden?

Copy link
Member Author

Choose a reason for hiding this comment

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

4.13.0-ec.4 CI:

$ curl -s https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/origin-ci-test/logs/periodic-ci-openshift-release-master-nightly-4.13-e2e-aws-sdn-serial/1631695148700143616/artifacts/e2e-aws-sdn-serial/gather-extra/artifacts/pods/openshift-cluster-version_cluster-version-operator-6f5d958c6b-k8t5l_cluster-version-operator.log | grep excluding | head -n2
I0303 16:57:25.646863       1 payload.go:210] excluding 0000_10_config-operator_01_infrastructure-TechPreviewNoUpgrade.crd.yaml group=apiextensions.k8s.io kind=CustomResourceDefinition namespace= name=infrastructures.config.openshift.io: "Default" is required, and release.openshift.io/feature-set=TechPreviewNoUpgrade
I0303 16:57:25.676524       1 payload.go:210] excluding 0000_30_cluster-api_00_credentials-request.yaml group=cloudcredential.openshift.io kind=CredentialsRequest namespace=openshift-cloud-credential-operator name=openshift-cluster-api-aws: "Default" is required, and release.openshift.io/feature-set=TechPreviewNoUpgrade

And that excluding ... context gets wrapped around in:

cluster-verison-operator $ git --no-pager grep 'excluding ' pkg
pkg/payload/payload.go:                                 klog.V(2).Infof("excluding %s group=%s kind=%s namespace=%s name=%s: %v\n", manifest.OriginalFilename, manifest.GVK.Group, manifest.GVK.Kind, manifest.Obj.GetNamespace(), manifest.Obj.GetName(), err)

That could probably be cleaned up by leaning on (*Manifest).String(), but it's there. Do we have similar wrapping around each call site?

cluster-version-operator $ git --no-pager grep -A1 '[.]Include('
pkg/cvo/sync_worker.go:                 if err := task.Manifest.Include(nil, nil, nil, &capabilities, work.Overrides); err != nil {
pkg/cvo/sync_worker.go-                         klog.V(2).Infof("Skipping precreation of %s: %s", task, err)
--
pkg/cvo/sync_worker.go:                 if err := task.Manifest.Include(nil, nil, nil, &capabilities, work.Overrides); err != nil {
pkg/cvo/sync_worker.go-                         klog.V(2).Infof("Skipping %s: %s", task, err)
--
pkg/payload/payload.go:                         if err := manifest.Include(&excludeIdentifier, &requiredFeatureSet, &profile, onlyKnownCaps, nil); err != nil {
pkg/payload/payload.go-                                 klog.V(2).Infof("excluding %s group=%s kind=%s namespace=%s name=%s: %v\n", manifest.OriginalFilename, manifest.GVK.Group, manifest.GVK.Kind, manifest.Obj.GetNamespace(), manifest.Obj.GetName(), err)

So Include is covered. What about IncludeAllowUnknownCapabilities?

$ git --no-pager grep -A4 '[.]IncludeAllowUnknownCapabilities(' | grep -v vendor/
pkg/payload/payload.go:         updateManErr := updateManifest.IncludeAllowUnknownCapabilities(nil, nil, nil, &clusterCaps, nil, true)
pkg/payload/payload.go-
pkg/payload/payload.go-         // update manifest is enabled, no need to check
pkg/payload/payload.go-         if updateManErr == nil {
pkg/payload/payload.go-                 continue
--
pkg/payload/payload.go:                 if err := currentManifest.IncludeAllowUnknownCapabilities(nil, nil, nil, &clusterCaps, nil, true); err != nil {
pkg/payload/payload.go-                         continue
pkg/payload/payload.go-                 }
pkg/payload/payload.go-                 caps := capability.GetImplicitlyEnabledCapabilities(currentManifest.GetManifestCapabilities(),
pkg/payload/payload.go-                         updateManifest.GetManifestCapabilities(), capabilities)
--
$ git --no-pager grep '^func .*\|[.]IncludeAllowUnknownCapabilities(' pkg/payload/payload.go | grep -B1 IncludeAllowUnknownCapabilities
pkg/payload/payload.go:func GetImplicitlyEnabledCapabilities(updatePayloadManifests []manifest.Manifest, currentPayloadManifests []manifest.Manifest,
pkg/payload/payload.go:         updateManErr := updateManifest.IncludeAllowUnknownCapabilities(nil, nil, nil, &clusterCaps, nil, true)
pkg/payload/payload.go:                 if err := currentManifest.IncludeAllowUnknownCapabilities(nil, nil, nil, &clusterCaps, nil, true); err != nil {

So unless we wanted context logging in GetImplicitlyEnabledCapabilities, I think we're good. And if we do want that context logging in GetImplicitlyEnabledCapabilities, we can handle that on the CVO side without adding "here's the manifest I am" context on this side.

/hold cancel

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 21, 2023
@petr-muller
Copy link
Member

grumbles about repos that do not respect gh reviews
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 21, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 21, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: petr-muller, 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 openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 26, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 26, 2023

@wking: all tests passed!

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.

@openshift-merge-robot openshift-merge-robot merged commit af83143 into openshift:master Apr 26, 2023
4 checks passed
@wking wking deleted the overrides branch April 26, 2023 17:36
wking added a commit to wking/cluster-version-operator that referenced this pull request Apr 26, 2023
Shifting to the centralized logic from openshift/library-go@087d2eb13a
(pkg/manifest: Add 'overrides' handling, 2023-04-18,
openshift/library-go#1502).
wking added a commit to wking/cluster-version-operator that referenced this pull request Apr 26, 2023
Picking up openshift/library-go@087d2eb13a (pkg/manifest: Add
'overrides' handling, 2023-04-18, openshift/library-go#1502).
Generated with:

  $ go get -u github.com/openshift/library-go
  $ go mod tidy
  $ go mod vendor
  $ git add -A go.* vendor

using:

  $ go version
  go version go1.19.5 linux/amd64
wking added a commit to wking/cluster-version-operator that referenced this pull request Apr 26, 2023
Shifting to the centralized logic from openshift/library-go@087d2eb13a
(pkg/manifest: Add 'overrides' handling, 2023-04-18,
openshift/library-go#1502).
wking added a commit to wking/cluster-version-operator that referenced this pull request Apr 26, 2023
Picking up openshift/library-go@087d2eb13a (pkg/manifest: Add
'overrides' handling, 2023-04-18, openshift/library-go#1502).
Generated with:

  $ go get -u github.com/openshift/library-go
  $ go mod tidy
  $ go mod vendor
  $ git add -A go.* vendor

using:

  $ go version
  go version go1.19.5 linux/amd64
wking added a commit to wking/cluster-version-operator that referenced this pull request Apr 28, 2023
Shifting to the centralized logic from openshift/library-go@087d2eb13a
(pkg/manifest: Add 'overrides' handling, 2023-04-18,
openshift/library-go#1502).
wking added a commit to wking/cluster-version-operator that referenced this pull request Apr 28, 2023
Picking up openshift/library-go@087d2eb13a (pkg/manifest: Add
'overrides' handling, 2023-04-18, openshift/library-go#1502).
Generated with:

  $ go get -u github.com/openshift/library-go
  $ go mod tidy
  $ go mod vendor
  $ git add -A go.* vendor

using:

  $ go version
  go version go1.19.5 linux/amd64
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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants