Documentation
¶
Index ¶
- Constants
- Variables
- func AddRPC(path string) error
- func AllInit(kubeConfigPath string, verbose bool, with []string) error
- func Banner()
- func BusyboxDeployment(name string) *v1.Deployment
- func Client() (*kubernetes.Clientset, error)
- func ClientFromFlags(apiUrl, kubeConfigPath string) (*kubernetes.Clientset, error)
- func ClientFromPath(kubeConfigPath string) (*kubernetes.Clientset, error)
- func Codify(input io.Reader, v *MainGoValues) ([]byte, error)
- func I32p(i int32) *int32
- func I64p(i int64) *int64
- func Install(app Deployable) error
- func List()
- func PrintObjects(app Deployable)
- func ReaderToBytes(input io.Reader) ([]byte, error)
- func Register(app Deployable)
- func RegisterAndError(app Deployable) error
- func RegisterAndExit(app Deployable)
- func RegisterRemoteApplications() error
- func Registry() map[string]Deployable
- func RunCommandLine() error
- func RunCommandLineAndExit()
- func RunCommandLineWithOptions() error
- func RunOutput(appName string, o OutputEncoding) error
- func RunRPC() error
- func Stringp(i string) *string
- func TestClusterKubeConfigPath() string
- func TestClusterStart() error
- func TestClusterStop() error
- func Uninstall(app Deployable) error
- type CodifyObject
- type Deployable
- type MainGoValues
- type OutputEncoding
- type Program
- type RPCApplication
- type RPCError
- type RPCPointer
- type Source
Constants ¶
const ( KubeconfigEnvironmentalVariable = "KUBECONFIG" KubeconfigDefaultDirectory = ".kube" KubeconfigDefaultFile = "config" )
const FormatMainGo string = `` /* 3084-byte string literal not displayed */
const ( // TestClusterName is used to identify the test cluster with Kind. TestClusterName string = "namltestcluster" )
const YAMLDelimiter string = "---"
YAMLDelimiter is the official delimiter used to append multiple YAML files together into the same file.
Reference: https://yaml.org/spec/1.2/spec.html
Furthermore let it be documented that at the 2018 KubeCon pub trivia Bryan Liles (https://twitter.com/bryanl) correctly had answered the trivia question with the correct delimiter of 3 characters "---" and was awarded no points for his correct answer, while an opposing team was awarded a single point for their incorrect answer of 2 characters "--".
If the correct delimiter points would have been awarded to Brian's team they would technically should have been crowned KubeCon pub champions of 2018.
Variables ¶
var Version string
Version is this specific version on naml
Functions ¶
func AllInit ¶
AllInit is the "constructor" for every command line flag. This is how we use naml -w to include sub-namls
func BusyboxDeployment ¶
func BusyboxDeployment(name string) *v1.Deployment
BusyboxDeployment is useful for quick testing and debugging. This is broken by design.
func Client ¶
func Client() (*kubernetes.Clientset, error)
Client is used to authenticate with Kubernetes and build the Kube client for the rest of the program.
func ClientFromFlags ¶
func ClientFromFlags(apiUrl, kubeConfigPath string) (*kubernetes.Clientset, error)
ClientFromFlags will plumb well-known command line flags through to the kubeconfig
func ClientFromPath ¶
func ClientFromPath(kubeConfigPath string) (*kubernetes.Clientset, error)
ClientFromPath is used to authenticate with Kubernetes and build the Kube client for the rest of the program given a specific kube config path.
Useful for testing.
func Codify ¶ added in v0.2.6
func Codify(input io.Reader, v *MainGoValues) ([]byte, error)
Codify will take any valid Kubernetes YAML as an io.Reader and do it's best to return a syntactically correct Go program that is NAML compliant.
The NAML codebase is Apache 2.0 licensed, so we assume that any calling code will adopt the same Apache license.
func Install ¶
func Install(app Deployable) error
Install is used to install an application in Kubernetes
func PrintObjects ¶ added in v0.2.9
func PrintObjects(app Deployable)
func ReaderToBytes ¶ added in v0.2.7
ReaderToBytes is basically a wrapper for ReadAll, however we add in some specific error language for stdin.
func RegisterAndError ¶
func RegisterAndError(app Deployable) error
func RegisterAndExit ¶
func RegisterAndExit(app Deployable)
RegisterAndExit will register the app or exit with an error message in stdout
func RegisterRemoteApplications ¶
func RegisterRemoteApplications() error
RegisterRemoteApplications will call list() on all remote RPC servers and register the applications as pointers on the remote.
func RunCommandLine ¶
func RunCommandLine() error
RunCommandLine is the global NAML command line program.
Use this if you would like to use the built in NAML command line interface.
func RunCommandLineAndExit ¶
func RunCommandLineAndExit()
func RunCommandLineWithOptions ¶
func RunCommandLineWithOptions() error
RunCommandLineWithOptions is here so we can default values in RunCommandLine() that we would want to pass in here later (tests, etc)
func RunOutput ¶ added in v0.2.7
func RunOutput(appName string, o OutputEncoding) error
func RunRPC ¶
func RunRPC() error
RunRPC will run in RPC mode.
TODO: Nóva to come add security auth and validation to our RPC
func TestClusterKubeConfigPath ¶
func TestClusterKubeConfigPath() string
TestClusterKubeConfigPath will export the kubeconfig path to this directory to use for the client in the tests.
func TestClusterStart ¶
func TestClusterStart() error
TestClusterStart can be used to start the test cluster in the TestMain() function.
func TestClusterStop ¶
func TestClusterStop() error
TestClusterStop can be used to stop the test cluster in the TestMain() function.
func Uninstall ¶
func Uninstall(app Deployable) error
Uninstall is used to uninstall an application in Kubernetes
Types ¶
type CodifyObject ¶ added in v0.2.6
type CodifyObject interface {
// Install returns the snippet of code that would
// traditionall live INSIDE of a function. This
// will define literally (what it can) a struct
// for the object, and pass it to the corresponding
// kubernetes library.
Install() (string, []string)
// Uninstall is the reverse library call of install.
Uninstall() string
}
func ReaderToCodifyObjects ¶ added in v0.2.7
func ReaderToCodifyObjects(input io.Reader) ([]CodifyObject, error)
type Deployable ¶
type Deployable interface {
// Install will attempt to install in Kubernetes
Install(client *kubernetes.Clientset) error
// Uninstall will attempt to uninstall in Kubernetes
Uninstall(client *kubernetes.Clientset) error
// Meta returns the Kubernetes native ObjectMeta which is used to manage applications with naml.
Meta() *metav1.ObjectMeta
// Description returns the application description
Description() string
// Objects will return the runtime objects defined for each application
Objects() []runtime.Object
}
Deployable is an interface that can be implemented for deployable applications.
type MainGoValues ¶ added in v0.2.6
type MainGoValues struct {
AuthorName string
AuthorEmail string
CopyrightYear string
AppNameTitle string
AppNameLower string
Description string
Version string
Install string
Uninstall string
Packages string
}
MainGoValues are ultimately what is rendered into the .naml files in /src. These values are what will be created in the output.
type OutputEncoding ¶ added in v0.2.7
type OutputEncoding int
const ( OutputYAML OutputEncoding = 0 OutputJSON OutputEncoding = 1 )
type Program ¶ added in v0.2.7
type RPCApplication ¶
type RPCApplication struct {
// Name is the name of the remote application
AppName string
// Remote is the associated remote RPC server
Remote *RPCPointer
// AppDescription is the application description
AppDescription string
// AppVersion is the application version
AppVersion string
// O is the runtime.Objects
O []runtime.Object
}
RPCApplication is the pointer in the parent process to the child process internal application.
func (*RPCApplication) Description ¶
func (c *RPCApplication) Description() string
func (*RPCApplication) Install ¶
func (c *RPCApplication) Install(clientset *kubernetes.Clientset) error
Install is the remote application install wrapper.
func (*RPCApplication) Meta ¶
func (c *RPCApplication) Meta() *v1.ObjectMeta
func (*RPCApplication) Objects ¶ added in v0.2.7
func (c *RPCApplication) Objects() []runtime.Object
Objects will just return to runtime.Objects for each app.
func (*RPCApplication) Uninstall ¶
func (c *RPCApplication) Uninstall(clientset *kubernetes.Clientset) error
Uninstall is the remote application uninstall wrapper.
type RPCError ¶
type RPCError struct {
Message string
}
RPCError is when something goes wrong over the RPC
type RPCPointer ¶
RPCPointer is a pointer that allows us to connect to a remote RPC server