Skip to content

Pool concurrency controls and ResourceHandle status #102

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

Merged
merged 7 commits into from
Jun 27, 2024
Merged
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
2 changes: 2 additions & 0 deletions Development.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ odo push
+
----
ansible-playbook \
-e ansible_python_interpreter='{{ ansible_playbook_python }}' \
-e poolboy_domain=poolboy.dev.local \
-e poolboy_namespace=poolboy-dev \
-e poolboy_service_account=default \
Expand Down Expand Up @@ -123,6 +124,7 @@ helm template helm \
+
----
ansible-playbook \
-e ansible_python_interpreter='{{ ansible_playbook_python }}' \
-e poolboy_domain=poolboy.dev.local \
-e poolboy_namespace=poolboy-dev \
-e poolboy_service_account=poolboy-dev \
Expand Down
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ image::docs/diagram.png[Poolboy Diagram,500,400]

. User updates an existing ResourceClaim
. Each resource template in the ResourceClaim is checked for validity against the OpenAPIv3 schema in the ResourceProvider.
. A JSON Patch for each resource template in the ResourceHandle is generated and then the JSON Patch is filtered according to each ResourceProvider's `spec.updateFilters`.
. A JSON Patch for each resource template in the ResourceHandle is generated and then the JSON Patch is filtered according to each ResourceProvider's `spec.updateFilters`.
. Updates are applied to the ResourceHandle.

