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

chore: add patch/create crds #655

Merged
merged 4 commits into from
Mar 14, 2024
Merged

chore: add patch/create crds #655

merged 4 commits into from
Mar 14, 2024

Conversation

cmwylie19
Copy link
Collaborator

@cmwylie19 cmwylie19 commented Mar 14, 2024

Description

#577

UDS ran into this problem:

Helm Problem Each Pepr module creates the CRD for PeprStore. A problem arrises when multiple Pepr modules are packaged in a helm chart. Helm will not render resources that already exist.

We fixed it in #580 which used the KFC to ServerSide Apply the PeprStore CustomResourceDefinition.

This led to a regression when building the pepr moduled with scoped rbac npx pepr build --rbac-mode=scoped

{
  "level": 50,
  "time": 1710435728180,
  "pid": 1,
  "hostname": "pepr-6e43c347-0370-5954-bda3-552d74a5e3bd-6f8ddbb9dd-fvjrf",
  "data": {
    "kind": "Status",
    "apiVersion": "v1",
    "metadata": {},
    "status": "Failure",
    "message": "customresourcedefinitions.apiextensions.k8s.io \"peprstores.pepr.dev\" is forbidden: ",
    "reason": "Forbidden",
    "details": {
      "name": "peprstores.pepr.dev",
      "group": "apiextensions.k8s.io",
      "kind": "customresourcedefinitions"
    },
    "code": 403
  },
  "ok": false,
  "status": 403,
  "statusText": "Forbidden"
}
{
  "level": 50,
  "time": 1710435597286,
  "pid": 1,
  "hostname": "pepr-6e43c347-0370-5954-bda3-552d74a5e3bd-6f8ddbb9dd-2q5vr",
  "data": {
    "kind": "Status",
    "apiVersion": "v1",
    "metadata": {},
    "status": "Failure",
    "message": "customresourcedefinitions.apiextensions.k8s.io \"peprstores.pepr.dev\" is forbidden: User \"system:serviceaccount:pepr-system:pepr-6e43c347-0370-5954-bda3-552d74a5e3bd\" cannot patch resource \"customresourcedefinitions\" in API group \"apiextensions.k8s.io\" at the cluster scope",
    "reason": "Forbidden",
    "details": {
      "name": "peprstores.pepr.dev",
      "group": "apiextensions.k8s.io",
      "kind": "customresourcedefinitions"
    },
    "code": 403
  },

The code that generates the RBAC did not take into account this new criteria that it needed permissions to patch,update CustomResourceDefinitions.

This PR adds the necessary code so that RBAC mode gives the Pepr service account appropriate permissions to do the job

issue: Pods do not come up, permanent CrashLoopBackOff

┌─[cmwylie19@Cases-MacBook-Pro] - [~/deadass] - [2024-03-14 12:57:06]
└─[0] <git:(main✈) > k get po -n pepr-system 
NAME                                                         READY   STATUS             RESTARTS     AGE
pepr-6e43c347-0370-5954-bda3-552d74a5e3bd-6f8ddbb9dd-shj6j   0/1     CrashLoopBackOff   1 (3s ago)   8s
pepr-6e43c347-0370-5954-bda3-552d74a5e3bd-6f8ddbb9dd-mndd6   0/1     CrashLoopBackOff   1 (3s ago)   8s

Related Issue

Fixes #

Relates to #

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Other (security config, docs update, etc)

Checklist before merging

Signed-off-by: Case Wylie <cmwylie19@defenseunicorns.com>
Signed-off-by: Case Wylie <cmwylie19@defenseunicorns.com>
schaeferka
schaeferka previously approved these changes Mar 14, 2024
Signed-off-by: Case Wylie <cmwylie19@defenseunicorns.com>
@cmwylie19
Copy link
Collaborator Author

Reviewed by Kim and approved

@cmwylie19 cmwylie19 merged commit 833f2c3 into main Mar 14, 2024
11 checks passed
@cmwylie19 cmwylie19 deleted the scoped_mode_bug branch March 14, 2024 17:48
@cmwylie19 cmwylie19 self-assigned this Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants