Skip to content

Commit

Permalink
Merge branch 'main' into support/implement-kbagent-multiple-images
Browse files Browse the repository at this point in the history
  • Loading branch information
Ursasi committed Aug 28, 2024
2 parents 02c6a42 + 95d2f3b commit 902fbfb
Show file tree
Hide file tree
Showing 48 changed files with 259 additions and 713 deletions.
2 changes: 1 addition & 1 deletion apis/apps/v1alpha1/opsdefinition_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ type OpsDefinitionStatus struct {
// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:categories={kubeblocks,all},scope=Cluster,shortName=od
// +kubebuilder:resource:categories={kubeblocks},scope=Cluster,shortName=od
// +kubebuilder:printcolumn:name="STATUS",type="string",JSONPath=".status.phase",description="OpsDefinition status phase."
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"

Expand Down
1 change: 0 additions & 1 deletion config/crd/bases/apps.kubeblocks.io_opsdefinitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ spec:
names:
categories:
- kubeblocks
- all
kind: OpsDefinition
listKind: OpsDefinitionList
plural: opsdefinitions
Expand Down
1 change: 0 additions & 1 deletion deploy/helm/crds/apps.kubeblocks.io_opsdefinitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ spec:
names:
categories:
- kubeblocks
- all
kind: OpsDefinition
listKind: OpsDefinitionList
plural: opsdefinitions
Expand Down
19 changes: 12 additions & 7 deletions examples/apecloud-mysql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ ApeCloud MySQL is a database that is compatible with MySQL syntax and achieves h

This example assumes that you have a Kubernetes cluster installed and running, and that you have installed the kubectl command line tool and helm somewhere in your path. Please see the [getting started](https://kubernetes.io/docs/setup/) and [Installing Helm](https://helm.sh/docs/intro/install/) for installation instructions for your platform.

Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "0.9.0" with the version you want to use.
Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "`$kb_version`" with the version you want to use.
```bash
# Create dependent CRDs
kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v0.9.0/kubeblocks_crds.yaml
# If github is not accessible or very slow for you, please use following command instead
kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v0.9.0/kubeblocks_crds.yaml

# Add Helm repo
helm repo add kubeblocks https://apecloud.github.io/helm-charts
# If github is not accessible or very slow for you, please use following repo instead
Expand All @@ -21,8 +16,18 @@ helm repo add kubeblocks https://jihulab.com/api/v4/projects/85949/packages/helm
# Update helm repo
helm repo update

# Get the versions of KubeBlocks and select the one you want to use
helm search repo kubeblocks/kubeblocks --versions
# If you want to obtain the development versions of KubeBlocks, Please add the '--devel' parameter as the following command
helm search repo kubeblocks/kubeblocks --versions --devel

# Create dependent CRDs
kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v$kb_version/kubeblocks_crds.yaml
# If github is not accessible or very slow for you, please use following command instead
kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v$kb_version/kubeblocks_crds.yaml

# Install KubeBlocks
helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="0.9.0"
helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="$kb_version"
```


Expand Down
14 changes: 2 additions & 12 deletions examples/apecloud-mysql/cluster-cmpd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: Cluster
metadata:
name: acmysql-cluster
namespace: default
labels:
auditLogEnabled: "false"
spec:
# Specifies the behavior when a Cluster is deleted.
# - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact.
Expand All @@ -16,18 +18,6 @@ spec:
- name: mysql
# References the name of a ComponentDefinition. The ComponentDefinition specifies the behavior and characteristics of the Component. If both `componentDefRef` and `componentDef` are provided, the `componentDef` will take precedence over `componentDefRef`.
componentDef: apecloud-mysql
# Specifies a group of affinity scheduling rules for the Component. It allows users to control how the Component's Pods are scheduled onto nodes in the cluster.
affinity:
podAntiAffinity: Preferred
topologyKeys:
- kubernetes.io/hostname
tenancy: SharedNode
# Allows the Component to be scheduled onto nodes with matching taints.
tolerations:
- key: kb-data
operator: Equal
value: 'true'
effect: NoSchedule
# Specifies which types of logs should be collected for the Cluster.
enabledLogs:
- error
Expand Down
56 changes: 25 additions & 31 deletions examples/apecloud-mysql/cluster-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,23 @@ kind: Cluster
metadata:
name: acmysql-cluster
namespace: default
annotations:
kubeblocks.io/extra-env: '{"KB_PROXY_ENABLED":"on","ETCDCTL_API": "3"}'
labels:
auditLogEnabled: "false"
spec:
# Specifies the name of the ClusterDefinition to use when creating a Cluster.
clusterDefinitionRef: apecloud-mysql
# Refers to the ClusterVersion name. Deprecated since v0.9, use ComponentVersion instead. This field is maintained for backward compatibility and its use is discouraged. Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
clusterVersionRef: ac-mysql-8.0.30
# Specifies the behavior when a Cluster is deleted.
# - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact.
# - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations.
# - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data.
# - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss.
terminationPolicy: Delete
# Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster.
affinity:
# Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance.
podAntiAffinity: Preferred
# Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints.
topologyKeys:
- kubernetes.io/hostname
# Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`.
# - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s.
# - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node.
tenancy: SharedNode
# An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints.
tolerations:
- key: kb-data
operator: Equal
value: "true"
effect: NoSchedule
# Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. ClusterComponentSpec defines the specifications for a Component in a Cluster.
componentSpecs:
- name: mysql
componentDefRef: mysql
componentDef: apecloud-mysql
enabledLogs:
- error
- general
- slow
disableExporter: true
replicas: 3
Expand All @@ -57,13 +39,25 @@ spec:
resources:
requests:
storage: 20Gi
- componentDefRef: vtcontroller
enabledLogs:
- error
- warning
- info
- componentDef: etcd
disableExporter: true
name: etcd
replicas: 3
resources:
limits:
cpu: '0.5'
memory: 0.5Gi
volumeClaimTemplates:
- name: data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
- componentDef: wescale-ctrl
disableExporter: true
name: vtcontroller
name: wescale-ctrl
replicas: 1
resources:
limits:
Expand All @@ -77,14 +71,14 @@ spec:
resources:
requests:
storage: 20Gi
- componentDefRef: vtgate
- componentDef: wescale
enabledLogs:
- error
- warning
- info
- queryLog
disableExporter: true
name: vtgate
name: wescale
replicas: 1
resources:
limits:
Expand Down
25 changes: 3 additions & 22 deletions examples/apecloud-mysql/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,21 @@ kind: Cluster
metadata:
name: acmysql-cluster
namespace: default
labels:
auditLogEnabled: "false"
spec:
# Specifies the name of the ClusterDefinition to use when creating a Cluster.
clusterDefinitionRef: apecloud-mysql
# Refers to the ClusterVersion name. Deprecated since v0.9, use ComponentVersion instead. This field is maintained for backward compatibility and its use is discouraged. Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
clusterVersionRef: ac-mysql-8.0.30
# Specifies the behavior when a Cluster is deleted.
# - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact.
# - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations.
# - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data.
# - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss.
terminationPolicy: Delete
# Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster.
affinity:
# Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance.
podAntiAffinity: Preferred
# Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints.
topologyKeys:
- kubernetes.io/hostname
# Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`.
# - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s.
# - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node.
tenancy: SharedNode
# An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints.
tolerations:
- key: kb-data
operator: Equal
value: 'true'
effect: NoSchedule
# Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster.
# Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster.
# ClusterComponentSpec defines the specifications for a Component in a Cluster.
componentSpecs:
- name: mysql
componentDefRef: mysql
componentDef: apecloud-mysql
enabledLogs:
- error
- general
Expand Down
2 changes: 1 addition & 1 deletion examples/apecloud-mysql/configure-vtgate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
# Specifies a component and its configuration updates. This field is deprecated and replaced by `reconfigures`.
reconfigure:
# Specifies the name of the Component.
componentName: vtgate
componentName: wescale
# Contains a list of ConfigurationItem objects, specifying the Component's configuration template name, upgrade policy, and parameter key-value pairs to be updated.
configurations:
# Sets the parameters to be updated. It should contain at least one item.
Expand Down
14 changes: 2 additions & 12 deletions examples/apecloud-mysql/restore-cmpd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: Cluster
metadata:
name: acmysql-cluster-restore
namespace: default
labels:
auditLogEnabled: "false"
annotations:
kubeblocks.io/restore-from-backup: '{"mysql":{"connectionPassword":"<backup-connection-password>","name":"acmysql-cluster-backup","namespace":"default","volumeRestorePolicy":"Parallel"}}'
spec:
Expand All @@ -18,18 +20,6 @@ spec:
- name: mysql
# References the name of a ComponentDefinition. The ComponentDefinition specifies the behavior and characteristics of the Component. If both `componentDefRef` and `componentDef` are provided, the `componentDef` will take precedence over `componentDefRef`.
componentDef: apecloud-mysql
# Specifies a group of affinity scheduling rules for the Component. It allows users to control how the Component's Pods are scheduled onto nodes in the cluster.
affinity:
podAntiAffinity: Preferred
topologyKeys:
- kubernetes.io/hostname
tenancy: SharedNode
# Allows the Component to be scheduled onto nodes with matching taints.
tolerations:
- key: kb-data
operator: Equal
value: 'true'
effect: NoSchedule
# Specifies which types of logs should be collected for the Cluster.
enabledLogs:
- error
Expand Down
25 changes: 3 additions & 22 deletions examples/apecloud-mysql/restore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,23 @@ kind: Cluster
metadata:
name: acmysql-cluster-restore
namespace: default
labels:
auditLogEnabled: "false"
annotations:
kubeblocks.io/restore-from-backup: '{"mysql":{"connectionPassword":"<backup-connection-password>","name":"acmysql-cluster-backup","namespace":"default","volumeRestorePolicy":"Parallel"}}'
spec:
# Specifies the name of the ClusterDefinition to use when creating a Cluster.
clusterDefinitionRef: apecloud-mysql
# Refers to the ClusterVersion name. Deprecated since v0.9, use ComponentVersion instead. This field is maintained for backward compatibility and its use is discouraged. Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases.
clusterVersionRef: ac-mysql-8.0.30
# Specifies the behavior when a Cluster is deleted.
# - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact.
# - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations.
# - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data.
# - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss.
terminationPolicy: Delete
# Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster.
affinity:
# Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance.
podAntiAffinity: Preferred
# Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints.
topologyKeys:
- kubernetes.io/hostname
# Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`.
# - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s.
# - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node.
tenancy: SharedNode
# An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints.
tolerations:
- key: kb-data
operator: Equal
value: 'true'
effect: NoSchedule
# Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster.
# Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster.
# ClusterComponentSpec defines the specifications for a Component in a Cluster.
componentSpecs:
- name: mysql
componentDefRef: mysql
componentDef: apecloud-mysql
enabledLogs:
- error
- general
Expand Down
19 changes: 12 additions & 7 deletions examples/kafka/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ Apache Kafka is a distributed streaming platform designed to build real-time pip

This example assumes that you have a Kubernetes cluster installed and running, and that you have installed the kubectl command line tool and helm somewhere in your path. Please see the [getting started](https://kubernetes.io/docs/setup/) and [Installing Helm](https://helm.sh/docs/intro/install/) for installation instructions for your platform.

Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "0.9.0" with the version you want to use.
Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "`$kb_version`" with the version you want to use.
```bash
# Create dependent CRDs
kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v0.9.0/kubeblocks_crds.yaml
# If github is not accessible or very slow for you, please use following command instead
kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v0.9.0/kubeblocks_crds.yaml

# Add Helm repo
helm repo add kubeblocks https://apecloud.github.io/helm-charts
# If github is not accessible or very slow for you, please use following repo instead
Expand All @@ -21,8 +16,18 @@ helm repo add kubeblocks https://jihulab.com/api/v4/projects/85949/packages/helm
# Update helm repo
helm repo update

# Get the versions of KubeBlocks and select the one you want to use
helm search repo kubeblocks/kubeblocks --versions
# If you want to obtain the development versions of KubeBlocks, Please add the '--devel' parameter as the following command
helm search repo kubeblocks/kubeblocks --versions --devel

# Create dependent CRDs
kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v$kb_version/kubeblocks_crds.yaml
# If github is not accessible or very slow for you, please use following command instead
kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v$kb_version/kubeblocks_crds.yaml

# Install KubeBlocks
helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="0.9.0"
helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="$kb_version"
```


Expand Down
10 changes: 0 additions & 10 deletions examples/kafka/cluster-cmpd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@ spec:
componentDef: kafka-combine
tls: false
replicas: 1
affinity:
podAntiAffinity: Preferred
topologyKeys:
- kubernetes.io/hostname
tenancy: SharedNode
tolerations:
- key: kb-data
operator: Equal
value: 'true'
effect: NoSchedule
serviceAccountName: kb-kafka-cluster
resources:
limits:
Expand Down
Loading

0 comments on commit 902fbfb

Please sign in to comment.