services

package
v0.0.0-...-0ccacba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2018 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildResources

func BuildResources(vars map[string]string, templateList []string, isReplace bool)

BuildResources get Status of specified resources. Iterating over each type of app

func CreateResources

func CreateResources(vars map[string]string, templateList []string)

CreateResources creates a list of kubernetes resources specified in the template list

func DBClientFindAndReserve

func DBClientFindAndReserve(client *redis.Client, app string, env string, ttl time.Duration) (string, error)

DBClientFindAndReserve is a wrapper to find a free cluster and update the cache of used clusters

func DBClientGetAllClusters

func DBClientGetAllClusters(client *redis.Client, app string, env string) (string, error)

DBClientGetAllClusters is a wrapper to list the clusters in use and the resources using the clusters

func DBClientGetAllClustersDetail

func DBClientGetAllClustersDetail(client *redis.Client, app string, env string) (string, error)

DBClientGetAllClustersDetail is a wrapper to get details used clusters and resources using the clusters

func DBClientGetSingleCluster

func DBClientGetSingleCluster(client *redis.Client, app string, env string, cluster string) (string, error)

DBClientGetSingleCluster wrapper to get resource using a given cluster

func DBClientGetSingleClusterDetail

func DBClientGetSingleClusterDetail(client *redis.Client, app string, env string, cluster string) (string, error)

DBClientGetSingleClusterDetail wrapper to get details of a resource using a given cluster

func DBClientListClusters

func DBClientListClusters(client *redis.Client, app string, env string, cluster string, detail bool) (string, error)

DBClientListClusters fetches the details of clusters in use and resources using those clusters

func DBClientReserveCluster

func DBClientReserveCluster(client *redis.Client, app string, env string, key string, val []byte, t time.Duration) error

DBClientReserveCluster updates the redis cache and allocates the cluster to the incoming resource

func DBGetClusterReservation

func DBGetClusterReservation(client *redis.Client, app string, env string, cluster string) (string, error)

DBGetClusterReservation ...

func DeleteKubernetesJob

func DeleteKubernetesJob(resource, namespace string) string

DeleteKubernetesJob - Cleans a job from Kubernetes memory space.

func ErrorHandler

func ErrorHandler(err error)

ErrorHandler is a generic error handler

func ExecCmd

func ExecCmd(cmdName string, cmdArgs []string) ([]byte, error)

ExecCmd executions the input command and argumets on the command line and returns the output

func GetAPIActions

func GetAPIActions(api string, application string, m map[string]interface{}) ([]map[string]interface{}, error)

GetAPIActions loads API definitions from file every time work needs to be done. A future enhancement will be to preload this so that we don't need to keep ready from disk

func GetClientSet

func GetClientSet() *kubernetes.Clientset

GetClientSet returns a clientset object to make API calls

func GetDatabaseConnection

func GetDatabaseConnection() *sql.DB

GetDatabaseConnection - opens, tests and returns a new database connection

func GetDockerTag

func GetDockerTag(api string, m map[string]interface{}) (string, error)

GetDockerTag fetches the most recent tag of the resource defined in api yaml

func GetJobAPI

func GetJobAPI(vars map[string]string) (map[string]interface{}, error)

GetJobAPI retrieves all keypairs api for the k8s Job from YAML

func GetJobNamespace

func GetJobNamespace(vars map[string]string) (string, error)

GetJobNamespace retrieves the namespace for the k8s Job from YAML

func GetLogs

func GetLogs(job *batchv1.Job) (string, error)

GetLogs retrieves the logs of the jobresource given in the request

func GetResourceStatus

func GetResourceStatus(parms map[string]string, resourcePostfix []string) ([]byte, error)

GetResourceStatus get Status of specified resources. Iterating over each type of app

func IsClusterInList

func IsClusterInList(environment, cluster, m interface{}) bool

IsClusterInList checks if given cluster is in the given environment in the cluster list definition

