Skip to content

Define JobRequest resource#17

Merged
samsimpson1 merged 1 commit into
mainfrom
samsimpson1/crd
May 20, 2026
Merged

Define JobRequest resource#17
samsimpson1 merged 1 commit into
mainfrom
samsimpson1/crd

Conversation

@samsimpson1
Copy link
Copy Markdown
Member

Also fix a load of incorrect package names across the project

This is a first pass. This resource definition needs some adjustments (more validation, comments, etc)

alphagov/govuk-infrastructure#4173

@samsimpson1 samsimpson1 requested a review from a team as a code owner May 20, 2026 12:22
Comment thread api/v1/jobrequest_types.go Outdated
Conditions []metav1.Condition `json:"conditions,omitempty"`
JobName string `json:"jobName,omitempty"`
// +kubebuilder:validation:Enum=Requested;Approved;Rejected;Started;Completed;Failed
State string `json:"state,omitempty"`
Copy link
Copy Markdown
Member

@AP-Hunt AP-Hunt May 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it idiomatic Go to use type aliases to constrain, or at least suggest, valid values?

type Status = string
var (
    StatusRequested Status = "Requested"
    StatusApproved         = "Approved"
    // ...
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation here ends up in the CRD, so you'd need to define the set of valid options twice. I'm going to leave it as is for now, and if creating a type alias makes it easier to implement the actual operator logic, it could be added later

Comment thread api/v1/jobrequest_types.go Outdated
Comment thread api/v1/jobrequest_types.go
@samsimpson1 samsimpson1 force-pushed the samsimpson1/crd branch 2 times, most recently from 33b916f to 7e4d366 Compare May 20, 2026 13:22
Also fix a load of incorrect package names across the project
@samsimpson1 samsimpson1 merged commit 2591dc1 into main May 20, 2026
8 checks passed
@samsimpson1 samsimpson1 deleted the samsimpson1/crd branch May 20, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants