modules

package
v0.1.2 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: 40 Imported by: 0

Documentation

Overview

Copyright 2020 The metaGraf Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	NameSpace     string // Used to pass namespace from cmd to module to avoid import cycle.
	Output        bool   // Flag passing hack
	Version       string // Flag passing hack
	Dryrun        bool   // Flag passing hack
	BaseEnvs      bool   //Flag passing hack
	Defaults      bool   //Flag passing hack
	Format        string // Flag passing hack
	Template      string // Flag passing hack
	Suffix        string // Flag passing hack
	ImageNS       string
	Registry      string
	Tag           string
	OName         string
	Context       string // Application context root from FlagPassingHack.
	CreateGlobals bool
	// Sets the default pull policy for all metagraf modules
	PullPolicy corev1.PullPolicy = corev1.PullIfNotPresent
)

This is a complete hack. todo: fix this shit, restructure packages

View Source
var EnvBlacklistFilter []string = []string{
	"path",
	"home",
	"bash",
	"env",
	"sti",
	"openshift",
}

Slice of strings that we wash environment variables with from the base image when creating a deploymentconfig

View Source
var LabelBlacklistFilter []string = []string{
	"openshift",
	"s2i",
	"license",
	"k8s",
}

Slice of strings that we wash labels from baseimage with when creating a deploymentconfig

View Source
var TmplBasePath = "/usr/share/metagraf/templates"

todo this should be made a configuration option, distribution of templates are also "unsolved"

Functions

func ConfigSecretName added in v0.0.6

func ConfigSecretName(c *metagraf.Config) string

func CreateEmptySecret added in v0.1.0

func CreateEmptySecret(name string, labels map[string]string) corev1.Secret

func DeleteBuildConfig added in v0.0.30

func DeleteBuildConfig(name string)

func DeleteConfigMap added in v0.0.30

func DeleteConfigMap(name string)

func DeleteConfigMaps added in v0.0.30

func DeleteConfigMaps(mg *metagraf.MetaGraf)

func DeleteDeploymentConfig added in v0.0.30

func DeleteDeploymentConfig(name string)

func DeleteImageStream added in v0.0.30

func DeleteImageStream(name string)

func DeleteRoute added in v0.0.30

func DeleteRoute(name string)

func DeleteSecret added in v0.0.30

func DeleteSecret(name string)

func DeleteSecrets added in v0.0.30

func DeleteSecrets(mg *metagraf.MetaGraf)

func DeleteService added in v0.0.30

func DeleteService(name string)

func DeleteServiceMonitor added in v0.1.0

func DeleteServiceMonitor(name string)

func DownwardAPIEnvVars added in v0.1.0

func DownwardAPIEnvVars() []corev1.EnvVar

Builds and returns slice of Kubernetes EnvVars for common values extracted from DownwardAPI.

func FindMetagrafConfigMaps added in v0.0.12

func FindMetagrafConfigMaps(mg *metagraf.MetaGraf) map[string]string

This function will inspect the metaGraf specification for which configmaps it will need to create and their type in a map.

func FindSecrets

func FindSecrets(mg *metagraf.MetaGraf) map[string]string

func FindServiceMonitorPath added in v0.1.0

func FindServiceMonitorPath(mg *metagraf.MetaGraf) string

Parses metaGraf specification to look for annotation to control scrape path for ServiceMonitor resource.

func FindServiceMonitorPort added in v0.1.0

func FindServiceMonitorPort(mg *metagraf.MetaGraf) int32

Parses metaGraf specification to look for annotation to control scrape port when generating ServiceMonitor resource.

func GenApplication added in v0.1.0

func GenApplication(mg *metagraf.MetaGraf)

func GenArgoApplication added in v0.1.0

func GenArgoApplication(mg *metagraf.MetaGraf) argoapp.Application

func GenBuildConfig

func GenBuildConfig(mg *metagraf.MetaGraf)

func GenConfigMaps

func GenConfigMaps(mg *metagraf.MetaGraf)

Entry function for creating a slew of configmaps, this will be somewhat specific to NT internal workings for now.

func GenDeployment

func GenDeployment(mg *metagraf.MetaGraf, namespace string)

func GenDeploymentConfig

func GenDeploymentConfig(mg *metagraf.MetaGraf)

Todo: Still needs to be split up, but some refactoring has been done.

func GenDotFromPath

func GenDotFromPath(cpath string)

func GenEnvVar_JVM_SYS_PROP added in v0.0.31

func GenEnvVar_JVM_SYS_PROP(mgp metagraf.MGProperties, name string) corev1.EnvVar

Generate an EnvVar for a config section. SecretFrom or EnvFrom will not be processed.

func GenImageStream

func GenImageStream(mg *metagraf.MetaGraf, namespace string)

func GenIstioServiceEntry added in v0.1.0

func GenIstioServiceEntry(mg *metagraf.MetaGraf)

func GenIstioVirtualService added in v0.1.0

func GenIstioVirtualService(mg *metagraf.MetaGraf)

