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

fix: ensure input CAbundle always end with a newline #1339

Merged

Conversation

zdtsw
Copy link
Member

@zdtsw zdtsw commented Nov 4, 2024

i am not fond of the solution provided in https://issues.redhat.com/browse/RHOAIENG-11895 on a component base.
this could protentially cause other components to fail.

Description

How Has This Been Tested?

quay.io/wenzhou/opendatahub-operator:2.20.114

  1. input
  trustedCABundle:
    customCABundle: -----BEGIN CERTIFICATE-----
      MIIFVjCCAz6gAwIBAgIUQ+NxE9izWRRdt86M/TX9b7wFjUUwDQYJKoZIhvcNAQEL
     ...
      IrrVQJLuM7IjWcmOvFjai57QGfIvWcaMY1q6n6MLsLOaXLoRuBLpDLvPbmyAhykU
      ------END ------

output in CM:

odh-ca-bundle.crt: |
    -----BEGIN CERTIFICATE----- MIIFVjCCAz6gAwIBAgIUQ+NxE9izWRRdt86M/TX9b7wFjUUwDQYJKoZIhvcNAQEL ...IrrVQJLuM7IjWcmOvFjai57QGfIvWcaMY1q6n6MLsLOaXLoRuBLpDLvPbmyAhykU 
   ------END ------
  1. input
 trustedCABundle:
   customCABundle: |
     -----BEGIN CERTIFICATE----- 
     MIIFVjCCAz6gAwIBAgIUQ+NxE9izWRRdt86M/TX9b7wFjUUwDQYJKoZIhvcNAQEL 
     ...
     IrrVQJLuM7IjWcmOvFjai57QGfIvWcaMY1q6n6MLsLOaXLoRuBLpDLvPbmyAhykU 
     ------END ------
   managementState: Managed

output in CM:

  odh-ca-bundle.crt: |
    -----BEGIN CERTIFICATE----- 
    MIIFVjCCAz6gAwIBAgIUQ+NxE9izWRRdt86M/TX9b7wFjUUwDQYJKoZIhvcNAQEL 
    ...
    IrrVQJLuM7IjWcmOvFjai57QGfIvWcaMY1q6n6MLsLOaXLoRuBLpDLvPbmyAhykU 
    ------END ------
  1. input
trustedCABundle:
   customCABundle: |-
     -----BEGIN CERTIFICATE-----
     MIIFVjCCAz6gAwIBAgIUQ+NxE9izWRRdt86M/TX9b7wFjUUwDQYJKoZIhvcNAQEL
     ...
     IrrVQJLuM7IjWcmOvFjai57QGfIvWcaMY1q6n6MLsLOaXLoRuBLpDLvPbmyAhykU
     ------END ------

output in CM:

  odh-ca-bundle.crt: |
    -----BEGIN CERTIFICATE-----
    MIIFVjCCAz6gAwIBAgIUQ+NxE9izWRRdt86M/TX9b7wFjUUwDQYJKoZIhvcNAQEL
    ...
    IrrVQJLuM7IjWcmOvFjai57QGfIvWcaMY1q6n6MLsLOaXLoRuBLpDLvPbmyAhykU
    ------END ------

Screenshot or short clip

Merge criteria

  • You have read the contributors guide.
  • Commit messages are meaningful - have a clear and concise summary and detailed explanation of what was changed and why.
  • Pull Request contains a description of the solution, a link to the JIRA issue, and to any dependent or related Pull Request.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

Copy link

codecov bot commented Nov 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (incubation@1f5af72). Learn more about missing BASE report.

Additional details and impacted files
@@              Coverage Diff              @@
##             incubation    #1339   +/-   ##
=============================================
  Coverage              ?   19.08%           
=============================================
  Files                 ?       30           
  Lines                 ?     3369           
  Branches              ?        0           
=============================================
  Hits                  ?      643           
  Misses                ?     2657           
  Partials              ?       69           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zdtsw zdtsw marked this pull request as ready for review November 5, 2024 06:57
@zdtsw zdtsw requested review from VaishnaviHire and removed request for asanzgom and grdryn November 5, 2024 06:57
@zdtsw zdtsw force-pushed the chore_137 branch 2 times, most recently from 726a4bf to 65977fb Compare November 5, 2024 10:48
- missing newline will cause problem when inject data into configmap
- this happens when user use kustomize with their own CA for DSCI, it set to use |- not |
- fix lint

