Documentation ¶
Index ¶
- Variables
- func AddKubeConfigIf(i *apiv1.Intent, ws *apiv1.Workspace)
- func AppendToIntent(resourceType apiv1.Type, resourceID string, i *apiv1.Intent, resource any) error
- func CallGenerators(i *apiv1.Intent, newGenerators ...NewGeneratorFunc) error
- func CallPatchers(resources map[string][]*apiv1.Resource, newPatchers ...NewPatcherFunc) error
- func ForeachOrdered[T any](m map[string]T, f func(key string, value T) error) error
- func GenericPtr[T any](i T) *T
- func KubernetesResourceID(typeMeta metav1.TypeMeta, objectMeta metav1.ObjectMeta) string
- func KusionPathDependency(id, name string) string
- func MergeMaps(maps ...map[string]string) map[string]string
- func PatchResource[T any](resources map[string][]*apiv1.Resource, gvk string, patchFunc func(*T) error) error
- func ProviderExtensions(provider *inputs.Provider, providerMeta map[string]any, resourceType string) map[string]interface{}
- func TerraformResource(id string, dependsOn []string, attrs, exts map[string]interface{}) apiv1.Resource
- func TerraformResourceID(provider *inputs.Provider, resourceType string, resourceName string) string
- func UniqueAppLabels(projectName, appName string) map[string]string
- func UniqueAppName(projectName, stackName, appName string) string
- type Generator
- type GeneratorContext
- type NewGeneratorFunc
- type NewPatcherFunc
- type Patcher
Constants ¶
This section is empty.
Variables ¶
var ( GVKDeployment = appsv1.SchemeGroupVersion.WithKind("Deployment").String() GVKService = corev1.SchemeGroupVersion.WithKind("Service").String() )
GVKDeployment is the GroupVersionKind of Deployment
Functions ¶
func AddKubeConfigIf ¶ added in v0.10.0
AddKubeConfigIf adds kubeConfig from workspace to extensions of Kubernetes type resource in intent. If there is already has kubeConfig in extensions, use the kubeConfig in extensions.
func AppendToIntent ¶
func AppendToIntent(resourceType apiv1.Type, resourceID string, i *apiv1.Intent, resource any) error
AppendToIntent adds a Kubernetes resource to the Intent resources slice.
func CallGenerators ¶
func CallGenerators(i *apiv1.Intent, newGenerators ...NewGeneratorFunc) error
CallGenerators calls the Generate method of each Generator instance returned by the given NewGeneratorFuncs.
func CallPatchers ¶
func CallPatchers(resources map[string][]*apiv1.Resource, newPatchers ...NewPatcherFunc) error
CallPatchers calls the Patch method of each Generator instance returned by the given NewPatcherFuncs.
func ForeachOrdered ¶
ForeachOrdered executes the given function on each item in the map in order of their keys.
func GenericPtr ¶
func GenericPtr[T any](i T) *T
GenericPtr returns a pointer to the provided value.
func KubernetesResourceID ¶
func KubernetesResourceID(typeMeta metav1.TypeMeta, objectMeta metav1.ObjectMeta) string
KubernetesResourceID returns the unique ID of a Kubernetes resource based on its type and metadata.
func KusionPathDependency ¶
KusionPathDependency returns the implicit resource dependency path based on the resource id and name with the "$kusion_path" prefix.
func MergeMaps ¶
MergeMaps merges multiple map[string]string into one map[string]string. If a map is nil, it skips it and moves on to the next one. For each non-nil map, it iterates over its key-value pairs and adds them to the merged map. Finally, it returns the merged map.
func PatchResource ¶
func PatchResource[T any](resources map[string][]*apiv1.Resource, gvk string, patchFunc func(*T) error) error
PatchResource patches the resource with the given patch.
func ProviderExtensions ¶
func ProviderExtensions(provider *inputs.Provider, providerMeta map[string]any, resourceType string) map[string]interface{}
ProviderExtensions returns the extended information of provider based on the provider and type of the resource.
func TerraformResource ¶
func TerraformResource(id string, dependsOn []string, attrs, exts map[string]interface{}) apiv1.Resource
TerraformResource returns the Terraform resource in the form of Intent.Resource
func TerraformResourceID ¶
func TerraformResourceID(provider *inputs.Provider, resourceType string, resourceName string) string
TerraformResourceID returns the unique ID of a Terraform resource based on its provider, type and name.
func UniqueAppLabels ¶
UniqueAppLabels returns a map of labels that identify an app based on its project and name.
func UniqueAppName ¶
UniqueAppName returns a unique name for a workload based on its project and app name.
Types ¶
type Generator ¶
type Generator interface { // Generate performs the intent generate operation. Generate(intent *v1.Intent) error }
Generator is an interface for things that can generate Intent from input configurations.
func CallGeneratorFuncs ¶
func CallGeneratorFuncs(newGenerators ...NewGeneratorFunc) ([]Generator, error)
CallGeneratorFuncs calls each NewGeneratorFunc in the given slice and returns a slice of Generator instances.
type GeneratorContext ¶ added in v0.10.0
type GeneratorContext struct { // Project provides basic project information for a given generator. Project *v1.Project // Stack provides basic stack information for a given generator. Stack *v1.Stack // Application provides basic application information for a given generator. Application *inputs.AppConfiguration // Namespace specifies the target Kubernetes namespace. Namespace string // ModuleInputs is the collection of module inputs for the target project. ModuleInputs map[string]v1.GenericConfig // TerraformConfig is the collection of provider configs for the terraform runtime. TerraformConfig v1.TerraformConfig // SecretStoreSpec is the external secret store spec SecretStoreSpec *v1.SecretStoreSpec }
GeneratorContext defines the context object used for generator.
type NewGeneratorFunc ¶
NewGeneratorFunc is a function that returns a Generator.
type NewPatcherFunc ¶
NewPatcherFunc is a function that returns a Patcher.
Directories ¶
Path | Synopsis |
---|---|
Package generators contains all codes about the Intent generator mechanism.
|
Package generators contains all codes about the Intent generator mechanism. |
patchers
|
|