8000 GitHub - nachocano/gsuite-source: GSuite Event Sources PoC for Knative
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

nachocano/gsuite-source

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Knative G Suite Sources

This repository implements Event Sources to wire G Suite events into Knative Eventing.

Prerequisites

You will need:

  1. A Google Cloud project and install the gcloud CLI and run gcloud auth login. The samples below will use a mix of gcloud and kubectl commands. We assume that you have set the $PROJECT_ID environment variable to your GCP project ID, and that you set your project ID as default using gcloud config set project $PROJECT_ID.
  2. An internet-accessible Kubernetes cluster with Knative Serving installed. Follow the installation instructions if you need to create one.
  3. Ensure Knative Serving is configured with a domain name that allows G Suite to call into the cluster.
  4. Ensure Knative Serving is configured with HTTPS with a custom certificate as G Suite Push Notifications require HTTPS and valid certificates.
  5. If you're using GKE, you'll also want to assign a static IP address.
  6. Install Knative Eventing. Those instructions also install the default eventing sources.
  7. A G Suite domain where you have administrator privileges, as we will do G Suite Domain-Wide Delegation of Authority.

GCP Service Account and Kubernetes Secrets

  1. Create a GCP Service Account. All the examples below use the same service account but you can create different ones for the different G Suite applications. Create a new service account named gcs-source with the following command:

    1. Create a new service account named gsuite-source with the following command:
      gcloud iam service-accounts create gsuite-source
    2. Give that service account the viewer role for your GCP project:
      gcloud projects add-iam-policy-binding $PROJECT_ID \
        --member=serviceAccount:gsuite-source@$PROJECT_ID.iam.gserviceaccount.com \
        --role roles/viewer
    3. Edit that service account from the GCP UI, and mark the checkbox to Enable G Suite domain-wide delegation. Also, copy the Client ID to some notes as you will use it later.
    4. Download a new JSON private key for that service account.
       gcloud iam service-accounts keys create gsuite-source.json \
         --iam-account=gsuite-source@$PROJECT_ID.iam.gserviceaccount.com
    5. Create a namespace where the secret is created and where our controller will run
      kubectl create namespace gsuite-sources
    6. Create a secret on the Kubernetes cluster for the downloaded key. You need to store this key in key.json in a secret named gsuite-source-key. This is used by the controller to create webhooks to G Suite Push notifications.
    kubectl -n gsuite-sources create secret generic gsuite-source-key \
      --from-file=key.json=gsuite-source.json --dry-run -o yaml | kubectl apply --filename -
    1. Create another secret for the downloaded key that we will use in the different examples.
    kubectl -n default create secret generic gs-source-key --from-file=key.json=gsuite-source.json

Install G Suite Sources

Install the G Suite sources by executing:

ko apply -f ./config

Wait until the controller has Running status:

kubectl get pods -n gsuite-sources 
NAME                          READY   STATUS    RESTARTS   AGE
gsuite-controller-manager-0   1/1     Running   0          14s

The G Suite controller is up and running!

G Suite Sources CRDs

Below you can find the list of the currently supported G Suite sources CRDs and their respective examples that are packaged with this installation.

Name Status Support Description
Calendar Proof of Concept None Brings Google Calendar events into Knative
Drive Proof of Concept None Brings Google Drive events into Knative

Cleanup

You can remove the G Suite sources by deleting the namespace:

kubectl delete namespace gsuite-sources

About

GSuite Event Sources PoC for Knative

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0