validators

package
v0.0.0-...-7449cab Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigMapEnvVars []EnvVar

The `deployment` validator needs access to these env vars so it can plug them into its template. This needs to happen because the current Deployment has the env vars embedded but the new Deployment will access them via a `ConfigMap`.

Functions

func GetClient

func GetClient() (*kubernetes.Clientset, error)

func GetDeploymentClient

func GetDeploymentClient(kind string) (*v1.Deployment, error)

func GetIngressClient

func GetIngressClient(kind string) (*networkingv1.Ingress, error)

func GetServiceClient

func GetServiceClient(kind string) (*corev1.Service, error)

func New

func New(filename string)

func RemoveDir

func RemoveDir(buildDir, serviceDir string) error

func Validate

func Validate(localFile, remoteFile string) (bool, error)

func WriteTemplate

func WriteTemplate(to, from string, T any) error

Types

type ConfigMapManifest

type ConfigMapManifest struct {
	APIVersion string   `json:"apiVersion"`
	Kind       string   `json:"kind"`
	Metadata   Metadata `json:"metadata"`
	Data       Data     `json:"data"`
}

func (ConfigMapManifest) Write

func (m ConfigMapManifest) Write()

type Container

type Container struct {
	Name            string             `json:"name,omitempty"`
	Image           string             `json:"image,omitempty"`
	ImagePullPolicy string             `json:"imagePullPolicy,omitempty"`
	Env             []EnvVar           `json:"env,omitempty"`
	EnvFrom         []EnvFrom          `json:"envFrom,omitempty"`
	Ports           []v1.ContainerPort `json:"ports,omitempty"`
	Resources       Resources          `json:"resources,omitempty"`
	VolumeMounts    []VolumeMount      `json:"volumeMounts,omitempty"`
}

type Data

type Data map[string]string

type DeploymentManifest

type DeploymentManifest struct {
	APIVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`
	Metadata   `json:"metadata"`
	Spec       DeploymentSpec `json:"spec"`
}

func (DeploymentManifest) Write

func (m DeploymentManifest) Write()

type DeploymentSpec

type DeploymentSpec struct {
	Replicas int           `json:"replicas,omitempty"`
	Selector LabelSelector `json:"selector,omitempty"`
	Template Template      `json:"template,omitempty"`
}

type Document

type Document[T Manifest] struct {
	Manifest T `json:"manifest"`
}

func (*Document[T]) DecodeAndPrint

func (m *Document[T]) DecodeAndPrint(dec *json.Decoder) error

type EnvFrom

type EnvFrom struct {
	ConfigMapRef Data `json:"configMapRef,omitempty"`
}

type EnvVar

type EnvVar struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type HTTPIngressPath

type HTTPIngressPath struct {
	Path     string         `json:"path,omitempty"`
	PathType string         `json:"pathType,omitempty"`
	Backend  IngressBackend `json:"backend,omitempty"`
}

type HTTPIngressRuleValue

type HTTPIngressRuleValue struct {
	Paths []HTTPIngressPath `json:"paths,omitempty"`
}

type IngressBackend

type IngressBackend struct {
	Service IngressServiceBackend `json:"service,omitempty"`
}

type IngressManifest

type IngressManifest struct {
	APIVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`
	Metadata   `json:"metadata"`
	Spec       IngressSpec `json:"spec"`
}

func (IngressManifest) Write

func (m IngressManifest) Write()

type IngressRule

type IngressRule struct {
	IngressRuleValue `json:",inline,omitempty"`
}

type IngressRuleValue

type IngressRuleValue struct {
	HTTP HTTPIngressRuleValue `json:"http,omitempty"`
}

type IngressServiceBackend

type IngressServiceBackend struct {
	Name string             `json:"name,omitempty"`
	Port ServiceBackendPort `json:"port,omitempty"`
}

type IngressSpec

type IngressSpec struct {
	Rules []IngressRule `json:"rules,omitempty"`
}

type LabelSelector

type LabelSelector struct {
	MatchLabels Data `json:"matchLabels,omitempty"`
}

type Manifest

type Manifest interface {
	ConfigMapManifest | DeploymentManifest | IngressManifest | ServiceManifest
	Write()
}

type Metadata

type Metadata struct {
	Name        string            `json:"name,omitempty"`
	Namespace   string            `json:"namespace,omitempty"`
	Labels      Data              `json:"labels,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
}

type NFSVolumeSource

type NFSVolumeSource struct {
	Server   string `json:"server,omitempty"`
	Path     string `json:"path,omitempty"`
	ReadOnly bool   `json:"read_only,omitempty"`
}

type PodSpec

type PodSpec struct {
	Containers   []Container `json:"containers,omitempty"`
	Volumes      []Volume    `json:"volumes,omitempty"`
	NodeSelector Data        `json:"nodeSelector,omitempty"`
}

type Resources

type Resources struct {
	Limits   v1.ResourceList `json:"limits,omitempty"`
	Requests v1.ResourceList `json:"requests,omitempty"`
}

type ServiceBackendPort

type ServiceBackendPort struct {
	Name   string `json:"name,omitempty"`
	Number int    `json:"number,omitempty"`
}

type ServiceManifest

type ServiceManifest struct {
	APIVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`
	Metadata   `json:"metadata"`
	Spec       ServiceSpec `json:"spec"`
}

func (ServiceManifest) Write

func (m ServiceManifest) Write()

type ServicePort

type ServicePort struct {
	Port       int
	TargetPort intstr.IntOrString
	Protocol   string
}

type ServiceSpec

type ServiceSpec struct {
	Ports    []ServicePort
	Selector Data
	Type     string
}

type Template

type Template struct {
	Metadata Metadata `json:"metadata,omitempty"`
	Spec     PodSpec  `json:"spec,omitempty"`
}

type Volume

type Volume struct {
	Name string           `json:"name,omitempty"`
	NFS  *NFSVolumeSource `json:"nfs,omitempty"`
}

type VolumeMount

type VolumeMount struct {
	Name      string `json:"name,omitempty"`
	MountPath string `json:"mountPath,omitempty"`
	SubPath   string `json:"subPath,omitempty"`
}

Jump to

Keyboard shortcuts

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