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

Change namespace creation for osd-logging #2262

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

petrkotas
Copy link
Member

What type of PR is this?

BUG

What this PR does / why we need it?

Moved namespace creation from osd-logging to be create only. Additional resources are created in patches.

This is change related to bug:

Which Jira/Github issue(s) this PR fixes?

Fixes # https://issues.redhat.com/browse/OSD-25576

Special notes for your reviewer:

Pre-checks (if applicable):

  • Tested latest changes against a cluster

  • Included documentation changes with PR

  • If this is a new object that is not intended for the FedRAMP environment (if unsure, please reach out to team FedRAMP), please exclude it with:

    matchExpressions:
    - key: api.openshift.com/fedramp
      operator: NotIn
      values: ["true"]

Copy link
Contributor

openshift-ci bot commented Nov 6, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: petrkotas
Once this PR has been reviewed and has the lgtm label, please assign fahlmant for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

Moved namespace creation from osd-logging to be create only.
Additional resources are created in patches.

This is change related to bug:
- https://issues.redhat.com/browse/OSD-25576

Signed-off-by: Petr <[email protected]>
@petrkotas petrkotas force-pushed the fix-create-namespace branch 2 times, most recently from 154aa53 to 800d821 Compare November 8, 2024 10:55
@petrkotas
Copy link
Member Author

@jewzaam and @2uasimojo would you please be able to review this? Thank you.

- watch
name: dedicated-admins-openshift-logging
namespace: openshift-logging
patch: '{"rules":[{"apiGroups":[""],"resources":["events","namespaces","persistentvolumeclaims","persistentvolumes","pods","pods/log"],"verbs":["list","get","watch"]},{"apiGroups":[""],"resources":["secrets"],"verbs":["*"]},{"apiGroups":["logging.openshift.io"],"resources":["clusterloggings"],"verbs":["create","delete","deletecollection","get","list","patch","update","watch"]},{"apiGroups":["operators.coreos.com"],"resources":["subscriptions","clusterserviceversions"],"verbs":["*"]},{"apiGroups":["operators.coreos.com"],"resources":["installplans"],"verbs":["update"]},{"apiGroups":[""],"resources":["persistentvolumeclaims"],"verbs":["*"]},{"apiGroups":["apps","extensions"],"resources":["daemonsets"],"verbs":["get","list","patch","update","watch"]}]}'
Copy link
Member

Choose a reason for hiding this comment

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

I'm obviously not going to be qualified to review this for content, but for readability, consider using yaml's multiline string syntax:

Suggested change
patch: '{"rules":[{"apiGroups":[""],"resources":["events","namespaces","persistentvolumeclaims","persistentvolumes","pods","pods/log"],"verbs":["list","get","watch"]},{"apiGroups":[""],"resources":["secrets"],"verbs":["*"]},{"apiGroups":["logging.openshift.io"],"resources":["clusterloggings"],"verbs":["create","delete","deletecollection","get","list","patch","update","watch"]},{"apiGroups":["operators.coreos.com"],"resources":["subscriptions","clusterserviceversions"],"verbs":["*"]},{"apiGroups":["operators.coreos.com"],"resources":["installplans"],"verbs":["update"]},{"apiGroups":[""],"resources":["persistentvolumeclaims"],"verbs":["*"]},{"apiGroups":["apps","extensions"],"resources":["daemonsets"],"verbs":["get","list","patch","update","watch"]}]}'
patch: |
{
"rules": [
{
"apiGroups": [
""
],
"resources": [
"events",
"namespaces",
"persistentvolumeclaims",
"persistentvolumes",
"pods",
"pods/log"
],
"verbs": [
"list",
"get",
"watch"
]
},
{
"apiGroups": [
""
],
"resources": [
"secrets"
],
"verbs": [
"*"
]
},
{
"apiGroups": [
"logging.openshift.io"
],
"resources": [
"clusterloggings"
],
"verbs": [
"create",
"delete",
"deletecollection",
"get",
"list",
"patch",
"update",
"watch"
]
},
{
"apiGroups": [
"operators.coreos.com"
],
"resources": [
"subscriptions",
"clusterserviceversions"
],
"verbs": [
"*"
]
},
{
"apiGroups": [
"operators.coreos.com"
],
"resources": [
"installplans"
],
"verbs": [
"update"
]
},
{
"apiGroups": [
""
],
"resources": [
"persistentvolumeclaims"
],
"verbs": [
"*"
]
},
{
"apiGroups": [
"apps",
"extensions"
],
"resources": [
"daemonsets"
],
"verbs": [
"get",
"list",
"patch",
"update",
"watch"
]
}
]
}