Signed-off-by: Wen Zhou <[email protected]>
// Adding newline breaker if user input does not have it
if !strings.HasSuffix(customCAData, "\n") {
customCAData += "\n"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe something we can do unconditionally, like

customCAData = strings.TrimSpace(customCAData) + "\n"

Copy link
Member Author

Choose a reason for hiding this comment

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

thats nicer

@lburgazzoli
Copy link
Contributor

It would be nice to have the tests done manually also as part of the test suite

@zdtsw
Copy link
Member Author

zdtsw commented Nov 6, 2024

It would be nice to have the tests done manually also as part of the test suite

haha, we have an ongoing https://github.com/opendatahub-io/opendatahub-operator/pull/1346/files for this topic

@lburgazzoli
Copy link
Contributor

It would be nice to have the tests done manually also as part of the test suite

haha, we have an ongoing https://github.com/opendatahub-io/opendatahub-operator/pull/1346/files for this topic

Wonder if that PR should be merged after this and include also the tests you included in the PR description.

@zdtsw
Copy link
Member Author

zdtsw commented Nov 6, 2024

It would be nice to have the tests done manually also as part of the test suite

haha, we have an ongoing https://github.com/opendatahub-io/opendatahub-operator/pull/1346/files for this topic

Wonder if that PR should be merged after this and include also the tests you included in the PR description.

yep, i think so.

@zdtsw zdtsw added the odh-2.21 label Nov 6, 2024
@lburgazzoli
Copy link
Contributor

lgtm, I'd love to see this merged along with the related tests so we are sure it won't break anything.

I let @VaishnaviHire doing a final review as I probably don't know all the implication

@VaishnaviHire
Copy link
Member

Wonder if that PR should be merged after this and include also the tests you included in the PR description.

Agree, we can add all the test cases above.

Thanks for the changes @zdtsw

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Nov 7, 2024
Copy link

openshift-ci bot commented Nov 7, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: VaishnaviHire

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 added the approved label Nov 7, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 656d53e into opendatahub-io:incubation Nov 7, 2024
10 checks passed
zdtsw added a commit to zdtsw-forking/opendatahub-operator that referenced this pull request Nov 8, 2024
…1339)

* fix: ensure input CAbundle always end with a newline

- missing newline will cause problem when inject data into configmap
- this happens when user use kustomize with their own CA for DSCI, it set to use |- not |
- fix lint

Signed-off-by: Wen Zhou <[email protected]>

* update: better way to add newline

Signed-off-by: Wen Zhou <[email protected]>

---------

Signed-off-by: Wen Zhou <[email protected]>
(cherry picked from commit 656d53e)
openshift-merge-bot bot pushed a commit that referenced this pull request Nov 11, 2024
* fix: ensure input CAbundle always end with a newline (#1339)

* fix: ensure input CAbundle always end with a newline

- missing newline will cause problem when inject data into configmap
- this happens when user use kustomize with their own CA for DSCI, it set to use |- not |
- fix lint

Signed-off-by: Wen Zhou <[email protected]>

* update: better way to add newline

Signed-off-by: Wen Zhou <[email protected]>

---------

Signed-off-by: Wen Zhou <[email protected]>
(cherry picked from commit 656d53e)

* fix: add check to remove old kube-rbac-proxy container in modelregistry operator, fixes RHOAIENG-15328 (#1341)

* fix: add check to remove old kube-rbac-proxy container in modelregistry operator, fixes RHOAIENG-15328

Signed-off-by: Dhiraj Bokde <[email protected]>

* update: remove check in ModelReg code, add it to upgrade logic

Signed-off-by: Wen Zhou <[email protected]>

---------

Signed-off-by: Dhiraj Bokde <[email protected]>
Signed-off-by: Wen Zhou <[email protected]>
Co-authored-by: Wen Zhou <[email protected]>
(cherry picked from commit 92251e4)

* fix: cherry-pick error

- remove new logger
- dummy: request from devops to verify auto-sync

Signed-off-by: Wen Zhou <[email protected]>

---------

Signed-off-by: Wen Zhou <[email protected]>
Co-authored-by: Dhiraj Bokde <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants