GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - karmab/samplecontroller: a demo of how to run a python custom controller with crd on kubernetes

This repository was archived by the owner on Aug 22, 2023. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

43 Commits
43 Commits

Folders and files

NameName
Last commit message
Last commit date
crd
crd
 
 
initializer
initializer
 
 
kopf
kopf
 
 
ui
ui
 
 
.gitignore
.gitignore
 
 
Dockerfile
Dockerfile
 
 
Dockerfile.client-python-kubernetes
Dockerfile.client-python-kubernetes
 
 
Dockerfile_kopf
Dockerfile_kopf
 
 
README.md
README.md
 
 
controller.py
controller.py
 
 
demo.md
demo.md
 
 
demo.sh
demo.sh
 
 
events.py
events.py
 
 
guitar.yml
guitar.yml
 
 
image_cleaner.py
image_cleaner.py
 
 
piano.yml
piano.yml
 
 

Repository files navigation

samplecontroller repository

This is a simple controller to demonstrate how to interact within kubernetes using python api and custom resource definitions

Requisites

  • a running kubernetes/openshift cluster

Running

on minikub/gce

kubectl run samplecontroller --image=karmab/samplecontroller --restart=Always
kubectl run sampleui --image=karmab/sampleui
kubectl expose deployment sampleui --port=9000 --target-port=9000 --type=LoadBalancer
  • on openshift ( enough privileges needed as i m checking guitars cluster wide)
oc new-project guitarcenter
oc adm policy add-cluster-role-to-user cluster-admin -z default -n guitarcenter
oc new-app karmab/samplecontroller

Note that the guitar custom resource definition gets created when launching the controller

How to use

Create some guitars and see the review made for you

oc create -f crd/stratocaster.yml
oc create -f crd/lespaul.yml
oc get guitars -o yaml

UI

To ease testing, you can also use the provided UI to list, create and delete guitars

oc new-app karmab/sampleui
oc expose svc sampleui

BONUS

You can also have a look at initializer for extra code around Initializers

Also, if you prefer to use kopf, you can use the code in kopf_handler.py

Copyright

Copyright 2017 Karim Boumedhel

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Problems?

Send me a mail at [email protected] !

Mc Fly!!!

karmab

About

a demo of how to run a python custom controller with crd on kubernetes

Topics

crdcustomcontrollerkubernetespython

Resources

Readme
Activity

Stars

77 stars

Watchers

1 watching

Forks

26 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.