Documentation ¶
Index ¶
Constants ¶
View Source
const ( ScaleAction = "scale" StartAction = "start" StopAction = "stop" ResetAction = "reset" UpgradeAction = "upgrade" )
Variables ¶
View Source
var Module = module.Descriptor{ Kind: "firehose", Dependencies: map[string]string{ // contains filtered or unexported fields }, Actions: []module.ActionDesc{ { Name: module.CreateAction, Description: "Creates a new firehose", }, { Name: module.UpdateAction, Description: "Update all configurations of firehose", }, { Name: ResetAction, Description: "Stop firehose, reset consumer group, restart", }, { Name: StopAction, Description: "Stop all replicas of this firehose.", }, { Name: StartAction, Description: "Start the firehose if it is currently stopped.", }, { Name: ScaleAction, Description: "Scale the number of replicas to given number.", }, { Name: UpgradeAction, Description: "Upgrade firehose version", }, }, DriverFactory: func(confJSON json.RawMessage) (module.Driver, error) { conf := defaultDriverConf if err := json.Unmarshal(confJSON, &conf); err != nil { return nil, err } else if err := validator.TaggedStruct(conf); err != nil { return nil, err } return &firehoseDriver{ conf: conf, timeNow: time.Now, kubeDeploy: func(_ context.Context, isCreate bool, kubeConf kube.Config, hc helm.ReleaseConfig) error { canUpdate := func(rel *release.Release) bool { curLabels, ok := rel.Config[labelsConfKey].(map[string]any) if !ok { return false } newLabels, ok := hc.Values[labelsConfKey].(map[string]string) if !ok { return false } isManagedByEntropy := curLabels[labelOrchestrator] == orchestratorLabelValue isSameDeployment := curLabels[labelDeployment] == newLabels[labelDeployment] return isManagedByEntropy && isSameDeployment } helmCl := helm.NewClient(&helm.Config{Kubernetes: kubeConf}) _, errHelm := helmCl.Upsert(&hc, canUpdate) return errHelm }, kubeGetPod: func(ctx context.Context, conf kube.Config, ns string, labels map[string]string) ([]kube.Pod, error) { kubeCl := kube.NewClient(conf) return kubeCl.GetPodDetails(ctx, ns, labels) }, consumerReset: consumerReset, }, nil }, }
Functions ¶
This section is empty.
Types ¶
type ChartValues ¶
type Config ¶
type Config struct { // Stopped flag when set forces the firehose to be stopped on next sync. Stopped bool `json:"stopped"` // StopTime can be set to schedule the firehose to be stopped at given time. StopTime *time.Time `json:"stop_time,omitempty"` // Replicas is the number of firehose instances to run. Replicas int `json:"replicas"` // Namespace is the target namespace where firehose should be deployed. // Inherits from driver config. Namespace string `json:"namespace,omitempty"` // DeploymentID will be used as the release-name for the deployment. // Must be shorter than 53 chars if set. If not set, one will be generated // automatically. DeploymentID string `json:"deployment_id,omitempty"` // EnvVariables contains all the firehose environment config values. EnvVariables map[string]string `json:"env_variables,omitempty"` // ResetOffset represents the value to which kafka consumer offset was set to ResetOffset string `json:"reset_offset,omitempty"` Limits UsageSpec `json:"limits,omitempty"` Requests UsageSpec `json:"requests,omitempty"` Telegraf *Telegraf `json:"telegraf,omitempty"` ChartValues *ChartValues `json:"chart_values,omitempty"` InitContainer InitContainer `json:"init_container,omitempty"` }
type InitContainer ¶
type NodeAffinityMatchExpressions ¶
type NodeAffinityMatchExpressions struct { RequiredDuringSchedulingIgnoredDuringExecution []Preference `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty"` PreferredDuringSchedulingIgnoredDuringExecution []WeightedPreference `json:"preferredDuringSchedulingIgnoredDuringExecution,omitempty"` }
type Preference ¶
type RequestsAndLimits ¶
type ScaleParams ¶
type ScaleParams struct {
Replicas int `json:"replicas"`
}
type StartParams ¶
type Telegraf ¶
type Telegraf struct { Enabled bool `json:"enabled,omitempty"` Image map[string]any `json:"image,omitempty"` Config TelegrafConf `json:"config,omitempty"` }
type TelegrafConf ¶
type WeightedPreference ¶
type WeightedPreference struct { Weight int `json:"weight" validate:"required"` Preference []Preference `json:"preference" validate:"required"` }
Click to show internal directories.
Click to hide internal directories.