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: [Helm] Select ClusterIssuer by label #1037

Merged
merged 5 commits into from
Dec 22, 2020
Merged

fix: [Helm] Select ClusterIssuer by label #1037

merged 5 commits into from
Dec 22, 2020

Conversation

mmorhun
Copy link
Contributor

@mmorhun mmorhun commented Dec 17, 2020

Signed-off-by: Mykola Morhun mmorhun@redhat.com

What does this PR do?

Makes chectl to select Cert-Managers's ClusterIssuer by label instead of creating own one.
The new behaviour:

  1. Try to get ClusterIssuer by label
  2. If there is only one ClusterIssuer found - use it, if more than one - fail with error message
  3. If no ClusterIssuer with corresponding label found, create own one (as was done before in all cases)

What issues does this PR fix or reference?

eclipse-che/che#18450

How to test this PR?

  1. Install Cert-Manager
  2. Configure ClusterIssuer
  3. Label the ClusterIssuer with app=che label
  4. Deploy Eclipse Che with Helm installer
  5. It should use already existing ClusterIssuer instead of creating own

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
src/api/kube.ts Outdated Show resolved Hide resolved
src/api/kube.ts Outdated Show resolved Hide resolved
src/api/kube.ts Outdated Show resolved Hide resolved
src/api/kube.ts Outdated Show resolved Hide resolved
src/api/kube.ts Outdated Show resolved Hide resolved
src/api/kube.ts Outdated Show resolved Hide resolved
src/api/kube.ts Outdated Show resolved Hide resolved
src/tasks/component-installers/cert-manager.ts Outdated Show resolved Hide resolved
src/constants.ts Outdated
@@ -8,6 +8,9 @@
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/

// labels
export const CHE_RELATED_COMPONENT_LABEL = 'app=che'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pls remove label usage.
If am not sure about appropriate label

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to keep the label. It gives better user experience, imo. But I agree, that the label itself should be changed

Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
src/api/kube.ts Outdated Show resolved Hide resolved
Comment on lines +1905 to +1907
const clusterIssuersList: {items?: any[]} = res.body

return clusterIssuersList.items || []
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
const clusterIssuersList: {items?: any[]} = res.body
return clusterIssuersList.items || []
return res.body.items || []

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We imply items field at by const clusterIssuersList: {items?: any[]} = res.body. I think it should be kept.

@tolusha tolusha changed the title [Helm] Select ClusterIssuer by label fix: [Helm] Select ClusterIssuer by label Dec 22, 2020
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
@@ -65,6 +67,8 @@ export class CertManagerTasks {
throw new Error('Cert Manager should be deployed before.')
}

ctx.certManagerK8sApiVersion = await this.kubeHelper.getCertManagerK8sApiVersion()
Copy link
Collaborator

@tolusha tolusha Dec 22, 2020

Choose a reason for hiding this comment

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

We should move this to Set up Eclipse Che certificates issuer task due to enabled: ctx => ctx.certManagerInstalled,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cert Manager will be present at that step. The check is done just for case.

@openshift-merge-robot
Copy link
Collaborator

openshift-merge-robot commented Dec 22, 2020

@mmorhun: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/v5-chectl-e2e-operator-installer 48f8ebe link /test v5-chectl-e2e-operator-installer

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants