

cirocosta/pizza-controller
source link: https://github.com/cirocosta/pizza-controller
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

pizza-controller
making kubernetes do what it was always meant to do: order pizza.
- https://gum.co/kubernetes-crds to get up to speed with custom resources and controllers
- docs for CRD reference
usage
First, create a secret with the credit card information (yeah, this is fine, trust me) to be used during payment:
kind: Secret apiVersion: v1 metadata: name: credit-card stringData: number: 123343132314232 expiration: 12/02 securityCode: 123 zip: m5d0l2
then, create a PizzaCustomer
, the representation of you, the customer:
kind: PizzaCustomer apiVersion: ops.tips/v1alpha1 metadata: name: you spec: firstName: barack lastName: obama email: [email protected] phone: "31241323" streetNumber: "20" streetName: King St city: Toronto state: "ON" zip: m5lz8j
With the PizzaCustomer
object created, we can see what's the closest store available
for it:
$ kubectl get pizzacustomer NAME CLOSEST you store-123
Looking at the PizzaStore object, we can check out its menu:
$ kubectl get pizzastore store-123 -o yaml kind: PizzaStore metadata: name: store-123 spec: address: | 51 Niagara St Toronto, ON M5V1C3 id: "10391" phone: 416-364-3939 products: - description: Unique Lymon (lemon-lime) flavor, clear, clean and crisp with no caffeine. id: 2LSPRITE name: Sprite size: 2 Litre
Knowing what's available to us, we can place the order:
kind: PizzaOrder apiVersion: ops.tips/v1 metadata: name: ma-pizza spec: yeahSurePlaceThisOrder: true # otherwise, it'll just calculate the price storeRef: {name: store-123} customerRef: {name: you} payment: creditCardSecretRef: {name: cc} items: - ticker: 10SCREEN quantity: 1
To keep track of what's going on with your pizza, check out the order's status:
$ kubectl get pizzaorder ma-pizza NAME PRICE ID CONDITION AGE order 9.030000 Wlz6HcE6BPlfQNlxDAXa OrderPlaced 68m
what's next?
are you really into ordering pizza using kubectl
?
like, really? are you sure?
here's what's missing:
- well, any .. tests
- order tracking (it's
xml
-based - SOAP stuff) - being more flexible with non-canadian folks (it's currently hardcoded for Canada, but could easily be changed)
at the moment I got my pizza .. development finished maybe you'll
carry it forward?
Installation
- apply the manifest
git clone https://github.com/cirocosta/pizza-controller
cd pizza-controller
# using `kapp` - recommended :)
#
kapp deploy -a pizza-controller -f ./config/release.yaml
# OR .. plain old kubectl
#
kubectl apply -f ./config/release.yaml
thanks
The API part was heavily inspired by these two projects:
Thank you!
LICENSE
Recommend
-
109
cr The concurrent runner Overview cr is a job executor co...
-
62
readme.md Pizza CLI
-
17
“The two pizza team” paradigm has become really popular in the context of organizing software teams. The idea is to have small, self-reliant teams working independently to solve problems. The “two-pizza” refers to the gui...
-
12
make pizza not warknoblauchbrotknoblauchöl, parmigiano, pfefferrote soßegrünzeug, maracuja-senf-dressing, walnüsse, mariniertes hähnchen, ziegenfrischkäse, rote-beete...
-
9
Pizza Time! Using CloudObjects Core for Domain Models For fun, let’s...
-
18
How Domino’s Pizza Drove a 90x Increase in Stock Value by Acting Like a Tech Startup Startups can learn some of the most valuable lessons on product and marketing from the growth of the world’s biggest pizza chain. The...
-
11
-
9
Just Rankin’ Sh!tThe 7 Least-Bad National Pizza Chain Restaurants, RankedAs long as it doesn’t rhyme with ‘Sbarro,’ we’re good
-
6
Building a Chatbot to Order a PizzaWe are building a PizzaBot using Microsoft’s Bot Framework v4 to help prove that chatbots have gone from a nifty side project to a new marketing and sales channel. Chatbots have evolved from a simple...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK