Skip to content

Commit

Permalink
Revise resource calculator api to support edit mode
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Oct 23, 2023
1 parent 45b3cbc commit 9e41b19
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 4 deletions.
30 changes: 28 additions & 2 deletions apis/meta/v1alpha1/openapi_generated.go

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

7 changes: 6 additions & 1 deletion apis/meta/v1alpha1/resourcecalculator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,16 @@ type ResourceCalculator struct {
metav1.ObjectMeta `json:"metadata,omitempty"`

// +kubebuilder:pruning:PreserveUnknownFields
Request *runtime.RawExtension `json:"request,omitempty"`
Request *ResourceCalculatorRequest `json:"request,omitempty"`
// +optional
Response *ResourceCalculatorResponse `json:"response,omitempty"`
}

type ResourceCalculatorRequest struct {
Resource *runtime.RawExtension `json:"resource,omitempty"`
Edit bool `json:"edit,omitempty"`
}

type ResourceCalculatorResponse struct {
APIType kmapi.ResourceID `json:"apiType"`
// +optional
Expand Down
23 changes: 22 additions & 1 deletion apis/meta/v1alpha1/zz_generated.deepcopy.go

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

6 changes: 6 additions & 0 deletions crds/meta.k8s.appscode.com_resourcecalculators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ spec:
metadata:
type: object
request:
properties:
edit:
type: boolean
resource:
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
x-kubernetes-preserve-unknown-fields: true
response:
Expand Down

0 comments on commit 9e41b19

Please sign in to comment.