api

package
v0.0.0-...-57b96c7 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2018 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPortName         = "http"
	NavTruststoreFasitAlias = "nav_truststore"
)
View Source
const (
	RootMountPoint           = "/var/run/secrets/naisd.io/"
	AlertsConfigMapNamespace = "nais"
	AlertsConfigMapName      = "app-rules"
)

Variables

This section is empty.

Functions

func AddDefaultManifestValues

func AddDefaultManifestValues(manifest *NaisManifest, application string) error

func CreateOrUpdateFasitResources

func CreateOrUpdateFasitResources(fasit FasitClientAdapter, resources []ExposedResource, hostname, fasitEnvironmentClass, fasitEnvironment string, deploymentRequest naisrequest.Deploy) ([]int, error)

func GenerateDeployMessage

func GenerateDeployMessage(deploymentRequest *naisrequest.Deploy, clusterName *string) ([]byte, error)

func NotifySensuAboutDeploy

func NotifySensuAboutDeploy(deploymentRequest *naisrequest.Deploy, clusterName *string)

func SafeMarshal

func SafeMarshal(v interface{}) ([]byte, error)

Types

type Api

type Api struct {
	Clientset              kubernetes.Interface
	FasitUrl               string
	ClusterSubdomain       string
	ClusterName            string
	IstioEnabled           bool
	DeploymentStatusViewer DeploymentStatusViewer
}

func NewApi

func NewApi(clientset kubernetes.Interface, fasitUrl, clusterDomain, clusterName string, istioEnabled bool, d DeploymentStatusViewer) Api

func (Api) Handler

func (api Api) Handler() http.Handler

type AppError

type AppError interface {
	error
	Code() int
}

type ApplicationInstancePayload

type ApplicationInstancePayload struct {
	Application      string     `json:"application"`
	Environment      string     `json:"environment"`
	Version          string     `json:"version"`
	ExposedResources []Resource `json:"exposedresources"`
	UsedResources    []Resource `json:"usedresources"`
	ClusterName      string     `json:"clustername"`
	Domain           string     `json:"domain"`
}

type DeployStatus

type DeployStatus int
const (
	Success DeployStatus = iota
	InProgress
	Failed
)

func (DeployStatus) String

func (d DeployStatus) String() string

type DeploymentResult

type DeploymentResult struct {
	Autoscaler      *k8sautoscaling.HorizontalPodAutoscaler
	Ingress         *k8sextensions.Ingress
	Deployment      *k8sextensions.Deployment
	Secret          *k8score.Secret
	Service         *k8score.Service
	Redis           *redisapi.RedisFailover
	AlertsConfigMap *k8score.ConfigMap
	ServiceAccount  *k8score.ServiceAccount
}

type DeploymentStatusView

type DeploymentStatusView struct {
	Name       string
	Desired    int32
	Current    int32
	UpToDate   int32
	Available  int32
	Containers []string
	Images     []string
	Status     string
	Reason     string
}

type DeploymentStatusViewer

type DeploymentStatusViewer interface {
	DeploymentStatusView(namespace string, deployName string) (DeployStatus, DeploymentStatusView, error)
}

func NewDeploymentStatusViewer

func NewDeploymentStatusViewer(clientset kubernetes.Interface) DeploymentStatusViewer

type ExposedResource

type ExposedResource struct {
	Alias          string
	ResourceType   string `yaml:"resourceType"`
	Path           string
	Description    string
	WsdlGroupId    string `yaml:"wsdlGroupId"`
	WsdlArtifactId string `yaml:"wsdlArtifactId"`
	WsdlVersion    string `yaml:"wsdlVersion"`
	SecurityToken  string `yaml:"securityToken"`
	AllZones       bool   `yaml:"allZones"`
}

type FasitClient

type FasitClient struct {
	FasitUrl string
	Username string
	Password string
}

func (FasitClient) GetFasitApplication

func (fasit FasitClient) GetFasitApplication(application string) error

func (FasitClient) GetFasitEnvironmentClass

func (fasit FasitClient) GetFasitEnvironmentClass(environmentName string) (string, error)

func (FasitClient) GetScopedResources

func (fasit FasitClient) GetScopedResources(resourcesRequests []ResourceRequest, environment string, application string, zone string) (resources []NaisResource, err error)

type FasitClientAdapter

type FasitClientAdapter interface {
	GetFasitEnvironmentClass(environmentName string) (string, error)
	GetFasitApplication(application string) error
	GetScopedResources(resourcesRequests []ResourceRequest, environment string, application string, zone string) (resources []NaisResource, err error)
	// contains filtered or unexported methods
}

type FasitResource

type FasitResource struct {
	Id           int
	Alias        string
	ResourceType string `json:"type"`
	Scope        Scope  `json:"scope"`
	Properties   map[string]string
	Secrets      map[string]map[string]string
	Certificates map[string]interface{} `json:"files"`
}

type FasitResources

type FasitResources struct {
	Used    []UsedResource
	Exposed []ExposedResource
}

type Field

type Field struct {
	Name  string
	Value string
}

type Healthcheck

type Healthcheck struct {
	Liveness  Probe
	Readiness Probe
}

type Ingress

type Ingress struct {
	Disabled bool
}

type IstioConfig

