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

oidc-authservice: add authservice to manifests #529

Conversation

yanniszark
Copy link
Contributor

@yanniszark yanniszark commented Oct 15, 2019

Which issue is resolved by this Pull Request:
Resolves #267
Resolves kubeflow/kubeflow#3839

Description of your changes:
This PR adds the AuthService to manifests.

It also adds those new capabilities to the existing_arrikto config.

Some small changes that were made to the Dex application:

Checklist:

  • Unit tests have been rebuilt:
    1. cd manifests/tests
    2. make generate
    3. make test

/cc @krishnadurai @elikatsis


This change is Reviewable

@krishnadurai
Copy link
Contributor

@yanniszark this is awesome! Thanks for being prompt!
I'll review this soon.

Copy link
Contributor

@krishnadurai krishnadurai left a comment

Choose a reason for hiding this comment

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

@yanniszark great work here!

* Use the latest image built from master, so as to include [dexidp/dex#1554](https://github.com/dexidp/dex/pull/1554)

Especially for this cool contribution to dex!

I have had an initial look at the code and have a few comments. I would like to further deploy and test this out for my next pass.

prefix: /dex/
route:
- destination:
host: dex.auth.svc.cluster.local
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we parameterize dex.auth.svc.cluster.local to dex.$(namespace).svc.cluster.local?

@@ -0,0 +1,22 @@
# This config is gated on kiali upgrade to 0.21 from 0.16 in istio 1.1.6:
# https://github.com/kiali/kiali/issues/1154
# https://github.com/istio/istio/issues/11131
Copy link
Contributor

@krishnadurai krishnadurai Oct 16, 2019

Choose a reason for hiding this comment

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

These comments were added because when this virtual-service is deployed through kubectl apply -f, kiali rejects this configuration as invalid for Istio 1.1.6.
I'll test this by deploying once again to see if it persists when we deploy through KfDef and kfctl. Otherwise, we could mention that only kubectl apply -f has this issue and KfDef works fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

I can confirm that this issue is not surfacing through KfDef.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great! What are the actionable items for this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can just change the comment to say that this was observed while deploying through kubectl CLI and it works fine with KfDef.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@krishnadurai I'm not too familiar with the issue and it seems you have experience with it.
Could you open an issue explaining what happens in order to track this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure

@@ -80,5 +80,5 @@ configurations:
- params.yaml
images:
- name: quay.io/coreos/dex
newName: quay.io/coreos/dex
newTag: v2.9.0
newName: gcr.io/arrikto/dexidp/dex
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: We could move this image to gcr.io/kubeflow-public-images. This can be done after this PR gets merged in.
Can we add a TODO here to replace this with a dex upstream image whenever they release next?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed.
I don't personally have access to gcr.io/kubeflow-images-public, so it has to be done by someone with the right permissions.

spec:
containers:
- name: authservice
image: gcr.io/arrikto/kubeflow/oidc-authservice:6ac9400
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: We could move this image to gcr.io/kubeflow-public-images, after this PR is in.

kind: EnvoyFilter
metadata:
name: authn-filter
namespace: istio-system
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Let's strip the namespace off metadata fields.

apiVersion: v1
fieldref:
fieldpath: data.skip_auth_uri
- name: userid-header
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: We could use a convention to have these variables named in a consistent manner within this configMap.

Throughout manifests we seem to have different styles camel case, snake case, capitalized names for environment vars. I would be great to have a convention. This is not in relation to this just this PR, we could address this separately.

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 agree, it is unfortunate.
I used snake case for the userid related parameters because that's how they're defined in other applications as well.

- name: CLIENT_SECRET
value: $(application_secret)
- name: STORE_PATH
value: /var/lib/authservice/data.db
Copy link
Contributor

Choose a reason for hiding this comment

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

@yanniszark, I'll need help from you to understand this part. I'm trying to figure out how this DB is getting used by the authservice. The latest code seems to be hosted here: https://github.com/arrikto/ambassador-auth-oidc/commits/feature-kubeflow-rc

Likewise, in the code for authservice, I can see that redis is being used for blacklisting tokens and is an optional component: ajmyyra/ambassador-auth-oidc@a07b7bd

It would be great if you can point me to where and how this DB is getting used by the authservice. Secondly, is this being used for blacklisting tokens?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@krishnadurai the latest code is in the arrikto/oidc-authservice repo.
Pleaso also see: #267 (comment)

The default DB is BoltDB, an embedded key-value store. Its data lives on a PVC.
The DB is used for 2 things:

  1. Store state of the OIDC flow (see state parameter of OAuth).
  2. Store sessions.

spec:
serviceAccountName: dex
containers:
- image: quay.io/coreos/dex:v2.9.0
Copy link
Contributor

Choose a reason for hiding this comment

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

We should change this to the newer dex image for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should be fixed by test generation.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the source file for dex deployment has this older value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, but this seems like an issue of the test generation, unrelated to this PR.
The image is changed using the images field of the kustomization file, which is the standard way provided by kustomize.

httpService:
serverUri:
uri: http://authservice.istio-system.svc.cluster.local
cluster: outbound|8080||authservice.istio-system.svc.cluster.local
Copy link
Contributor

Choose a reason for hiding this comment

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

We should parameterize this to authservice.$(namespace).svc.cluster.local in case istio-system isn't istio deployment's namespace.

subjects:
- kind: ServiceAccount
name: dex # Service account assigned to the dex pod.
namespace: auth # The namespace dex is running in.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'll remove these and replace them with $(namespace) in a follow-up PR.

@yanniszark yanniszark force-pushed the feature-existing-arrikto-internal-relative-urls-v3 branch from 3d6e278 to 52aa3e5 Compare October 16, 2019 17:56
@yanniszark
Copy link
Contributor Author

Thanks @krishnadurai, great comments.
I rebased and addressed the proposed fixes in a new commit.
PTAL

Copy link
Contributor

@krishnadurai krishnadurai left a comment

Choose a reason for hiding this comment

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

@yanniszark I have tested this on a fresh GCP cluster with the modified existing KfDef. Few points to note:

  1. Istio ingressgateway is NodePort
  2. Certificate creation was done manually - will be taken care by the CertManger changes
  3. The platform existing.go code didn't seem to execute from the latest kfctl

I think these above 3 configurations can be tackled with follow on PRs.

There are a few comments which I've made and need to be addressed in this PR.

spec:
serviceAccountName: dex
containers:
- image: quay.io/coreos/dex:v2.9.0
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the source file for dex deployment has this older value.

name: istio
- kustomizeConfig:
overlays:
- application
Copy link
Contributor

Choose a reason for hiding this comment

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

kustomizeConfig for application and application-crds needs to be on-top here so that we avoid this error:

error: unable to recognize "/tmp/kout": no matches for kind "Application" in version "app.k8s.io/v1beta1"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting, I didn't get this error.
I wonder why.
Will fix according to your suggestion.

value: istio-system
repoRef:
name: manifests
path: istio/istio-install
Copy link
Contributor

@krishnadurai krishnadurai Oct 16, 2019

Choose a reason for hiding this comment

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

In istio-install istio-ingressgateway service is by default set to NodePort. I think the earlier platform config for this config assumes it to be LoadBalancer type.

We can address this later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, let's address this later.

@@ -0,0 +1,22 @@
# This config is gated on kiali upgrade to 0.21 from 0.16 in istio 1.1.6:
# https://github.com/kiali/kiali/issues/1154
# https://github.com/istio/istio/issues/11131
Copy link
Contributor

Choose a reason for hiding this comment

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

I can confirm that this issue is not surfacing through KfDef.

@yanniszark yanniszark force-pushed the feature-existing-arrikto-internal-relative-urls-v3 branch from 52aa3e5 to dd0b728 Compare October 17, 2019 17:37
@yanniszark
Copy link
Contributor Author

@krishnadurai thanks again for the review.
Gave it a final pass and fixed the application ordering.

For the comment:

I can confirm that this issue is not surfacing through KfDef.

I'm not sure if there's an actionable item there.
Is there and is it necessary for now, or can we leave it for a subsequent PR?

Copy link
Contributor

@krishnadurai krishnadurai left a comment

Choose a reason for hiding this comment

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

@yanniszark thanks.

Some of the comments on how we handle namespaces need to be addressed:

  1. https://github.com/kubeflow/manifests/pull/529/files#r335397628
  2. https://github.com/kubeflow/manifests/pull/529/files#r335528820
  3. https://github.com/kubeflow/manifests/pull/529/files#r335390356

I'm not sure if there's an actionable item there.
Is there and is it necessary for now, or can we leave it for a subsequent PR?

We could just note that this was observed while deploying through kubectl CLI and KfDef works fine.

@@ -0,0 +1,22 @@
# This config is gated on kiali upgrade to 0.21 from 0.16 in istio 1.1.6:
# https://github.com/kiali/kiali/issues/1154
# https://github.com/istio/istio/issues/11131
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can just change the comment to say that this was observed while deploying through kubectl CLI and it works fine with KfDef.

Signed-off-by: Yannis Zarkadas <[email protected]>
Signed-off-by: Yannis Zarkadas <[email protected]>
Signed-off-by: Yannis Zarkadas <[email protected]>
Signed-off-by: Yannis Zarkadas <[email protected]>
@yanniszark
Copy link
Contributor Author

@krishnadurai thanks, I made the changes but forgot to commit.
All done now!

@yanniszark yanniszark force-pushed the feature-existing-arrikto-internal-relative-urls-v3 branch from dd0b728 to 001e4fa Compare October 18, 2019 12:54
Signed-off-by: Yannis Zarkadas <[email protected]>
Signed-off-by: Yannis Zarkadas <[email protected]>
@yanniszark yanniszark force-pushed the feature-existing-arrikto-internal-relative-urls-v3 branch from 001e4fa to acc18c8 Compare October 18, 2019 13:29
@krishnadurai
Copy link
Contributor

@yanniszark great work with this PR!

/lgtm

@yanniszark
Copy link
Contributor Author

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: yanniszark

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

@k8s-ci-robot k8s-ci-robot merged commit 7f53ac9 into kubeflow:master Oct 18, 2019
Dibel pushed a commit to Dibel/manifests that referenced this pull request Nov 6, 2019
* istio: oidc-authservice

Signed-off-by: Yannis Zarkadas <[email protected]>

* dex: add virtualservice

Signed-off-by: Yannis Zarkadas <[email protected]>

* existing_arrikto kfdef update

Signed-off-by: Yannis Zarkadas <[email protected]>

* dex: custom image for relative urls

Signed-off-by: Yannis Zarkadas <[email protected]>

* istio: oidc-authservice: add application overlay

Signed-off-by: Yannis Zarkadas <[email protected]>

* reorder applications

Signed-off-by: Yannis Zarkadas <[email protected]>

* parameterize namespace

Signed-off-by: Yannis Zarkadas <[email protected]>

* regenerate tests

Signed-off-by: Yannis Zarkadas <[email protected]>

# Conflicts:
#	kfdef/kfctl_aws.0.7.0.yaml
k8s-ci-robot pushed a commit that referenced this pull request Dec 3, 2019
…529 on v0.7-branch. #529: istio: oidc-authservice (#615)

* istio: oidc-authservice

Signed-off-by: Yannis Zarkadas <[email protected]>

* dex: add virtualservice

Signed-off-by: Yannis Zarkadas <[email protected]>

* dex: custom image for relative urls

Signed-off-by: Yannis Zarkadas <[email protected]>

* istio: oidc-authservice: add application overlay

Signed-off-by: Yannis Zarkadas <[email protected]>

* parameterize namespace

Signed-off-by: Yannis Zarkadas <[email protected]>

* regenerate tests

Signed-off-by: Yannis Zarkadas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants