infra

package module
v0.0.0-...-e40ffd5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2023 License: Unlicense Imports: 39 Imported by: 0

README

infra

Infrastructure that is also code, or the other way around.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DeployCmd = &cobra.Command{
	Use:   "deploy",
	Short: "Deploy the service to a cluster.",
	Long:  deploytxt,
	RunE: func(_ *cobra.Command, _ []string) error {
		errnie.Tracing(tweaker.GetBool("errnie.trace"))
		errnie.Debugging(tweaker.GetBool("errnie.debug"))

		tags := []string{}

		switch tweaker.Stage() {
		case "development":
			tags = append(tags, os.Getenv("USER"))
		default:
			tags = append(tags, tweaker.Stage())
		}

		container := NewContainer(tweaker.Program(), tags)
		container.Build()

		container.Push()

		cluster := NewKind()
		cluster.Provision()

		deploy := NewDeploy(cluster)
		deploy.Do()

		return nil
	},
}

DeployCmd deploys the service to a cluster.

This command is added to the rootCmd of each service, so we prevent having to deplicate this code.

TODO: We could probably do the same with the runCmd, if we made all

the managers have the same name, or better still, just have
one manager that can handle all services, like the request handler.

Functions

This section is empty.

Types

type Client

type Client struct {
	KubeClient *kubernetes.Clientset

	ControllerClient *clientset.Clientset
	ExtClient        *apiextension.Clientset
	PromClient       *promclientset.Clientset
	HelmClient       helmclient.Client
	// contains filtered or unexported fields
}

Client wraps the various Kubernetes clients that are needed to manipulate both Kubernetes native, as well as extended or custom resources.

func NewClient

func NewClient() *Client

NewClient returns a handle on the various clients that we will need access to.

func (Client) Apply

func (client Client) Apply(scope string, values map[string]string)

type Cluster

type Cluster interface {
	Provision() error
	Teardown() error
}

type Container

type Container struct {
	// contains filtered or unexported fields
}

Container wraps the behavior of building Docker images and pushing them to container repositories.

func NewContainer

func NewContainer(name string, tags []string) *Container

NewContainer constructs an instance of Container and returns a pointer reference to it.

It is the entrypoint to building a Dockerfile and pushing the result to a container registry.

func (*Container) Build

func (container *Container) Build()

Build a Dockerfile for any service.

func (*Container) Push

func (container *Container) Push()

type Daemon

type Daemon struct{}

func NewDaemon

func NewDaemon() *Daemon

type Deploy

type Deploy struct {
	// contains filtered or unexported fields
}

Deploy wraps the process of reading the embedded manifest configuration, which orchestrates the provisioning of the platform and infrastructure.

func NewDeploy

func NewDeploy(cluster *Kind) *Deploy

NewDeploy constructs an instance of Deploy and returns a pointer reference to it.

func (*Deploy) Do

func (deploy *Deploy) Do() error

Do the deployment, which brings up everything we need in the cluster.

type Kind

type Kind struct {
	// contains filtered or unexported fields
}

func NewKind

func NewKind() *Kind

func (*Kind) Provision

func (cluster *Kind) Provision() error

func (*Kind) Teardown

func (cluster *Kind) Teardown() error

type LogLine

type LogLine struct {
	Stream         string `json:"stream"`
	Status         string `json:"status"`
	ProgressDetail struct {
		Current  int    `json:"current"`
		Total    int    `json:"total"`
		Progress string `json:"progress"`
	} `json:"progressDetail"`
	Error       string `json:"error"`
	ErrorDetail struct {
		Message string `json:"message"`
	} `json:"errorDetail"`
}

type Manifest

type Manifest struct {
	// contains filtered or unexported fields
}

func NewManifest

func NewManifest(scope string, values map[string]string, f string) *Manifest

func (*Manifest) Compile

func (manifest *Manifest) Compile() []byte

type Values

type Values struct {
	Name      string
	Namespace string
	Data      string
	Port      string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL