Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SchedulerJobLabels ¶
func SchedulerJobLabels(owner kmeta.OwnerRefable, action string) map[string]string
SchedulerJobLabels creates a label to find a job again. keys is recommended to be (name, kind, action)
func SchedulerJobName ¶
func SchedulerJobName(owner kmeta.OwnerRefable, action string) string
SchedulerJobName creates the name of a scheduler ops job.
Types ¶
type JobActionResult ¶
type JobActionResult struct {
// Result is the result the operation attempted.
Result bool `json:"result,omitempty"`
// Error is the error string if failure occurred
Error string `json:"error,omitempty"`
// JobName holds the name of the created job
// and is filled in during create operation.
JobName string `json:"jobName,omitempty"`
// Project is the project id that we used (this might have
// been defaulted, to we'll expose it).
ProjectId string `json:"projectId,omitempty"`
}
TODO: the job could output the resolved projectID.
type JobArgs ¶
type JobArgs struct {
// UID of the resource that caused the action to be taken. Will
// be added as a label to the podtemplate.
UID string
// Image is the actual binary that we'll run to operate on the
// notification.
Image string
// Action is what the binary should do
Action string
// TopicID we'll use for pubsub target.
TopicID string
// JobName is the name of the Scheduler Job that we're
// operating on. The format is like so:
// projects/PROJECT_ID/locations/LOCATION_ID/jobs/JobId
JobName string
// Schedule for the Job
Schedule string
// Data to send in the payload
Data string
Secret corev1.SecretKeySelector
Owner kmeta.OwnerRefable
}
JobArgs are the configuration required to make a NewJobOps.
type JobOps ¶
type JobOps struct {
SchedulerOps
// Action is the operation the job should run.
// Options: [exists, create, delete]
Action string `envconfig:"ACTION" required:"true"`
// Topic is the environment variable containing the PubSub Topic being
// subscribed to's name. In the form that is unique within the project.
// E.g. 'laconia', not 'projects/my-gcp-project/topics/laconia'.
Topic string `envconfig:"PUBSUB_TOPIC_ID" required:"false"`
// Schedule specification
Schedule string `envconfig:"SCHEDULE" required:"false"`
// JobName is the environment variable containing the name of the
// job to operate on. F
JobName string `envconfig:"JOB_NAME" required:"false" default:""`
// Parent is the parent of the job.
Parent string `envconfig:"JOB_PARENT" required:"false" default:""`
// Data is the data to send in the payload.
Data string `envconfig:"DATA" required:"false" default:""`
}
JobOps defines the configuration to use for this operation.
type SchedulerOps ¶
type SchedulerOps struct {
// Environment variable containing project id.
Project string `envconfig:"PROJECT_ID"`
// contains filtered or unexported fields
}
func (*SchedulerOps) CreateClient ¶
func (s *SchedulerOps) CreateClient(ctx context.Context) error
Click to show internal directories.
Click to hide internal directories.