Documentation
¶
Index ¶
- Constants
- Variables
- func AddHelmChart(builder *Builder, chartIdentifier string, releaseName string, values string)
- func AddHelmChartNoValues(builder *Builder, chartIdentifier string, releaseName string)
- func AddHelmChartObject(builder *Builder, chartIdentifier string, releaseName string, ...)
- func CheckPathInsideMainScriptDirectory(jsRuntime *js.JsRuntime, filePath string)
- func CurrentScriptDirectory(jsRuntime *js.JsRuntime) string
- func CurrentScriptPath(jsRuntime *js.JsRuntime) string
- func GetAsPointer[T any](o any) *T
- func GetImageTag(image string) string
- func LoadChart(data []byte) *chart.Chart
- func LoadChartFromPath(path string) *chart.Chart
- func MainScriptDirectory(jsRuntime *js.JsRuntime) string
- func MainScriptPath(jsRuntime *js.JsRuntime) string
- func Parse(jsRuntime *js.JsRuntime, yamlText string) (*sobek.Object, error)
- func ParseYaml[T any](data string) (T, error)
- func Pointer[T any](input T) *T
- func ReadAllBytes(jsRuntime *js.JsRuntime, filePath string) []byte
- func ReadAllText(jsRuntime *js.JsRuntime, filePath string) string
- func RegisterCore(jsRuntime *js.JsRuntime)
- func RemoveTestHooks(helmRelease *release.Release)
- func SerializeSobekObjectToYaml(jsRuntime *js.JsRuntime, object *sobek.Object) (string, error)
- func SobekObjectGetString(object *sobek.Object, key string) *string
- func SobekObjectGetStringChain(object *sobek.Object, keys ...string) *string
- func SortedKeys[TKey cmp.Ordered, TValue any](m map[TKey]TValue) []TKey
- func WriteAllBytes(jsRuntime *js.JsRuntime, filePath string, data []byte)
- func WriteAllText(jsRuntime *js.JsRuntime, filePath string, content string)
- type Action
- type AdditionalFile
- type BuildContext
- func (context *BuildContext) AddAdditionalFile(additionalFile *AdditionalFile)
- func (context *BuildContext) AddAdditionalFileWithGroupPath(documentGroupPath string, additionalFile *AdditionalFile)
- func (context *BuildContext) AddDocument(document *Document)
- func (context *BuildContext) AddDocumentGroup(group *DocumentGroup)
- func (context *BuildContext) AddDocumentWithOptions(jsRuntime *js.JsRuntime, options *NewDocumentOptions) error
- func (context *BuildContext) GetAllComponents() []*Component
- func (context *BuildContext) GetAllDocuments() []*Document
- func (context *BuildContext) GetAllDocumentsSorted() []*Document
- func (context *BuildContext) GetComponentWithIdentifier(identifier string) *Component
- func (context *BuildContext) GetCurrentComponent() *Component
- func (context *BuildContext) GetDocument(predicate func(*Document) bool) *Document
- func (context *BuildContext) GetDocumentGroupWithPath(path string) *DocumentGroup
- func (context *BuildContext) GetDocumentGroups() []*DocumentGroup
- func (context *BuildContext) GetDocumentGroupsForComponent(component *Component) []*DocumentGroup
- func (context *BuildContext) GetDocumentWithPath(path string) *Document
- func (context *BuildContext) IsDevelopment() bool
- func (context *BuildContext) IsProduction() bool
- func (context *BuildContext) RemoveDocumentGroup(group *DocumentGroup)
- type Builder
- func (builder *Builder) AddAdditionalFile(additionalFile *AdditionalFile)
- func (builder *Builder) AddAdditionalFileWithGroupPath(documentGroupPath string, additionalFile *AdditionalFile)
- func (builder *Builder) AddComponent(component *Component)
- func (builder *Builder) AddDocument(document *Document)
- func (builder *Builder) AddDocumentGroup(documentGroup *DocumentGroup)
- func (builder *Builder) AddDocumentString(jsRuntime *js.JsRuntime, yaml string)
- func (builder *Builder) AddDocumentWithOptions(jsRuntime *js.JsRuntime, options *NewDocumentOptions)
- func (builder *Builder) AddProvisionCheckpoint(name string) *Component
- func (builder *Builder) Build()
- func (builder *Builder) OnGenerateResources(callback func(context *BuildContext)) *Component
- func (builder *Builder) OnGenerateResourcesBasedOnOtherResources(callback func(context *BuildContext)) *Component
- func (builder *Builder) OnModify(callback func(context *BuildContext)) *Component
- func (builder *Builder) OnPopulateKubernetesResources(callback func(context *BuildContext)) *Component
- func (builder *Builder) OnSanitize(callback func(context *BuildContext)) *Component
- func (builder *Builder) OnSpecifyProvisionerDependencies(callback func(context *BuildContext)) *Component
- func (builder *Builder) OnStep(step *Step, callback func(context *BuildContext)) *Component
- func (builder *Builder) RemoveComponent(component *Component)
- type BuilderOptions
- type Component
- func (component *Component) AddAction(step *Step, callback func(context *BuildContext))
- func (component *Component) GetComponentType() *string
- func (component *Component) GetCustomData(key string) any
- func (component *Component) GetIdentifier() *string
- func (component *Component) GetMetadata(key string) *string
- func (component *Component) ProvisionAfter(provisioner *Provisioner)
- func (component *Component) ProvisionAfterComponent(other *Component)
- func (component *Component) ProvisionBefore(provisioner *Provisioner)
- func (component *Component) ProvisionBeforeComponent(other *Component)
- func (component *Component) SetComponentType(componentType string)
- func (component *Component) SetCustomData(key string, value any)
- func (component *Component) SetIdentifier(identifier string)
- func (component *Component) SetMetadata(key, value string)
- type Dependencies
- type DependencyGraph
- type Document
- func HelmManifestToDocuments(jsRuntime *js.JsRuntime, manifests string, releaseName string, ...) []*Document
- func NewDocument(jsRuntime *js.JsRuntime) *Document
- func NewDocumentWithContent(content *sobek.Object) *Document
- func NewDocumentWithOptions(jsRuntime *js.JsRuntime, options *NewDocumentOptions) (*Document, error)
- func NewDocumentWithYaml(jsRuntime *js.JsRuntime, yaml string) (*Document, error)
- func ParseDocument(jsRuntime *js.JsRuntime, yaml string) (*Document, error)
- func (document *Document) FullPath() string
- func (document *Document) GetPath() string
- func (document *Document) ProvisionAfter(other *Document)
- func (document *Document) ProvisionBefore(other *Document)
- func (document *Document) SetPath(path *string)
- func (document *Document) ToJSON(jsRuntime *js.JsRuntime, dummy string) sobek.Value
- type DocumentGroup
- func (group *DocumentGroup) AddAdditionalFile(additionalFile *AdditionalFile)
- func (group *DocumentGroup) AddDocument(document *Document)
- func (group *DocumentGroup) AddDocuments(documents []*Document)
- func (group *DocumentGroup) GetComponent() *Component
- func (group *DocumentGroup) GetDocument(path string) *Document
- func (group *DocumentGroup) GetDocumentFunc(predicate func(*Document) bool) *Document
- func (group *DocumentGroup) MoveTo(other *DocumentGroup)
- func (documentGroup *DocumentGroup) ProvisionAfter(other *DocumentGroup)
- func (documentGroup *DocumentGroup) ProvisionBefore(other *DocumentGroup)
- func (group *DocumentGroup) RemoveAdditionalFile(additionalFile *AdditionalFile)
- func (group *DocumentGroup) RemoveDocument(document *Document)
- func (group *DocumentGroup) SortedDocuments() []*Document
- type Environment
- type EnvironmentType
- type HelmOptions
- type KubernetesCluster
- type KubernetesDistribution
- type KubernetesResource
- type KubernetesResourceInfo
- func (info *KubernetesResourceInfo) AddKubernetesResource(resource *KubernetesResource)
- func (info *KubernetesResourceInfo) AddResource(apiVersion string, kind string, isNamespaced bool)
- func (info *KubernetesResourceInfo) AllResources() []*KubernetesResource
- func (info *KubernetesResourceInfo) Contains(apiVersion string, kind string) bool
- func (info *KubernetesResourceInfo) ContainsKind(kind string) bool
- func (info *KubernetesResourceInfo) IsNamespaced(apiVersion string, kind string) bool
- type NewDocumentOptions
- type OutputConfiguration
- type Provisioner
- type ProvisionerType
- type Step
Constants ¶
const ( JsRuntimeMetadataBuilderApply = "builder/apply" JsRuntimeMetadataBuilderSkipConfirmation = "builder/skipConfirmation" )
const ( MetadataIdentifier = "identifier" MetadataComponentType = "component-type" )
const (
DocumentsDir = "manifests"
)
Variables ¶
var ( // Use this step to populate [KubernetesResource] resources so that other components can rely on this // information to modify existing resources or generate extra resources. // E.g. when ServiceMonitor is added on this step, other components can generate ServiceMonitor resources // to monitor the services. StepPopulateKubernetesResources = NewStep("Populate Kubernetes resources", 1) // Sanitize the options and the component properties in this step. StepSanitize = NewStep("Sanitize", 2) // Use this step to generate the documents and additional files. StepGenerateResources = NewStep("Generate resources", 5) // Use this step to generate the documents and additional files based on other documents and additional files. StepGenerateResourcesBasedOnOtherResources = NewStep("Generate based on other resources", 5, 1) // Use this step to modify the generated documents, e.g. set labels, annotations, etc. This is useful when // other services add documents to the document group on the [StepGenerateResources] step and you want to modify them. StepModify = NewStep("Modify", 6) // Specify provisioner dependencies in this step. StepSpecifyProvisionerDependencies = NewStep("Specify provisioner dependencies", 7) // Write the outputs, e.g. documents and additional files in this step. StepOutput = NewStep("Output", 99) // Apply the resources to the Kubernetes cluster in this step. StepApply = NewStep("Apply", 100) )
var (
DefaultKubernetesVersion = semver.MustParse("1.33")
)
Functions ¶
func AddHelmChart ¶
func AddHelmChartNoValues ¶
func AddHelmChartObject ¶ added in v0.2.0
func CurrentScriptDirectory ¶
func CurrentScriptPath ¶
func GetAsPointer ¶
func GetImageTag ¶
GetImageTag returns the tag of the image. If the image does not have a tag, empty string is returned.
func LoadChartFromPath ¶
Loads the chart from the given path. The path can be a local file or directory.
func MainScriptDirectory ¶
func MainScriptPath ¶
func ParseYaml ¶
Deserializes given string into an object of given type. Dedents the data using [Dedent] so that the multiline strings with indentation are handled properly. Trims the newlines before deserialization.
func RegisterCore ¶
func RemoveTestHooks ¶
func SerializeSobekObjectToYaml ¶ added in v0.2.0
func SobekObjectGetString ¶ added in v0.2.0
func SobekObjectGetStringChain ¶ added in v0.2.0
func SortedKeys ¶
Types ¶
type Action ¶
type Action struct {
Step *Step
Callback func(context *BuildContext)
}
Action is added to a Component to be run during the build process.
type AdditionalFile ¶
func NewAdditionalFile ¶
func NewAdditionalFile(path, content string) *AdditionalFile
Creates a new AdditionalFile with given path and content.
type BuildContext ¶
type BuildContext struct {
BuilderOptions *BuilderOptions
KubernetesResourceInfo *KubernetesResourceInfo
CustomData *sobek.Object
JsRuntime *js.JsRuntime
// contains filtered or unexported fields
}
BuildContext provides all the necessary objects and options to generate documents when Builder.Build is called.
func NewBuildContext ¶ added in v0.2.0
func NewBuildContext(builder *Builder, options *BuilderOptions) *BuildContext
func (*BuildContext) AddAdditionalFile ¶
func (context *BuildContext) AddAdditionalFile(additionalFile *AdditionalFile)
Adds given additional file to the document group named "". Creates the document group if it doesn't exist.
func (*BuildContext) AddAdditionalFileWithGroupPath ¶
func (context *BuildContext) AddAdditionalFileWithGroupPath(documentGroupPath string, additionalFile *AdditionalFile)
Adds given additional file to the document group with the given name. Creates the document group if it doesn't exist.
func (*BuildContext) AddDocument ¶
func (context *BuildContext) AddDocument(document *Document)
Adds given document to the document group named "". Creates the document group if it doesn't exist.
func (*BuildContext) AddDocumentGroup ¶
func (context *BuildContext) AddDocumentGroup(group *DocumentGroup)
Adds given group to the document groups list.
func (*BuildContext) AddDocumentWithOptions ¶
func (context *BuildContext) AddDocumentWithOptions(jsRuntime *js.JsRuntime, options *NewDocumentOptions) error
Adds given document to the document group with the given path and content. Creates the document group if it doesn't exist.
func (*BuildContext) GetAllComponents ¶
func (context *BuildContext) GetAllComponents() []*Component
func (*BuildContext) GetAllDocuments ¶
func (context *BuildContext) GetAllDocuments() []*Document
Returns all documents inside all document groups as a slice.
func (*BuildContext) GetAllDocumentsSorted ¶
func (context *BuildContext) GetAllDocumentsSorted() []*Document
Returns all documents inside all document groups sorted by their file path as a slice.
func (*BuildContext) GetComponentWithIdentifier ¶
func (context *BuildContext) GetComponentWithIdentifier(identifier string) *Component
func (*BuildContext) GetCurrentComponent ¶
func (context *BuildContext) GetCurrentComponent() *Component
func (*BuildContext) GetDocument ¶
func (context *BuildContext) GetDocument(predicate func(*Document) bool) *Document
Returns the first document that satisfies the given predicate. Returns nil if no document is found.
func (*BuildContext) GetDocumentGroupWithPath ¶
func (context *BuildContext) GetDocumentGroupWithPath(path string) *DocumentGroup
func (*BuildContext) GetDocumentGroups ¶
func (context *BuildContext) GetDocumentGroups() []*DocumentGroup
func (*BuildContext) GetDocumentGroupsForComponent ¶
func (context *BuildContext) GetDocumentGroupsForComponent(component *Component) []*DocumentGroup
func (*BuildContext) GetDocumentWithPath ¶
func (context *BuildContext) GetDocumentWithPath(path string) *Document
Returns the first document that has the given path. Returns nil if no document is found.
func (*BuildContext) IsDevelopment ¶
func (context *BuildContext) IsDevelopment() bool
func (*BuildContext) IsProduction ¶
func (context *BuildContext) IsProduction() bool
func (*BuildContext) RemoveDocumentGroup ¶
func (context *BuildContext) RemoveDocumentGroup(group *DocumentGroup)
Removes given group from the document groups list.
type Builder ¶
type Builder struct {
Components []*Component
Options *BuilderOptions
// contains filtered or unexported fields
}
Builder is a collection of components.
func NewBuilder ¶
Creates a new Builder instance with default options.
func NewBuilderVersionDistributionEnvironmentType ¶ added in v0.2.0
func NewBuilderVersionDistributionEnvironmentType(version *semver.Version, distribution KubernetesDistribution, environment EnvironmentType, jsRuntime *js.JsRuntime) *Builder
func NewBuilderWithOptions ¶
func NewBuilderWithOptions(options *BuilderOptions, jsRuntime *js.JsRuntime) *Builder
Creates a new Builder instance with given options.
func (*Builder) AddAdditionalFile ¶
func (builder *Builder) AddAdditionalFile(additionalFile *AdditionalFile)
func (*Builder) AddAdditionalFileWithGroupPath ¶
func (builder *Builder) AddAdditionalFileWithGroupPath(documentGroupPath string, additionalFile *AdditionalFile)
func (*Builder) AddComponent ¶
Appends given component to the list of components.
func (*Builder) AddDocument ¶
func (*Builder) AddDocumentGroup ¶ added in v0.2.1
func (builder *Builder) AddDocumentGroup(documentGroup *DocumentGroup)
func (*Builder) AddDocumentString ¶ added in v0.2.0
func (*Builder) AddDocumentWithOptions ¶
func (builder *Builder) AddDocumentWithOptions(jsRuntime *js.JsRuntime, options *NewDocumentOptions)
func (*Builder) AddProvisionCheckpoint ¶
Adds a component that creates a document group with the given name during StepGenerateResources. Document group doesn't contain any documents, it serves as a placeholder for provision dependencies.
func (*Builder) Build ¶
func (builder *Builder) Build()
Build method is at the heart of the all process. It collects all actions from all components and sorts them by their steps. Then it applies each action sequentially.
func (*Builder) OnGenerateResources ¶
func (builder *Builder) OnGenerateResources(callback func(context *BuildContext)) *Component
Creates a new component with the given action that will be run during StepGenerateResources and adds it to the list of components.
func (*Builder) OnGenerateResourcesBasedOnOtherResources ¶
func (builder *Builder) OnGenerateResourcesBasedOnOtherResources(callback func(context *BuildContext)) *Component
Creates a new component with the given action that will be run during StepGenerateResourcesBasedOnOtherResources and adds it to the list of components.
func (*Builder) OnModify ¶
func (builder *Builder) OnModify(callback func(context *BuildContext)) *Component
Creates a new component with the given action that will be run during StepModify and adds it to the list of components.
func (*Builder) OnPopulateKubernetesResources ¶
func (builder *Builder) OnPopulateKubernetesResources(callback func(context *BuildContext)) *Component
Creates a new component with the given action that will be run during StepPopulateKubernetesResources and adds it to the list of components.
func (*Builder) OnSanitize ¶
func (builder *Builder) OnSanitize(callback func(context *BuildContext)) *Component
Creates a new component with the given action that will be run during StepSanitize and adds it to the list of components.
func (*Builder) OnSpecifyProvisionerDependencies ¶
func (builder *Builder) OnSpecifyProvisionerDependencies(callback func(context *BuildContext)) *Component
Creates a new component with the given action that will be run during StepSpecifyProvisionerDependencies and adds it to the list of components.
func (*Builder) OnStep ¶
func (builder *Builder) OnStep(step *Step, callback func(context *BuildContext)) *Component
Creates a new component with the given action and adds it to the list of components.
func (*Builder) RemoveComponent ¶
Removes given component from the list of components.
type BuilderOptions ¶
type BuilderOptions struct {
KubernetesCluster *KubernetesCluster
Environment *Environment
OutputConfiguration *OutputConfiguration
}
BuilderOptions contains common options and global services that are used by all components.
func NewBuilderOptions ¶
func NewBuilderOptions(kubernetesCluster *KubernetesCluster, environment *Environment) *BuilderOptions
func NewBuilderOptionsWithOutputConfiguration ¶
func NewBuilderOptionsWithOutputConfiguration(kubernetesCluster *KubernetesCluster, environment *Environment, outputConfiguration *OutputConfiguration) *BuilderOptions
type Component ¶
type Component struct {
// Actions are ordered by their steps and executed in sequence.
Actions []*Action
// contains filtered or unexported fields
}
Component is collection of actions that are executed in sequence.
func NewComponent ¶
func NewComponent() *Component
func (*Component) AddAction ¶
func (component *Component) AddAction(step *Step, callback func(context *BuildContext))
Adds given action to the list of actions.
func (*Component) GetComponentType ¶
func (*Component) GetCustomData ¶
func (*Component) GetIdentifier ¶
func (*Component) GetMetadata ¶
func (*Component) ProvisionAfter ¶
func (component *Component) ProvisionAfter(provisioner *Provisioner)
func (*Component) ProvisionAfterComponent ¶
func (*Component) ProvisionBefore ¶
func (component *Component) ProvisionBefore(provisioner *Provisioner)
func (*Component) ProvisionBeforeComponent ¶
func (*Component) SetComponentType ¶
func (*Component) SetCustomData ¶
func (*Component) SetIdentifier ¶
func (*Component) SetMetadata ¶
type Dependencies ¶
type Dependencies[T comparable] struct { Prerequisites []T Dependents []T }
Dependencies specifies prerequisites and dependents of the given type. This information is used to create dependency graphs in order to sort dependent objects.
func NewDependencies ¶
func NewDependencies[T comparable]() *Dependencies[T]
func (*Dependencies[T]) Merge ¶
func (d *Dependencies[T]) Merge(other *Dependencies[T])
Appends dependency specifications of the given object into this object.
func (*Dependencies[T]) RunAfter ¶
func (d *Dependencies[T]) RunAfter(element T)
Makes the given element a prerequisite of this instance.
func (*Dependencies[T]) RunBefore ¶
func (d *Dependencies[T]) RunBefore(element T)
Makes this instance a prerequisite of the given element.
type DependencyGraph ¶
type DependencyGraph[T comparable] struct { Elements []T IdentifierGetter func(element T) string DependenciesGetter func(T) *Dependencies[T] }
func (*DependencyGraph[T]) GetSortedElements ¶
func (d *DependencyGraph[T]) GetSortedElements() []T
type Document ¶
type Document struct {
*sobek.Object
Group *DocumentGroup
Dependencies *Dependencies[*Document]
// contains filtered or unexported fields
}
func HelmManifestToDocuments ¶
func NewDocument ¶
func NewDocumentWithContent ¶ added in v0.2.0
func NewDocumentWithOptions ¶
func NewDocumentWithOptions(jsRuntime *js.JsRuntime, options *NewDocumentOptions) (*Document, error)
func NewDocumentWithYaml ¶
func ParseDocument ¶
Parses given text as a Document.
func (*Document) FullPath ¶
Returns the path to write the document. Adds group path as base directory if it is not nil.
func (*Document) GetPath ¶ added in v0.2.0
Returns the file path of the document. May contain multiple segments separated by slashes.
func (*Document) ProvisionAfter ¶
func (*Document) ProvisionBefore ¶
type DocumentGroup ¶
type DocumentGroup struct {
Path string
Documents []*Document
AdditionalFiles []*AdditionalFile
ApplyProvisioner *Provisioner
WaitProvisioner *Provisioner
// contains filtered or unexported fields
}
DocumentGroup is a named container for multiple Document instances.
func GenerateFromChart ¶
func GenerateFromChart(chart *chart.Chart, context *BuildContext, options *HelmOptions) *DocumentGroup
Runs helm template with values from the options and parses the generated documents.
func NewDocumentGroup ¶
func NewDocumentGroup(path string) *DocumentGroup
Creates a new DocumentGroup with given path.
func (*DocumentGroup) AddAdditionalFile ¶
func (group *DocumentGroup) AddAdditionalFile(additionalFile *AdditionalFile)
Adds the given additional file to this group.
func (*DocumentGroup) AddDocument ¶
func (group *DocumentGroup) AddDocument(document *Document)
Adds the given document to this group and sets its Group field to this group.
func (*DocumentGroup) AddDocuments ¶ added in v0.2.0
func (group *DocumentGroup) AddDocuments(documents []*Document)
Adds the given documents to this group and sets their Group field to this group.
func (*DocumentGroup) GetComponent ¶
func (group *DocumentGroup) GetComponent() *Component
Returns the component that created this document group. Component is set when the document group is added to the builder context.
func (*DocumentGroup) GetDocument ¶
func (group *DocumentGroup) GetDocument(path string) *Document
Returns the first document that has the given path. Returns nil if no document is found.
func (*DocumentGroup) GetDocumentFunc ¶
func (group *DocumentGroup) GetDocumentFunc(predicate func(*Document) bool) *Document
Returns the first document that satisfies the given predicate. Returns nil if no document is found.
func (*DocumentGroup) MoveTo ¶
func (group *DocumentGroup) MoveTo(other *DocumentGroup)
Removes all documents and additional files from this group and adds them to the given group.
func (*DocumentGroup) ProvisionAfter ¶
func (documentGroup *DocumentGroup) ProvisionAfter(other *DocumentGroup)
func (*DocumentGroup) ProvisionBefore ¶
func (documentGroup *DocumentGroup) ProvisionBefore(other *DocumentGroup)
func (*DocumentGroup) RemoveAdditionalFile ¶
func (group *DocumentGroup) RemoveAdditionalFile(additionalFile *AdditionalFile)
Removes the given additional file from this group.
func (*DocumentGroup) RemoveDocument ¶
func (group *DocumentGroup) RemoveDocument(document *Document)
Removes the given document from this group and sets its Group field to nil.
func (*DocumentGroup) SortedDocuments ¶
func (group *DocumentGroup) SortedDocuments() []*Document
Returns the documents in this group sorted by their file path.
type Environment ¶
type Environment struct {
Name string
Type EnvironmentType
}
Environment contains information about the target environment.
func NewEnvironment ¶
func NewEnvironment(name string, environmentType EnvironmentType) *Environment
type EnvironmentType ¶
type EnvironmentType string
EnvironmentType represents the type of the target environment such as Development or Production.
const ( EnvironmentTypeUnknown EnvironmentType = "unknown" EnvironmentTypeDevelopment EnvironmentType = "dev" EnvironmentTypeTesting EnvironmentType = "test" EnvironmentTypeProduction EnvironmentType = "prod" )
type HelmOptions ¶
Options to create documents using Helm.
func NewHelmOptions ¶
func NewHelmOptions(releaseName string, namespace string) *HelmOptions
func NewHelmOptionsWithValues ¶
func NewHelmOptionsWithValues(releaseName string, namespace string, values string) *HelmOptions
type KubernetesCluster ¶
type KubernetesCluster struct {
Version *semver.Version
Distribution KubernetesDistribution
AdditionalResources []*KubernetesResource
}
KubernetesCluster contains information about the target Kubernetes cluster.
func NewKubernetesCluster ¶
func NewKubernetesCluster(version *semver.Version, distribution KubernetesDistribution) *KubernetesCluster
func NewKubernetesClusterWithAdditionalResources ¶
func NewKubernetesClusterWithAdditionalResources( version *semver.Version, distribution KubernetesDistribution, additionalResources []*KubernetesResource, ) *KubernetesCluster
type KubernetesDistribution ¶
type KubernetesDistribution string
KubernetesDistribution represents the distribution of the target Kubernetes cluster such as MicroK8s or OpenShift.
const ( KubernetesDistributionUnknown KubernetesDistribution = "unknown" KubernetesDistributionAKS KubernetesDistribution = "aks" KubernetesDistributionEKS KubernetesDistribution = "eks" KubernetesDistributionGKE KubernetesDistribution = "gke" KubernetesDistributionK3S KubernetesDistribution = "k3s" KubernetesDistributionKubeadm KubernetesDistribution = "kubeadm" KubernetesDistributionMicroK8s KubernetesDistribution = "microk8s" KubernetesDistributionMinikube KubernetesDistribution = "minikube" KubernetesDistributionOpenShift KubernetesDistribution = "openshift" )
type KubernetesResource ¶
KubernetesResource defines a Kubernetes API resource. This includes both built-in Kubernetes objects and external CRDs.
func NewKubernetesResource ¶
func NewKubernetesResource(apiVersion string, kind string, isNamespaced bool) *KubernetesResource
type KubernetesResourceInfo ¶
type KubernetesResourceInfo struct {
// contains filtered or unexported fields
}
KubernetesResourceInfo contains all the API resources defined in the target cluster and enables listing them and querying their existence.
func NewKubernetesResourceInfo ¶
func NewKubernetesResourceInfo(version *semver.Version) *KubernetesResourceInfo
Creates a new KubernetesResourceInfo instance.
func (*KubernetesResourceInfo) AddKubernetesResource ¶
func (info *KubernetesResourceInfo) AddKubernetesResource(resource *KubernetesResource)
Adds the given API resource to the available resources list.
func (*KubernetesResourceInfo) AddResource ¶
func (info *KubernetesResourceInfo) AddResource(apiVersion string, kind string, isNamespaced bool)
Adds the given API resource to the available resources list.
func (*KubernetesResourceInfo) AllResources ¶
func (info *KubernetesResourceInfo) AllResources() []*KubernetesResource
func (*KubernetesResourceInfo) Contains ¶
func (info *KubernetesResourceInfo) Contains(apiVersion string, kind string) bool
Returns true if the given API resource exists in the target cluster.
func (*KubernetesResourceInfo) ContainsKind ¶
func (info *KubernetesResourceInfo) ContainsKind(kind string) bool
Returns true if the given kind exists in the target cluster. This ignores the apiVersion field.
func (*KubernetesResourceInfo) IsNamespaced ¶
func (info *KubernetesResourceInfo) IsNamespaced(apiVersion string, kind string) bool
Returns true if the given API resource is namespaced. E.g. returns true for v1/Pod, false for rbac.authorization.k8s.io/v1/ClusterRole.
type NewDocumentOptions ¶ added in v0.2.0
type NewDocumentOptions struct {
Yaml *string
Object *sobek.Object
Path *string
DocumentGroup *string
}
func NewNewDocumentOptions ¶ added in v0.2.0
func NewNewDocumentOptions() *NewDocumentOptions
type OutputConfiguration ¶
type OutputConfiguration struct {
OutputPath string
}
OutputConfiguration specifies the output paths.
func NewOutputConfiguration ¶
func NewOutputConfiguration() *OutputConfiguration
type Provisioner ¶
type Provisioner struct {
Type ProvisionerType
DocumentGroup *DocumentGroup
Dependencies *Dependencies[*Provisioner]
}
func ApplyDocuments ¶
func ApplyDocuments(documentGroup *DocumentGroup) *Provisioner
func WaitDocuments ¶
func WaitDocuments(documentGroup *DocumentGroup) *Provisioner
func (*Provisioner) RunAfter ¶
func (provisioner *Provisioner) RunAfter(p *Provisioner)
Makes the given provisioner a prerequisite of this provisioner.
func (*Provisioner) RunBefore ¶
func (provisioner *Provisioner) RunBefore(p *Provisioner)
Makes this provisioner a prerequisite of the given provisioner.
type ProvisionerType ¶
type ProvisionerType string
const ( ProvisionerTypeApply ProvisionerType = "apply" ProvisionerTypeWait ProvisionerType = "wait" )