Documentation ¶
Overview ¶
Package chart contains types and methods to convert the App CRD to an internal representation of a helm chart and install it to a kubernetes cluster.
Index ¶
- Constants
- Variables
- type ApplicationChart
- type ChartConfig
- type Configurator
- func (c Configurator) ContainerPortsForProcess(process string) []apiv1.ContainerPort
- func (c Configurator) Lifecycle() *apiv1.Lifecycle
- func (c Configurator) Probes(port int32) (Probes, error)
- func (c Configurator) ProcessPortConfigs(process string) []ketchv1.KetchYamlProcessPortConfig
- func (c Configurator) ServicePortsForProcess(process string) []apiv1.ServicePort
- type HelmClient
- type HelmClientFactory
- type InstallOption
- type Job
- type JobChart
- type Option
- type Options
- type Probes
- type Procfile
- type TemplateValuer
Constants ¶
const ( DefaultApplicationPort = 8888 DefaultRoutableProcessName = "web" )
Variables ¶
var (
ErrEmptyProcfile = errors.New("procfile should contain at least one process name with a command")
)
var (
ErrPortsNotFound = errors.New("routable process should have at least one container port and one service port")
)
Functions ¶
This section is empty.
Types ¶
type ApplicationChart ¶
type ApplicationChart struct {
// contains filtered or unexported fields
}
ApplicationChart is an internal representation of a helm chart converted from the App CRD and is used to render a helm chart.
func New ¶
func New(application *ketchv1.App, framework *ketchv1.Framework, opts ...Option) (*ApplicationChart, error)
New returns an ApplicationChart instance.
func (ApplicationChart) ExportToDirectory ¶
func (chrt ApplicationChart) ExportToDirectory(directory string, chartConfig ChartConfig) error
ExportToDirectory saves the chart to the provided directory inside a folder with app_Name_TIMESTAMP
for example, for any app with name `hello`, it will save chart inside a folder with name `hello_11_Dec_20_12_30_IST`
func (ApplicationChart) GetName ¶
func (a ApplicationChart) GetName() string
GetName returns the app name, satisfying TemplateValuer
func (ApplicationChart) GetTemplates ¶
func (a ApplicationChart) GetTemplates() map[string]string
GetTemplates returns the app templates, satisfying TemplateValuer
func (ApplicationChart) GetValues ¶
func (a ApplicationChart) GetValues() interface{}
GetValues returns the app values, satisfying TemplateValuer
type ChartConfig ¶
type ChartConfig struct { Version string Description string AppName string AppVersion string DeploymentVersions []int }
ChartConfig contains data used to render the helm chart's "Chart.yaml" file.
func NewChartConfig ¶
func NewChartConfig(app ketchv1.App) ChartConfig
NewChartConfig returns a ChartConfig instance based on the given application.
func NewJobChartConfig ¶
func NewJobChartConfig(job ketchv1.Job) ChartConfig
NewJobChartConfig returns a ChartConfig instance based on the given job.
type Configurator ¶
type Configurator struct {
// contains filtered or unexported fields
}
Configurator provides a Pod related configuration based on KetchYamlData and Procfile.
func NewConfigurator ¶
func NewConfigurator(data *ketchv1.KetchYamlData, procfile Procfile, exposedPorts []ketchv1.ExposedPort, defaultPort int) Configurator
NewConfigurator returns a Configurator instance.
func (Configurator) ContainerPortsForProcess ¶
func (c Configurator) ContainerPortsForProcess(process string) []apiv1.ContainerPort
func (Configurator) Lifecycle ¶
func (c Configurator) Lifecycle() *apiv1.Lifecycle
func (Configurator) ProcessPortConfigs ¶
func (c Configurator) ProcessPortConfigs(process string) []ketchv1.KetchYamlProcessPortConfig
func (Configurator) ServicePortsForProcess ¶
func (c Configurator) ServicePortsForProcess(process string) []apiv1.ServicePort
type HelmClient ¶
type HelmClient struct {
// contains filtered or unexported fields
}
HelmClient performs helm install and uninstall operations for provided application helm charts.
func (HelmClient) DeleteChart ¶
func (c HelmClient) DeleteChart(appName string) error
DeleteChart uninstalls the app's helm release. It doesn't return an error if the release is not found.
func (HelmClient) UpdateChart ¶
func (c HelmClient) UpdateChart(tv TemplateValuer, config ChartConfig, opts ...InstallOption) (*release.Release, error)
UpdateChart checks if the app chart is already installed and performs "helm install" or "helm update" operation.
type HelmClientFactory ¶ added in v0.6.2
HelmClientFactory provides "NewHelmClient()" method to get a helm client. HelmClientFactory internally maintains a cache for action.Configurations per k8s namespace decreasing the cost of creating a new helm client.
func NewHelmClientFactory ¶ added in v0.6.2
func NewHelmClientFactory() *HelmClientFactory
func (*HelmClientFactory) NewHelmClient ¶ added in v0.6.2
func (f *HelmClientFactory) NewHelmClient(namespace string, c client.Client, log logr.Logger) (*HelmClient, error)
NewHelmClient returns a HelmClient instance.
type InstallOption ¶
InstallOption to perform additional configuration of action.Install before running a chart installation.
type JobChart ¶
type JobChart struct {
// contains filtered or unexported fields
}
JobChart is an internal representation of a helm chart converted from the Job CRD and is used to render a helm chart.
func NewJobChart ¶
NewJobChart returns a JobChart instance from a ketchv1.Job and []Option
func (*JobChart) GetTemplates ¶
GetTemplates returns the job templates, satisfying TemplateValuer
type Option ¶
type Option func(opts *Options)
func WithExposedPorts ¶
func WithExposedPorts(ports map[ketchv1.DeploymentVersion][]ketchv1.ExposedPort) Option
func WithTemplates ¶
type Options ¶
type Options struct { // ExposedPorts are ports exposed by an image of each deployment. ExposedPorts map[ketchv1.DeploymentVersion][]ketchv1.ExposedPort Templates templates.Templates }
type Procfile ¶
Procfile represents a parsed Procfile.
func CreateProcfile ¶
CreateProcfile creates a Procfile instance from pack build metadata found under the `io.buildpacks.build.metadata` label. This function should only be called for images build using pack
func ProcfileFromProcesses ¶
func ProcfileFromProcesses(processes []ketchv1.ProcessSpec) (*Procfile, error)
ProcfileFromProcesses construct a Procfile instance from a list of ProcessSpec and returns it.
func (*Procfile) IsRoutable ¶
func (*Procfile) SortedNames ¶
type TemplateValuer ¶
type TemplateValuer interface { GetValues() interface{} GetTemplates() map[string]string GetName() string }
TemplateValuer is an interface that permits types that implement it (e.g. Application, Job) to be parameters in the UpdateChart function.