func Keys

func Keys(m map[string][]string) (keys []string)

Keys ...

func KubeGetDeployments

func KubeGetDeployments(filter string) (map[string]interface{}, error)

KubeGetDeployments get details for kubernetes resources names matching the filter

func KubeGetServices

func KubeGetServices(filter string) (map[string]interface{}, error)

KubeGetServices gets details of services for the given filter

func NewDBClient

func NewDBClient() *redis.Client

NewDBClient establishes a new redis database connection and returns the client connection object

func RunActions

func RunActions(api string, vars map[string]interface{}) (map[string]interface{}, error)

RunActions ...

func RunJobActions

func RunJobActions(api string, vars map[string]interface{}) (map[string]interface{}, error)

RunJobActions ...

func SaveEventStatus

func SaveEventStatus(eventdata map[string]string) error

SaveEventStatus - stores events to database

func UpdateResources

func UpdateResources(vars map[string]string, templateList []string)

UpdateResources updates the kubernetes resources using the new configuration from the template list

Types

type APIList

type APIList struct {
	Description string
	Application map[string][]map[string]interface{}
}

APIList describes the list of APIs for the application

type GitHubData

type GitHubData struct {
	URL       string
	RepoName  string
	CommitID  string
	Timestamp string
	RepoID    float64
}

GitHubData ...

func GetGhData

func GetGhData() ([](*GitHubData), error)

GetGhData ...

func ParseGithubPayload

func ParseGithubPayload(m map[string]interface{}) *GitHubData

ParseGithubPayload reads a Hook from an incoming HTTP Request.

func (*GitHubData) CloneAndSymlinkApp

func (ghdata *GitHubData) CloneAndSymlinkApp() (string, string)

CloneAndSymlinkApp downloads the github repo and symlinks it to application/{repo}

func (*GitHubData) SaveGhData

func (ghdata *GitHubData) SaveGhData()

SaveGhData ...

type GitHubHook

type GitHubHook struct {
	ID        string
	Event     string
	Signature string
	Payload   []byte
}

GitHubHook ...

func NewHook

func NewHook(req *http.Request) *GitHubHook

NewHook inits a new GithubHook struct

func ParseGithubHook

func ParseGithubHook(req *http.Request) (*GitHubHook, error)

ParseGithubHook reads a Hook from an incoming HTTP Request.

func (*GitHubHook) SignedBy

func (h *GitHubHook) SignedBy(secret []byte) bool

SignedBy checks that the provided secret matches the hook Signature

type KubeEndpoint

type KubeEndpoint struct {
	// Hostname, either as a domain name or IP address.
	Host string `json:"host"`
	// List of ports opened for this endpoint on the hostname.
	Ports []KubeServicePort `json:"ports"`
}

KubeEndpoint describes an endpoint that is host and a list of available ports for that host.

func GetExternalEndpoints

func GetExternalEndpoints(service *api.Service) []KubeEndpoint

GetExternalEndpoints returns endpoints that are externally reachable for a service.

func GetInternalEndpoint

func GetInternalEndpoint(serviceName, namespace string, ports []api.ServicePort) KubeEndpoint

GetInternalEndpoint returns internal endpoint name for the given service properties, e.g, "my-service.namespace 80/TCP" or "my-service 53/TCP,53/UDP"

type KubeServicePort

type KubeServicePort struct {
	// Positive port number.
	Port int32 `json:"port"`

	// Protocol name, e.g., TCP or UDP.
	Protocol apiv1.Protocol `json:"protocol"`

	// The port on each node on which service is exposed.
	NodePort int32 `json:"nodePort"`
}

KubeServicePort is a pair of port and protocol, e.g. a service endpoint.

func GetServicePorts

func GetServicePorts(apiPorts []apiv1.ServicePort) []KubeServicePort

GetServicePorts returns human readable name for the given service ports list.

Jump to

Keyboard shortcuts

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