Documentation
¶
Index ¶
- func ConvertWorkloadCRToYAML(workload *openchoreov1alpha1.Workload) ([]byte, error)
- func ConvertWorkloadDescriptorToWorkloadCR(descriptorPath string, params CreateWorkloadParams) (*openchoreov1alpha1.Workload, error)
- func CreateBasicWorkload(params CreateWorkloadParams) (*openchoreov1alpha1.Workload, error)
- type ConversionParams
- type CreateWorkloadParams
- type WorkloadDescriptor
- type WorkloadDescriptorConfiguration
- type WorkloadDescriptorConnection
- type WorkloadDescriptorConnectionEnvBindings
- type WorkloadDescriptorDependencies
- type WorkloadDescriptorEndpoint
- type WorkloadDescriptorEnvVar
- type WorkloadDescriptorEnvVarSource
- type WorkloadDescriptorFileVar
- type WorkloadDescriptorMetadata
- type WorkloadDescriptorResourceDependency
- type WorkloadDescriptorSecretKeyRef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertWorkloadCRToYAML ¶
func ConvertWorkloadCRToYAML(workload *openchoreov1alpha1.Workload) ([]byte, error)
ConvertWorkloadCRToYAML converts a Workload CR to clean YAML bytes with proper field ordering
func ConvertWorkloadDescriptorToWorkloadCR ¶
func ConvertWorkloadDescriptorToWorkloadCR(descriptorPath string, params CreateWorkloadParams) (*openchoreov1alpha1.Workload, error)
ConvertWorkloadDescriptorToWorkloadCR converts a workload.yaml descriptor to a Workload CR
func CreateBasicWorkload ¶
func CreateBasicWorkload(params CreateWorkloadParams) (*openchoreov1alpha1.Workload, error)
CreateBasicWorkload creates a basic Workload CR without reading from a descriptor file
Types ¶
type ConversionParams ¶
type ConversionParams struct {
NamespaceName string
ProjectName string
ComponentName string
ImageURL string
}
ConversionParams holds the parameters needed for workload conversion
type CreateWorkloadParams ¶ added in v1.1.0
type CreateWorkloadParams struct {
FilePath string
NamespaceName string
ProjectName string
ComponentName string
ImageURL string
OutputPath string
DryRun bool
Mode string // "api-server" or "file-system"
RootDir string
}
CreateWorkloadParams holds the parameters needed to create or generate a Workload CR.
type WorkloadDescriptor ¶
type WorkloadDescriptor struct {
APIVersion string `yaml:"apiVersion"`
Metadata WorkloadDescriptorMetadata `yaml:"metadata"`
Endpoints []WorkloadDescriptorEndpoint `yaml:"endpoints,omitempty"`
Dependencies *WorkloadDescriptorDependencies `yaml:"dependencies,omitempty"`
Configurations WorkloadDescriptorConfiguration `yaml:"configurations,omitempty"`
}
WorkloadDescriptor represents the structure of a workload.yaml file This is the developer-maintained descriptor alongside source code
type WorkloadDescriptorConfiguration ¶
type WorkloadDescriptorConfiguration struct {
Env []WorkloadDescriptorEnvVar `yaml:"env,omitempty"`
Files []WorkloadDescriptorFileVar `yaml:"files,omitempty"`
}
WorkloadDescriptorConfiguration represents the configurations section in workload.yaml
type WorkloadDescriptorConnection ¶
type WorkloadDescriptorConnection struct {
// Project is the target component's project name (optional, defaults to same project).
Project string `yaml:"project,omitempty"`
// Component is the target component name.
Component string `yaml:"component"`
// Name is the target endpoint name.
Name string `yaml:"name"`
// Visibility is the visibility level for the connection.
Visibility string `yaml:"visibility"`
// EnvBindings maps connection address components to env var names.
EnvBindings WorkloadDescriptorConnectionEnvBindings `yaml:"envBindings"`
}
type WorkloadDescriptorConnectionEnvBindings ¶ added in v0.17.0
type WorkloadDescriptorDependencies ¶ added in v1.0.0
type WorkloadDescriptorDependencies struct {
// Endpoints define how this workload consumes endpoints from other components.
Endpoints []WorkloadDescriptorConnection `yaml:"endpoints,omitempty"`
// Resources define how this workload consumes outputs from project-bound Resources.
Resources []WorkloadDescriptorResourceDependency `yaml:"resources,omitempty"`
}
WorkloadDescriptorDependencies represents the dependencies section in workload.yaml
type WorkloadDescriptorEndpoint ¶
type WorkloadDescriptorEndpoint struct {
Name string `yaml:"name"`
DisplayName string `yaml:"displayName,omitempty"`
Port int32 `yaml:"port"`
TargetPort int32 `yaml:"targetPort,omitempty"`
Type string `yaml:"type"`
BasePath string `yaml:"basePath,omitempty"`
SchemaFile string `yaml:"schemaFile,omitempty"`
Context string `yaml:"context,omitempty"`
Visibility []string `yaml:"visibility,omitempty"`
}
type WorkloadDescriptorEnvVar ¶
type WorkloadDescriptorEnvVar struct {
Name string `yaml:"name"`
Value string `yaml:"value,omitempty"`
ValueFrom *WorkloadDescriptorEnvVarSource `yaml:"valueFrom,omitempty"`
}
WorkloadDescriptorEnvVar represents an environment variable in the descriptor
type WorkloadDescriptorEnvVarSource ¶
type WorkloadDescriptorEnvVarSource struct {
SecretKeyRef *WorkloadDescriptorSecretKeyRef `yaml:"secretKeyRef,omitempty"`
Path string `yaml:"path,omitempty"`
}
WorkloadDescriptorEnvVarSource represents the source for an environment variable value
type WorkloadDescriptorFileVar ¶
type WorkloadDescriptorFileVar struct {
Name string `yaml:"name"`
MountPath string `yaml:"mountPath"`
Value string `yaml:"value,omitempty"`
ValueFrom *WorkloadDescriptorEnvVarSource `yaml:"valueFrom,omitempty"`
}
WorkloadDescriptorFileVar represents a file configuration in the descriptor
type WorkloadDescriptorMetadata ¶
type WorkloadDescriptorMetadata struct {
Name string `yaml:"name"`
}
type WorkloadDescriptorResourceDependency ¶ added in v1.1.0
type WorkloadDescriptorResourceDependency struct {
// Ref is the name of the Resource to consume.
Ref string `yaml:"ref"`
// EnvBindings maps a ResourceType output name to a container environment variable name.
EnvBindings map[string]string `yaml:"envBindings,omitempty"`
// FileBindings maps a ResourceType output name to a container mount path. The referenced
// output's source kind must be secretKeyRef or configMapKeyRef.
FileBindings map[string]string `yaml:"fileBindings,omitempty"`
}
WorkloadDescriptorResourceDependency represents a dependency on a project-bound Resource. Output names declared on the referenced ResourceType are wired into the consuming container as env vars (envBindings) and file mounts (fileBindings).
type WorkloadDescriptorSecretKeyRef ¶
WorkloadDescriptorSecretKeyRef represents a reference to a secret key