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

internal/pkg/scaffold/olm-catalog: use olm.targetNamespaces annotation in WATCH_NAMESPACE #1396

Merged
merged 4 commits into from
Jun 5, 2019

Conversation

estroz
Copy link
Member

@estroz estroz commented May 6, 2019

Description of the change: reference olm.targetNamespaces from metadata.annotations for WATCH_NAMESPACE in a CSV's install plan.

Motivation for the change: OLM determines the namespace(s) in which an operator is deployed, and places these in metadata.annotations.olm.targetNamespaces. WATCH_NAMESPACE will only be updated if the env var field reference is updated as it is in this PR. See the OperatorGroup docs for more details.

Note: OLM supports multiple namespaces but the SDK will not until we bump controller-runtime to v0.2.0. However, gen-csv sets MultiNamespace support to false by default so WATCH_NAMESPACE will only contain one namespace until the bump.

Closes #1360

@estroz estroz added kind/bug Categorizes issue or PR as related to a bug. olm-integration Issue relates to the OLM integration labels May 6, 2019
@openshift-ci-robot openshift-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 6, 2019
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 9, 2019
@estroz estroz requested a review from joelanford May 31, 2019 19:16
@matzew
Copy link

matzew commented Jun 5, 2019

@estroz I am running into this too - any chance to get this landed ?

Copy link
Member

@lilic lilic left a comment

Choose a reason for hiding this comment

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

If it fixes the problem for the users we should merge this asap 👍 lgtm

Couple of questions but nothing blocking.

