Documentation ¶
Index ¶
- Constants
- Variables
- func BuildClusterConfig(serviceConfig *ServiceConfig) (*rest.Config, *hfClientset.Clientset, *kubernetes.Clientset)
- func BuildTLSClientCredentials(caPath string) (credentials.TransportCredentials, error)
- func ConnectionWatchdog(svc MicroService, conn *grpc.ClientConn)
- func CreateGRPCServer(c credentials.TransportCredentials) *grpc.Server
- func EstablishConnection(svc MicroService, cert credentials.TransportCredentials) *grpc.ClientConn
- func EstablishConnections(services []MicroService, cert credentials.TransportCredentials) map[MicroService]*grpc.ClientConn
- func GetWorkerThreadCount() int
- func StartAPIServer(server APIServer)
- func StartGRPCServer(server *grpc.Server, enableReflection bool)
- type APIServer
- type MicroService
- type ServiceConfig
Constants ¶
const (
InitialConnectionTimeout time.Duration = 30 * time.Second
)
Variables ¶
var CORS_ALLOWED_HEADERS = []string{"Authorization", "Content-Type"}
var CORS_ALLOWED_METHODS_ALL = [...]string{"GET", "POST", "PUT", "HEAD", "OPTIONS", "DELETE"}
var CORS_ALLOWED_ORIGINS = []string{"*"}
var CORS_HANDLER_ALLOWED_HEADERS = handlers.AllowedHeaders(CORS_ALLOWED_HEADERS)
var CORS_HANDLER_ALLOWED_METHODS = handlers.AllowedMethods(CORS_ALLOWED_METHODS_ALL[:])
var CORS_HANDLER_ALLOWED_ORIGINS = handlers.AllowedOrigins(CORS_ALLOWED_ORIGINS)
Functions ¶
func BuildClusterConfig ¶
func BuildClusterConfig(serviceConfig *ServiceConfig) (*rest.Config, *hfClientset.Clientset, *kubernetes.Clientset)
func BuildTLSClientCredentials ¶
func BuildTLSClientCredentials(caPath string) (credentials.TransportCredentials, error)
func ConnectionWatchdog ¶
func ConnectionWatchdog(svc MicroService, conn *grpc.ClientConn)
Watchdog for grpc Connection that logs state changes Only log changes if - moving to TransientFailure or Shutdown - moving to any other state when there was an Error (this happens until the error is resolved and the state = READY)
Second watchdog tries to catch initial connection errors
func CreateGRPCServer ¶
func CreateGRPCServer(c credentials.TransportCredentials) *grpc.Server
/ Used to create new gcpr server with options
func EstablishConnection ¶
func EstablishConnection(svc MicroService, cert credentials.TransportCredentials) *grpc.ClientConn
/ Used to create new gcpr client with options
func EstablishConnections ¶
func EstablishConnections(services []MicroService, cert credentials.TransportCredentials) map[MicroService]*grpc.ClientConn
func GetWorkerThreadCount ¶ added in v3.2.0
func GetWorkerThreadCount() int
This method tries to retreive the controller thread count from an environment variable CONTROLLER_THREAD_COUNT otherwise it sets the thread count to the default value
func StartAPIServer ¶
func StartAPIServer(server APIServer)
Common method that starts a microservices API server
func StartGRPCServer ¶
Common method that starts a microservices grpc server
Types ¶
type MicroService ¶
type MicroService string
Add type MicroService based on string that is used to define constants for every service
const ( AccessCode MicroService = "accesscode-service" AuthN MicroService = "authn-service" AuthR MicroService = "authr-service" Course MicroService = "course-service" DBConfig MicroService = "dbconfig-service" Environment MicroService = "environment-service" Progress MicroService = "progress-service" Rbac MicroService = "rbac-service" Scenario MicroService = "scenario-service" ScheduledEvent MicroService = "scheduledevent-service" Session MicroService = "session-service" Setting MicroService = "setting-service" Terraform MicroService = "terraform-service" User MicroService = "user-service" VMClaim MicroService = "vmclaim-service" VMSet MicroService = "vmset-service" VM MicroService = "vm-service" VMTemplate MicroService = "vmtemplate-service" )
type ServiceConfig ¶
type ServiceConfig struct { TLSCert string TLSKey string TLSCA string WebhookTLSCA string LocalMasterUrl string LocalKubeconfig string EnableReflection bool ClientCert credentials.TransportCredentials ServerCert credentials.TransportCredentials }
ServiceConfig holds the configuration for a service
func BuildServiceConfig ¶
func BuildServiceConfig() *ServiceConfig
ParseFlags declares the flags and parses them, then returns a ServiceConfig struct.