Code Monkey home page Code Monkey logo

kcc-demo's Introduction

kcc-demo

Collection of Config Connector demos on GKE. More info about KCC here.

For more on declarative management of Kubernetes objects see docs here.

Assumptions

  • gcloud installed and authenticated
  • gcloud defaults defined (example):
gcloud config set project YOUR_PROJECT_ID
gcloud config set compute/region us-west1
gcloud config set compute/zone us-west1-c

Setup

This will create GKE cluster (kcc-demo) and configure KCC on namespace demo:

bin/setup

Verify installation:

kubectl wait -n cnrm-system --for=condition=Ready pod --all

It may take a minute for the resources to be available. Eventually, if everything installed correctly, you should see at least 5 condition met statements:

pod/cnrm-controller-manager-0 condition met
pod/cnrm-deletiondefender-0 condition met
pod/cnrm-resource-stats-recorder-******-ztwpm condition met
pod/cnrm-webhook-manager-******-***** condition met
pod/cnrm-webhook-manager-******-***** condition met

Demo

Use bin/reset to reset demo state after previous runs

Show available GCP resources in UI. And by querying the cluster CRDs:

kubectl get crds --selector cnrm.cloud.google.com/managed-by-kcc=true # | grep pubsub

more info on

PubSub

Show API description for the PubSubTopic:

kubectl describe crd pubsubtopics.pubsub.cnrm.cloud.google.com

Enable PubSub service:

kubectl apply -f config/enable-pubsub.yaml

The YAML:

apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1
kind: Service
metadata:
  name: pubsub.googleapis.com
spec:
  projectRef:
    external: projects/PROJECT_ID

Create PubSub Topic (kcc-demo-topic):

kubectl apply -f config/pubsub-topic.yaml

The YAML:

apiVersion: pubsub.cnrm.cloud.google.com/v1beta1
kind: PubSubTopic
metadata:
  annotations:
    cnrm.cloud.google.com/project-id: PROJECT_ID
  name: kcc-demo-topic

Once created, you can describe the created resource:

kubectl describe pubsubtopics

You can also navigate to the list of PubSub Topics in Console, or verify (condition met) that the resource is created via kubectl:

kubectl wait --for=condition=READY pubsubtopics kcc-demo-topic

BigQuery

KCC is also not only for service creation, you can also manage objects in those services, see BigQuery dataset example below:

apiVersion: bigquery.cnrm.cloud.google.com/v1beta1
  kind: BigQueryDataset
  metadata:
    name: bigquerydatasetsample
  spec:
    defaultTableExpirationMs: 3600000
    description: "BigQuery Dataset Sample"
    friendlyName: bigquerydataset-sample
    location: US

Cleanup

To delete all resources created by this demo, including the GKE cluster service account:

bin/cleanup

To only reset demo state use bin/reset.

Disclaimer

This is my personal project and it does not represent my employer. While I do my best to ensure that everything works, I take no responsibility for issues caused by this code.

kcc-demo's People

Contributors

mchmarny avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.