// check that depHasOLMNamespaces() returns false.
dep := &appsv1.Deployment{}
if err := yaml.Unmarshal(depBytes, dep); err != nil {
t.Fatalf("(1) Failed to unmarshal Deployment bytes: %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

What does the (1) here signify?

Copy link
Member Author

Choose a reason for hiding this comment

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

Artifact from testing. Removed.

Copy link
Contributor

@hasbro17 hasbro17 left a comment

Choose a reason for hiding this comment

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

LGTM

@estroz If this considered a bug fix in csv-gen then we should add it to the CHANGELOG.

@estroz estroz merged commit 342284e into operator-framework:master Jun 5, 2019
@estroz estroz deleted the olm-csv-targetnamespace branch June 5, 2019 19:03
estroz added a commit to estroz/operator-sdk that referenced this pull request Jul 19, 2019
…n in WATCH_NAMESPACE (operator-framework#1396)

* internal/pkg/scaffold/olm-catalog/csv_updaters.go: use olm.targetNamespaces annotation in WATCH_NAMESPACE, and add unit tests

* CHANGELOG.md: add CSV WATCH_NAMESPACE update
estroz added a commit to estroz/operator-sdk that referenced this pull request Jul 19, 2019
…n in WATCH_NAMESPACE (operator-framework#1396)

* internal/pkg/scaffold/olm-catalog/csv_updaters.go: use olm.targetNamespaces annotation in WATCH_NAMESPACE, and add unit tests

* CHANGELOG.md: add CSV WATCH_NAMESPACE update
miguelsorianod added a commit to 3scale/3scale-operator that referenced this pull request Feb 15, 2020
Changes:
- metadata.alm-examples section is indented/pretty-printed now
- spec.apiservicedefinitions explicitely set as empty hash. This is what is done in operator-sdk new projects too
- the spec.install.spec.deployments.spec section sets the WATCH_NAMESPACE to  fieldPath: metadata.annotations['olm.targetNamespaces']
- instead of the olf fieldPath: metadata.namespace. This is a change introduced in operator-sdk v0.8.2. More information
  about this: operator-framework/operator-sdk#1396
- updated the role section with the current contents of deploy/role.yaml
- fix version of the CSV from 0.3.0 to 0.0.0
- modification of some description fields
- minor format changes
miguelsorianod added a commit to 3scale/3scale-operator that referenced this pull request Feb 15, 2020
Changes:
- metadata.alm-examples section is indented/pretty-printed now
- spec.apiservicedefinitions explicitely set as empty hash. This is what is done in operator-sdk new projects too
- the spec.install.spec.deployments.spec section sets the WATCH_NAMESPACE to  fieldPath: metadata.annotations['olm.targetNamespaces']
- instead of the olf fieldPath: metadata.namespace. This is a change introduced in operator-sdk v0.8.2. More information
  about this: operator-framework/operator-sdk#1396
- updated the role section with the current contents of deploy/role.yaml
- fix version of the CSV from 0.3.0 to 0.0.0
- modification of some description fields
- minor format changes
miguelsorianod added a commit to 3scale/3scale-operator that referenced this pull request Feb 15, 2020
Changes:
- metadata.alm-examples section is indented/pretty-printed now
- spec.apiservicedefinitions explicitely set as empty hash. This is what is done in operator-sdk new projects too
- the spec.install.spec.deployments.spec section sets the WATCH_NAMESPACE to  fieldPath: metadata.annotations['olm.targetNamespaces']
- instead of the olf fieldPath: metadata.namespace. This is a change introduced in operator-sdk v0.8.2. More information
  about this: operator-framework/operator-sdk#1396
- updated the role section with the current contents of deploy/role.yaml
- fix version of the CSV from 0.3.0 to 0.0.0
- modification of some description fields
- minor format changes
miguelsorianod added a commit to 3scale/3scale-operator that referenced this pull request Feb 15, 2020
Changes:
- metadata.alm-examples section is indented/pretty-printed now
- spec.apiservicedefinitions explicitely set as empty hash. This is what is done in operator-sdk new projects too
- the spec.install.spec.deployments.spec section sets the WATCH_NAMESPACE to  fieldPath: metadata.annotations['olm.targetNamespaces']
- instead of the olf fieldPath: metadata.namespace. This is a change introduced in operator-sdk v0.8.2. More information
  about this: operator-framework/operator-sdk#1396
- updated the role section with the current contents of deploy/role.yaml
- fix version of the CSV from 0.3.0 to 0.0.0
- modification of some description fields
- minor format changes
miguelsorianod added a commit to 3scale/3scale-operator that referenced this pull request Feb 15, 2020
Changes:
- metadata.alm-examples section is indented/pretty-printed now
- spec.apiservicedefinitions explicitely set as empty hash. This is what is done in operator-sdk new projects too
- the spec.install.spec.deployments.spec section sets the WATCH_NAMESPACE to  fieldPath: metadata.annotations['olm.targetNamespaces']
- instead of the olf fieldPath: metadata.namespace. This is a change introduced in operator-sdk v0.8.2. More information
  about this: operator-framework/operator-sdk#1396
- updated the role section with the current contents of deploy/role.yaml
- fix version of the CSV from 0.3.0 to 0.0.0
- modification of some description fields
- minor format changes
miguelsorianod added a commit to 3scale/3scale-operator that referenced this pull request Feb 15, 2020
Changes:
- metadata.alm-examples section is indented/pretty-printed now
- spec.apiservicedefinitions explicitely set as empty hash. This is what is done in operator-sdk new projects too
- the spec.install.spec.deployments.spec section sets the WATCH_NAMESPACE to fieldPath: metadata.annotations['olm.targetNamespaces']
  instead of the old fieldPath: metadata.namespace. This is a change introduced in operator-sdk v0.8.2. More information
  about this: operator-framework/operator-sdk#1396
- updated the role section with the current contents of deploy/role.yaml
- fix version of the CSV from 0.3.0 to 0.0.0
- modification of some description fields
- minor format changes
miguelsorianod added a commit to 3scale/3scale-operator that referenced this pull request Feb 17, 2020
Changes:
- metadata.alm-examples section is indented/pretty-printed now
- spec.apiservicedefinitions explicitely set as empty hash. This is what is done in operator-sdk new projects too
- the spec.install.spec.deployments.spec section sets the WATCH_NAMESPACE to fieldPath: metadata.annotations['olm.targetNamespaces']
  instead of the old fieldPath: metadata.namespace. This is a change introduced in operator-sdk v0.8.2. More information
  about this: operator-framework/operator-sdk#1396
- updated the role section with the current contents of deploy/role.yaml
- fix version of the CSV from 0.3.0 to 0.0.0
- modification of some description fields
- minor format changes
miguelsorianod added a commit to 3scale/3scale-operator that referenced this pull request Feb 19, 2020
Changes:
- metadata.alm-examples section is indented/pretty-printed now
- spec.apiservicedefinitions explicitely set as empty hash. This is what is done in operator-sdk new projects too
- the spec.install.spec.deployments.spec section sets the WATCH_NAMESPACE to fieldPath: metadata.annotations['olm.targetNamespaces']
  instead of the old fieldPath: metadata.namespace. This is a change introduced in operator-sdk v0.8.2. More information
  about this: operator-framework/operator-sdk#1396
- updated the role section with the current contents of deploy/role.yaml
- fix version of the CSV from 0.3.0 to 0.0.0
- modification of some description fields
- minor format changes
miguelsorianod added a commit to 3scale/3scale-operator that referenced this pull request Feb 20, 2020
Changes:
- metadata.alm-examples section is indented/pretty-printed now
- spec.apiservicedefinitions explicitely set as empty hash. This is what is done in operator-sdk new projects too
- the spec.install.spec.deployments.spec section sets the WATCH_NAMESPACE to fieldPath: metadata.annotations['olm.targetNamespaces']
  instead of the old fieldPath: metadata.namespace. This is a change introduced in operator-sdk v0.8.2. More information
  about this: operator-framework/operator-sdk#1396
- updated the role section with the current contents of deploy/role.yaml
- fix version of the CSV from 0.3.0 to 0.0.0
- modification of some description fields
- minor format changes
miguelsorianod added a commit to 3scale/3scale-operator that referenced this pull request Feb 28, 2020
Changes:
- metadata.alm-examples section is indented/pretty-printed now
- spec.apiservicedefinitions explicitely set as empty hash. This is what is done in operator-sdk new projects too
- the spec.install.spec.deployments.spec section sets the WATCH_NAMESPACE to fieldPath: metadata.annotations['olm.targetNamespaces']
  instead of the old fieldPath: metadata.namespace. This is a change introduced in operator-sdk v0.8.2. More information
  about this: operator-framework/operator-sdk#1396
- updated the role section with the current contents of deploy/role.yaml
- fix version of the CSV from 0.3.0 to 0.0.0
- modification of some description fields
- minor format changes
miguelsorianod added a commit to 3scale/apicast-operator that referenced this pull request Feb 28, 2020
Changes:
- metadata.alm-examples section is indented/pretty-printed now
- the spec.install.spec.deployments.spec section sets the WATCH_NAMESPACE to fieldPath: metadata.annotations['olm.targetNamespaces']
  instead of the old fieldPath: metadata.namespace. This is a change introduced in operator-sdk v0.8.2. More information
  about this: operator-framework/operator-sdk#1396
- updated the role section with the current contents of deploy/role.yaml
- modification of some description fields
- minor format changes
miguelsorianod added a commit to 3scale/3scale-operator that referenced this pull request Feb 28, 2020
Changes:
- metadata.alm-examples section is indented/pretty-printed now
- spec.apiservicedefinitions explicitely set as empty hash. This is what is done in operator-sdk new projects too
- the spec.install.spec.deployments.spec section sets the WATCH_NAMESPACE to fieldPath: metadata.annotations['olm.targetNamespaces']
  instead of the old fieldPath: metadata.namespace. This is a change introduced in operator-sdk v0.8.2. More information
  about this: operator-framework/operator-sdk#1396
- updated the role section with the current contents of deploy/role.yaml
- fix version of the CSV from 0.3.0 to 0.0.0
- modification of some description fields
- minor format changes
miguelsorianod added a commit to 3scale/apicast-operator that referenced this pull request Feb 28, 2020
Changes:
- metadata.alm-examples section is indented/pretty-printed now
- the spec.install.spec.deployments.spec section sets the WATCH_NAMESPACE to fieldPath: metadata.annotations['olm.targetNamespaces']
  instead of the old fieldPath: metadata.namespace. This is a change introduced in operator-sdk v0.8.2. More information
  about this: operator-framework/operator-sdk#1396
- updated the role section with the current contents of deploy/role.yaml
- modification of some description fields
- minor format changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. olm-integration Issue relates to the OLM integration size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can gen-csv update the WATCH_NAMESPACE downward api destination?
7 participants