Skip to content

Commit

Permalink
fix: remove field resourceConstraintRef (#4366)
Browse files Browse the repository at this point in the history
(cherry picked from commit 56053d5)
  • Loading branch information
iziang committed Jul 19, 2023
1 parent f6cc6e6 commit aa2e2dd
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 23 deletions.
6 changes: 2 additions & 4 deletions deploy/apecloud-mysql/templates/class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ metadata:
clusterdefinition.kubeblocks.io/name: apecloud-mysql
spec:
groups:
- resourceConstraintRef: kb-resource-constraint-general
template: |
- template: |
cpu: {{ printf "{{ .cpu }}" }}
memory: {{ printf "{{ .memory }}Gi" }}
vars: [ cpu, memory]
Expand All @@ -28,8 +27,7 @@ spec:
- args: [ "64", "256"]
- args: [ "128", "512"]
- resourceConstraintRef: kb-resource-constraint-memory-optimized
template: |
- template: |
cpu: {{ printf "{{ .cpu }}" }}
memory: {{ printf "{{ .memory }}Gi" }}
vars: [ cpu, memory]
Expand Down
6 changes: 0 additions & 6 deletions deploy/helm/templates/class/componentclassconstraint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,3 @@ spec:
storage:
min: 20Gi
max: 10Ti
selector:
- clusterDefRef: apecloud-mysql
components:
- componentDefRef: mysql
constraints:
- "general"
3 changes: 1 addition & 2 deletions internal/cli/cmd/class/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ import (
)

const ComponentClassTemplate = `
- resourceConstraintRef: kb-resource-constraint-general
# class template, you can declare variables and set default values here
- # class template, you can declare variables and set default values here
template: |
cpu: "{{ or .cpu 1 }}"
memory: "{{ or .memory 4 }}Gi"
Expand Down
7 changes: 2 additions & 5 deletions internal/cli/testing/testdata/class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ metadata:
clusterdefinition.kubeblocks.io/name: apecloud-mysql
spec:
groups:
- # resource constraint name, such as general, memory-optimized, cpu-optimized etc.
resourceConstraintRef: kb-resource-constraint-general
# class schema template, you can set default resource values here
- # class schema template, you can set default resource values here
template: |
cpu: "{{ .cpu }}"
memory: "{{ .memory }}Gi"
Expand All @@ -36,8 +34,7 @@ spec:
- args: [ "64", "256"]
- args: [ "128", "512"]

- resourceConstraintRef: kb-resource-constraint-memory-optimized
template: |
- template: |
cpu: "{{ .cpu }}"
memory: "{{ .memory }}Gi"
vars: [ cpu, memory]
Expand Down
6 changes: 2 additions & 4 deletions internal/cli/testing/testdata/custom_class.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
- resourceConstraintRef: kb-resource-constraint-general
template: |
- template: |
cpu: "{{ or .cpu 1 }}"
memory: "{{ or .memory 4 }}Gi"
vars: [cpu, memory]
Expand All @@ -11,8 +10,7 @@
cpu: 4
memory: 16Gi
- resourceConstraintRef: kb-resource-constraint-memory-optimized
template: |
- template: |
cpu: "{{ or .cpu 1 }}"
memory: "{{ or .memory 4 }}Gi"
vars: [cpu, memory]
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/testdata/smoketest/wesql/02_custom_class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ metadata:
clusterdefinition.kubeblocks.io/name: apecloud-mysql
spec:
groups:
- resourceConstraintRef: kb-resource-constraint-custom
template: |
- template: |
cpu: "{{ or .cpu 1 }}"
memory: "{{ or .memory 4 }}Gi"
vars: [ cpu, memory]
Expand Down

0 comments on commit aa2e2dd

Please sign in to comment.