Documentation
¶
Index ¶
- Constants
- func CleanStaleConfigs(arch *servicemanager.MicroserviceArchitecture, logger zerolog.Logger) error
- func GenerateAndWriteServiceSpecificConfigs(arch *servicemanager.MicroserviceArchitecture, logger zerolog.Logger) error
- func PrepareServiceDirectorSource(arch *servicemanager.MicroserviceArchitecture, logger zerolog.Logger) error
- func ReadResourceMappings(spec *servicemanager.CloudResourcesSpec) map[string]string
- func WriteServiceConfigFiles(filesToWrite []ServiceConfig, logger zerolog.Logger) error
- type Command
- type CommandInstruction
- type CompletionEvent
- type CompletionStatus
- type Conductor
- type ConductorOptions
- type DependentSetupPayload
- type DeploymentManager
- type EmbeddedArchitectureLoader
- func (l *EmbeddedArchitectureLoader) LoadArchitecture(_ context.Context) (*servicemanager.MicroserviceArchitecture, error)
- func (l *EmbeddedArchitectureLoader) LoadResourceGroup(_ context.Context, _ string) (*servicemanager.ResourceGroup, error)
- func (l *EmbeddedArchitectureLoader) WriteProvisionedResources(_ context.Context, _ *servicemanager.ProvisionedResources) error
- type FoundationalSetupPayload
- type IAMOrchestrator
- func (o *IAMOrchestrator) ApplyProjectLevelIAMForDataflow(ctx context.Context, dataflowName string, saEmails map[string]string) error
- func (o *IAMOrchestrator) EnsureDataflowSAsExist(ctx context.Context, dataflowName string) (map[string]string, error)
- func (o *IAMOrchestrator) GetProjectNumber(ctx context.Context, projectID string) (string, error)
- func (o *IAMOrchestrator) PollForSAExistence(ctx context.Context, accountEmail string, timeout time.Duration) error
- func (o *IAMOrchestrator) PreflightChecks(ctx context.Context) error
- func (o *IAMOrchestrator) SetupServiceDirectorIAM(ctx context.Context) (map[string]string, error)
- func (o *IAMOrchestrator) Teardown(ctx context.Context) error
- func (o *IAMOrchestrator) VerifyProjectLevelIAMForDataflow(ctx context.Context, dataflowName string, saEmails map[string]string, ...) error
- func (o *IAMOrchestrator) VerifyResourceLevelIAMForDataflow(ctx context.Context, dataflowName string, saEmails map[string]string, ...) error
- func (o *IAMOrchestrator) VerifyServiceDirectorIAM(ctx context.Context, saEmails map[string]string, ...) error
- type PlanEntry
- type PreflightValidator
- type RemoteDirectorClient
- func (c *RemoteDirectorClient) Teardown(ctx context.Context) error
- func (c *RemoteDirectorClient) TriggerDependentSetup(ctx context.Context, dataflowName string, serviceURLs map[string]string) (CompletionEvent, error)
- func (c *RemoteDirectorClient) TriggerFoundationalSetup(ctx context.Context, dataflowName string) (CompletionEvent, error)
- type ServiceConfig
Constants ¶
const ServiceDirector = "service-director"
Variables ¶
This section is empty.
Functions ¶
func CleanStaleConfigs ¶
func CleanStaleConfigs(arch *servicemanager.MicroserviceArchitecture, logger zerolog.Logger) error
CleanStaleConfigs removes any leftover resources.yaml or services.yaml files from the source directories of all services defined in the architecture. This ensures every deployment starts from a clean state.
func GenerateAndWriteServiceSpecificConfigs ¶
func GenerateAndWriteServiceSpecificConfigs(arch *servicemanager.MicroserviceArchitecture, logger zerolog.Logger) error
REFACTOR: This new function handles the copying of service-specific templates. GenerateAndWriteServiceSpecificConfigs iterates through all services and copies their defined configuration templates into their respective build directories.
func PrepareServiceDirectorSource ¶
func PrepareServiceDirectorSource(arch *servicemanager.MicroserviceArchitecture, logger zerolog.Logger) error
PrepareServiceDirectorSource marshals the arch to YAML and copies the resulting services.yaml file into the ServiceDirector's source code directory so it can be included in the build.
func ReadResourceMappings ¶
func ReadResourceMappings(spec *servicemanager.CloudResourcesSpec) map[string]string
ReadResourceMappings extract the lookup names from a CloudResourcesSpec.
func WriteServiceConfigFiles ¶
func WriteServiceConfigFiles( filesToWrite []ServiceConfig, logger zerolog.Logger, ) error
WriteServiceConfigFiles writes the generated configurations to their respective service directories.
Types ¶
type Command ¶
type Command struct {
Instruction CommandInstruction `json:"instruction"`
Payload json.RawMessage `json:"payload"`
}
type CommandInstruction ¶
type CommandInstruction string
const ( Setup CommandInstruction = "dataflow-setup" Teardown CommandInstruction = "teardown" SetupDependent CommandInstruction = "dependent-resource-setup" )
type CompletionEvent ¶
type CompletionEvent struct {
Status CompletionStatus `json:"status"`
Value string `json:"value"`
ErrorMessage string `json:"error_message,omitempty"`
AppliedIAM map[string]iam.PolicyBinding `json:"applied_iam,omitempty"`
}
type CompletionStatus ¶
type CompletionStatus string
const ( ServiceDirectorReady CompletionStatus = "setup_complete" DataflowComplete CompletionStatus = "dataflow_complete" )
type Conductor ¶
type Conductor struct {
// contains filtered or unexported fields
}
Conductor manages the high-level orchestration of a full microservice architecture deployment.
func NewConductor ¶
func NewConductor(ctx context.Context, arch *servicemanager.MicroserviceArchitecture, logger zerolog.Logger, opts ConductorOptions) (*Conductor, error)
NewConductor creates and initializes a new Conductor with specific options.
func (*Conductor) GenerateIAMPlan ¶
GenerateIAMPlan creates the full IAM plan and writes it to a YAML file.
func (*Conductor) Preflight ¶
Preflight runs permission checks for the identity executing the Conductor.
type ConductorOptions ¶
type ConductorOptions struct {
CheckPrerequisites bool
PreflightServiceConfigs bool
SetupIAM bool
BuildAndDeployServices bool
TriggerRemoteSetup bool
VerifyDataflowIAM bool
DirectorURLOverride string
SAPollTimeout time.Duration
PolicyPollTimeout time.Duration
}
ConductorOptions provides flags and configuration to control the orchestration workflow.
type DependentSetupPayload ¶
type DependentSetupPayload struct {
DataflowName string `json:"dataflow_name"`
ServiceURLs map[string]string `json:"service_urls"`
}
DependentSetupPayload contains the dataflow name and the map of deployed service URLs.
type DeploymentManager ¶
type DeploymentManager struct {
// contains filtered or unexported fields
}
DeploymentManager handles the logic of building and deploying containerized services. It has no knowledge of remote orchestration or Pub/Sub.
func NewDeploymentManager ¶
func NewDeploymentManager(arch *servicemanager.MicroserviceArchitecture, deployer deployment.ContainerDeployer, logger zerolog.Logger) *DeploymentManager
NewDeploymentManager creates a new manager for local build and deploy operations.
func (*DeploymentManager) BuildAllServices ¶
BuildAllServices builds all services defined in the architecture in parallel. It returns a map of service names to their final container image URIs.
func (*DeploymentManager) DeployApplicationServices ¶
func (m *DeploymentManager) DeployApplicationServices(ctx context.Context, dataflowName string, saEmails map[string]string, builtImages map[string]string, directorURL string) (map[string]string, error)
DeployApplicationServices deploys all services for a given dataflow in parallel.
type EmbeddedArchitectureLoader ¶
type EmbeddedArchitectureLoader struct {
// contains filtered or unexported fields
}
EmbeddedArchitectureLoader is a simple implementation of the servicemanager.ArchitectureIO interface that works with a pre-existing, in-memory MicroserviceArchitecture struct. This is primarily useful for scenarios where the architecture is defined statically, for example, from a `go:embed` directive.
func NewEmbeddedArchitectureLoader ¶
func NewEmbeddedArchitectureLoader(arch *servicemanager.MicroserviceArchitecture) *EmbeddedArchitectureLoader
NewEmbeddedArchitectureLoader creates a new loader that serves a pre-parsed architecture.
func (*EmbeddedArchitectureLoader) LoadArchitecture ¶
func (l *EmbeddedArchitectureLoader) LoadArchitecture(_ context.Context) (*servicemanager.MicroserviceArchitecture, error)
LoadArchitecture simply returns the pre-parsed architecture from the embedded data.
func (*EmbeddedArchitectureLoader) LoadResourceGroup ¶
func (l *EmbeddedArchitectureLoader) LoadResourceGroup(_ context.Context, _ string) (*servicemanager.ResourceGroup, error)
LoadResourceGroup is not implemented for the embedded loader.
func (*EmbeddedArchitectureLoader) WriteProvisionedResources ¶
func (l *EmbeddedArchitectureLoader) WriteProvisionedResources(_ context.Context, _ *servicemanager.ProvisionedResources) error
WriteProvisionedResources is not implemented for the embedded loader.
type FoundationalSetupPayload ¶
type FoundationalSetupPayload struct {
DataflowName string `json:"dataflow_name"`
}
FoundationalSetupPayload is the payload for the initial 'dataflow-setup' command.
type IAMOrchestrator ¶
type IAMOrchestrator struct {
// contains filtered or unexported fields
}
IAMOrchestrator is responsible for the high-level orchestration of all IAM policies for an architecture.
func NewIAMOrchestrator ¶
func NewIAMOrchestrator(ctx context.Context, arch *servicemanager.MicroserviceArchitecture, logger zerolog.Logger, clientOpts ...option.ClientOption) (*IAMOrchestrator, error)
NewIAMOrchestrator creates a new orchestrator focused solely on IAM.
func (*IAMOrchestrator) ApplyProjectLevelIAMForDataflow ¶
func (o *IAMOrchestrator) ApplyProjectLevelIAMForDataflow(ctx context.Context, dataflowName string, saEmails map[string]string) error
ApplyProjectLevelIAMForDataflow plans and applies all project-level IAM roles for a dataflow's services. Note: This function only applies the roles; it does not wait for them to propagate.
func (*IAMOrchestrator) EnsureDataflowSAsExist ¶
func (o *IAMOrchestrator) EnsureDataflowSAsExist(ctx context.Context, dataflowName string) (map[string]string, error)
EnsureDataflowSAsExist creates the necessary service accounts for a dataflow.
func (*IAMOrchestrator) GetProjectNumber ¶
GetProjectNumber retrieves the numeric ID for a given project ID string.
func (*IAMOrchestrator) PollForSAExistence ¶
func (o *IAMOrchestrator) PollForSAExistence(ctx context.Context, accountEmail string, timeout time.Duration) error
PollForSAExistence waits for a newly created service account to propagate throughout Google Cloud.
func (*IAMOrchestrator) PreflightChecks ¶
func (o *IAMOrchestrator) PreflightChecks(ctx context.Context) error
PreflightChecks verifies that the identity running the Conductor has the minimum necessary permissions to perform its verification steps.
func (*IAMOrchestrator) SetupServiceDirectorIAM ¶
SetupServiceDirectorIAM ensures the ServiceDirector's SA exists and grants it necessary project-level roles.
func (*IAMOrchestrator) Teardown ¶
func (o *IAMOrchestrator) Teardown(ctx context.Context) error
Teardown cleans up service accounts created during the orchestration run.
func (*IAMOrchestrator) VerifyProjectLevelIAMForDataflow ¶
func (o *IAMOrchestrator) VerifyProjectLevelIAMForDataflow(ctx context.Context, dataflowName string, saEmails map[string]string, verificationTimeout time.Duration) error
VerifyProjectLevelIAMForDataflow polls project-level IAM policies until they reflect the planned state.
func (*IAMOrchestrator) VerifyResourceLevelIAMForDataflow ¶
func (o *IAMOrchestrator) VerifyResourceLevelIAMForDataflow(ctx context.Context, dataflowName string, saEmails map[string]string, verificationTimeout time.Duration) error
VerifyResourceLevelIAMForDataflow polls resource-level IAM policies until they reflect the planned state.
func (*IAMOrchestrator) VerifyServiceDirectorIAM ¶
func (o *IAMOrchestrator) VerifyServiceDirectorIAM(ctx context.Context, saEmails map[string]string, verificationTimeout time.Duration) error
VerifyServiceDirectorIAM polls the project-level IAM policies for the ServiceDirector until they are effective.
type PlanEntry ¶
type PlanEntry struct {
Source string `yaml:"source"`
Binding iam.IAMBinding `yaml:"binding"`
Reason string `yaml:"reason"`
}
PlanEntry is a richer struct for the IAM plan file, including the reason for the binding.
type PreflightValidator ¶
type PreflightValidator struct {
// contains filtered or unexported fields
}
PreflightValidator runs local tests against service source code to validate generated configuration files before a build or deployment is attempted.
func NewPreflightValidator ¶
func NewPreflightValidator(arch *servicemanager.MicroserviceArchitecture, logger zerolog.Logger) *PreflightValidator
NewPreflightValidator creates a new validator.
func (*PreflightValidator) GenerateTestEnvForService ¶
func (v *PreflightValidator) GenerateTestEnvForService(serviceName string) []string
GenerateTestEnvForService inspects the hydrated architecture to find all resources linked to a specific service and generates the environment variables for its pre-flight test.
func (*PreflightValidator) Run ¶
func (v *PreflightValidator) Run() error
Run executes `go test` in each service's directory. It dynamically determines the expected resource names from the architecture and passes them to the test process as environment variables.
type RemoteDirectorClient ¶
type RemoteDirectorClient struct {
// contains filtered or unexported fields
}
RemoteDirectorClient manages all asynchronous communication with the remote ServiceDirector.
func NewRemoteDirectorClient ¶
func NewRemoteDirectorClient(ctx context.Context, arch *servicemanager.MicroserviceArchitecture, logger zerolog.Logger, clientOpts ...option.ClientOption) (*RemoteDirectorClient, error)
NewRemoteDirectorClient creates a new client for communicating with the ServiceDirector.
func (*RemoteDirectorClient) Teardown ¶
func (c *RemoteDirectorClient) Teardown(ctx context.Context) error
Teardown cleans up the client's Pub/Sub resources.
func (*RemoteDirectorClient) TriggerDependentSetup ¶
func (c *RemoteDirectorClient) TriggerDependentSetup(ctx context.Context, dataflowName string, serviceURLs map[string]string) (CompletionEvent, error)
TriggerDependentSetup sends the command to set up dependent resources and waits for completion.
func (*RemoteDirectorClient) TriggerFoundationalSetup ¶
func (c *RemoteDirectorClient) TriggerFoundationalSetup(ctx context.Context, dataflowName string) (CompletionEvent, error)
TriggerFoundationalSetup sends the command to set up foundational resources and waits for completion.
type ServiceConfig ¶
type ServiceConfig struct {
ServiceName string
FilePath string
Config servicemanager.CloudResourcesSpec
}
func GenerateServiceConfigs ¶
func GenerateServiceConfigs(arch *servicemanager.MicroserviceArchitecture) ([]ServiceConfig, error)
GenerateServiceConfigs creates service-specific YAML configs based on the architecture.