Skip to content

Commit

Permalink
Implement state machine for entrypoint (#57)
Browse files Browse the repository at this point in the history
* feat: Improve task

* feat: Rework phases

* chore: Move updatePortStatus

* feat: Boilerplate code for EntryPoint rewrite

* chore: Update helmchart
  • Loading branch information
emil-jacero committed Sep 1, 2024
1 parent 4fe076c commit f84275c
Show file tree
Hide file tree
Showing 22 changed files with 1,055 additions and 756 deletions.
9 changes: 6 additions & 3 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ vars:
KIND_CONTEXT: '{{ .KIND_CONTEXT | default "kind-test" }}'
IMG: '{{.IMG | default "emiljacero/kode-operator:v0.0.0-latest"}}'

CONCAT_EXCLUDE_PATTERNS: 'zz_generated.deepcopy.go'
CONCAT_INCLUDE_PATTERNS: 'v1alpha2/kode_types.go,v1alpha2/common_types.go,v1alpha2/entrypoint_types.go,common/*,resource/*,template/*,status/*,controllers/kode/ensure_*,controllers/kode/reconciler.go,controllers/kode/states.go,controllers/kode/status.go,controllers/kode/finalizer.go,controllers/kode/config.go,controllers/kode/cleanup.go'
# ,controllers/kode/ensure_*,controllers/kode/reconciler.go,controllers/kode/states.go,controllers/kode/status.go,controllers/kode/finalizer.go,controllers/kode/config.go,controllers/kode/cleanup.go
CONCAT_DIRECTORY: '{{.ROOT_DIR}}/'
CONCAT_INCLUDE_COMMON: 'v1alpha2/common_types.go,common/*,status/*'
CONCAT_INCLUDE_KODE: 'v1alpha2/kode_types.go,controllers/kode/reconciler.go,controllers/kode/utils.go,controllers/kode/finalizer.go,controllers/kode/config.go'
CONCAT_INCLUDE_ENTRYPOINT: 'v1alpha2/entrypoint_types.go,controllers/entrypoint/reconciler.go,controllers/entrypoint/utils.go,controllers/entrypoint/finalizer.go,controllers/entrypoint/config.go,controllers/entrypoint/ensure_routes.go'

CONCAT_EXCLUDE_PATTERNS: 'zz_generated.deepcopy.go'
CONCAT_INCLUDE_PATTERNS: '{{.CONCAT_INCLUDE_COMMON}},{{.CONCAT_INCLUDE_KODE}},{{.CONCAT_INCLUDE_ENTRYPOINT}}'

tasks:
default:
Expand Down
32 changes: 22 additions & 10 deletions api/v1alpha2/entrypoint_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,32 @@ const (
type EntryPointPhase string

const (
// EntryPointPhaseCreating means the EntryPoint is being created.
EntryPointPhaseCreating EntryPointPhase = "Creating"

// KodePhaseCreated indicates that the Kode resource has been created.
EntryPointPhaseCreated EntryPointPhase = "Created"
// EntryPointPhasePending indicates that the EntryPoint resource is pending.
// The Gateway and other resources are not created yet.
EntryPointPhasePending EntryPointPhase = "Pending"

// EntryPointPhaseFailed means the EntryPoint has failed.
EntryPointPhaseFailed EntryPointPhase = "Failed"
// EntryPointPhaseConfiguring indicates that the EntryPoint resource is configuring.
// The Gateway and other resources are being created.
EntryPointPhaseConfiguring EntryPointPhase = "Configuring"

// EntryPointPhasePending means the EntryPoint is pending.
EntryPointPhasePending EntryPointPhase = "Pending"
// EntryPointPhaseProvisioning indicates that the EntryPoint resource is provisioning.
// The Gateway and other resources are being provisioned.
// The EntryPoint is not ready to serve traffic.
EntryPointPhaseProvisioning EntryPointPhase = "Provisioning"

// EntryPointPhaseActive means the EntryPoint is active.
// EntryPointPhaseActive indicates that the EntryPoint resource is fully operational.
// The Gateway and other resources have been created and the EntryPoint is ready to serve traffic.
EntryPointPhaseActive EntryPointPhase = "Active"

// EntryPointPhaseDeleting indicates that the EntryPoint resource is being deleted.
// The Gateway and other resources are being deleted.
EntryPointPhaseDeleting EntryPointPhase = "Deleting"

// EntryPointPhaseFailed indicates that the EntryPoint resource has failed.
EntryPointPhaseFailed EntryPointPhase = "Failed"

// EntryPointPhaseUnknown indicates that the EntryPoint resource is in an unknown state.
EntryPointPhaseUnknown EntryPointPhase = "Unknown"
)

// BaseDomain is the domain name to use either as a suffix in the case of Type=domain or as a prefix/domain in the case of Type=path.
Expand Down
3 changes: 0 additions & 3 deletions helm-charts/kode-crd/templates/clusterpodtemplate-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,9 @@ spec:
authentication.
type: string
username:
default: abc
description: Is both the the HTTP Basic auth username (when used)
and the user the container should run as. Defaults to 'abc'.
type: string
required:
- username
type: object
defaultHome:
default: /config
Expand Down
3 changes: 0 additions & 3 deletions helm-charts/kode-crd/templates/clustertofutemplate-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,9 @@ spec:
authentication.
type: string
username:
default: abc
description: Is both the the HTTP Basic auth username (when used)
and the user the container should run as. Defaults to 'abc'.
type: string
required:
- username
type: object
entryPointRef:
description: EntryPointSpec defines the desired state of the entrypoint.
Expand Down
Loading

0 comments on commit f84275c

Please sign in to comment.