app2kube

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const MaxNameLength = 63

MaxNameLength of App

View Source
const NamespaceDefault = apiv1.NamespaceDefault

NamespaceDefault means the object is in the default namespace which is applied when not specified by clients

Variables

This section is empty.

Functions

func DecryptAES

func DecryptAES(password string, crypt64 string) (string, error)

DecryptAES base64 string encoded by the AES-256 CBC

func DecryptRSA added in v0.6.0

func DecryptRSA(privateKey string, crypt64 string) (string, error)

DecryptRSA base64 string encoded by the RSA private key

func EncryptAES

func EncryptAES(password string, plaintext string) (string, error)

EncryptAES text with AES-256 CBC and returns a base64 encoded string

func EncryptRSA added in v0.6.0

func EncryptRSA(publicKey string, plaintext string) (string, error)

EncryptRSA text with RSA public key and returns a base64 encoded string

func GenerateRSAKeys added in v0.6.0

func GenerateRSAKeys(bits int) (string, string, error)

GenerateRSAKeys returns a base64 encoded public and private keys

func IsEncrypted added in v0.6.0

func IsEncrypted(value string) bool

IsEncrypted returns true if the value is encrypted

func PrintObj

func PrintObj(obj runtime.Object, output string) (string, error)

PrintObj return manifest from object

Types

type App

type App struct {
	Branch string `yaml:"branch"`
	Common struct {
		CronjobSuspend     bool            `yaml:"cronjobSuspend"`
		DNSPolicy          apiv1.DNSPolicy `yaml:"dnsPolicy"`
		EnableServiceLinks bool            `yaml:"enableServiceLinks"`
		GracePeriod        int64           `yaml:"gracePeriod"`
		Image              struct {
			PullPolicy  apiv1.PullPolicy `yaml:"pullPolicy"`
			PullSecrets string           `yaml:"pullSecrets"`
			Repository  string           `yaml:"repository"`
			Tag         string           `yaml:"tag"`
		} `yaml:"image"`
		Ingress struct {
			IngressCommon
		} `yaml:"ingress"`
		MountServiceAccountToken bool               `yaml:"mountServiceAccountToken"`
		NodeSelector             map[string]string  `yaml:"nodeSelector"`
		PodAntiAffinity          string             `yaml:"podAntiAffinity"`
		SharedData               string             `yaml:"sharedData"`
		Tolerations              []apiv1.Toleration `yaml:"tolerations"`
	} `yaml:"common"`
	ConfigMap map[string]string `yaml:"configmap"`
	Cronjob   map[string]struct {
		ActiveDeadlineSeconds      int64                      `yaml:"activeDeadlineSeconds"`
		BackoffLimit               int32                      `yaml:"backoffLimit"`
		ConcurrencyPolicy          batch.ConcurrencyPolicy    `yaml:"concurrencyPolicy"`
		Container                  apiv1.Container            `yaml:"container"`
		Containers                 map[string]apiv1.Container `yaml:"container"`
		FailedJobsHistoryLimit     int32                      `yaml:"failedJobsHistoryLimit"`
		RestartPolicy              apiv1.RestartPolicy        `yaml:"restartPolicy"`
		Schedule                   string                     `yaml:"schedule"`
		SuccessfulJobsHistoryLimit int32                      `yaml:"successfulJobsHistoryLimit"`
		Suspend                    bool                       `yaml:"suspend"`
	} `yaml:"cronjob"`
	Deployment struct {
		BlueGreenColor       string                     `yaml:"blueGreenColor"`
		Containers           map[string]apiv1.Container `yaml:"containers"`
		InitContainers       map[string]apiv1.Container `yaml:"initContainers"`
		ReplicaCount         int32                      `yaml:"replicaCount"`
		ReplicaCountStaging  int32                      `yaml:"replicaCountStaging"`
		RevisionHistoryLimit int32                      `yaml:"revisionHistoryLimit"`
		Strategy             appsv1.DeploymentStrategy  `yaml:"strategy"`
	} `yaml:"deployment"`
	Env       map[string]string  `yaml:"env"`
	Ingress   []Ingress          `yaml:"ingress"`
	Labels    map[string]string  `yaml:"labels"`
	Name      string             `yaml:"name"`
	Namespace string             `yaml:"namespace"`
	Secrets   map[string]string  `yaml:"secrets"`
	Service   map[string]Service `yaml:"service"`
	Staging   string             `yaml:"staging"`
	Volumes   map[string]struct {
		Spec      apiv1.PersistentVolumeClaimSpec `yaml:"spec"`
		MountPath string                          `yaml:"mountPath"`
	} `yaml:"volumes"`
	// contains filtered or unexported fields
}

App instance

func NewApp

func NewApp() *App

NewApp return App instance

func (*App) EncryptSecret added in v0.6.0

