Documentation
¶
Overview ¶
Copyright 2018 Tharanga Nilupul Thennakoon
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.
Copyright 2018 Tharanga Nilupul Thennakoon ¶
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
- func CreateJWTToken(claims jwt.MapClaims, secret string) (string, error)
- func DockerContainerReStart(containerID string) error
- func DockerContainerStart(authConfig types.AuthConfig, image string, exposedPortSet nat.PortSet, ...) (string, error)
- func DockerContainerStop(containerID string) error
- func DockerNetworkCreate(networkID string) (string, error)
- func DockerServiceCreate(networkID string, serviceName string, dockerimage string, ...) (string, error)
- func DockerServiceGetByName(serviceName string) (swarm.Service, []byte, error)
- func DockerServiceList(serviceName string) ([]swarm.Service, error)
- func DockerServiceLogs(serviceName string, options types.ContainerLogsOptions) (io.ReadCloser, error)
- func DockerServiceReStart(networkID string, serviceName string, dockerimage string, ...) (string, error)
- func DockerServiceStop(serviceName string) error
- func GetAuthStr(authConfig types.AuthConfig) string
- func GetFunctionDockerFileContent(runtime Runtime) string
- func GetUserHomeDir() string
- func IntToStr(value int) string
- func KubeDeploy(kubeConfig KubeConfig, spec KubeServiceCreateSpec) (*v1.Service, error)
- func KubeDeployCreate(kubeConfig KubeConfig, spec KubeServiceCreateSpec) (*v1.Service, error)
- func KubeDeployUpdate(kubeConfig KubeConfig, spec KubeServiceCreateSpec) (*v1.Service, error)
- func KubeNameSpaceCreate(kubeConfig KubeConfig) error
- func KubeServiceDeleteByAppName(kubeConfig KubeConfig, appName string) error
- func KubeServiceGetByAppName(kubeConfig KubeConfig, appName string) (*v1.Service, error)
- func RuntimeValidate(runtime Runtime) bool
- func StrParseToPrimitive(str string) interface{}
- func StrToInt(value string) int
- type KubeConfig
- type KubeServiceCreateSpec
- type Port
- type PortConfig
- type Runtime
- type TargetPort
Constants ¶
const ApigatewayImage = "quebicdocker/quebic-faas-apigateway:1.0.0"
const ApigatewayServerPort = 3000
ApigatewayServerPort apigateway server port
const ComponentAPIGateway = componentPrefix + "apigateway"
ComponentAPIGateway apigateway
const ComponentDockerRegistry = componentPrefix + "docker-registry"
ComponentDockerRegistry docker_registry
const ComponentEventBus = componentPrefix + "eventbus"
ComponentEventBus eventbus
const ConsumerApigateway = "quebic-faas-apigateway"
ConsumerApigateway consumer
const ConsumerMgr = "quebic-faas-mgr"
ConsumerMgr consumer
const ConsumerRequestTracker = "quebic-faas-request-tracker"
ConsumerRequestTracker consumer
const ConsumerRequestTrackerDataFetch = "quebic-faas-request-tracker-data-fetch"
ConsumerRequestTrackerDataFetch consumer data-fetch
const DockerFileContent_Java = "" /* 132-byte string literal not displayed */
DockerFileContent_Java java docker file
const DockerFileContent_NodeJS = "" /* 147-byte string literal not displayed */
DockerFileContent_Java java docker file
const DockerNetworkID = "quebic-faas-network"
DockerNetworkID network id in service
const DockerRegistryPort = "5000"
DockerRegistryPort docker registry port
const DockerServiceApigateway = "quebic-faas-apigateway"
DockerServiceApigateway network id in service
const DockerServiceEventBus = "quebic-faas-eventbus"
DockerServiceEventBus network id in service
const EnvKeyAPIGateWayAccessKey = "access_key"
EnvKeyAPIGateWayAccessKey env key
this is env key which stored in docker image to access manager restricted endpoints. apigateway will make http request with the access_key.
const EnvKeyFunctionContainerSecret = "secret"
EnvKeyFunctionContainerSecret env key
this is env key which stored in docker image when creating new function. when start function container manager pass jwt encoded meta data which required to start function. this encode data open using this env key
const EnvKeyHostIP = "host_ip"
EnvKeyHostIP env key
const EnvKeyMgrPORT = "mgr_port"
EnvKeyMgrPORT env key
this is env key which stored in docker image to access manager.
const EnvKey_appID = "appID"
Used by function docker service
const EnvKey_artifactLocation = "artifactLocation"
const EnvKey_eventConst_eventLogListener = "eventConst.eventLogListener"
const EnvKey_eventConst_eventPrefixUserDefined = "eventConst.eventPrefixUserDefined"
const EnvKey_events = "events"
const EnvKey_functionPath = "functionPath"
const EnvKey_rabbitmq_exchange = "rabbitmq.exchange"
const EnvKey_rabbitmq_host = "rabbitmq.host"
const EnvKey_rabbitmq_management_password = "rabbitmq.management.password"
const EnvKey_rabbitmq_management_username = "rabbitmq.management.username"
const EnvKey_rabbitmq_port = "rabbitmq.port"
const EventApigatewayDataFetch = EventPrefixInternal + EventJOIN + "apigateway-data-fetch"
EventApigatewayDataFetch used to share data between manage ans apigateway
const EventJOIN = "."
EventJOIN event id join
const EventPrefixExecutionACK = eventPrefix + EventJOIN + "execution-ack"
EventPrefixExecutionACK execution ack prefix
const EventPrefixFunction = eventPrefix + EventJOIN + "function"
EventPrefixFunction function prefix
const EventPrefixInternal = eventPrefix + EventJOIN + "internal"
EventPrefixInternal execution ack prefix
const EventPrefixUserDefined = eventPrefix + EventJOIN + "user-defined"
EventPrefixUserDefined event id prefix
const EventRequestTracker = EventPrefixInternal + EventJOIN + "request-tracker"
EventRequestTracker used to listing apigatewat logs
const EventRequestTrackerDataFetch = EventPrefixInternal + EventJOIN + "request-tracker-data-fetch"
EventRequestTrackerDataFetch used to listing apigateways data fetch request
const EventbusImage = "rabbitmq:3-management"
const FilepathSeparator = string(filepath.Separator)
FilepathSeparator filepathSeparator
const HeaderAccessKey = "accesskey"
HeaderAccessKey header
const HostMachineIP = "0.0.0.0"
HostMachineIP host machine ip
const LogStateComponentSetupFailed = "COMPONENT_SETUP_FAILED"
LogStateComponentSetupFailed COMPONENT_SETUP_FAILED
const LogStateDockerContainerRestarting = "DOCKER_CONTAINER_RESTARTING"
LogStateDockerContainerRestarting DOCKER_CONTAINER_RESTARTING
const LogStateDockerContainerStartFailed = "DOCKER_CONTAINER_START_FAILED"
LogStateDockerContainerStartFailed DOCKER_IMAGE_CREATING_FAILED
const LogStateDockerContainerStarted = "DOCKER_CONTAINER_STARTED"
LogStateDockerContainerStarted DOCKER_IMAGE_CREATED
const LogStateDockerContainerStarting = "DOCKER_CONTAINER_STARTING"
LogStateDockerContainerStarting DOCKER_CONTAINER_STARTING
const LogStateDockerContainerStoped = "DOCKER_CONTAINER_STOPED"
LogStateDockerContainerStoped DOCKER_CONTAINER_STOPED
const LogStateDockerImageCreated = "DOCKER_IMAGE_CREATED"
LogStateDockerImageCreated DOCKER_IMAGE_CREATED
const LogStateDockerImageCreating = "DOCKER_IMAGE_CREATING"
LogStateDockerImageCreating DOCKER_IMAGE_CREATING
const LogStateDockerImageCreatingFailed = "DOCKER_IMAGE_CREATING_FAILED"
LogStateDockerImageCreatingFailed DOCKER_IMAGE_CREATING_FAILED
const LogStateDockerImagePublished = "DOCKER_IMAGE_PUBLISHED"
LogStateDockerImagePublished DOCKER_IMAGE_PUBLISHED
const LogStateDockerImagePublishing = "DOCKER_IMAGE_PUBLISHING"
LogStateDockerImagePublishing DOCKER_IMAGE_PUBLISHING
const LogStateDockerImagePublishingFailed = "DOCKER_IMAGE_PUBLISHING_FAILED"
LogStateDockerImagePublishingFailed DOCKER_IMAGE_PUBLISHING_FAILED
const LogStateDockerServiceStartFailed = "DOCKER_SERVICE_START_FAILED"
LogStateDockerServiceStartFailed DOCKER_SERVICE_START_FAILED
const LogStateDockerServiceStarted = "DOCKER_SERVICE_STARTED"
LogStateDockerServiceStarted DOCKER_SERVICE_STARTED
const LogStateDockerServiceStarting = "DOCKER_SERVICE_STARTING"
LogStateDockerServiceStarting DOCKER_SERVICE_STARTING
const LogStateDockerServiceStopped = "DOCKER_SERVICE_STOPPED"
LogStateDockerServiceStopped DOCKER_SERVICE_STOPPED
const LogStateSaved = "SAVED"
LogStateSaved SAVED
const MgrServerPort = 1028
MgrServerPort mgr server port
const RabbitmqAMQPPort = 5672
RabbitmqAMQPPort rabbit
const RabbitmqManagementPassword = "guest"
RabbitmqManagementPassword rabbit
const RabbitmqManagementPort = 15672
RabbitmqManagementPort rabbit
const RabbitmqManagementUserName = "guest"
RabbitmqManagementUserName rabbit
const ResourceJOIN = ":"
ResourceJOIN resource id join
const ResourceRequestMethodDELETE = "DELETE"
ResourceRequestMethodDELETE DELETE
const ResourceRequestMethodGET = "GET"
ResourceRequestMethodGET GET
const ResourceRequestMethodPOST = "POST"
ResourceRequestMethodPOST POST
const ResourceRequestMethodPUT = "PUT"
ResourceRequestMethodPUT PUT
const RuntimeJava = "java"
RuntimeJava java
const RuntimeNodeJS = "nodejs"
RuntimeNodeJS nodejs
Variables ¶
This section is empty.
Functions ¶
func CreateJWTToken ¶
CreateJWTToken create jwt token
func DockerContainerReStart ¶ added in v0.1.2
DockerContainerReStart re-start docker container by imageName
func DockerContainerStart ¶ added in v0.1.2
func DockerContainerStart( authConfig types.AuthConfig, image string, exposedPortSet nat.PortSet, portMap nat.PortMap, networkMode container.NetworkMode, cmd strslice.StrSlice) (string, error)
DockerContainerStart start docker container by imageName
func DockerContainerStop ¶ added in v0.1.2
DockerContainerStop stop docker container by containerID
func DockerNetworkCreate ¶
DockerNetworkCreate create natework
func DockerServiceCreate ¶
func DockerServiceCreate( networkID string, serviceName string, dockerimage string, portConfig []swarm.PortConfig, replicas int, envkeys map[string]string) (string, error)
DockerServiceCreate service create
func DockerServiceGetByName ¶
DockerServiceGetByName get service by name
func DockerServiceList ¶
DockerServiceList service list
func DockerServiceLogs ¶
func DockerServiceLogs( serviceName string, options types.ContainerLogsOptions, ) (io.ReadCloser, error)
DockerServiceLogs service list
func DockerServiceReStart ¶
func DockerServiceReStart( networkID string, serviceName string, dockerimage string, portConfig []swarm.PortConfig, replicas int, envkeys map[string]string) (string, error)
DockerServiceReStart service re-start
func DockerServiceStop ¶
DockerServiceStop service create
func GetFunctionDockerFileContent ¶
GetFunctionDockerFileContent getFunctionDockerFileContent
func KubeDeploy ¶
func KubeDeploy( kubeConfig KubeConfig, spec KubeServiceCreateSpec) (*v1.Service, error)
KubeDeploy create or update
func KubeDeployCreate ¶
func KubeDeployCreate( kubeConfig KubeConfig, spec KubeServiceCreateSpec) (*v1.Service, error)
KubeDeployCreate kube-update
func KubeDeployUpdate ¶
func KubeDeployUpdate( kubeConfig KubeConfig, spec KubeServiceCreateSpec) (*v1.Service, error)
KubeDeployUpdate kube-update
func KubeNameSpaceCreate ¶
func KubeNameSpaceCreate( kubeConfig KubeConfig) error
KubeNameSpaceCreate create namespace
func KubeServiceDeleteByAppName ¶
func KubeServiceDeleteByAppName( kubeConfig KubeConfig, appName string) error
KubeServiceDeleteByAppName delete by appName
func KubeServiceGetByAppName ¶
func KubeServiceGetByAppName( kubeConfig KubeConfig, appName string) (*v1.Service, error)
KubeServiceGetByAppName get by appName
func StrParseToPrimitive ¶
func StrParseToPrimitive(str string) interface{}
StrParseToPrimitive convert string to matching primitve type
Types ¶
type KubeConfig ¶
type KubeConfig struct {
ConfigPath string `json:"configPath"`
}
KubeConfig kubernates config
type KubeServiceCreateSpec ¶
type KubeServiceCreateSpec struct {
AppName string
Dockerimage string
Replicas int
Envkeys map[string]string
PortConfigs []PortConfig
}
KubeServiceCreateSpec kubeServiceCreateSpec
type PortConfig ¶
type PortConfig struct {
Name string
Port Port
TargetPort TargetPort
}
PortConfig portConfig