type IstioConfig struct {
	Enabled bool
}

type NaisManifest

type NaisManifest struct {
	Team            string
	Image           string
	Port            int
	Healthcheck     Healthcheck
	PreStopHookPath string `yaml:"preStopHookPath"`
	Prometheus      PrometheusConfig
	Istio           IstioConfig
	Replicas        Replicas
	Ingress         Ingress
	Resources       ResourceRequirements
	FasitResources  FasitResources `yaml:"fasitResources"`
	LeaderElection  bool           `yaml:"leaderElection"`
	Redis           bool           `yaml:"redis"`
	WebProxy        bool
	Alerts          []PrometheusAlertRule
	Logformat       string
	Logtransform    string
}

func GenerateManifest

func GenerateManifest(deploymentRequest naisrequest.Deploy) (naisManifest NaisManifest, err error)

func GetDefaultManifest

func GetDefaultManifest(application string) NaisManifest

type NaisResource

type NaisResource struct {
	// contains filtered or unexported fields
}

func FetchFasitResources

func FetchFasitResources(fasit FasitClientAdapter, application string, environment string, zone string, usedResources []UsedResource) (naisresources []NaisResource, err error)

func (NaisResource) Certificates

func (nr NaisResource) Certificates() map[string][]byte

func (NaisResource) MountPoint

func (nr NaisResource) MountPoint(property string) string

func (NaisResource) Properties

func (nr NaisResource) Properties() map[string]string

func (NaisResource) Secret

func (nr NaisResource) Secret() map[string]string

func (NaisResource) ToEnvironmentVariable

func (nr NaisResource) ToEnvironmentVariable(property string) string

func (NaisResource) ToResourceVariable

func (nr NaisResource) ToResourceVariable(property string) string

type Password

type Password struct {
	Ref string `json:"ref"`
}

type Probe

type Probe struct {
	Path             string
	InitialDelay     int `yaml:"initialDelay"`
	PeriodSeconds    int `yaml:"periodSeconds"`
	FailureThreshold int `yaml:"failureThreshold"`
	Timeout          int `yaml:"timeout"`
}

type PrometheusAlertGroup

type PrometheusAlertGroup struct {
	Name  string
	Rules []PrometheusAlertRule
}

type PrometheusAlertGroups

type PrometheusAlertGroups struct {
	Groups []PrometheusAlertGroup
}

type PrometheusAlertRule

type PrometheusAlertRule struct {
	Alert       string
	Expr        string
	For         string
	Labels      map[string]string
	Annotations map[string]string
}

type PrometheusConfig

type PrometheusConfig struct {
	Enabled bool
	Port    string
	Path    string
}

type Replicas

type Replicas struct {
	Min                    int
	Max                    int
	CpuThresholdPercentage int `yaml:"cpuThresholdPercentage"`
}

type Resource

type Resource struct {
	Id int `json:"id"`
}

type ResourceList

type ResourceList struct {
	Cpu    string
	Memory string
}

type ResourcePayload

type ResourcePayload interface{}

type ResourceRequest

type ResourceRequest struct {
	Alias        string
	ResourceType string
	PropertyMap  map[string]string
}

func DefaultResourceRequests

func DefaultResourceRequests() []ResourceRequest

type ResourceRequirements

type ResourceRequirements struct {
	Limits   ResourceList
	Requests ResourceList
}

type RestProperties

type RestProperties struct {
	Url         string `json:"url"`
	Description string `json:"description,omitempty"`
}

type RestResourcePayload

type RestResourcePayload struct {
	Alias      string         `json:"alias"`
	Scope      Scope          `json:"scope"`
	Type       string         `json:"type"`
	Properties RestProperties `json:"properties"`
}

type Scope

type Scope struct {
	EnvironmentClass string `json:"environmentclass"`
	Environment      string `json:"environment,omitempty"`
	Zone             string `json:"zone,omitempty"`
}

type ServiceAccountInterface

type ServiceAccountInterface interface {
	CreateOrUpdate(name, namespace, team string) (*v1.ServiceAccount, error)
	Delete(name, namespace string) error
}

func NewServiceAccountInterface

func NewServiceAccountInterface(client kubernetes.Interface) ServiceAccountInterface

type UsedResource

type UsedResource struct {
	Alias        string
	ResourceType string            `yaml:"resourceType"`
	PropertyMap  map[string]string `yaml:"propertyMap"`
}

type ValidationError

type ValidationError struct {
	ErrorMessage string
	Fields       map[string]string
}

type ValidationErrors

type ValidationErrors struct {
	Errors []ValidationError
}

func ValidateManifest

func ValidateManifest(manifest NaisManifest) ValidationErrors

func (ValidationErrors) Error

func (errors ValidationErrors) Error() (s string)

type WebserviceProperties

type WebserviceProperties struct {
	EndpointUrl   string `json:"endpointUrl"`
	WsdlUrl       string `json:"wsdlUrl"`
	SecurityToken string `json:"securityToken"`
	Description   string `json:"description,omitempty"`
}

type WebserviceResourcePayload

type WebserviceResourcePayload struct {
	Alias      string               `json:"alias"`
	Scope      Scope                `json:"scope"`
	Type       string               `json:"type"`
	Properties WebserviceProperties `json:"properties"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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