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

feat: Add pre-install task to check if an OIDC provider is installed #1912

Merged
merged 5 commits into from
Jan 11, 2022

Conversation

mmorhun
Copy link
Contributor

@mmorhun mmorhun commented Dec 21, 2021

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

What does this PR do?

Adds a new check that ensures k8s cluster has OIDC provider installed and configured.
The only exception is minikube as Dex is automatically installed.

Screenshot/screencast of this PR

In case of missing OIDC provider on a k8s cluster:
Screenshot from 2021-12-21 17-14-04

In case of minikube:
Screenshot from 2021-12-21 17-16-42

In case if Che is already installed, the check is disabled (and not displayed).

What issues does this PR fix or reference?

eclipse-che/che#20909

How to test this PR?

Try to deploy Che using chectl server:deploy --platform=k8s --domain=****.
Deployment should fail if he cluster misses an OIDC provider installed and k8s API server configured to use it.

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.

@codecov-commenter
Copy link

Codecov Report

Merging #1912 (bf8266b) into main (2bc4a9d) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1912      +/-   ##
==========================================
- Coverage   10.61%   10.58%   -0.04%     
==========================================
  Files          62       62              
  Lines        6813     6833      +20     
  Branches     1147     1152       +5     
==========================================
  Hits          723      723              
- Misses       6090     6110      +20     
Impacted Files Coverage Δ
src/commands/server/deploy.ts 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2bc4a9d...bf8266b. Read the comment docs.

@mmorhun mmorhun requested a review from sparkoo December 22, 2021 08:36
@tolusha tolusha changed the title Add pre-install task to check if an OIDC provider is installed feat: Add pre-install task to check if an OIDC provider is installed Dec 29, 2021
src/commands/server/deploy.ts Outdated Show resolved Hide resolved
},
task: async (_ctx: any, task: any) => {
const kube = new KubeHelper(flags)
const apiServerPods = await kube.getPodListByLabel('kube-system', 'component=kube-apiserver')
Copy link
Member

Choose a reason for hiding this comment

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

checking apiserver container arguments looks a bit hacky. Have you checked that there isn't any API to get oidc url or something like that? I really don't know how this is realiable on various kubernetes flavors. (doing quick search I can't find anything so this may be our best bet)

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 searched it second time and still found nothing. Looks like it is not possible to get via K8S API, API server configuration

mmorhun and others added 4 commits January 10, 2022 15:57
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
@openshift-ci
Copy link

openshift-ci bot commented Jan 11, 2022

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: AndrienkoAleksandr, mmorhun, tolusha

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

Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
@openshift-ci openshift-ci bot removed the lgtm label Jan 11, 2022
@openshift-ci
Copy link

openshift-ci bot commented Jan 11, 2022

New changes are detected. LGTM label has been removed.

@openshift-ci
Copy link

openshift-ci bot commented Jan 11, 2022

@mmorhun: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/v9-chectl-e2e-rollback 9d92d73 link true /test v9-chectl-e2e-rollback
ci/prow/v8-chectl-e2e-rollback 9d92d73 link true /test v8-chectl-e2e-rollback

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.

@mmorhun mmorhun merged commit da7d569 into main Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants