Skip to content

Commit

Permalink
refactor: make some fields optional
Browse files Browse the repository at this point in the history
  • Loading branch information
zyy17 committed Sep 19, 2024
1 parent d207e66 commit 7cd8c90
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 50 deletions.
4 changes: 2 additions & 2 deletions apis/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ type MainContainerSpec struct {
// Defaults to `Always` if `:latest` tag is specified, or IfNotPresent otherwise.
// Cannot be updated.
// More info: `https://kubernetes.io/docs/concepts/containers/images#updating-images`
// ImagePullPolicy field is from `orev1.Container.ImagePullPolicy`.
// ImagePullPolicy field is from `corev1.Container.ImagePullPolicy`.
// +optional
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`

Expand Down Expand Up @@ -635,7 +635,7 @@ type PrometheusMonitorSpec struct {
Enabled bool `json:"enabled"`

// Labels is the labels for the PodMonitor.
// +required
// +optional
Labels map[string]string `json:"labels"`

// Interval is the scape interval for the PodMonitor.
Expand Down
6 changes: 3 additions & 3 deletions apis/v1alpha1/greptimedbcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
// ComponentSpec is the common specification for all components(`frontend`/`meta`/`datanode`/`flownode`).
type ComponentSpec struct {
// The number of replicas of the components.
// +required
// +kubebuilder:validation:Minimum=1
Replicas *int32 `json:"replicas"`
// +optional
// +kubebuilder:validation:Minimum=0
Replicas *int32 `json:"replicas,omitempty"`

// The content of the configuration file of the component in TOML format.
// +optional
Expand Down
16 changes: 4 additions & 12 deletions config/crd/resources/greptime.io_greptimedbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2821,7 +2821,7 @@ spec:
type: integer
replicas:
format: int32
minimum: 1
minimum: 0
type: integer
rpcPort:
format: int32
Expand Down Expand Up @@ -5610,16 +5610,14 @@ spec:
type: object
type: array
type: object
required:
- replicas
type: object
flownode:
properties:
config:
type: string
replicas:
format: int32
minimum: 1
minimum: 0
type: integer
rpcPort:
format: int32
Expand Down Expand Up @@ -8386,16 +8384,14 @@ spec:
type: object
type: array
type: object
required:
- replicas
type: object
frontend:
properties:
config:
type: string
replicas:
format: int32
minimum: 1
minimum: 0
type: integer
service:
properties:
Expand Down Expand Up @@ -11181,8 +11177,6 @@ spec:
required:
- secretName
type: object
required:
- replicas
type: object
httpPort:
format: int32
Expand All @@ -11209,7 +11203,7 @@ spec:
type: integer
replicas:
format: int32
minimum: 1
minimum: 0
type: integer
rpcPort:
format: int32
Expand Down Expand Up @@ -13980,7 +13974,6 @@ spec:
type: object
required:
- etcdEndpoints
- replicas
type: object
mysqlPort:
format: int32
Expand Down Expand Up @@ -14075,7 +14068,6 @@ spec:
type: object
required:
- enabled
- labels
type: object
rpcPort:
format: int32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2925,7 +2925,6 @@ spec:
type: object
required:
- enabled
- labels
type: object
rpcPort:
format: int32
Expand Down
12 changes: 6 additions & 6 deletions docs/api-references/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ _Appears in:_

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `replicas` _integer_ | The number of replicas of the components. | | Minimum: 1 <br /> |
| `replicas` _integer_ | The number of replicas of the components. | | Minimum: 0 <br /> |
| `config` _string_ | The content of the configuration file of the component in TOML format. | | |
| `template` _[PodTemplateSpec](#podtemplatespec)_ | Template defines the pod template for the component, if not specified, the pod template will use the default value. | | |

Expand Down Expand Up @@ -106,7 +106,7 @@ _Appears in:_

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `replicas` _integer_ | The number of replicas of the components. | | Minimum: 1 <br /> |
| `replicas` _integer_ | The number of replicas of the components. | | Minimum: 0 <br /> |
| `config` _string_ | The content of the configuration file of the component in TOML format. | | |
| `template` _[PodTemplateSpec](#podtemplatespec)_ | Template defines the pod template for the component, if not specified, the pod template will use the default value. | | |
| `rpcPort` _integer_ | RPCPort is the gRPC port of the datanode. | | |
Expand Down Expand Up @@ -186,7 +186,7 @@ _Appears in:_

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `replicas` _integer_ | The number of replicas of the components. | | Minimum: 1 <br /> |
| `replicas` _integer_ | The number of replicas of the components. | | Minimum: 0 <br /> |
| `config` _string_ | The content of the configuration file of the component in TOML format. | | |
| `template` _[PodTemplateSpec](#podtemplatespec)_ | Template defines the pod template for the component, if not specified, the pod template will use the default value. | | |
| `rpcPort` _integer_ | The gRPC port of the flownode. | | |
Expand Down Expand Up @@ -222,7 +222,7 @@ _Appears in:_

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `replicas` _integer_ | The number of replicas of the components. | | Minimum: 1 <br /> |
| `replicas` _integer_ | The number of replicas of the components. | | Minimum: 0 <br /> |
| `config` _string_ | The content of the configuration file of the component in TOML format. | | |
| `template` _[PodTemplateSpec](#podtemplatespec)_ | Template defines the pod template for the component, if not specified, the pod template will use the default value. | | |
| `service` _[ServiceSpec](#servicespec)_ | Service is the service configuration of the frontend. | | |
Expand Down Expand Up @@ -458,7 +458,7 @@ _Appears in:_
| `livenessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#probe-v1-core)_ | Periodic probe of container liveness.<br />Container will be restarted if the probe fails.<br />More info: `https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes`<br />LivenessProbe field is from `corev1.Container.LivenessProbe`. | | |
| `readinessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#probe-v1-core)_ | Periodic probe of container service readiness.<br />Container will be removed from service endpoints if the probe fails.<br />ReadinessProbe field is from `corev1.Container.LivenessProbe`.<br />More info: `https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes` | | |
| `lifecycle` _[Lifecycle](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#lifecycle-v1-core)_ | Actions that the management system should take in response to container lifecycle events.<br />Cannot be updated.<br />Lifecycle field is from `corev1.Container.Lifecycle`. | | |
| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#pullpolicy-v1-core)_ | Image pull policy.<br />One of `Always`, `Never`, `IfNotPresent`.<br />Defaults to `Always` if `:latest` tag is specified, or IfNotPresent otherwise.<br />Cannot be updated.<br />More info: `https://kubernetes.io/docs/concepts/containers/images#updating-images`<br />ImagePullPolicy field is from `orev1.Container.ImagePullPolicy`. | | |
| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#pullpolicy-v1-core)_ | Image pull policy.<br />One of `Always`, `Never`, `IfNotPresent`.<br />Defaults to `Always` if `:latest` tag is specified, or IfNotPresent otherwise.<br />Cannot be updated.<br />More info: `https://kubernetes.io/docs/concepts/containers/images#updating-images`<br />ImagePullPolicy field is from `corev1.Container.ImagePullPolicy`. | | |
| `volumeMounts` _[VolumeMount](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#volumemount-v1-core) array_ | Pod volumes to mount into the container's filesystem.<br />Cannot be updated. | | |


Expand All @@ -475,7 +475,7 @@ _Appears in:_

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `replicas` _integer_ | The number of replicas of the components. | | Minimum: 1 <br /> |
| `replicas` _integer_ | The number of replicas of the components. | | Minimum: 0 <br /> |
| `config` _string_ | The content of the configuration file of the component in TOML format. | | |
| `template` _[PodTemplateSpec](#podtemplatespec)_ | Template defines the pod template for the component, if not specified, the pod template will use the default value. | | |
| `rpcPort` _integer_ | RPCPort is the gRPC port of the meta. | | |
Expand Down
17 changes: 4 additions & 13 deletions manifests/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2827,7 +2827,7 @@ spec:
type: integer
replicas:
format: int32
minimum: 1
minimum: 0
type: integer
rpcPort:
format: int32
Expand Down Expand Up @@ -5616,16 +5616,14 @@ spec:
type: object
type: array
type: object
required:
- replicas
type: object
flownode:
properties:
config:
type: string
replicas:
format: int32
minimum: 1
minimum: 0
type: integer
rpcPort:
format: int32
Expand Down Expand Up @@ -8392,16 +8390,14 @@ spec:
type: object
type: array
type: object
required:
- replicas
type: object
frontend:
properties:
config:
type: string
replicas:
format: int32
minimum: 1
minimum: 0
type: integer
service:
properties:
Expand Down Expand Up @@ -11187,8 +11183,6 @@ spec:
required:
- secretName
type: object
required:
- replicas
type: object
httpPort:
format: int32
Expand All @@ -11215,7 +11209,7 @@ spec:
type: integer
replicas:
format: int32
minimum: 1
minimum: 0
type: integer
rpcPort:
format: int32
Expand Down Expand Up @@ -13986,7 +13980,6 @@ spec:
type: object
required:
- etcdEndpoints
- replicas
type: object
mysqlPort:
format: int32
Expand Down Expand Up @@ -14081,7 +14074,6 @@ spec:
type: object
required:
- enabled
- labels
type: object
rpcPort:
format: int32
Expand Down Expand Up @@ -17141,7 +17133,6 @@ spec:
type: object
required:
- enabled
- labels
type: object
rpcPort:
format: int32
Expand Down
17 changes: 4 additions & 13 deletions manifests/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2820,7 +2820,7 @@ spec:
type: integer
replicas:
format: int32
minimum: 1
minimum: 0
type: integer
rpcPort:
format: int32
Expand Down Expand Up @@ -5609,16 +5609,14 @@ spec:
type: object
type: array
type: object
required:
- replicas
type: object
flownode:
properties:
config:
type: string
replicas:
format: int32
minimum: 1
minimum: 0
type: integer
rpcPort:
format: int32
Expand Down Expand Up @@ -8385,16 +8383,14 @@ spec:
type: object
type: array
type: object
required:
- replicas
type: object
frontend:
properties:
config:
type: string
replicas:
format: int32
minimum: 1
minimum: 0
type: integer
service:
properties:
Expand Down Expand Up @@ -11180,8 +11176,6 @@ spec:
required:
- secretName
type: object
required:
- replicas
type: object
httpPort:
format: int32
Expand All @@ -11208,7 +11202,7 @@ spec:
type: integer
replicas:
format: int32
minimum: 1
minimum: 0
type: integer
rpcPort:
format: int32
Expand Down Expand Up @@ -13979,7 +13973,6 @@ spec:
type: object
required:
- etcdEndpoints
- replicas
type: object
mysqlPort:
format: int32
Expand Down Expand Up @@ -14074,7 +14067,6 @@ spec:
type: object
required:
- enabled
- labels
type: object
rpcPort:
format: int32
Expand Down Expand Up @@ -17134,7 +17126,6 @@ spec:
type: object
required:
- enabled
- labels
type: object
rpcPort:
format: int32
Expand Down

0 comments on commit 7cd8c90

Please sign in to comment.