Skip to content

Commit

Permalink
reworking codey API
Browse files Browse the repository at this point in the history
  • Loading branch information
wejdross committed Jan 30, 2025
1 parent 3db515d commit 5b9b101
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 87 deletions.
13 changes: 12 additions & 1 deletion apis/codey/dbaas_vshn_codey.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

//go:generate yq -i e ../generated/codey.io_codeys.yaml --expression "with(.spec.versions[]; .schema.openAPIV3Schema.properties.spec.properties.parameters.properties.size.default={})"

// +groupName=codey.io
// +versionName=v1
// +kubebuilder:object:root=true
Expand Down Expand Up @@ -48,7 +50,7 @@ type CodeyParameters struct {
// Size contains settings to control the sizing of a service.
// +kubebuilder:validation:Enum=mini;small
// +kubebuilder:default=mini
Size string `json:"size,omitempty"`
Size VSHNCodeySizeSpec `json:"size,omitempty"`
}

// CodeyServiceSpec contains Codey DBaaS specific properties
Expand Down Expand Up @@ -111,3 +113,12 @@ type XCodeyList struct {

Items []XCodey `json:"items"`
}

// VSHNCodeySizeSpec contains settings to control the sizing of a service.
type VSHNCodeySizeSpec struct {
// Size contains settings to control the sizing of a service.
// +kubebuilder:validation:Enum=mini;small
// +kubebuilder:default=mini
// Plan is the name of the resource plan that defines the compute resources.
Plan string `json:"plan,omitempty"`
}
16 changes: 16 additions & 0 deletions apis/codey/zz_generated.deepcopy.go

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

177 changes: 92 additions & 85 deletions crds/codey.io_codeys.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,89 +14,96 @@ spec:
singular: codey
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: Codey is the API for creating Codey instances.
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: Spec defines the desired state of a Codey.
properties:
parameters:
default: {}
description: Parameters are the configurable fields of a Codey.
properties:
service:
description: Service contains Codey DBaaS specific properties
properties:
adminEmail:
description: AdminEmail for email notifications.
type: string
fqdn:
description: |-
FQDN contains the FQDNs array, which will be used for the ingress.
If it's not set, no ingress will be deployed.
This also enables strict hostname checking for this FQDN.
items:
- name: v1
schema:
openAPIV3Schema:
description: Codey is the API for creating Codey instances.
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: Spec defines the desired state of a Codey.
properties:
parameters:
default: {}
description: Parameters are the configurable fields of a Codey.
properties:
service:
description: Service contains Codey DBaaS specific properties
properties:
adminEmail:
description: AdminEmail for email notifications.
type: string
minItems: 1
type: array
majorVersion:
description: |-
Version contains supported version of Codey.
Multiple versions are supported.
type: string
required:
- adminEmail
- fqdn
type: object
size:
default: mini
description: Size contains settings to control the sizing of a
service.
enum:
- mini
- small
type: string
type: object
writeConnectionSecretToRef:
description: WriteConnectionSecretToRef references a secret to which
the connection details will be written.
properties:
name:
description: Name of the secret.
type: string
required:
- name
type: object
type: object
status:
description: Status reflects the observed state of a Codey.
properties:
instanceNamespace:
description: InstanceNamespace contains the name of the namespace
where the instance resides
type: string
type: object
required:
- spec
type: object
served: true
storage: true
fqdn:
description: |-
FQDN contains the FQDNs array, which will be used for the ingress.
If it's not set, no ingress will be deployed.
This also enables strict hostname checking for this FQDN.
items:
type: string
minItems: 1
type: array
majorVersion:
description: |-
Version contains supported version of Codey.
Multiple versions are supported.
type: string
required:
- adminEmail
- fqdn
type: object
size:
default: {}
description: Size contains settings to control the sizing of a service.
enum:
- mini
- small
properties:
plan:
default: mini
description: |-
Size contains settings to control the sizing of a service.
Plan is the name of the resource plan that defines the compute resources.
enum:
- mini
- small
type: string
type: object
type: object
writeConnectionSecretToRef:
description: WriteConnectionSecretToRef references a secret to which the connection details will be written.
properties:
name:
description: Name of the secret.
type: string
required:
- name
type: object
type: object
status:
description: Status reflects the observed state of a Codey.
properties:
instanceNamespace:
description: InstanceNamespace contains the name of the namespace where the instance resides
type: string
type: object
required:
- spec
type: object
served: true
storage: true
12 changes: 11 additions & 1 deletion crds/codey.io_xcodeys.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,17 @@ spec:
enum:
- mini
- small
type: string
properties:
plan:
default: mini
description: |-
Size contains settings to control the sizing of a service.
Plan is the name of the resource plan that defines the compute resources.
enum:
- mini
- small
type: string
type: object
type: object
providerConfigRef:
default:
Expand Down

0 comments on commit 5b9b101

Please sign in to comment.