func GenRef

func GenRef(mg *metagraf.MetaGraf)

func GenRoute

func GenRoute(mg *metagraf.MetaGraf)

func GenSecrets

func GenSecrets(mg *metagraf.MetaGraf)

func GenService

func GenService(mg *metagraf.MetaGraf)

func GenServiceMonitor added in v0.1.0

func GenServiceMonitor(mg *metagraf.MetaGraf)

func GenServiceMonitorAndService added in v0.1.0

func GenServiceMonitorAndService(mg *metagraf.MetaGraf)

func GetArgoCDApplicationNamespace added in v0.1.0

func GetArgoCDApplicationNamespace() string

func GetArgoCDApplicationSyncPolicy added in v0.1.0

func GetArgoCDApplicationSyncPolicy() *argoapp.SyncPolicy

func GetArgoCDSourceDirectory added in v0.1.0

func GetArgoCDSourceDirectory() *argoapp.ApplicationSourceDirectory

func GetBuildEnvVars added in v0.1.0

func GetBuildEnvVars(mg *metagraf.MetaGraf, mgp metagraf.MGProperties) []corev1.EnvVar

func GetConfigMap added in v0.0.12

func GetConfigMap(name string) (*corev1.ConfigMap, error)

Fetch a ConfigMap resource the connected kubernetes cluster.

func GetEnvVars added in v0.1.0

func GetEnvVars(mg *metagraf.MetaGraf, inputprops metagraf.MGProperties) []corev1.EnvVar

func GetGlobalConfigMapVolumes added in v0.1.0

func GetGlobalConfigMapVolumes(mg *metagraf.MetaGraf, Volumes *[]corev1.Volume, VolumeMounts *[]corev1.VolumeMount)

func GetMGEnvVars added in v0.1.0

func GetMGEnvVars(mg *metagraf.MetaGraf) []corev1.EnvVar

Returns a slice of metagraf convention informative k8s EnvVar{}'s

func GetMetagrafConfigsByType added in v0.1.0

func GetMetagrafConfigsByType(mg *metagraf.MetaGraf, ctype string) []metagraf.Config

Returns a slice of metagraf Config structs that match specific ctype string

func GetSecret added in v0.0.12

func GetSecret(name string) (*corev1.Secret, error)

func GetServicePorts added in v0.1.0

func GetServicePorts(mg *metagraf.MetaGraf, imageports []corev1.ServicePort) []corev1.ServicePort

Applies protocol and port conventions for generating standardized Kubernetes Service resource. Defaults to 80->8080 mapping if no annotations or image port configuration is found.

func HasJVM_SYS_PROP added in v0.0.31

func HasJVM_SYS_PROP(mg *metagraf.MetaGraf) bool

Identify if a metagraf specification has a JVM_SYS_PROP configuration type. This is a special type for handling system properties in the java space that your application might not know about.

func InspectConfigMaps

func InspectConfigMaps(mg *metagraf.MetaGraf)

func InspectSecrets

func InspectSecrets(mg *metagraf.MetaGraf)

func Labels added in v0.1.0

func Labels(name string, input map[string]string) map[string]string

Generate standardised labels map

func MGAppName

func MGAppName(mg *metagraf.MetaGraf) string

func MarshalObject

func MarshalObject(obj runtime.Object)

Marshal kubernetes resource to json

func Name

func Name(mg *metagraf.MetaGraf) string

Returns a name for a resource based on convention as follows.

func OutputArgoCDApplication added in v0.1.0

func OutputArgoCDApplication(obj argoapp.Application)

func ResourceSecretName

func ResourceSecretName(r *metagraf.Resource) string

Returns a name for a secret for a resource based on convention as follows.

func SpecName added in v0.0.19

func SpecName(mg *metagraf.MetaGraf) string

Return a specification name for a resource base on convention. Does not adhere to override flags.

func StoreApplication added in v0.1.0

func StoreApplication(obj kapp.Application)

func StoreArgoCDApplication added in v0.1.0

func StoreArgoCDApplication(obj argoapp.Application)

func StoreBuildConfig

func StoreBuildConfig(obj buildv1.BuildConfig)

func StoreConfigMap

func StoreConfigMap(m corev1.ConfigMap)

func StoreDeployment added in v0.0.32

func StoreDeployment(obj appsv1.Deployment)

func StoreDeploymentConfig

func StoreDeploymentConfig(obj appsv1.DeploymentConfig)

func StoreImageStream

func StoreImageStream(obj imagev1.ImageStream)

func StoreRoute

func StoreRoute(obj routev1.Route)

func StoreSecret

func StoreSecret(obj corev1.Secret)

func StoreService

func StoreService(obj corev1.Service)

func StoreServiceMonitor added in v0.1.0

func StoreServiceMonitor(obj monitoringv1.ServiceMonitor)

func TriggerLocalBuild added in v0.1.0

func TriggerLocalBuild(mg metagraf.MetaGraf)

func ValueFromEnv

func ValueFromEnv(key string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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