Documentation ¶
Index ¶
- func Checkout(gitHubOrg string, project string, branch string) (*git.Repository, error)
- func CheckoutPrevCommit(repo *git.Repository) (*plumbing.Reference, error)
- func CheckoutReference(repo *git.Repository, ref *plumbing.Reference) error
- func DoHelmUpgrade(project string, stage string) error
- func ExecuteCommand(command string, args []string) (string, error)
- func ExecuteCommandInDirectory(command string, args []string, directory string) (string, error)
- func ExpandTilde(fileName string) string
- func GetChart(project string, service string, stage string, chartName string, ...) (*chart.Chart, error)
- func GetClientset(useInClusterConfig bool) (*kubernetes.Clientset, error)
- func GetFiles(workingPath string, suffixes ...string) ([]string, error)
- func GetKeptnDirectory() (string, error)
- func GetKeptnDomain(useInClusterConfig bool) (string, error)
- func GetKubeAPI(useInClusterConfig bool) (v1.CoreV1Interface, error)
- func GetRenderedDeployments(ch *chart.Chart) ([]*appsv1.Deployment, error)
- func GetRenderedServices(ch *chart.Chart) ([]*corev1.Service, error)
- func IsDeployment(dpl *appsv1.Deployment) bool
- func IsService(svc *corev1.Service) bool
- func LoadChart(data []byte) (*chart.Chart, error)
- func LoadChartFromPath(path string) (*chart.Chart, error)
- func OpenWS(connData ConnectionData, apiEndPoint url.URL) (*websocket.Conn, *http.Response, error)
- func PackageChart(ch *chart.Chart) ([]byte, error)
- func ResolveXipIo(network, addr string) (net.Conn, error)
- func ResolveXipIoWithContext(ctx context.Context, network, addr string) (net.Conn, error)
- func RestartPodsWithSelector(useInClusterConfig bool, namespace string, selector string) error
- func ScaleDeployment(useInClusterConfig bool, deployment string, namespace string, replicas int32) error
- func StoreChart(project string, service string, stage string, chartName string, ...) error
- func UserHomeDir() string
- func WaitForDeploymentToBeRolledOut(useInClusterConfig bool, deploymentName string, namespace string) error
- func WaitForDeploymentsInNamespace(useInClusterConfig bool, namespace string) error
- func WaitForPodsWithSelector(useInClusterConfig bool, namespace string, selector string, retries int, ...) error
- func WriteLog(ws *websocket.Conn, logData LogData, shkeptnContext string) error
- func WriteWSLog(ws *websocket.Conn, logEvent cloudevents.Event, message string, terminate bool, ...) error
- type ChannelInfo
- type CombinedLogger
- type ConfigService
- type ConnectionData
- type IncompleteCE
- type KeptnHandler
- type LogData
- type Logger
- type LoggerInterface
- type MyCloudEvent
- type ProjectHandler
- type ResourceHandler
- func (r *ResourceHandler) CreateProjectResources(project string, resources []*models.Resource) (string, error)
- func (r *ResourceHandler) CreateServiceResources(project string, stage string, service string, resources []*models.Resource) (string, error)
- func (r *ResourceHandler) CreateStageResources(project string, stage string, resources []*models.Resource) (string, error)
- func (r *ResourceHandler) DeleteProjectResource(project string, resourceURI string) error
- func (r *ResourceHandler) DeleteServiceResource(project string, stage string, service string, resourceURI string) error
- func (r *ResourceHandler) DeleteStageResource(project string, stage string, resourceURI string) error
- func (r *ResourceHandler) GetAllStageResources(project string, stage string) ([]*models.Resource, error)
- func (r *ResourceHandler) GetProjectResource(project string, resourceURI string) (*models.Resource, error)
- func (r *ResourceHandler) GetServiceResource(project string, stage string, service string, resourceURI string) (*models.Resource, error)
- func (r *ResourceHandler) GetStageResource(project string, stage string, resourceURI string) (*models.Resource, error)
- func (r *ResourceHandler) UpdateProjectResource(project string, resource *models.Resource) (string, error)
- func (r *ResourceHandler) UpdateProjectResources(project string, resources []*models.Resource) (string, error)
- func (r *ResourceHandler) UpdateServiceResource(project string, stage string, service string, resource *models.Resource) (string, error)
- func (r *ResourceHandler) UpdateServiceResources(project string, stage string, service string, resources []*models.Resource) (string, error)
- func (r *ResourceHandler) UpdateStageResource(project string, stage string, resource *models.Resource) (string, error)
- func (r *ResourceHandler) UpdateStageResources(project string, stage string, resources []*models.Resource) (string, error)
- type ServiceHandler
- type StageHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckoutPrevCommit ¶
CheckoutPrevCommit moves the HEAD pointer to the previous commit. It returns the original HEAD.
func CheckoutReference ¶
CheckoutReference moves the HEAD pointer to the specified reference.
func DoHelmUpgrade ¶
DoHelmUpgrade executes a helm update and upgrade
func ExecuteCommand ¶
ExecuteCommand exectues the command using the args
func ExecuteCommandInDirectory ¶
ExecuteCommandInDirectory executes the command using the args within the specified directory
func GetChart ¶
func GetChart(project string, service string, stage string, chartName string, configServiceURL string) (*chart.Chart, error)
GetChart reads the chart from the configuration service
func GetClientset ¶
func GetClientset(useInClusterConfig bool) (*kubernetes.Clientset, error)
GetClientset returns the kubernetes Clientset
func GetKeptnDirectory ¶
GetKeptnDirectory returns a path, which is used to store logs and possibly creds
func GetKeptnDomain ¶
GetKeptnDomain reads the configmap keptn-domain in namespace keptn and returns the contained app_domain
func GetKubeAPI ¶
func GetKubeAPI(useInClusterConfig bool) (v1.CoreV1Interface, error)
GetKubeAPI returns the CoreV1Interface
func GetRenderedDeployments ¶
func GetRenderedDeployments(ch *chart.Chart) ([]*appsv1.Deployment, error)
GetRenderedDeployments returns all deployments contained in the provided chart
func GetRenderedServices ¶
GetRenderedServices returns all services contained in the provided chart
func IsDeployment ¶
func IsDeployment(dpl *appsv1.Deployment) bool
IsDeployment tests whether the provided struct is a deployment
func LoadChartFromPath ¶
LoadChartFromPath loads a directory or Helm chart into a Chart
func PackageChart ¶
PackageChart packages the chart and returns it
func ResolveXipIo ¶
ResolveXipIo resolves a xip io address
func ResolveXipIoWithContext ¶
ResolveXipIoWithContext resolves a xip io address
func RestartPodsWithSelector ¶
RestartPodsWithSelector restarts the pods which are found in the provided namespace and selector
func ScaleDeployment ¶
func StoreChart ¶
func StoreChart(project string, service string, stage string, chartName string, helmChart []byte, configServiceURL string) error
StoreChart stores a chart in the configuration service
func UserHomeDir ¶
func UserHomeDir() string
UserHomeDir returns the HOME directory by taking into account the operating system
func WaitForDeploymentToBeRolledOut ¶
func WaitForDeploymentToBeRolledOut(useInClusterConfig bool, deploymentName string, namespace string) error
WaitForDeploymentToBeRolledOut waits until the deployment is Available
func WaitForDeploymentsInNamespace ¶
WaitForDeploymentsInNamespace waits until all deployments in a namespace are available
func WaitForPodsWithSelector ¶
func WriteWSLog ¶
func WriteWSLog(ws *websocket.Conn, logEvent cloudevents.Event, message string, terminate bool, logLevel string) error
WriteWSLog writes the log event to the websocket
Types ¶
type ChannelInfo ¶
ChannelInfo stores a token and a channelID used for opening the websocket
type CombinedLogger ¶
type CombinedLogger struct {
// contains filtered or unexported fields
}
CombinedLogger logs messages to the logger as well as to the websocket
func NewCombinedLogger ¶
func NewCombinedLogger(logger *Logger, ws *websocket.Conn, shKeptnContext string) *CombinedLogger
NewCombinedLogger creates a new CombinedLogger which writes log messages to the logger as well as to the websocket
func (*CombinedLogger) Debug ¶
func (l *CombinedLogger) Debug(message string)
Debug logs a debug message
func (*CombinedLogger) Error ¶
func (l *CombinedLogger) Error(message string)
Error logs an error message
func (*CombinedLogger) Info ¶
func (l *CombinedLogger) Info(message string)
Info logs an info message
func (*CombinedLogger) Terminate ¶
func (l *CombinedLogger) Terminate()
Terminate sends a terminate message to the websocket
type ConfigService ¶
type ConfigService interface {
// contains filtered or unexported methods
}
ConfigService represents the interface for accessing the configuration service
type ConnectionData ¶
type ConnectionData struct {
ChannelInfo ChannelInfo `json:"channelInfo"`
}
ConnectionData stores ChannelInfo and Success data
type IncompleteCE ¶
type IncompleteCE struct {
ConnData ConnectionData `json:"data"`
}
IncompleteCE is a helper type for unmarshalling the CE data
type KeptnHandler ¶
type KeptnHandler struct {
ResourceHandler *ResourceHandler
}
KeptnHandler provides an interface to keptn resources
func NewKeptnHandler ¶
func NewKeptnHandler(rh *ResourceHandler) *KeptnHandler
NewKeptnHandler returns a new KeptnHandler instance
func (*KeptnHandler) GetShipyard ¶
func (k *KeptnHandler) GetShipyard(project string) (*models.Shipyard, error)
GetShipyard returns the shipyard definition of a project
type LogData ¶
type LogData struct { Message string `json:"message"` Terminate bool `json:"terminate"` LogLevel string `json:"loglevel"` }
LogData represents log data
type Logger ¶
type Logger struct { KeptnContext string `json:"keptnContext"` EventID string `json:"eventId"` ServiceName string `json:"keptnService"` }
Logger contains data for logging
type LoggerInterface ¶
LoggerInterface collects signatures of the logger
type MyCloudEvent ¶
type MyCloudEvent struct { SpecVersoin string `json:"specversion"` ContentType string `json:"contentType"` Data json.RawMessage `json:"data"` ID string `json:"id"` Time string `json:"time"` Type string `json:"type"` Source string `json:"source"` ShKeptnContext string `json:"shkeptncontext"` }
MyCloudEvent represents a keptn cloud event
type ProjectHandler ¶
type ProjectHandler struct { BaseURL string AuthToken string AuthHeader string HTTPClient *http.Client Scheme string }
ProjectHandler handles projects
func NewAuthenticatedProjectHandler ¶
func NewAuthenticatedProjectHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *ProjectHandler
NewAuthenticatedProjectHandler returns a new ProjectHandler that authenticates at the endpoint via the provided token
func NewProjectHandler ¶
func NewProjectHandler(baseURL string) *ProjectHandler
NewProjectHandler returns a new ProjectHandler
func (*ProjectHandler) CreateProject ¶
CreateProject creates a new project
func (*ProjectHandler) DeleteProject ¶
DeleteProject deletes a project
func (*ProjectHandler) GetProject ¶
GetProject returns a project
type ResourceHandler ¶
type ResourceHandler struct { BaseURL string AuthToken string AuthHeader string HTTPClient *http.Client Scheme string }
ResourceHandler handles resources
func NewAuthenticatedResourceHandler ¶
func NewAuthenticatedResourceHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *ResourceHandler
NewAuthenticatedResourceHandler returns a new ResourceHandler that authenticates at the endpoint via the provided token
func NewResourceHandler ¶
func NewResourceHandler(baseURL string) *ResourceHandler
NewResourceHandler returns a new ResourceHandler
func (*ResourceHandler) CreateProjectResources ¶
func (r *ResourceHandler) CreateProjectResources(project string, resources []*models.Resource) (string, error)
CreateProjectResources creates multiple project resources
func (*ResourceHandler) CreateServiceResources ¶
func (r *ResourceHandler) CreateServiceResources(project string, stage string, service string, resources []*models.Resource) (string, error)
CreateServiceResources creates a service resource
func (*ResourceHandler) CreateStageResources ¶
func (r *ResourceHandler) CreateStageResources(project string, stage string, resources []*models.Resource) (string, error)
CreateStageResources creates a stage resource
func (*ResourceHandler) DeleteProjectResource ¶
func (r *ResourceHandler) DeleteProjectResource(project string, resourceURI string) error
DeleteProjectResource deletes a project resource
func (*ResourceHandler) DeleteServiceResource ¶
func (r *ResourceHandler) DeleteServiceResource(project string, stage string, service string, resourceURI string) error
DeleteServiceResource deletes a service resource
func (*ResourceHandler) DeleteStageResource ¶
func (r *ResourceHandler) DeleteStageResource(project string, stage string, resourceURI string) error
DeleteStageResource deletes a stage resource
func (*ResourceHandler) GetAllStageResources ¶
func (r *ResourceHandler) GetAllStageResources(project string, stage string) ([]*models.Resource, error)
GetAllStageResources returns a list of all resources.
func (*ResourceHandler) GetProjectResource ¶
func (r *ResourceHandler) GetProjectResource(project string, resourceURI string) (*models.Resource, error)
GetProjectResource retrieves a project resource from the configuration service
func (*ResourceHandler) GetServiceResource ¶
func (r *ResourceHandler) GetServiceResource(project string, stage string, service string, resourceURI string) (*models.Resource, error)
GetServiceResource retrieves a service resource from the configuration service
func (*ResourceHandler) GetStageResource ¶
func (r *ResourceHandler) GetStageResource(project string, stage string, resourceURI string) (*models.Resource, error)
GetStageResource retrieves a stage resource from the configuration service
func (*ResourceHandler) UpdateProjectResource ¶
func (r *ResourceHandler) UpdateProjectResource(project string, resource *models.Resource) (string, error)
UpdateProjectResource updates a project resource
func (*ResourceHandler) UpdateProjectResources ¶
func (r *ResourceHandler) UpdateProjectResources(project string, resources []*models.Resource) (string, error)
UpdateProjectResources updates multiple project resources
func (*ResourceHandler) UpdateServiceResource ¶
func (r *ResourceHandler) UpdateServiceResource(project string, stage string, service string, resource *models.Resource) (string, error)
UpdateServiceResource updates a service resource
func (*ResourceHandler) UpdateServiceResources ¶
func (r *ResourceHandler) UpdateServiceResources(project string, stage string, service string, resources []*models.Resource) (string, error)
UpdateServiceResources updates multiple service resources
func (*ResourceHandler) UpdateStageResource ¶
func (r *ResourceHandler) UpdateStageResource(project string, stage string, resource *models.Resource) (string, error)
UpdateStageResource updates a stage resource
func (*ResourceHandler) UpdateStageResources ¶
func (r *ResourceHandler) UpdateStageResources(project string, stage string, resources []*models.Resource) (string, error)
UpdateStageResources updates multiple stage resources
type ServiceHandler ¶
type ServiceHandler struct { BaseURL string AuthToken string AuthHeader string HTTPClient *http.Client Scheme string }
ServiceHandler handles services
func NewAuthenticatedServiceHandler ¶
func NewAuthenticatedServiceHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *ServiceHandler
NewAuthenticatedServiceHandler returns a new ServiceHandler that authenticates at the endpoint via the provided token
func NewServiceHandler ¶
func NewServiceHandler(baseURL string) *ServiceHandler
NewServiceHandler returns a new ServiceHandler
func (*ServiceHandler) CreateService ¶
func (s *ServiceHandler) CreateService(project string, stage string, serviceName string) (*models.Error, error)
CreateService creates a new service
func (*ServiceHandler) GetAllServices ¶
GetAllServices returns a list of all services.
type StageHandler ¶
type StageHandler struct { BaseURL string AuthToken string AuthHeader string HTTPClient *http.Client Scheme string }
StageHandler handles stages
func NewAuthenticatedStageHandler ¶
func NewAuthenticatedStageHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *StageHandler
NewAuthenticatedStageHandler returns a new StageHandler that authenticates at the endpoint via the provided token
func NewStageHandler ¶
func NewStageHandler(baseURL string) *StageHandler
NewStageHandler returns a new StageHandler
func (*StageHandler) CreateStage ¶
CreateStage creates a new stage with the provided name
func (*StageHandler) GetAllStages ¶
func (s *StageHandler) GetAllStages(project string) ([]*models.Stage, error)
GetAllStages returns a list of all stages.