Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change devbox runtime config to devbox config. #5205

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 44 additions & 33 deletions controllers/devbox/api/v1alpha1/devbox_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,51 @@ const (

type ResourceList map[ResourceName]resource.Quantity

type RuntimeRef struct {
// +kubebuilder:validation:Required
Name string `json:"name"`
// +kubebuilder:validation:Optional
Namespace string `json:"namespace,omitempty"`
}

type NetworkSpec struct {
// +kubebuilder:validation:Required
// +kubebuilder:validation:Enum=NodePort;Tailnet
Type NetworkType `json:"type"`
}

type Config struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default=sealos
User string `json:"user"`

// +kubebuilder:validation:Optional
Labels map[string]string `json:"labels,omitempty"`
// +kubebuilder:validation:Optional
Annotations map[string]string `json:"annotations,omitempty"`

// +kubebuilder:validation:Optional
Command []string `json:"command,omitempty"`
// kubebuilder:validation:Optional
Args []string `json:"args,omitempty"`
// +kubebuilder:validation:Optional
// +kubebuilder:default=/home/sealos/project
WorkingDir string `json:"workingDir,omitempty"`
// +kubebuilder:validation:Optional
Env []corev1.EnvVar `json:"env,omitempty"`

// +kubebuilder:validation:Optional
// +kubebuilder:default={/bin/bash,-c}
ReleaseCommand []string `json:"releaseCommand,omitempty"`
// +kubebuilder:validation:Optional
// +kubebuilder:default={/home/sealos/project/entrypoint.sh}
ReleaseArgs []string `json:"releaseArgs,omitempty"`

// TODO: in v1alpha2 api we need fix the port and app port into one field and create a new type for it.
// +kubebuilder:validation:Optional
ExtraPorts []corev1.ContainerPort `json:"extraPorts"`
// +kubebuilder:default={{name:"devbox-ssh-port",containerPort:22,protocol:TCP}}
Ports []corev1.ContainerPort `json:"ports,omitempty"`
// +kubebuilder:validation:Optional
// +kubebuilder:default={{name:"devbox-app-port",port:8080,protocol:TCP}}
AppPorts []corev1.ServicePort `json:"appPorts,omitempty"`

// +kubebuilder:validation:Optional
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
// +kubebuilder:validation:Optional
Volumes []corev1.Volume `json:"volumes,omitempty"`
}

// DevboxSpec defines the desired state of Devbox
Expand All @@ -82,32 +114,13 @@ type DevboxSpec struct {
Squash bool `json:"squash"`

// +kubebuilder:validation:Required
RuntimeRef RuntimeRef `json:"runtimeRef"`
Image string `json:"image"`

// +kubebuilder:validation:Required
NetworkSpec NetworkSpec `json:"network,omitempty"`
Config Config `json:"config"`

// todo add rewrite labels and annotations...
// +kubebuilder:validation:Optional
ExtraLabels map[string]string `json:"extraLabels,omitempty"`
// +kubebuilder:validation:Optional
ExtraAnnotations map[string]string `json:"extraAnnotations,omitempty"`

// +kubebuilder:validation:Optional
Command []string `json:"command,omitempty"`
// +kubebuilder:validation:Optional
Args []string `json:"args,omitempty"`
// +kubebuilder:validation:Optional
WorkingDir string `json:"workingDir,omitempty"`
// todo add rewrite env...
// +kubebuilder:validation:Optional
ExtraEnvs []corev1.EnvVar `json:"extraEnvs"`

// todo add rewrite volumes and volume mounts..
// +kubebuilder:validation:Optional
ExtraVolumes []corev1.Volume `json:"extraVolumes,omitempty"`
// +kubebuilder:validation:Optional
ExtraVolumeMounts []corev1.VolumeMount `json:"extraVolumeMounts,omitempty"`
// +kubebuilder:validation:Required
NetworkSpec NetworkSpec `json:"network,omitempty"`

// +kubebuilder:validation:Optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
Expand Down Expand Up @@ -189,8 +202,6 @@ type DevboxStatus struct {
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".spec.state"
// +kubebuilder:printcolumn:name="RuntimeRef",type="string",JSONPath=".spec.runtimeRef.name"
// +kubebuilder:printcolumn:name="PodPhase",type="string",JSONPath=".status.podPhase"
// +kubebuilder:printcolumn:name="NetworkType",type="string",JSONPath=".status.network.type"
// +kubebuilder:printcolumn:name="NodePort",type="integer",JSONPath=".status.network.nodePort"
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase"
Expand Down
140 changes: 0 additions & 140 deletions controllers/devbox/api/v1alpha1/runtime_types.go

This file was deleted.

71 changes: 0 additions & 71 deletions controllers/devbox/api/v1alpha1/runtimeclass_types.go

This file was deleted.

Loading
Loading