Similar below.

FYI I generated the above guts via:

efried@efried-thinkpadp16vgen1:~/go/src/github.com/openshift/hive$ echo '{"rules":[{"apiGroups":[""],"resources":["events","namespaces","persistentvolumeclaims","persistentvolumes","pods","pods/log"],"verbs":["list","get","watch"]},{"apiGroups":[""],"resources":["secrets"],"verbs":["*"]},{"apiGroups":["logging.openshift.io"],"resources":["clusterloggings"],"verbs":["create","delete","deletecollection","get","list","patch","update","watch"]},{"apiGroups":["operators.coreos.com"],"resources":["subscriptions","clusterserviceversions"],"verbs":["*"]},{"apiGroups":["operators.coreos.com"],"resources":["installplans"],"verbs":["update"]},{"apiGroups":[""],"resources":["persistentvolumeclaims"],"verbs":["*"]},{"apiGroups":["apps","extensions"],"resources":["daemonsets"],"verbs":["get","list","patch","update","watch"]}]}' | jq | sed 's/^/                          /'
  • jq helpfully formats the JSON
  • Using sed to prefix each line with the correct number of spaces (jq --indent unfortunately doesn't do what we need here).

Comment on lines 39 to 42
applyMode: AlwaysApply
kind: Role
metadata:
name: dedicated-admins-openshift-logging
namespace: openshift-logging
rules:
- apiGroups:
- ""
resources:
- events
- namespaces
- persistentvolumeclaims
- persistentvolumes
- pods
- pods/log
verbs:
- list
- get
- watch
- apiGroups:
- ""
resources:
- secrets
verbs:
- '*'
- apiGroups:
- logging.openshift.io
resources:
- clusterloggings
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- operators.coreos.com
resources:
- subscriptions
- clusterserviceversions
verbs:
- '*'
- apiGroups:
- operators.coreos.com
resources:
- installplans
verbs:
- update
- apiGroups:
- ""
resources:
- persistentvolumeclaims
verbs:
- '*'
- apiGroups:
- apps
- extensions
resources:
- daemonsets
verbs:
- get
- list
- patch
- update
- watch
name: dedicated-admins-openshift-logging
namespace: openshift-logging
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we actually want to use a patch for this Role, which based on its name is intended to be SREP-owned. Is there a situation where you would want to preserve some existing -- presumably customer admin-injected -- rules in this Role?

IIUC the general intent behind this change is to make sure we're preserving customer settings on objects they're supposed to be allowed to modify -- like labels on OpenShift namespaces.

Comment on lines 4 to 5
namespace: openshift-logging
namespace: openshift-logging
Copy link
Member

Choose a reason for hiding this comment

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

Duplicated line

Suggested change
namespace: openshift-logging
namespace: openshift-logging
namespace: openshift-logging

Copy link
Member

Choose a reason for hiding this comment

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

This file rename doesn't look intentional. Similar with other .bak renames below.

(There's generally no need to check in "backed up" files, as the files are always available from earlier commits.)

Copy link
Member

@jewzaam jewzaam left a comment

Choose a reason for hiding this comment

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

/hold

This changes from creation of resources to patching only. Implication is any place where this is applied for the first time for a cluster it will do nothing because there is nothing to patch. JIRA is the right place to sort out the plan for how this is applied and implications to existing or new clusters. Not clear right now what the requirements are.

@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 Nov 11, 2024
Copy link
Contributor

openshift-ci bot commented Nov 15, 2024

@petrkotas: 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-sigs/prow repository. I understand the commands that are listed here.

@2uasimojo
Copy link
Member

Syntactically this seems sane at a glance. IIUC there's still some discussion around whether SREP's management of this namespace is correct/desired at a high level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants