projectconfig

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package projectconfig handles declarative cloud project configuration manifests (volcano-config.yaml) that describe storage buckets, storage policies, and function visibility for a project.

Index

Constants

View Source
const (
	// ManifestVersion is the only currently supported manifest schema version.
	ManifestVersion = 1
)

Variables

This section is empty.

Functions

func ResolveManifestPath

func ResolveManifestPath(fileArg string) (string, error)

ResolveManifestPath returns the manifest path that `config deploy` should load. An explicit path is used as-is (after existence check); otherwise the CLI looks for volcano/volcano-config.yaml then volcano-config.yaml in the working directory.

Types

type BucketManifest

type BucketManifest struct {
	Name             string           `yaml:"name"`
	FileSizeLimit    *int64           `yaml:"file_size_limit,omitempty"`
	AllowedMimeTypes *[]string        `yaml:"allowed_mime_types,omitempty"`
	Policies         []PolicyManifest `yaml:"policies,omitempty"`
}

BucketManifest declares one storage bucket and its desired policies.

type FunctionManifest

type FunctionManifest struct {
	Name       string              `yaml:"name"`
	Public     *bool               `yaml:"public,omitempty"`
	Schedulers []SchedulerManifest `yaml:"schedulers,omitempty"`
}

FunctionManifest declares the desired visibility for one deployed function.

type FunctionReconciler

type FunctionReconciler interface {
	ListPage(ctx context.Context, page, limit int) (*apiclient.PaginatedFunctions, error)
	UpdateVisibility(ctx context.Context, identifier string, isPublic bool) (*apiclient.Function, error)
}

FunctionReconciler is the subset of internal/function.Service used to update function visibility from a manifest.

type Manifest

type Manifest struct {
	Version   int                `yaml:"version"`
	Buckets   []BucketManifest   `yaml:"buckets,omitempty"`
	Functions []FunctionManifest `yaml:"functions,omitempty"`
}

Manifest is the on-disk shape of volcano-config.yaml.

func Load

func Load(filePath string) (*Manifest, string, error)

Load reads, parses, and validates a manifest from disk. The returned path is the absolute path that was actually opened.

func (*Manifest) Validate

func (m *Manifest) Validate() error

Validate checks the manifest for structural and semantic errors, normalizing field values (trimming, uppercasing operations, dropping empty MIME entries) in place so callers receive a ready-to-deploy view.

type PolicyManifest

type PolicyManifest struct {
	Name       string `yaml:"name"`
	Operation  string `yaml:"operation"`
	Definition string `yaml:"definition"`
}

PolicyManifest declares one storage policy attached to a bucket.

type SchedulerManifest added in v0.0.4

type SchedulerManifest struct {
	Name    string         `yaml:"name"`
	Cron    string         `yaml:"cron"`
	Enabled *bool          `yaml:"enabled,omitempty"`
	Payload map[string]any `yaml:"payload,omitempty"`
	Regions []string       `yaml:"regions,omitempty"`
}

SchedulerManifest declares one scheduler attached to a function.

type SchedulerReconciler added in v0.0.4

type SchedulerReconciler interface {
	ListSchedulers(ctx context.Context, identifier string) (*apiclient.Function, *apiclient.FunctionSchedulerListResponse, error)
	CreateSchedulerByID(ctx context.Context, functionID uuid.UUID, input api.FunctionSchedulerInput) (*apiclient.FunctionScheduler, error)
	UpdateSchedulerByID(ctx context.Context, functionID, schedulerID uuid.UUID, input api.FunctionSchedulerInput) (*apiclient.FunctionScheduler, error)
}

SchedulerReconciler is the subset of internal/function.Service used to reconcile schedulers from a manifest.

type Service

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

Service deploys declarative project configuration to the Volcano API.

func NewService

func NewService(deps cliruntime.Deps) Service

NewService wires the projectconfig Service against the storage and function services.

func NewServiceWithReconcilers

func NewServiceWithReconcilers(storage StorageReconciler, functions FunctionReconciler, schedulers SchedulerReconciler) Service

NewServiceWithReconcilers returns a Service that uses the supplied reconcilers. Intended for tests.

func (Service) Deploy

func (s Service) Deploy(ctx context.Context, manifest *Manifest) (*Summary, error)

Deploy reconciles the project state to match the manifest. Buckets and their policies are processed in manifest order; function visibility updates run after storage so an operator can see partial progress in the summary even when the storage phase fails.

type StorageReconciler

type StorageReconciler interface {
	GetBucket(ctx context.Context, name string) (*apiclient.StorageBucket, error)
	CreateBucket(ctx context.Context, input api.StorageBucketCreateInput) (*apiclient.StorageBucket, error)
	UpdateBucket(ctx context.Context, name string, input api.StorageBucketUpdateInput) (*apiclient.StorageBucket, error)
	ListPolicies(ctx context.Context, bucketName string) ([]apiclient.StoragePolicy, error)
	CreatePolicy(ctx context.Context, bucketName string, input api.StoragePolicyCreateInput) (*apiclient.StoragePolicy, error)
	DeletePolicy(ctx context.Context, bucketName, identifier string) (*apiclient.StoragePolicy, error)
}

StorageReconciler is the subset of internal/storage.Service that Deploy drives. It is defined here so tests can substitute a fake implementation without standing up an authenticated session.

type Summary

type Summary struct {
	BucketsCreated      int
	BucketsUpdated      int
	BucketsUnchanged    int
	PoliciesCreated     int
	PoliciesUpdated     int
	PoliciesDeleted     int
	PoliciesUnchanged   int
	FunctionsUpdated    int
	FunctionsUnchanged  int
	SchedulersCreated   int
	SchedulersUpdated   int
	SchedulersUnchanged int
}

Summary describes what changed in one Deploy run. All counters are non-decreasing across reconciliation steps so callers can render a single "buckets: X created, Y updated, Z unchanged" line per resource type.

Jump to

Keyboard shortcuts

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