Skip to content

Instantly share code, notes, and snippets.

@polvi

polvi/README.md

Last active May 22, 2018
Embed
What would you like to do?

kQuery

A jQuery like library for manipulating kubernetes objects across various popular kubernetes platforms.

Problems that kQuery addresses:

  • Easy to use client library that is accessible to a wide range of developers (javascript/jQuery)
  • Consistent client library across inconsistent kubernetes implementations (abstracts the differences between EKS/AKS/GKE/Tectonic etc)
  • Simplify building long running custom controllers or operators on k8s

Examples

// jQuery like selector syntax
var pod = $('pod[name=my-pod]');

// supports events
pod.on( 'status-change', function( event ) {
  $('service', {
    name: 'expose-pod',
    label-selector: 'name=my-pod'
  )).create(event.namespace);
});

// supports chaining
$('namespace[name=default]').find('pod').delete();

// is aware of cluster compatibility 
if ( $.kubernetes.tectonic ) {
  console.log('this is CoreOS Tectonic!');
} else if ( $.kubernetes.aks ) {
  console.log('Azure ftw!');
} 
@lpabon

This comment has been minimized.

Copy link

@lpabon lpabon commented Jan 31, 2018

This is a really cool idea. I have seen lots of users, developers, and customers just use kubectl and shell scripts as a poor man's version of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment