...

Package guestbook

import "k8s.io/kubernetes/test/images/agnhost/guestbook"
Overview
Index

Overview ▾

Index ▾

Package files

guestbook.go

Variables

CmdGuestbook is used by agnhost Cobra.

var CmdGuestbook = &cobra.Command{
    Use:   "guestbook",
    Short: "Creates a HTTP server with various endpoints representing a guestbook app",
    Long: `Starts a HTTP server on the given --http-port (default: 80), serving various endpoints representing a guestbook app. The endpoints and their purpose are:

- /register: A guestbook replica will subscribe to a primary, to its given --replicaof endpoint. The primary will then push any updates it receives to its registered replicas through the --backend-port.
- /get: Returns '{"data": value}', where the value is the stored value for the given key if non-empty, or the entire store.
- /set: Will set the given key-value pair in its own store and propagate it to its replicas, if any. Will return '{"data": "Updated"}' to the caller on success.
- /guestbook: Will proxy the request to agnhost-primary if the given cmd is 'set', or agnhost-replica if the given cmd is 'get'.`,
    Args: cobra.MaximumNArgs(0),
    Run:  main,
}