Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
HUAHUAI23 committed Sep 23, 2024
2 parents b1d6d8d + f3efe28 commit 5f0db77
Show file tree
Hide file tree
Showing 377 changed files with 14,012 additions and 1,725 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
providers/objectstorage,
providers/kubepanel,
providers/workorder,
providers/devbox,
desktop,
]
steps:
Expand Down Expand Up @@ -165,6 +166,7 @@ jobs:
providers/objectstorage,
providers/kubepanel,
providers/workorder,
providers/devbox,
desktop,
]
steps:
Expand Down
4 changes: 4 additions & 0 deletions controllers/devbox/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ build: ## Build manager binary.
run: manifests generate fmt vet ## Run a controller from your host.
go run ./cmd/main.go

.PHONY: debug
debug:
go run ./cmd/main.go --debug

.PHONY: docker-build
docker-build: ## Build docker image with the manager.
mv bin/manager bin/controller-devbox-${TARGETARCH}
Expand Down
5 changes: 5 additions & 0 deletions controllers/devbox/api/v1alpha1/devbox_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ type DevboxStatus struct {
CommitHistory []*CommitHistory `json:"commitHistory"`
// +kubebuilder:validation:Optional
Phase DevboxPhase `json:"phase"`

// +kubebuilder:validation:Optional
State corev1.ContainerState `json:"state"`
// +kubebuilder:validation:Optional
LastTerminationState corev1.ContainerState `json:"lastState"`
}

// +kubebuilder:object:root=true
Expand Down
8 changes: 8 additions & 0 deletions controllers/devbox/api/v1alpha1/runtime_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,18 @@ type Config struct {
// 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"`

// +kubebuilder:validation:Optional
// +kubebuilder:default={{name:"devbox-ssh-port",containerPort:22,protocol:TCP}}
Ports []corev1.ContainerPort `json:"ports,omitempty"`
Expand Down
12 changes: 12 additions & 0 deletions controllers/devbox/api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

122 changes: 122 additions & 0 deletions controllers/devbox/config/crd/bases/devbox.sealos.io_devboxes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2768,6 +2768,67 @@ spec:
- time
type: object
type: array
lastState:
description: |-
ContainerState holds a possible state of container.
Only one of its members may be specified.
If none of them is specified, the default one is ContainerStateWaiting.
properties:
running:
description: Details about a running container
properties:
startedAt:
description: Time at which the container was last (re-)started
format: date-time
type: string
type: object
terminated:
description: Details about a terminated container
properties:
containerID:
description: Container's ID in the format '<type>://<container_id>'
type: string
exitCode:
description: Exit status from the last termination of the
container
format: int32
type: integer
finishedAt:
description: Time at which the container last terminated
format: date-time
type: string
message:
description: Message regarding the last termination of the
container
type: string
reason:
description: (brief) reason from the last termination of the
container
type: string
signal:
description: Signal from the last termination of the container
format: int32
type: integer
startedAt:
description: Time at which previous execution of the container
started
format: date-time
type: string
required:
- exitCode
type: object
waiting:
description: Details about a waiting container
properties:
message:
description: Message regarding why the container is not yet
running.
type: string
reason:
description: (brief) reason the container is not yet running.
type: string
type: object
type: object
network:
properties:
nodePort:
Expand All @@ -2791,6 +2852,67 @@ spec:
description: PodPhase is a label for the condition of a pod at the
current time.
type: string
state:
description: |-
ContainerState holds a possible state of container.
Only one of its members may be specified.
If none of them is specified, the default one is ContainerStateWaiting.
properties:
running:
description: Details about a running container
properties:
startedAt:
description: Time at which the container was last (re-)started
format: date-time
type: string
type: object
terminated:
description: Details about a terminated container
properties:
containerID:
description: Container's ID in the format '<type>://<container_id>'
type: string
exitCode:
description: Exit status from the last termination of the
container
format: int32
type: integer
finishedAt:
description: Time at which the container last terminated
format: date-time
type: string
message:
description: Message regarding the last termination of the
container
type: string
reason:
description: (brief) reason from the last termination of the
container
type: string
signal:
description: Signal from the last termination of the container
format: int32
type: integer
startedAt:
description: Time at which previous execution of the container
started
format: date-time
type: string
required:
- exitCode
type: object
waiting:
description: Details about a waiting container
properties:
message:
description: Message regarding why the container is not yet
running.
type: string
reason:
description: (brief) reason the container is not yet running.
type: string
type: object
type: object
type: object
type: object
served: true
Expand Down
14 changes: 14 additions & 0 deletions controllers/devbox/config/crd/bases/devbox.sealos.io_runtimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,19 @@ spec:
- containerPort
type: object
type: array
releaseArgs:
default:
- /home/sealos/project/entrypoint.sh
items:
type: string
type: array
releaseCommand:
default:
- /bin/bash
- -c
items:
type: string
type: array
user:
default: sealos
type: string
Expand Down Expand Up @@ -1902,6 +1915,7 @@ spec:
type: object
type: array
workingDir:
default: /home/sealos/project
type: string
required:
- image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ spec:
description: go1.22.5
config:
image: ghcr.io/cbluebird/devbox/go1.22.5:2f4067
workingDir: /home/sealos/project
releaseCommand:
- /bin/bash
- -c
releaseArgs:
- /home/sealos/project/entrypoint.sh
category:
- ubuntu
- go
Expand Down
44 changes: 44 additions & 0 deletions controllers/devbox/config/samples/test/devbox_v1alpha1_devbox.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright © 2024 sealos.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: devbox.sealos.io/v1alpha1
kind: Devbox
metadata:
labels:
app.kubernetes.io/name: devbox
app.kubernetes.io/managed-by: kustomize
name: devbox-sample
spec:
state: Running
resource:
cpu: 1000m
memory: 1024Mi
runtimeRef:
name: go-1-22-5
namespace: devbox-system
command:
- /bin/bash
args:
- -c
- |
apt-get update
apt-get install -y tini
tini -- /bin/bash -c "echo 'DevBox is ready for testing'; tail -f /dev/null"
network:
type: NodePort
extraPorts:
- containerPort: 443
name: 'https'
- containerPort: 80
name: 'http'
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright © 2024 sealos.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: devbox.sealos.io/v1alpha1
kind: Runtime
metadata:
name: go-1-22-5
namespace: devbox-system
spec:
classRef: go
version: go1.22.5
description: go1.22.5
config:
image: ubuntu
workingDir: /home/sealos/project
releaseCommand:
- /bin/bash
- -c
releaseArgs:
- /home/sealos/project/entrypoint.sh
category:
- ubuntu
- go
Loading

0 comments on commit 5f0db77

Please sign in to comment.