func (app *App) EncryptSecret(plaintext string) (string, error)

EncryptSecret encrypts plaintext secret by AES or RSA. It returns a string with a prefix "AES#" or "RSA#" and a base64 encoded encrypted secret. RSA has priority over AES if both keys are specified.

func (*App) GetColorLabels added in v0.4.0

func (app *App) GetColorLabels() map[string]string

GetColorLabels return labels for blue/green deployment

func (*App) GetConfigMap

func (app *App) GetConfigMap() (configmap *apiv1.ConfigMap, err error)

GetConfigMap resource

func (*App) GetCronJobs

func (app *App) GetCronJobs() (crons []*batch.CronJob, err error)

GetCronJobs resource

func (*App) GetDecryptedSecrets added in v0.5.0

func (app *App) GetDecryptedSecrets() (secrets map[string]string, err error)

GetDecryptedSecrets return decrypted secrets of App

func (*App) GetDeployment

func (app *App) GetDeployment() (deployment *appsv1.Deployment, err error)

GetDeployment resource

func (*App) GetDeploymentName added in v0.4.0

func (app *App) GetDeploymentName() string

GetDeploymentName of App

func (*App) GetIngress

func (app *App) GetIngress() (ingress []*v1.Ingress, err error)

GetIngress resource

func (*App) GetIngressSecrets

func (app *App) GetIngressSecrets() (secrets []*apiv1.Secret)

GetIngressSecrets return TLS secrets for ingress

func (*App) GetManifest

func (app *App) GetManifest(outputFormat string, typeOutput ...OutputResource) (manifest string, err error)

GetManifest returns a manifest with the specified resource types

func (*App) GetNamespace

func (app *App) GetNamespace() (namespace *apiv1.Namespace)

GetNamespace resource

func (*App) GetObjectMeta

func (app *App) GetObjectMeta(name string) metav1.ObjectMeta

GetObjectMeta return App metadata

func (*App) GetPersistentVolumeClaims

func (app *App) GetPersistentVolumeClaims() (claims []*apiv1.PersistentVolumeClaim, err error)

GetPersistentVolumeClaims resource

func (*App) GetReleaseName

func (app *App) GetReleaseName() string

GetReleaseName of App

func (*App) GetSecret

func (app *App) GetSecret() (secret *apiv1.Secret, err error)

GetSecret resource

func (*App) GetServices

func (app *App) GetServices() (services []*apiv1.Service, err error)

GetServices resource

func (*App) LoadValues

func (app *App) LoadValues(valueFiles ValueFiles, values, stringValues, fileValues []string) ([]byte, error)

LoadValues for App

type Ingress

type Ingress struct {
	IngressCommon
	Aliases       []string `yaml:"aliases"`
	Host          string   `yaml:"host"`
	Path          string   `yaml:"path"`
	TLSCrt        string   `yaml:"tlsCrt"`
	TLSKey        string   `yaml:"tlsKey"`
	TLSSecretName string   `yaml:"tlsSecretName"`
}

Ingress specification

type IngressCommon

type IngressCommon struct {
	Annotations map[string]string `yaml:"annotations"`
	Class       string            `yaml:"class"`
	Letsencrypt bool              `yaml:"letsencrypt"`
	ServiceName string            `yaml:"serviceName"`
	ServicePort int32             `yaml:"servicePort"`
	SslRedirect bool              `yaml:"sslRedirect"`
}

IngressCommon specification

type OutputResource

type OutputResource int

OutputResource type

const (
	// OutputAll for all resources (except namespace)
	OutputAll OutputResource = iota
	// OutputAllForDeployment is all the resources needed to run Deployment
	OutputAllForDeployment
	// OutputAllOther is all other resources not needed to run Deployment
	OutputAllOther
	// OutputConfigMap only
	OutputConfigMap
	// OutputCronJob only
	OutputCronJob
	// OutputDeployment only
	OutputDeployment
	// OutputIngress only
	OutputIngress
	// OutputNamespace only
	OutputNamespace
	// OutputPersistentVolumeClaim only
	OutputPersistentVolumeClaim
	// OutputSecret only
	OutputSecret
	// OutputService only
	OutputService
)

type Service

type Service struct {
	ExternalPort int32             `yaml:"externalPort"`
	InternalPort int32             `yaml:"internalPort"`
	Port         int32             `yaml:"port"`
	Protocol     apiv1.Protocol    `yaml:"protocol"`
	Type         apiv1.ServiceType `yaml:"type"`
}

Service specification

type ValueFiles

type ValueFiles []string

ValueFiles list

func (*ValueFiles) Set

func (v *ValueFiles) Set(value string) error

Set ValueFiles

func (*ValueFiles) String

func (v *ValueFiles) String() string

func (*ValueFiles) Type

func (v *ValueFiles) Type() string

Type ValueFiles

Jump to

Keyboard shortcuts

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