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

Add validation when connecting Kubernetes endpoints #94

Merged
merged 2 commits into from
Nov 16, 2018

Conversation

nwmac
Copy link
Member

@nwmac nwmac commented Nov 15, 2018

Adds a Validate function to the endpoint plugin that is called as part of the Connect flow.

Allows an endpoint plugin to check that the authentication provided is valid.

Fixes #91

@nwmac nwmac self-assigned this Nov 15, 2018
@nwmac nwmac requested a review from irfanhabib November 15, 2018 13:26
@nwmac nwmac added the ready for review Ready for review label Nov 15, 2018
@codecov-io
Copy link

Codecov Report

Merging #94 into v2-master will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           v2-master      #94   +/-   ##
==========================================
  Coverage      71.92%   71.92%           
==========================================
  Files            685      685           
  Lines          29583    29583           
  Branches        6787     6787           
==========================================
  Hits           21277    21277           
  Misses          8306     8306

Copy link
Member

@richard-cox richard-cox left a comment

Choose a reason for hiding this comment

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

One comment, otherwise LGTM

@@ -59,6 +59,19 @@ func (c *KubernetesSpecification) Register(echoContext echo.Context) error {
return c.portalProxy.RegisterEndpoint(echoContext, c.Info)
}

func (c *KubernetesSpecification) Validate(userGUID string, cnsiRecord interfaces.CNSIRecord, tokenRecord interfaces.TokenRecord) error {
response, err := c.portalProxy.DoProxySingleRequest(cnsiRecord.GUID, userGUID, "GET", "api/v1/pods")
Copy link
Member

Choose a reason for hiding this comment

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

We might want to apply a limit param of 1 to this (see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.12/#list-all-namespaces-pod-v1-core), otherwise we could get a huge amount of data back

@richard-cox richard-cox added needs attention Needs attention and removed in review labels Nov 15, 2018
@irfanhabib irfanhabib merged commit 101a056 into v2-master Nov 16, 2018
@irfanhabib irfanhabib deleted the fix-k8s-connect-check branch November 16, 2018 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs attention Needs attention ready for review Ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants