resources

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IstioNamespace      = "istio-system"
	KubeSystemNamespace = "kube-system"
	KonSystemNamespace  = "kon-system"
	GrafanaNamespace    = "grafana"

	IngressBackendName = "istio-ingressgateway"
	IngressHealthPath  = "/healthz/ready"
	IngressGatewayName = "ingressgateway"
	MeshGatewayName    = "mesh"
)
View Source
const (
	NodepoolPrefix     = "kon-nodepool"
	NodepoolLabel      = "k11n.dev/nodepool"
	AppLabel           = "k11n.dev/app"
	TargetLabel        = "k11n.dev/target"
	BuildRegistryLabel = "k11n.dev/buildRegistry"
	BuildImageLabel    = "k11n.dev/buildImage"
	BuildLabel         = "k11n.dev/build"
	BuildTypeLabel     = "k11n.dev/buildType"
	AppReleaseLabel    = "k11n.dev/appRelease"
	DomainLabel        = "k11n.dev/domain"
	TargetReleaseLabel = "k11n.dev/targetRelease"
	AppProtocolLabel   = "k11n.dev/appProtocol"

	KubeManagedByLabel   = "app.kubernetes.io/managed-by"
	KubeAppLabel         = "app"
	KubeAppVersionLabel  = "app.kubernetes.io/version"
	KubeAppInstanceLabel = "app.kubernetes.io/instance"

	IstioInjectLabel = "istio-injection"

	Konstellation   = "konstellation"
	BuildTypeLatest = "latest"
)
View Source
const (
	GatewayName = "ingressgateway"
)
View Source
const (
	SERVICE_ACCOUNT_KON_ADMIN = "kon-admin"
)

Variables

View Source
var (
	ErrNotFound = fmt.Errorf("the resource is not found")
	Break       = fmt.Errorf("")
)

Functions

func CertificateCovers

func CertificateCovers(certDomain string, domain string) bool

Checks if certificate can cover the domain

func ContextNameForCluster

func ContextNameForCluster(cloud, cluster string) string

func CreateConfigMap

func CreateConfigMap(appName string, ac *v1alpha1.AppConfig, sharedConfigs []*v1alpha1.AppConfig) *corev1.ConfigMap

func ForEach

func ForEach(kclient client.Client, listObj runtime.Object, eachFunc func(item interface{}) error, opts ...client.ListOption) error

*

  • Helper function to iterate through all resources in a list

func GetActiveRelease

func GetActiveRelease(kclient client.Client, app, target string) (*v1alpha1.AppRelease, error)

func GetAppByName

func GetAppByName(kclient client.Client, name string) (app *v1alpha1.App, err error)

func GetAppConfig

func GetAppConfig(kclient client.Client, app, target string) (ac *v1alpha1.AppConfig, err error)

func GetAppRelease

func GetAppRelease(kclient client.Client, app, target, name string) (*v1alpha1.AppRelease, error)

func GetAppReleaseByName

func GetAppReleaseByName(kclient client.Client, release string, target string) (ar *v1alpha1.AppRelease, err error)

func GetAppReleases

func GetAppReleases(kclient client.Client, app string, target string) ([]*v1alpha1.AppRelease, error)

func GetAppTarget

func GetAppTarget(kclient client.Client, name string) (*v1alpha1.AppTarget, error)

func GetAppTargetWithLabels

func GetAppTargetWithLabels(kclient client.Client, app, target string) (*v1alpha1.AppTarget, error)

func GetAppTargets

func GetAppTargets(kclient client.Client, appName string) (targets []v1alpha1.AppTarget, err error)

func GetBuildByName

func GetBuildByName(kclient client.Client, name string) (*v1alpha1.Build, error)

func GetCertificateForDomain

func GetCertificateForDomain(kclient client.Client, domain string) (cert *v1alpha1.CertificateRef, err error)

func GetCertificatesForHosts

func GetCertificatesForHosts(kclient client.Client, hosts []string) (certs map[string]*v1alpha1.CertificateRef, err error)

func GetClusterConfig

func GetClusterConfig(kclient client.Client) (cc *v1alpha1.ClusterConfig, err error)

func GetConfigForType

func GetConfigForType(kclient client.Client, confType v1alpha1.ConfigType, name string, target string) (ac *v1alpha1.AppConfig, err error)

func GetConfigMap

func GetConfigMap(kclient client.Client, namespace string, name string) (cm *corev1.ConfigMap, err error)

func GetFirstDeployableRelease

func GetFirstDeployableRelease(releases []*v1alpha1.AppRelease) *v1alpha1.AppRelease

func GetIngressRequests added in v0.5.2

func GetIngressRequests(kclient client.Client, target string) (irs []*v1alpha1.IngressRequest, err error)

func GetIngressRequestsForAppProtocol added in v0.5.8

func GetIngressRequestsForAppProtocol(kclient client.Client, target string, protocol string) (irs []*v1alpha1.IngressRequest, err error)

func GetLatestBuild

func GetLatestBuild(kclient client.Client, registry, image string) (build *v1alpha1.Build, err error)

func GetMergedConfigForType

func GetMergedConfigForType(kclient client.Client, confType v1alpha1.ConfigType, name, target string) (ac *v1alpha1.AppConfig, err error)