=== ResourceHandle Creation or Update
Expand Down
35 changes: 32 additions & 3 deletions helm/crds/resourceclaims.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ spec:
provider:
description: >-
ResourceProvider specification used to manage this claim.
Mutually exclusive with provider.
Mutually exclusive with resources.
type: object
required:
- name
Expand All @@ -100,7 +100,7 @@ spec:
type: string
parameterValues:
description: >-
Parameter values used with this ResourcProvider.
Parameter values used with the ResourceProvider.
type: object
x-kubernetes-preserve-unknown-fields: true
resources:
Expand Down Expand Up @@ -163,6 +163,9 @@ spec:
diffBase:
description: Kopf diffbase
type: string
healthy:
description: Health state as determined by check from ResourceProviders of resources.
type: boolean
kopf:
description: Kopf status
type: object
Expand Down Expand Up @@ -234,11 +237,14 @@ spec:
namespace:
type: string
resources:
description: Status of resources managed for this claim
description: Status of resources managed for this ResourceClaim
type: array
items:
type: object
properties:
healthy:
description: Health state as determined by check from ResourceProvider.
type: boolean
name:
description: >-
A name used to identify the resource.
Expand All @@ -255,6 +261,26 @@ spec:
type: string
namespace:
type: string
ready:
description: Readiness state as determined by check from ResourceProvider.
type: boolean
reference:
description: >-
Reference to managed resource.
type: object
required:
- apiVersion
- kind
- name
properties:
apiVersion:
type: string
kind:
type: string
name:
type: string
namespace:
type: string
state:
description: Resource state synchronized from managed resource
type: object
Expand All @@ -270,6 +296,9 @@ spec:
- Linked ResourceProvider
- Resource Definition
type: string
ready:
description: Readiness state as determined by check from ResourceProviders of resources.
type: boolean
summary:
description: >-
Status summary from current resources state, generated from ResourceProvider configuration.
Expand Down
92 changes: 81 additions & 11 deletions helm/crds/resourcehandles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,18 @@ spec:
subresources:
status: {}
additionalPrinterColumns:
- name: Provider
type: string
jsonPath: .spec.provider.name
- name: Pool
type: string
jsonPath: .spec.resourcePool.name
- name: Healthy
type: boolean
jsonPath: .status.healthy
- name: Ready
type: boolean
jsonPath: .status.ready
- name: Claim Namespace
type: string
jsonPath: .spec.resourceClaim.namespace
Expand Down Expand Up @@ -56,8 +65,6 @@ spec:
spec:
description: ResourceHandle specification
type: object
required:
- resources
properties:
lifespan:
description: >-
Expand Down Expand Up @@ -90,6 +97,24 @@ spec:
Ex: "3d" for 3 days.
This value may be a template string.
type: string
provider:
description: >-
ResourceProvider specification used to generate resources rather than
explicitly list spec.
Mutually exclusive with resources.
type: object
required:
- name
properties:
name:
description: >-
ResourceProvider name.
type: string
parameterValues:
description: >-
Parameter values used with the ResourceProvider to generate resources list.
type: object
x-kubernetes-preserve-unknown-fields: true
resourceClaim:
description: >-
ResourceClaim reference for claim matched to this ResourceHandle when the handle has been claimed.
Expand Down Expand Up @@ -159,7 +184,8 @@ spec:
type: string
reference:
description: >-
Reference to managed resource
Reference to managed resource.
(Deprecated in spec in favor of status).
type: object
required:
- apiVersion
Expand All @@ -180,14 +206,6 @@ spec:
claim's template is used to manage the handle template.
type: object
x-kubernetes-preserve-unknown-fields: true
waitingFor:
description: >-
Indication indicating that resource creation is blocked waiting on a condition.
enum:
- ResourceClaim
- Linked ResourceProvider
- Resource Definition
type: string
vars:
description: >-
Variables to use when evaluating validation checks and templates.
Expand All @@ -202,7 +220,59 @@ spec:
diffBase:
description: Kopf diffbase
type: string
healthy:
description: Health state as determined by check from ResourceProviders of resources.
type: boolean
kopf:
description: Kopf status
type: object
x-kubernetes-preserve-unknown-fields: true
ready:
description: Readiness state as determined by check from ResourceProviders of resources.
type: boolean
resources:
description: Status of resources managed by this ResourceHandle
type: array
items:
type: object
properties:
healthy:
description: Health state as determined by check from ResourceProvider.
type: boolean
name:
description: >-
A name used to identify the resource.
type: string
ready:
description: Readiness state as determined by check from ResourceProvider.
type: boolean
reference:
description: >-
Reference to managed resource.
type: object
required:
- apiVersion
- kind
- name
properties:
apiVersion:
type: string
kind:
type: string
name:
type: string
namespace:
type: string
waitingFor:
description: >-
Indication indicating that resource creation is blocked waiting on a condition.
enum:
- ResourceClaim
- Linked ResourceProvider
- Resource Definition
type: string
summary:
description: >-
Status summary from current resources state, generated from ResourceProvider configuration.
type: object
x-kubernetes-preserve-unknown-fields: true
56 changes: 54 additions & 2 deletions helm/crds/resourcepools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,18 @@ spec:
subresources:
status: {}
additionalPrinterColumns:
- name: ResourceProvider
jsonPath: .spec.provider.name
type: string
- name: Min
type: integer
jsonPath: .spec.minAvailable
- name: Available
type: integer
jsonPath: .status.resourceHandleCount.available
- name: Ready
type: integer
jsonPath: .status.resourceHandleCount.ready
- name: Age
type: date
jsonPath: .metadata.creationTimestamp
Expand Down Expand Up @@ -47,9 +56,11 @@ spec:
spec:
description: ResourcePool specification
type: object
required:
- resources
properties:
deleteUnhealthyResourceHandles:
description: >-
If set then any unbound ResourceHandle that fails health check will be automatically deleted.
type: boolean
lifespan:
description: >-
Lifespan configuration for ResourceHandle provisioned by the ResourcePool.
Expand Down Expand Up @@ -83,12 +94,35 @@ spec:
Ex: "3d" for 3 days.
type: string
pattern: ^[0-9]+[smhd]$
maxUnready:
description: >-
Maximum number of resource handles that do not pass readiness check.
type: integer
minimum: 0
minAvailable:
description: >-
Minimum number of unclaimed resource handles to maintain for the
ResourcePool.
type: integer
minimum: 0
provider:
description: >-
ResourceProvider specification used to generate resources rather than
explicitly list spec.
Mutually exclusive with resources.
type: object
required:
- name
properties:
name:
description: >-
ResourceProvider name.
type: string
parameterValues:
description: >-
Parameter values used with the ResourceProvider to generate resources list.
type: object
x-kubernetes-preserve-unknown-fields: true
resources:
description: >-
Resources description to apply to ResourceHandles for the pool.
Expand Down Expand Up @@ -141,3 +175,21 @@ spec:
description: Kopf status
type: object
x-kubernetes-preserve-unknown-fields: true
resourceHandleCount:
type: object
properties:
available:
type: integer
ready:
type: integer
resourceHandles:
type: array
items:
type: object
properties:
healthy:
type: boolean
name:
type: string
ready:
type: boolean
18 changes: 18 additions & 0 deletions helm/crds/resourceproviders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ spec:
If set to true, then ResourceHandle creation is disabled for any ResourceClaim using
this ResourceProvider.
type: boolean
healthCheck:
description: >-
Check to determine if provisioned resources are healthy.
Any pooled ResourceHandle that fails its health check will not be assigned to a ResourceClaim.
Syntax is a template that should return a boolean.
type: string
lifespan:
description: >-
Used to generate lifespan configuration for ResourceHandles using the ResourceProvider.
Expand All @@ -102,6 +108,13 @@ spec:
Ex: "3d" for 3 days.
This value may be a template string.
type: string
unclaimed:
description: >-
Lifespan applied to ResourceHandles in the pool to allow for replacement of unused resources.
Configured as a whole number followed by units "s", "m", "h", or "d" for seconds, minutes, hours, or days.
Ex: "3d" for 3 days.
type: string
pattern: ^[0-9]+[smhd]$
linkedResourceProviders:
description: >-
List of ResourceProviders this one depends upon.
Expand Down Expand Up @@ -236,6 +249,11 @@ spec:
fields to specific numeric ranges.
type: object
x-kubernetes-preserve-unknown-fields: true
readinessCheck:
description: >-
Check to determine when provisioned resources are ready.
Syntax is a template that should return a boolean.
type: string
resourceClaimAnnotations:
description: >-
Annotations to apply to ResourceClaim.
Expand Down
Loading
Loading