Documentation ¶
Overview ¶
********************************************************************** MicroCore Copyright 2020 - 2020 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************
********************************************************************** MicroCore Copyright 2020 - 2020 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************
********************************************************************** MicroCore Copyright 2020 - 2020 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************
********************************************************************** MicroCore Copyright 2020 - 2020 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************
********************************************************************** MicroCore Copyright 2020 - 2020 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************
********************************************************************** MicroCore Copyright 2020 - 2021 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************
Index ¶
- Constants
- Variables
- func ComposeOpenShiftJsonTemplate(params map[string]string) ([]byte, error)
- func ComposeOpenShiftJsonTemplateBySample(sample string, requiredParams map[string]string, params map[string]string) ([]byte, error)
- func ConfigTransformerConfigMap(src *dvevaluation.DvVariable) (dst *dvevaluation.DvVariable, err error)
- func ConfigTransformerDc(src *dvevaluation.DvVariable) (dst *dvevaluation.DvVariable, err error)
- func ConfigTransformerRoute(src *dvevaluation.DvVariable) (dst *dvevaluation.DvVariable, err error)
- func ConfigTransformerSvc(src *dvevaluation.DvVariable) (dst *dvevaluation.DvVariable, err error)
- func CopyFromPodInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
- func CopyFromPodRun(data []interface{}) bool
- func CopyToBaseFolder(baseFolder string, params string) error
- func CopyToPodInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
- func CopyToPodRun(data []interface{}) bool
- func CreateClientCredentials(user string, pw string, microserviceName string) bool
- func CreateMicroService(params map[string]string, files map[string]string, commands []string) bool
- func DeletePod(name string) bool
- func DownMicroServiceCommands(deleteInfo []string) (ok bool)
- func DownWholeMicroService(microServiceName string, mode int, debugNotSaved bool) bool
- func DownWholeMicroServiceHard(microServiceName string, microServiceAliases string, includeList []string) bool
- func EnsureTenantIdInGlobalProperties() bool
- func ExecuteCommandOnPod(name string, command string) (info string, err error)
- func ExecuteCommandOnPodByPodName(podName string, command string) (info string, err error)
- func ExecuteCommandOnSpecificPod(podName string, command string) (info string, err error)
- func ExecuteCommandsOnPod(microServiceName string, commands []string) bool
- func ExposeMicroServiceInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
- func ExposeMicroServiceRun(data []interface{}) bool
- func FindAddHeaderInNginxConfig(data string, headerName string, afterPos int) (posStart int, posEnd int)
- func FixContentSecurityPolicyLine(originalLine string, source string) string
- func GetConfigurationByOpenShiftObjectType(microServiceName string, openShiftObjectType string) (*dvevaluation.DvVariable, error)
- func GetConfigurationByOpenShiftObjectTypeAndName(objectName string, openShiftObjectType string) (*dvevaluation.DvVariable, error)
- func GetExistingFullOpenShiftTemplate(microServiceName string, notCritical bool) (deployment string, deleteInfo []string, services []string, routes []string, ...)
- func GetKubernetesConfigurationPart(cmdLine string, kind string, mode int, fn ConfigTransformer, notCritical bool) (string, error)
- func GetLiveConfiguration(cmdLine string) (*dvevaluation.DvVariable, error)
- func GetLiveDeploymentConfiguration(microServiceName string) (*dvevaluation.DvVariable, error)
- func GetMicroServiceConfigMaps(microServiceName string, notCritical bool) ([]string, []string, error)
- func GetMicroServiceDeploymentConfigs(microServiceName string, notCritical bool) ([]string, error)
- func GetMicroServiceFullList() ([]string, error)
- func GetMicroServiceRouteConfigs(routes []string, notCritical bool) ([]string, error)
- func GetMicroServiceRoutes(services []string) ([]string, error)
- func GetMicroServiceServiceConfigs(services []string, notCritical bool) ([]string, error)
- func GetMicroServiceServices(microServiceName string) ([]string, error)
- func GetObjectFullList(shortName string) ([]string, error)
- func GetObjectFullListByObjectType(openShiftObjectType string) ([]string, error)
- func GetOpenshiftSecrets(microserviceName string) (user string, ps string, okFinal bool)
- func GetParamByMapOrGlobal(params map[string]string, key string, baseName string) (res string)
- func GetPodName(microserviceName string, silent bool) (name string, ok bool)
- func GetRsyncOptionsForSingleFile(fileName string) string
- func GetShortOpenShiftNameForObjectType(openShiftObjectType string) (string, error)
- func GetSpecificVariableAtServer(microServiceName string, key string) (data string, err error)
- func GetStartEndPartsOfGeneralTemplate(microServiceName string) (string, string, map[string]string)
- func GetUrlByGlobalPropertiesAndService(globalUrlTemplatePropertyName, defaultUrlTemplate, serviceName string) (string, error)
- func InitBySettings(parameters map[string]string, functionPool map[string]interface{})
- func IntroduceContentSecurityPolicyInNginxConfig(data string, hosts string) string
- func IsMicroServicePresent(name string) (bool, error)
- func MicroServiceCacheCleanInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
- func MicroServiceCacheCleanRun(data []interface{}) bool
- func MicroServiceDownInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
- func MicroServiceDownRun(data []interface{}) bool
- func MicroServiceExecInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
- func MicroServiceExecRun(data []interface{}) bool
- func MicroServiceRestoration(microServiceName string, templateFileName string) error
- func MicroServiceRestoreInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
- func MicroServiceRestoreRun(data []interface{}) bool
- func MicroServiceSaveInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
- func MicroServiceSaveRun(data []interface{}) bool
- func MicroServiceSaveSingle(microServiceName string, folder string) (createFile string, deleteFile string, ok bool)
- func MicroServiceTemplateInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
- func MicroServiceTemplateRun(data []interface{}) bool
- func MicroServiceUpInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
- func MicroServiceUpOnlyRun(data []interface{}) bool
- func MicroServiceUpRun(data []interface{}) bool
- func OcLogin() bool
- func OpenShiftAddRoutesTOBeExposed(routeList string)
- func OpenShiftConvertListToMap(list string) (res map[string][]string, ok bool)
- func OpenShiftCopyFileFromPod(fileName string, podName string, strategy int) error
- func OpenShiftCopyFileToPod(fileName string, podName string, strategy int) error
- func OpenShiftCopyFolderFromPod(folderName string, fullPodName string) error
- func OpenShiftCopyFolderToPod(folderName string, fullPodName string) error
- func OpenShiftEnsureExposeRoutes() bool
- func OpenShiftExposeSpecificRoutes(routes []string) bool
- func OpenShiftGetPodNameAndPath(name string) (tmpFolder string, serviceName, podName string, pathName string, ...)
- func OpenShiftNginxRestart(name string) error
- func OpenShiftReadTextFile(name string, strategy int) (data string, err error)
- func OpenShiftReset(list string) bool
- func OpenShiftResetUp(service string)
- func OpenShiftScale(list string, replicas int) bool
- func OpenShiftScaleToReplicas(microService string, replicas int) bool
- func OpenShiftSetEnv(list string) bool
- func OpenShiftSetEnvironment(microService string, env []string) bool
- func OpenShiftWriteTextFile(name string, data string, strategy int) error
- func OrderTemplateObjectsByDependencies(objects []*dvevaluation.DvVariable, silent bool) (res []*dvevaluation.DvVariable, err error)
- func ProcessEnvSettingInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
- func ProcessEnvSettingsRun(data []interface{}) bool
- func PropertyForSpecificMicroService(microServiceName string, prefix string) string
- func ReadDirectoryFromPod(podName string, distributionFolder string, podFolder string, options string) bool
- func ReadPodEnvironmentAndDC(microServiceName string) (res map[string]string, dc *dvevaluation.DvVariable, err error)
- func ReadPodReadyEnvironment(microServiceName string) (res map[string]string, dc *dvevaluation.DvVariable, err error)
- func ReadTemplateParameters(templateData []byte) (res map[string]string, obj *dvevaluation.DvVariable, err error)
- func ReduceMicroServiceSaveInfo(microServiceName string)
- func RegisterUserCredentialsWithIdentityProvider(user, pw, microServiceName string, onBehalfMicroserviceName string, ...) bool
- func ResetPodNameCache()
- func ResolveMicroServiceUrl(microServiceName string) (string, error)
- func ResolveMostSimilarObjectByMicroserviceNameAndObjectType(microServiceName string, objectType string) (name string, ok bool)
- func ResolveTenantIdByTenant(tenant string) (string, error)
- func ResolveUrlRequestByGlobalPropertiesAndDefaults(prefix string, defaultMethod string, defaultUrl string, defaultBody string, ...) (string, error)
- func ResolveUrlTemplate(globalPropertiesTemplate string, defaultTemplate string) (string, error)
- func RunOCCommand(params string) (string, bool)
- func RunOCCommandFailureAllowed(params string, allowedFailureMessages []string) (string, int)
- func RunOCCommandLoginUnsafe(params string, allowedFailureMessages []string, envParams []string) (string, int)
- func RunOCCommandOrCache(cmdLine string) (string, error)
- func RunOCCommandOrCacheFailureAllowed(cmdLine string, allowedFailureMessages []string) (string, error)
- func RunOCCommandWithEditor(params string) (string, bool)
- func SaveMicroServiceOpenShiftInfo(microServiceName string, save int) (deleteInfo []string, deployment string, ok bool)
- func SaveOpenshiftSecret(folder string, microServiceName string) bool
- func UpdateContentSecurityPolicyOnPods(pods string, hosts string) bool
- func UploadFiles(microServiceName string, fileMap map[string]string, commands []string) bool
- func WaitPodIsReady(microServiceName string) bool
- func WriteDirectoryToPod(podName string, distributionFolder string, podFolder string, options string) bool
- type ConfigTransformer
- type ConnectionPropertiesInfo
- type DbaasInfo
- type MicroServiceSearch
Constants ¶
const ( CommandCopyToPod = "copyToPod" CommandCopyFromPod = "copyFromPod" CommandEnv = "env" CommandExpose = "expose" CommandMicroServiceCacheClean = "microserviceCacheClean" CommandMicroServiceDown = "microserviceDown" CommandMicroServiceExec = "microserviceExec" CommandMicroServiceSave = "microserviceSave" CommandMicroServiceTemplate = "microserviceTemplate" CommandMicroServiceRestore = "microserviceRestore" CommandMicroServiceUp = "microserviceUp" CommandMicroServiceUpOnly = "microserviceUpOnly" )
const ( MicroServiceDeleteForced = 0 MicroServiceDeleteTrySaveAndForceDelete = 1 MicroServiceDeleteSaveAndSafeDelete = 2 MicroServiceSaveTemporaryFolder = "__dobryvechir_microcore" MicroServiceProperty = "MICROSERVICE" )
const ( LogFatal = 0 LogError = 1 LogWarning = 2 LogInfo = 3 LogDetail = 4 LogDebug = 5 LogTrace = 6 )
const ( OcPostgreSql = "postgresql" OcMongoDb = "mongodb" DbaaSServerUrlTemplateProperty = "DBAAS_SERVER" DbaaSServerUrlDefault = "{dbaas-agent}/api/v1/dbaas/{{{OPENSHIFT_NAMESPACE}}}/databases" DbaaSRequestMethodProperty = "DBAAS_REQUEST_METHOD" DbaaSRequestMethod = "PUT" DbaaSRequestBodyTenantAwareProperty = "DBAAS_REQUEST_TENANT_AWARE" DbaaSRequestBodyTenantUnawareProperty = "DBAAS_REQUEST_TENANT_UNAWARE" DbaaSRequestBodyTenantAwareDefault = "" /* 308-byte string literal not displayed */ DbaaSRequestBodyTenantUnawareDefault = "" /* 279-byte string literal not displayed */ )
const ( StrategyReadWriteSingleFileBest = 0 StrategyReadWriteSingleFileThruCat = 1 StrategyReadWriteSingleFileThruDir = 2 )
const ( MicroserviceUrlProperty = "MICROSERVICE_PATH_" ApplicationInsideCloud = "APPLICATION_INSIDE_CLOUD" MicroServiceExposedRoute = "http://{SERVICE}-{{{OPENSHIFT_NAMESPACE}}}.{{{OPENSHIFT_SERVER}}}.{{{OPENSHIFT_DOMAIN}}}" MicroServiceInternalRoute = "http://{SERVICE}:8080" MicroServiceExposedRouteTemplate = "MICROSERVICE_EXPOSED_ROUTE_TEMPLATE" MicroServiceInternalRouteTemplate = "MICROSERVICE_INTERNAL_ROUTE_TEMPLATE" )
const ( TenantIdProperty = "TENANT_ID" TenantProperty = "TENANT" )
Variables ¶
var ( TenantResolvePropertyPrefix = "TENANT_RESOLVER" TenantResolveUrlTemplateDefault = "{public-gateway}/api/v2/tenant-manager/registration/tenants?dns={TENANT}" TenantResolveMethodDefault = "GET" TenantResolveBodyDefault = "" )
var Log = LogError
var StragegyReadWriteSingleFileThruDirExclude = make(map[string]bool)
var StrategyReadWriteSingleFile = StrategyReadWriteSingleFileThruCat
var TemplateObjectPriority = map[string]int{
"deploymentconfig": 1,
"imagestream": 2,
"service": 3,
"configmap": 4,
"route": 5,
"serviceaccount": 6,
"secret": 7,
}
Functions ¶
func ConfigTransformerConfigMap ¶
func ConfigTransformerConfigMap(src *dvevaluation.DvVariable) (dst *dvevaluation.DvVariable, err error)
func ConfigTransformerDc ¶
func ConfigTransformerDc(src *dvevaluation.DvVariable) (dst *dvevaluation.DvVariable, err error)
func ConfigTransformerRoute ¶
func ConfigTransformerRoute(src *dvevaluation.DvVariable) (dst *dvevaluation.DvVariable, err error)
func ConfigTransformerSvc ¶
func ConfigTransformerSvc(src *dvevaluation.DvVariable) (dst *dvevaluation.DvVariable, err error)
func CopyFromPodInit ¶ added in v1.0.2
func CopyFromPodInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
func CopyFromPodRun ¶ added in v1.0.2
func CopyFromPodRun(data []interface{}) bool
func CopyToBaseFolder ¶
func CopyToPodInit ¶ added in v1.0.2
func CopyToPodInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
func CopyToPodRun ¶ added in v1.0.2
func CopyToPodRun(data []interface{}) bool
func CreateClientCredentials ¶
func CreateMicroService ¶
func DownWholeMicroService ¶
func EnsureTenantIdInGlobalProperties ¶
func EnsureTenantIdInGlobalProperties() bool
func ExecuteCommandOnPod ¶
func ExecuteCommandsOnPod ¶
func ExposeMicroServiceInit ¶ added in v1.0.2
func ExposeMicroServiceInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
func ExposeMicroServiceRun ¶ added in v1.0.2
func ExposeMicroServiceRun(data []interface{}) bool
func GetConfigurationByOpenShiftObjectType ¶
func GetConfigurationByOpenShiftObjectType(microServiceName string, openShiftObjectType string) (*dvevaluation.DvVariable, error)
func GetConfigurationByOpenShiftObjectTypeAndName ¶
func GetConfigurationByOpenShiftObjectTypeAndName(objectName string, openShiftObjectType string) (*dvevaluation.DvVariable, error)
func GetLiveConfiguration ¶
func GetLiveConfiguration(cmdLine string) (*dvevaluation.DvVariable, error)
func GetLiveDeploymentConfiguration ¶
func GetLiveDeploymentConfiguration(microServiceName string) (*dvevaluation.DvVariable, error)
func GetMicroServiceFullList ¶
func GetMicroServiceRoutes ¶
func GetMicroServiceServices ¶
func GetObjectFullList ¶
func GetOpenshiftSecrets ¶
func GetParamByMapOrGlobal ¶
func InitBySettings ¶
func IsMicroServicePresent ¶
func MicroServiceCacheCleanInit ¶ added in v1.0.2
func MicroServiceCacheCleanInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
func MicroServiceCacheCleanRun ¶ added in v1.0.2
func MicroServiceCacheCleanRun(data []interface{}) bool
func MicroServiceDownInit ¶ added in v1.0.2
func MicroServiceDownInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
func MicroServiceDownRun ¶ added in v1.0.2
func MicroServiceDownRun(data []interface{}) bool
func MicroServiceExecInit ¶ added in v1.0.2
func MicroServiceExecInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
func MicroServiceExecRun ¶ added in v1.0.2
func MicroServiceExecRun(data []interface{}) bool
func MicroServiceRestoration ¶
func MicroServiceRestoreInit ¶ added in v1.0.2
func MicroServiceRestoreInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
func MicroServiceRestoreRun ¶ added in v1.0.2
func MicroServiceRestoreRun(data []interface{}) bool
func MicroServiceSaveInit ¶ added in v1.0.2
func MicroServiceSaveInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
func MicroServiceSaveRun ¶ added in v1.0.2
func MicroServiceSaveRun(data []interface{}) bool
func MicroServiceSaveSingle ¶ added in v1.0.2
func MicroServiceTemplateInit ¶ added in v1.0.2
func MicroServiceTemplateInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
func MicroServiceTemplateRun ¶ added in v1.0.2
func MicroServiceTemplateRun(data []interface{}) bool
func MicroServiceUpInit ¶ added in v1.0.2
func MicroServiceUpInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
func MicroServiceUpOnlyRun ¶ added in v1.0.2
func MicroServiceUpOnlyRun(data []interface{}) bool
func MicroServiceUpRun ¶ added in v1.0.2
func MicroServiceUpRun(data []interface{}) bool
func OpenShiftAddRoutesTOBeExposed ¶
func OpenShiftAddRoutesTOBeExposed(routeList string)
func OpenShiftCopyFileToPod ¶
func OpenShiftEnsureExposeRoutes ¶
func OpenShiftEnsureExposeRoutes() bool
func OpenShiftNginxRestart ¶
func OpenShiftReadTextFile ¶
func OpenShiftReset ¶
func OpenShiftResetUp ¶
func OpenShiftResetUp(service string)
func OpenShiftScale ¶
func OpenShiftSetEnv ¶
** For environment variable changes: When an old value is set, openshift automatically does nothing When a new value is set, openshift makes a change to the deployment config and an old pod is destroyed and a new pod is created and started
func OpenShiftSetEnvironment ¶
func OpenShiftWriteTextFile ¶
func OrderTemplateObjectsByDependencies ¶
func OrderTemplateObjectsByDependencies(objects []*dvevaluation.DvVariable, silent bool) (res []*dvevaluation.DvVariable, err error)
func ProcessEnvSettingInit ¶ added in v1.0.2
func ProcessEnvSettingInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
func ProcessEnvSettingsRun ¶ added in v1.0.2
func ProcessEnvSettingsRun(data []interface{}) bool
func ReadDirectoryFromPod ¶
func ReadPodEnvironmentAndDC ¶
func ReadPodEnvironmentAndDC(microServiceName string) (res map[string]string, dc *dvevaluation.DvVariable, err error)
func ReadPodReadyEnvironment ¶
func ReadPodReadyEnvironment(microServiceName string) (res map[string]string, dc *dvevaluation.DvVariable, err error)
func ReadTemplateParameters ¶
func ReadTemplateParameters(templateData []byte) (res map[string]string, obj *dvevaluation.DvVariable, err error)
func ReduceMicroServiceSaveInfo ¶
func ReduceMicroServiceSaveInfo(microServiceName string)
func ResetPodNameCache ¶
func ResetPodNameCache()
func ResolveMicroServiceUrl ¶
func ResolveTenantIdByTenant ¶
func ResolveUrlTemplate ¶
func RunOCCommand ¶
func RunOCCommandLoginUnsafe ¶
func RunOCCommandOrCache ¶
func RunOCCommandWithEditor ¶
func SaveOpenshiftSecret ¶
func UploadFiles ¶
func WaitPodIsReady ¶
Types ¶
type ConfigTransformer ¶
type ConfigTransformer func(*dvevaluation.DvVariable) (*dvevaluation.DvVariable, error)
type DbaasInfo ¶
type DbaasInfo struct {
ConnectionProperties ConnectionPropertiesInfo `json:"connectionProperties"`
}