func GetNamespace

func GetNamespace(kclient client.Client, namespace string) (*corev1.Namespace, error)

func GetNodepools

func GetNodepools(kclient client.Client) (pools []*v1alpha1.Nodepool, err error)

func GetNodesForNodepool

func GetNodesForNodepool(kclient client.Client, npName string) (nodes []*corev1.Node, err error)

func GetPodsForAppRelease

func GetPodsForAppRelease(kclient client.Client, namespace string, release string) (pods []*corev1.Pod, err error)

func GetReplicaSetForAppRelease

func GetReplicaSetForAppRelease(kclient client.Client, ar *v1alpha1.AppRelease) (rs *appsv1.ReplicaSet, err error)

func GetSecret

func GetSecret(kclient client.Client, namespace, name string) (secret *v1.Secret, err error)

func GetSecretForAccount

func GetSecretForAccount(kclient client.Client, namespace, name string) (secret *v1.Secret, err error)

func GetService

func GetService(kclient client.Client, namespace, name string) (svc *corev1.Service, err error)

func GetServiceHostEnvForReference

func GetServiceHostEnvForReference(kclient client.Client, ref v1alpha1.AppReference, defaultTarget string) (envs []corev1.EnvVar, err error)

func GetTargetRelease

func GetTargetRelease(kclient client.Client, app, target string) (*v1alpha1.AppRelease, error)

func KubeConfigContainsClusters

func KubeConfigContainsClusters(kconf *cliv1.Config, cloud string, clusters []string) bool

func LabelsForBuild

func LabelsForBuild(build *v1alpha1.Build) map[string]string

func ListApps

func ListApps(kclient client.Client) (apps []v1alpha1.App, err error)

func ListCertificates

func ListCertificates(kclient client.Client) (certificates []v1alpha1.CertificateRef, err error)

func LogUpdates

func LogUpdates(log logr.Logger, op controllerutil.OperationResult, message string, keysAndValues ...interface{})

func NewKubeConfig

func NewKubeConfig() *cliv1.Config

func NewYAMLDecoder

func NewYAMLDecoder() runtime.Decoder

func NewYAMLEncoder

func NewYAMLEncoder() runtime.Encoder

func NodepoolName

func NodepoolName() string

func NodepoolNameFromNode

func NodepoolNameFromNode(node *corev1.Node) string

func ReadObjectFromFile

func ReadObjectFromFile(decoder runtime.Decoder, filename string, obj runtime.Object) (res runtime.Object, err error)

func SaveAppConfig

func SaveAppConfig(kclient client.Client, ac *v1alpha1.AppConfig) error

func ServiceHostname

func ServiceHostname(namespace, service string) string

func SortAppReleasesByLatest

func SortAppReleasesByLatest(releases []*v1alpha1.AppRelease)

func ToEnvVar

func ToEnvVar(s string) string

func TopLevelDomain

func TopLevelDomain(domain string) string

func UpdateKubeConfig

func UpdateKubeConfig(kconf *cliv1.Config, cliPath string, clusters []*KubeClusterConfig, selectedIndex int)

func UpdateResource

func UpdateResource(kclient client.Client, object, owner metav1.Object, scheme *runtime.Scheme) (result controllerutil.OperationResult, err error)

func UpdateResourceWithMerge

func UpdateResourceWithMerge(kclient client.Client, object, owner metav1.Object, scheme *runtime.Scheme) (result controllerutil.OperationResult, err error)

Types

type DependencyInfo

type DependencyInfo struct {
	Namespace string
	Service   string
	Port      int
	PortName  string
}

func GetDependencyInfos

func GetDependencyInfos(kclient client.Client, ref v1alpha1.AppReference, defaultTarget string) (deps []DependencyInfo, err error)

For when running locally, return dependency data so proxies can be created

func (DependencyInfo) HostKey

func (d DependencyInfo) HostKey() string

type Exporter

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

func NewExporter

func NewExporter(kclient client.Client, targetPath string) *Exporter

func (*Exporter) Export

func (e *Exporter) Export() error

func (*Exporter) ExportApps

func (e *Exporter) ExportApps(appsDir string) error

func (*Exporter) ExportBuilds

func (e *Exporter) ExportBuilds(buildsDir string) error

func (*Exporter) ExportConfigs

func (e *Exporter) ExportConfigs(configsDir string) error

func (*Exporter) ExportLinkedAccounts

func (e *Exporter) ExportLinkedAccounts(dir string) error

type Importer

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

func NewImporter

func NewImporter(kclient client.Client, sourcePath string) *Importer

func (*Importer) ImportApps

func (i *Importer) ImportApps() error

func (*Importer) ImportBuilds

func (i *Importer) ImportBuilds() error

func (*Importer) ImportConfigs

func (i *Importer) ImportConfigs() error

func (*Importer) ImportLinkedAccounts

func (i *Importer) ImportLinkedAccounts() error

type KubeClusterConfig

type KubeClusterConfig struct {
	Cloud       string
	Cluster     string
	EndpointUrl string
	CAData      []byte
}

func (*KubeClusterConfig) Name

func (c *KubeClusterConfig) Name() string

func (*KubeClusterConfig) User

func (c *KubeClusterConfig) User() string

Jump to

Keyboard shortcuts

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