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 - 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) ***********************************************************************
Index ¶
- Constants
- Variables
- func AddProcessFunction(key string, processor ProcessFunction)
- func CleanM2MTokenInCache(microserviceName string)
- 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 *dvjson.DvFieldInfo) (dst *dvjson.DvFieldInfo, err error)
- func ConfigTransformerDc(src *dvjson.DvFieldInfo) (dst *dvjson.DvFieldInfo, err error)
- func ConfigTransformerRoute(src *dvjson.DvFieldInfo) (dst *dvjson.DvFieldInfo, err error)
- func ConfigTransformerSvc(src *dvjson.DvFieldInfo) (dst *dvjson.DvFieldInfo, err error)
- func CopyToBaseFolder(baseFolder string, params string) error
- 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 ExecuteProcessFunction(fn *ProcessFunction, pauseTime int, totalTime int, command string, ...) bool
- func ExecuteSequence(prefix string, ctx *dvmeta.RequestContext) bool
- func ExecuteSingleCommand(pauseTime int, totalTime int, prefix string, command string) 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) (*dvjson.DvFieldInfo, error)
- func GetConfigurationByOpenShiftObjectTypeAndName(objectName string, openShiftObjectType string) (*dvjson.DvFieldInfo, error)
- func GetExistingFullOpenShiftTemplate(microServiceName string, notCritical bool) (deployment string, deleteInfo []string, services []string, routes []string, ...)
- func GetIdentityProviderClientCredentials(microServiceName string) (user string, pw string, ok bool)
- func GetKubernetesConfigurationPart(cmdLine string, kind string, mode int, fn ConfigTransformer, notCritical bool) (string, error)
- func GetLiveConfiguration(cmdLine string) (*dvjson.DvFieldInfo, error)
- func GetLiveDeploymentConfiguration(microServiceName string) (*dvjson.DvFieldInfo, error)
- func GetM2MToken(microserviceName string) (token string, okFinal bool)
- func GetM2MTokenFromFileSystem(microserviceName string) (token string, ok bool)
- func GetMicroServiceConfigMaps(microServiceName string, notCritical bool) ([]string, []string, error)
- func GetMicroServiceDeploymentConfigs(microServiceName string, notCritical bool) ([]string, error)
- func GetMicroServiceFullList() ([]string, error)
- func GetMicroServicePropertyName(microServiceName string) string
- 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 MicroServiceRestoration(microServiceName string, templateFileName string) error
- func NetRequest(method string, url string, body string, headers map[string]string, ...) ([]byte, error)
- 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 []*dvjson.DvFieldInfo, silent bool) (res []*dvjson.DvFieldInfo, err error)
- 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 *dvjson.DvFieldInfo, err error)
- func ReadPodReadyEnvironment(microServiceName string) (res map[string]string, dc *dvjson.DvFieldInfo, err error)
- func ReadTemplateParameters(templateData []byte) (res map[string]string, obj *dvjson.DvFieldInfo, err error)
- func ReduceMicroServiceSaveInfo(microServiceName string)
- func RegisterOC() bool
- 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 SaveM2MTokenInFileSystem(microserviceName string, accessToken *AccessToken)
- func SaveMicroServiceOpenShiftInfo(microServiceName string, save int) (deleteInfo []string, deployment string, ok bool)
- func SaveOpenshiftSecret(folder string, microServiceName string) bool
- func SmartNetInit(command string, ctx *dvmeta.RequestContext) ([]interface{}, bool)
- func SmartNetRun(data []interface{}) bool
- func SmartNetRunByConfig(config *SmartNetConfig, ctx *dvmeta.RequestContext) 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 AccessToken
- type ConfigTransformer
- type ConnectionPropertiesInfo
- type DbaasInfo
- type ProcessFunction
- type SmartNetConfig
- type SmartNetConfigTemplate
Constants ¶
const ( CommandHttp = "http" CommandEnv = "env" CommandCopyToPod = "copyToPod" CommandCopyFromPod = "copyFromPod" CommandMicroServiceExec = "microserviceExec" CommandMicroServiceUp = "microserviceUp" CommandMicroServiceUpOnly = "microserviceUpOnly" CommandMicroServiceDown = "microserviceDown" CommandMicroServiceSave = "microserviceSave" CommandMicroServiceRestore = "microserviceRestore" CommandMicroServiceCacheClean = "microserviceCacheClean" CommandExpose = "expose" CommandNet = "net" CommandOs = "os" CommandPortForward = "forward" CommandSql = "sql" )
const ( MicroServiceDeleteForced = 0 MicroServiceDeleteTrySaveAndForceDelete = 1 MicroServiceDeleteSaveAndSafeDelete = 2 MicroServiceSaveTemporaryFolder = "__dobryvechir_microcore" MicroServiceProperty = "MICROSERVICE" )
const ( M2MTokenPrefix = "M2M_TOKEN_" M2MTokenPath = "M2MTOKEN_PATH" M2MAuthorizationRequest = "AuthorizationM2MService" )
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" )
const (
Authorization = "Authorization"
)
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 AddProcessFunction ¶
func AddProcessFunction(key string, processor ProcessFunction)
func CleanM2MTokenInCache ¶
func CleanM2MTokenInCache(microserviceName string)
func ConfigTransformerConfigMap ¶
func ConfigTransformerConfigMap(src *dvjson.DvFieldInfo) (dst *dvjson.DvFieldInfo, err error)
func ConfigTransformerDc ¶
func ConfigTransformerDc(src *dvjson.DvFieldInfo) (dst *dvjson.DvFieldInfo, err error)
func ConfigTransformerRoute ¶
func ConfigTransformerRoute(src *dvjson.DvFieldInfo) (dst *dvjson.DvFieldInfo, err error)
func ConfigTransformerSvc ¶
func ConfigTransformerSvc(src *dvjson.DvFieldInfo) (dst *dvjson.DvFieldInfo, err error)
func CopyToBaseFolder ¶
func CreateClientCredentials ¶
func CreateMicroService ¶
func DownWholeMicroService ¶
func EnsureTenantIdInGlobalProperties ¶
func EnsureTenantIdInGlobalProperties() bool
func ExecuteCommandOnPod ¶
func ExecuteCommandsOnPod ¶
func ExecuteProcessFunction ¶
func ExecuteProcessFunction(fn *ProcessFunction, pauseTime int, totalTime int, command string, group *sync.WaitGroup, ctx *dvmeta.RequestContext) bool
func ExecuteSequence ¶
func ExecuteSequence(prefix string, ctx *dvmeta.RequestContext) bool
func ExecuteSingleCommand ¶
func GetConfigurationByOpenShiftObjectType ¶
func GetConfigurationByOpenShiftObjectType(microServiceName string, openShiftObjectType string) (*dvjson.DvFieldInfo, error)
func GetConfigurationByOpenShiftObjectTypeAndName ¶
func GetConfigurationByOpenShiftObjectTypeAndName(objectName string, openShiftObjectType string) (*dvjson.DvFieldInfo, error)
func GetLiveConfiguration ¶
func GetLiveConfiguration(cmdLine string) (*dvjson.DvFieldInfo, error)
func GetLiveDeploymentConfiguration ¶
func GetLiveDeploymentConfiguration(microServiceName string) (*dvjson.DvFieldInfo, error)
func GetM2MToken ¶
func GetMicroServiceFullList ¶
func GetMicroServiceRoutes ¶
func GetMicroServiceServices ¶
func GetObjectFullList ¶
func GetOpenshiftSecrets ¶
func GetParamByMapOrGlobal ¶
func InitBySettings ¶
func IsMicroServicePresent ¶
func MicroServiceRestoration ¶
func NetRequest ¶
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 []*dvjson.DvFieldInfo, silent bool) (res []*dvjson.DvFieldInfo, err error)
func ReadDirectoryFromPod ¶
func ReadPodEnvironmentAndDC ¶
func ReadPodReadyEnvironment ¶
func ReadTemplateParameters ¶
func ReduceMicroServiceSaveInfo ¶
func ReduceMicroServiceSaveInfo(microServiceName string)
func RegisterOC ¶
func RegisterOC() bool
func ResetPodNameCache ¶
func ResetPodNameCache()
func ResolveMicroServiceUrl ¶
func ResolveTenantIdByTenant ¶
func ResolveUrlTemplate ¶
func RunOCCommand ¶
func RunOCCommandLoginUnsafe ¶
func RunOCCommandOrCache ¶
func RunOCCommandWithEditor ¶
func SaveM2MTokenInFileSystem ¶
func SaveM2MTokenInFileSystem(microserviceName string, accessToken *AccessToken)
func SaveOpenshiftSecret ¶
func SmartNetInit ¶
func SmartNetInit(command string, ctx *dvmeta.RequestContext) ([]interface{}, bool)
func SmartNetRun ¶
func SmartNetRun(data []interface{}) bool
func SmartNetRunByConfig ¶
func SmartNetRunByConfig(config *SmartNetConfig, ctx *dvmeta.RequestContext) bool
func UploadFiles ¶
func WaitPodIsReady ¶
Types ¶
type AccessToken ¶
type AccessToken struct { AccessToken string `json:"access_token"` TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in"` RefreshExpiresIn int `json:"refresh_expires_in"` RefreshToken string `json:"refresh_token"` NotBeforePolicy int `json:"not-before-policy"` SessionState string `json:"session_state"` Scope string `json:"scope"` }
type ConfigTransformer ¶
type ConfigTransformer func(*dvjson.DvFieldInfo) (*dvjson.DvFieldInfo, error)
type DbaasInfo ¶
type DbaasInfo struct {
ConnectionProperties ConnectionPropertiesInfo `json:"connectionProperties"`
}