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

Migrate to v1.6.0-rc.1 #378

Merged
merged 27 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b09010d
Merge pull request #1 from kubeflow/master
gkcalat Jul 6, 2022
2118483
Merge branch 'kubeflow:master' into master
gkcalat Jul 7, 2022
8ebfe96
Merge branch 'kubeflow:master' into master
gkcalat Jul 11, 2022
5c4e4e5
Merge branch 'kubeflow:master' into master
gkcalat Jul 13, 2022
80469f5
Update changelog.md. Closes #360. Closes #365.
gkcalat Jul 17, 2022
0f2662f
Remove deprecated KFServing component. Closes #375
gkcalat Jul 19, 2022
ee585c8
Upgrade knative serving to v1.2.5, net-istio to 1.2 (#365)
gkcalat Jul 17, 2022
4221c30
Add comment about serving-crds.yaml
gkcalat Jul 18, 2022
fc3bc45
Update the backend-updater workload to fix #371
gkcalat Jul 17, 2022
76dde6f
Prevent recreation of iap-enabler and backend-updater
gkcalat Jul 17, 2022
5e08f5d
Migrate from authorization.k8s.io/v1beta1
gkcalat Jul 19, 2022
fc735cf
Migrate from networking.k8s.io/v1beta1
gkcalat Jul 19, 2022
3444e76
Migrate from rbac.authorization.k8s.io/v1beta1
gkcalat Jul 19, 2022
b0f60ab
Update config-connector
gkcalat Jul 19, 2022
3b05197
Clean up comments after removing KFServing
gkcalat Jul 19, 2022
994a11e
Migrate from apiextensions.k8s.io/v1beta1
gkcalat Jul 19, 2022
26cf798
Update README for config-controller
gkcalat Jul 20, 2022
fa8491e
Change pathType in ingress, fix typos
gkcalat Aug 3, 2022
4e5e319
Bump upstream tags
gkcalat Aug 3, 2022
49877d3
Update CHANGELOG
gkcalat Aug 3, 2022
d491a3b
Migrate from cloud-endpoints-controller
gkcalat Aug 4, 2022
c3e640c
Move cloud endpoint to deployments
gkcalat Aug 4, 2022
9411955
Deprecate cloud-endpoints-controller
gkcalat Aug 4, 2022
cbe4366
Update changelog. Closes #377.
gkcalat Aug 4, 2022
5407621
Merge branch 'master' into updateChangelog
gkcalat Aug 4, 2022
c9d293b
Move services activation to the website instructions
gkcalat Aug 7, 2022
f430ef7
Add readme for iap-ingress component
gkcalat Aug 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions kubeflow/common/iap-ingress/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Identity-Aware Proxy (IAP) Ingress

[IAP](https://cloud.google.com/iap) establishes a central authorization layer via HTTPS and enables application-level access control. Your kubeflow cluster can only be accessed through the proxy by users, who have the correct Identity and Access Management (IAM) role. When you grant a user access by IAP, they're subject to the fine-grained access controls without requiring a VPN. When a user tries to access the kubeflow cluster, IAP performs authentication and authorization checks.

IAP is [integrated through Ingress](https://cloud.google.com/iap/docs/enabling-kubernetes-howto). The incoming traffic is handled by [HTTPS Load Balancing](https://cloud.google.com/load-balancing/docs/https), a component of Cloud Load Balancing, configured by the Ingress controller. The Ingress controller gets configuration information from an [Ingress](https://cloud.google.com/kubernetes-engine/docs/concepts/ingress) object (**envoy-ingress**) that is associated with one or more Service objects. Each Service object holds routing information that is used to direct an incoming request to a particular Pod and port. The Ingress controller reads configuration information from the BackendConfig (**iap-backendconfig**) and sets up the load balancer accordingly. **iap-backendconfig** holds configuration information that is specific to Cloud Load Balancing.

To create a fully qualified domain name (FQDN) for the kubeflow cluster and expose it through HTTPS, we employ [Cloud Endpoints](https://cloud.google.com/endpoints). Cloud Endpoints is an API management system that helps you secure, monitor, analyze, and set quotas on your APIs using the same infrastructure Google uses for its own APIs. Endpoints works with the Extensible Service Proxy (ESP) and the Extensible Service Proxy V2 (ESPv2) to provide API management. Endpoints supports version 2 of the OpenAPI Specification (formerly known as the [Swagger spec](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md)) — the industry standard for defining REST APIs. If you are unfamiliar with the OpenAPI Specification, see [OpenAPI Overview](https://cloud.google.com/endpoints/docs/openapi/openapi-overview).

## iap-enabler

[IAP uses](https://cloud.google.com/iap/docs/signed-headers-howto) JSON Web Tokens ([JWT](https://jwt.io/introduction)) to make sure that a request to kubeflow is authorized. This protects kubeflow from IAP being accidentally disabled, misconfigured firewalls, and access from within the project. This *Deployment* applies a RequestAuthentication (**ingress-jwt**) to the kubeflow cluster based on the [policy.yaml template](./base/policy.yaml).

## backend-updater

HTTPS Load Balancing requires a [health check](https://cloud.google.com/load-balancing/docs/health-check-concepts) to determine if backend (**istio-ingressgateway**) responds to traffic. This *StatefulSet* updates the **iap-backendconfig** with the appropriate backend port and backend path for the corresponding health check.

## cloud-endpoints-enabler

This *Deployment* is introduced to replace cloud-endpoints-controller. It [establishes a cloud endpoint](https://cloud.google.com/endpoints/docs/openapi/get-started-kubernetes-engine-espv2) using OpenAPI specification. It uses [swagger_template.yaml](./base/swagger_template.yaml) to build an appropriate OpenAPI spec. This template was used in the original [cloud-endpoint-controller](https://github.com/danisla/cloud-endpoints-controller) (deprecated) in Kubeflow 1.5.1 and earlier.
Comment on lines +9 to +19
Copy link
Collaborator

Choose a reason for hiding this comment

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

Very good writeup! As an additional information, you can share the link to kubeflow/common/iap-ingress/base/config-map.yaml where people can view and update iap-enabler/backend-updater/cloud-endpoints-enabler.

15 changes: 8 additions & 7 deletions kubeflow/common/iap-ingress/base/config-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ data:
sleep 3600
done
setup_cloudendpoints.sh: |
#!/usr/bin/env bash
#!/bin/bash
#
# A simple shell script to configure a cloud endpoint
set -x
Expand Down Expand Up @@ -236,24 +236,25 @@ data:
echo BACKEND_ID=${BACKEND_ID}

JWT_AUDIENCE="/projects/${PROJECT_NUM}/global/backendServices/${BACKEND_ID}"

# We use a regular expression to obtain the IP address of the target Ingress, assuming IPv4 standard.
INGRESS_TARGET_IP=$(kubectl get ingress --all-namespaces | grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)")
gkcalat marked this conversation as resolved.
Show resolved Hide resolved

echo "[DEBUG] ENDPOINT_NAME = ${ENDPOINT_NAME}"
echo "[DEBUG] INGRESS_TARGET_IP = ${INGRESS_TARGET_IP}"
echo "[DEBUG] JWT_AUDIENCE = ${JWT_AUDIENCE}"

# Create OpenAPI specification for the RESTful Cloud Endpoint
sed "s|JWT_AUDIENCE|${JWT_AUDIENCE}|;s|ENDPOINT_NAME|${ENDPOINT_NAME}|;s|INGRESS_TARGET_IP|${INGRESS_TARGET_IP}|" /var/envoy-config/swagger_template.yaml > openapi.yaml

# Deploy and enable the endpoint
gcloud endpoints services deploy openapi.yaml
Copy link
Contributor

Choose a reason for hiding this comment

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

In my setup, the admin SA does not have enough permissions to execute this.
I had to grant it roles/serviceusage.serviceUsageAdmin (see: https://cloud.google.com/service-usage/docs/access-control#predefined_roles)

Perhaps we need a new entry in kf-admin-policy.yaml ?

Copy link
Contributor

@fabito fabito Aug 17, 2022

Choose a reason for hiding this comment

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

After solving the permission issue above, I have a new endpoint deployed every 30 secs

Screenshot from 2022-08-17 12-59-42

Is this expected ?
Shouldn't we add a check and only deploy if necessary ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @fabito.
Thank you for your feedback!

The purpose of cloud-endpoints-enabler is to create and activate a cloud endpoint during deployment. It's supposed to be deleted at the end of make apply run. The behavior you observed is not intended, as we recommend running make apply and choose necessary components in config.yaml instead of deploying each component separately.

As per permissions, I was not able to reproduce the error you mentioned. Could you create a separate issue with details about your GKE cluster?

Current approach clearly has room for improvement. Your contributions are very welcome!


gcloud services enable servicemanagement.googleapis.com
gcloud services enable servicecontrol.googleapis.com
gcloud services enable endpoints.googleapis.com

gcloud services enable ${ENDPOINT_NAME}

# Create IAM resources used by the endpoint
gcloud endpoints services add-iam-policy-binding ${ENDPOINT_NAME} \
--member serviceAccount:${SERVICE_ACCOUNTNAME} \
--role roles/servicemanagement.serviceController

gcloud projects add-iam-policy-binding ${PROJECT} \
Copy link
Contributor

@fabito fabito Aug 17, 2022

Choose a reason for hiding this comment

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

Why do we need roles/cloudtrace.agent ?
If this is a new role for the admin SA at the project level, I think we need to move it to kf-admin-policy.yaml:

apiVersion: iam.cnrm.cloud.google.com/v1beta1
kind: IAMPolicyMember
metadata:
  name: KUBEFLOW-NAME-admin-cloudtraceagent # kpt-set: ${name}-admin-cloudtraceagent
spec:
  member: serviceAccount:[email protected] # kpt-set: serviceAccount:${name}-admin@${gcloud.core.project}.iam.gserviceaccount.com
  role: roles/cloudtrace.agent
  resourceRef:
    apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1
    kind: Project
    external: projects/PROJECT # kpt-set: projects/${gcloud.core.project}

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 is to enable Cloud Trace for troubleshooting, which we might actually disable for now as it doesn't seem to be a necessary feature. Your suggestion on moving it to the YAML file SGTM though. Thank you for your feedback!

--member serviceAccount:${SERVICE_ACCOUNTNAME} \
--role roles/cloudtrace.agent
Expand Down