Skip to content

Commit

Permalink
feat: add runtime version and state. (#5169)
Browse files Browse the repository at this point in the history
* feat: add jwt secret in devbox secret.

* add runtime version and state.
  • Loading branch information
lingdie authored Oct 23, 2024
1 parent 5e84ccb commit 32f6973
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 4 deletions.
22 changes: 20 additions & 2 deletions controllers/devbox/api/v1alpha1/runtime_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,19 @@ type Component struct {
Version string `json:"version"`
}

type RuntimeState string

const (
RuntimeStateActive RuntimeState = "active"
RuntimeStateDeprecated RuntimeState = "deprecated"
)

// RuntimeSpec defines the desired state of Runtime
type RuntimeSpec struct {
// +kubebuilder:validation:Required
Version string `json:"version"`
// +kubebuilder:validation:Required
ClassRef string `json:"classRef"`
// +kubebuilder:validation:Required
Version string `json:"version"`

// +kubebuilder:validation:Optional
Components []Component `json:"components,omitempty"`
Expand All @@ -88,6 +95,13 @@ type RuntimeSpec struct {

// +kubebuilder:validation:Required
Config Config `json:"config"`

// +kubebuilder:validation:Optional
RuntimeVersion string `json:"runtimeVersion,omitempty"`
// +kubebuilder:validation:Optional
// +kubebuilder:validation:Enum=active;deprecated
// +kubebuilder:default=active
State RuntimeState `json:"state,omitempty"`
}

// RuntimeStatus defines the observed state of Runtime
Expand All @@ -98,6 +112,10 @@ type RuntimeStatus struct {

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Class",type=string,JSONPath=`.spec.classRef`
// +kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version`
// +kubebuilder:printcolumn:name="RuntimeVersion",type=string,JSONPath=`.spec.runtimeVersion`
// +kubebuilder:printcolumn:name="State",type=string,JSONPath=`.spec.state`

// Runtime is the Schema for the runtimes API
type Runtime struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,20 @@ spec:
singular: runtime
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- jsonPath: .spec.classRef
name: Class
type: string
- jsonPath: .spec.version
name: Version
type: string
- jsonPath: .spec.runtimeVersion
name: RuntimeVersion
type: string
- jsonPath: .spec.state
name: State
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: Runtime is the Schema for the runtimes API
Expand Down Expand Up @@ -2002,6 +2015,14 @@ spec:
type: object
description:
type: string
runtimeVersion:
type: string
state:
default: active
enum:
- active
- deprecated
type: string
version:
type: string
required:
Expand Down
23 changes: 22 additions & 1 deletion controllers/devbox/deploy/manifests/deploy.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3129,7 +3129,20 @@ spec:
singular: runtime
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- jsonPath: .spec.classRef
name: Class
type: string
- jsonPath: .spec.version
name: Version
type: string
- jsonPath: .spec.runtimeVersion
name: RuntimeVersion
type: string
- jsonPath: .spec.state
name: State
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: Runtime is the Schema for the runtimes API
Expand Down Expand Up @@ -5103,6 +5116,14 @@ spec:
type: object
description:
type: string
runtimeVersion:
type: string
state:
default: active
enum:
- active
- deprecated
type: string
version:
type: string
required:
Expand Down

0 comments on commit 32f6973

Please sign in to comment.