Files
zeekay ea0026d172 merge: upstream/main (preserve Hanzo brand, 50 commits)
# Conflicts:
#	api/v1alpha1/casting.go
#	api/v1alpha1/installation/signoz.go
#	docs/casting.md
#	docs/examples/docker/compose/pours/deployment/configs/ingester/opamp.yaml
#	docs/examples/systemd/binary/pours/deployment/signoz-ingester.service
#	docs/examples/systemd/binary/pours/deployment/signoz-signoz.service
#	docs/examples/systemd/binary/pours/deployment/signoz-telemetrystore-migrator.service
#	docs/schemas/v1alpha1.yaml
#	internal/foundry/registry.go
#	internal/instrumentation/handler.go
#	internal/molding/signozmolding/signoz.go
2026-06-02 09:59:25 -07:00

69 lines
2.2 KiB
Go

package v1alpha1
import "maps"
type MoldingSpec struct {
// Whether the molding is enabled
Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty" description:"Whether the molding is enabled" default:"true"`
// Cluster configuration for the molding
Cluster TypeCluster `json:"cluster" yaml:"cluster,omitempty" description:"Cluster configuration for the molding"`
// The version of the molding to use
Version string `json:"version,omitempty" yaml:"version,omitempty" description:"The version of the molding to use" example:"latest"`
// Image of the molding
Image string `json:"image,omitempty" yaml:"image,omitempty" description:"Container image of the molding" example:"ghcr.io/hanzoai/o11y:latest"`
// Environment variables for the molding
Env map[string]string `json:"env,omitempty" yaml:"env,omitempty" description:"Environment variables for the molding"`
// Configuration for the molding
Config TypeConfig `json:"config" yaml:"config,omitempty" description:"Configuration for the molding"`
_ struct{} `additionalProperties:"false"`
}
type MoldingStatus struct {
// Extra information about the molding
Extras map[string]string `json:"extras,omitempty" yaml:"extras,omitempty" description:"Extra information about the molding"`
// Environment variables for the molding
Env map[string]string `json:"env,omitempty" yaml:"env,omitempty" description:"Environment variables for the molding"`
// Configuration for the molding
Config TypeConfig `json:"config" yaml:"config,omitempty" description:"Configuration for the molding"`
_ struct{} `additionalProperties:"false"`
}
// IsEnabled returns whether the molding is enabled.
// Returns false if the receiver or Enabled is nil.
func (spec *MoldingSpec) IsEnabled() bool {
if spec == nil || spec.Enabled == nil {
return false
}
return *spec.Enabled
}
func (spec *MoldingSpec) MergeStatus(status MoldingStatus) error {
if spec.Env == nil {
spec.Env = make(map[string]string)
}
if status.Env == nil {
status.Env = make(map[string]string)
}
maps.Copy(status.Env, spec.Env)
spec.Env = status.Env
if err := Merge(&status.Config, spec.Config); err != nil {
return err
}
spec.Config = status.Config
return nil
}