Skip to content

Commit

Permalink
Update Concepts Docs (#664)
Browse files Browse the repository at this point in the history
Signed-off-by: Neaj Morshad <[email protected]>
  • Loading branch information
Neaj-Morshad-101 authored Aug 22, 2024
1 parent f67480b commit 78e2f8f
Show file tree
Hide file tree
Showing 12 changed files with 489 additions and 191 deletions.
127 changes: 83 additions & 44 deletions docs/guides/elasticsearch/concepts/elasticsearch/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,16 @@ Currently supported node types are -
data:
maxUnavailable: 1
replicas: 3
resources:
limits:
cpu: 500m
memory: 1Gi
requests:
cpu: 500m
memory: 1Gi
podTemplate:
spec:
containers:
- name: "elasticsearch"
resources:
requests:
cpu: "500m"
limits:
cpu: "600m"
memory: "1.5Gi"
storage:
accessModes:
- ReadWriteOnce
Expand All @@ -351,13 +354,16 @@ Currently supported node types are -
ingest:
maxUnavailable: 1
replicas: 3
resources:
limits:
cpu: 500m
memory: 1Gi
requests:
cpu: 500m
memory: 1Gi
podTemplate:
spec:
containers:
- name: "elasticsearch"
resources:
requests:
cpu: "500m"
limits:
cpu: "600m"
memory: "1.5Gi"
storage:
accessModes:
- ReadWriteOnce
Expand All @@ -369,13 +375,17 @@ Currently supported node types are -
master:
maxUnavailable: 1
replicas: 2
resources:
limits:
cpu: 500m
memory: 1Gi
requests:
cpu: 500m
memory: 1Gi
podTemplate:
spec:
containers:
- name: "elasticsearch"
resources:
limits:
cpu: 500m
memory: 1Gi
requests:
cpu: 500m
memory: 1Gi
storage:
accessModes:
- ReadWriteOnce
Expand Down Expand Up @@ -718,9 +728,9 @@ KubeDB accept following fields to set in `spec.podTemplate:`
- annotations (petset's annotation)
- labels (petset's labels)
- spec:
- args
- env
- resources
- containers
- volumes
- podPlacementPolicy
- initContainers
- imagePullSecrets
- nodeSelector
Expand All @@ -735,24 +745,24 @@ KubeDB accept following fields to set in `spec.podTemplate:`
- readinessProbe
- lifecycle

You can checkout the full list [here](https://github.com/kmodules/offshoot-api/blob/ea366935d5bad69d7643906c7556923271592513/api/v1/types.go#L42-L259). Uses of some field of `spec.podTemplate` is described below,
You can check out the full list [here](https://github.com/kmodules/offshoot-api/blob/master/api/v2/types.go#L26C1-L279C1).

Uses of some fields of `spec.podTemplate` are described below,

#### spec.podTemplate.spec.env

`spec.podTemplate.spec.env` is an `optional` field that specifies the environment variables to pass to the Elasticsearch Docker image.

You are not allowed to pass the following `env`:
- `node.name`
- `node.ingest`
- `node.master`
- `node.data`
#### spec.podTemplate.spec.tolerations

The `spec.podTemplate.spec.tolerations` is an optional field. This can be used to specify the pod's tolerations.

#### spec.podTemplate.spec.volumes

The `spec.podTemplate.spec.volumes` is an optional field. This can be used to provide the list of volumes that can be mounted by containers belonging to the pod.

#### spec.podTemplate.spec.podPlacementPolicy

`spec.podTemplate.spec.podPlacementPolicy` is an optional field. This can be used to provide the reference of the podPlacementPolicy. This will be used by our Petset controller to place the db pods throughout the region, zone & nodes according to the policy. It utilizes kubernetes affinity & podTopologySpreadContraints feature to do so.

```ini
Error from server (Forbidden): error when creating "./elasticsearch.yaml": admission webhook "elasticsearch.validators.kubedb.com" denied the request: environment variable node.name is forbidden to use in Elasticsearch spec
```

#### spec.podTemplate.spec.imagePullSecrets

Expand All @@ -779,23 +789,52 @@ spec:
serviceAccountName: es
```

#### spec.podTemplate.spec.resources
#### spec.podTemplate.spec.containers

The `spec.podTemplate.spec.containers` can be used to provide the list containers and their configurations for to the database pod. some of the fields are described below,

##### spec.podTemplate.spec.containers[].name
The `spec.podTemplate.spec.containers[].name` field used to specify the name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.

##### spec.podTemplate.spec.containers[].args
`spec.podTemplate.spec.containers[].args` is an optional field. This can be used to provide additional arguments to database installation.

##### spec.podTemplate.spec.containers[].env

`spec.podTemplate.spec.env` is an `optional` field that specifies the environment variables to pass to the Elasticsearch Containers.

You are not allowed to pass the following `env`:
- `node.name`
- `node.ingest`
- `node.master`
- `node.data`


```ini
Error from server (Forbidden): error when creating "./elasticsearch.yaml": admission webhook "elasticsearch.validators.kubedb.com" denied the request: environment variable node.name is forbidden to use in Elasticsearch spec
```

##### spec.podTemplate.spec.containers[].resources

`spec.podTemplate.spec.resources` is an `optional` field. If the `spec.topology` field is not set, then it can be used to request or limit computational resources required by the database pods. To learn more, visit [here](http://kubernetes.io/docs/user-guide/compute-resources/).
`spec.podTemplate.spec.containers[].resources` is an `optional` field. then it can be used to request or limit computational resources required by the database pods. To learn more, visit [here](http://kubernetes.io/docs/user-guide/compute-resources/).

```yaml
spec:
podTemplate:
spec:
resources:
limits:
cpu: "1"
memory: 1Gi
requests:
cpu: 500m
memory: 512Mi
containers:
- name: "elasticsearch"
resources:
limits:
cpu: 500m
memory: 1Gi
requests:
cpu: 500m
memory: 1Gi
```



### spec.serviceTemplates

`spec.serviceTemplates` is an `optional` field that contains a list of the serviceTemplate. The templates are identified by the `alias`. For Elasticsearch, the configurable services' `alias` are `primary` and `stats`.
Expand Down
92 changes: 61 additions & 31 deletions docs/guides/kafka/concepts/kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ section_menu_id: guides
As with all other Kubernetes objects, a Kafka needs `apiVersion`, `kind`, and `metadata` fields. It also needs a `.spec` section. Below is an example Kafka object.

```yaml
apiVersion: kubedb.com/v1alpha2
apiVersion: kubedb.com/v1
kind: Kafka
metadata:
name: kafka
Expand Down Expand Up @@ -65,37 +65,37 @@ spec:
name: kafka-ca-issuer
topology:
broker:
replicas: 3
resources:
limits:
memory: 1Gi
requests:
cpu: 500m
memory: 1Gi
podTemplate:
spec:
containers:
- name: kafka
resources:
requests:
cpu: 500m
memory: 1024Mi
limits:
cpu: 700m
memory: 2Gi
storage:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storage: 10Gi
storageClassName: standard
suffix: broker
controller:
replicas: 3
resources:
limits:
memory: 1Gi
requests:
cpu: 500m
memory: 1Gi
storage:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: standard
suffix: controller
replicas: 1
podTemplate:
spec:
containers:
- name: kafka
resources:
requests:
cpu: 500m
memory: 1024Mi
limits:
cpu: 700m
memory: 2Gi
monitor:
agent: prometheus.io/operator
prometheus:
Expand Down Expand Up @@ -317,7 +317,9 @@ KubeDB accept following fields to set in `spec.podTemplate:`
- annotations (petset's annotation)
- labels (petset's labels)
- spec:
- resources
- containers
- volumes
- podPlacementPolicy
- initContainers
- containers
- imagePullSecrets
Expand All @@ -333,17 +335,26 @@ KubeDB accept following fields to set in `spec.podTemplate:`
- readinessProbe
- lifecycle

You can check out the full list [here](https://github.com/kmodules/offshoot-api/blob/39bf8b2/api/v2/types.go#L44-L279). Uses of some field of `spec.podTemplate` is described below,
You can check out the full list [here](https://github.com/kmodules/offshoot-api/blob/master/api/v2/types.go#L26C1-L279C1).
Uses of some field of `spec.podTemplate` is described below,

NB. If `spec.topology` is set, then `spec.podTemplate` needs to be empty. Instead use `spec.topology.<controller/broker>.podTemplate`

#### spec.podTemplate.spec.nodeSelector
#### spec.podTemplate.spec.tolerations

`spec.podTemplate.spec.nodeSelector` is an optional field that specifies a map of key-value pairs. For the pod to be eligible to run on a node, the node must have each of the indicated key-value pairs as labels (it can have additional labels as well). To learn more, see [here](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) .
The `spec.podTemplate.spec.tolerations` is an optional field. This can be used to specify the pod's tolerations.

#### spec.podTemplate.spec.volumes

The `spec.podTemplate.spec.volumes` is an optional field. This can be used to provide the list of volumes that can be mounted by containers belonging to the pod.

#### spec.podTemplate.spec.podPlacementPolicy

#### spec.podTemplate.spec.resources
`spec.podTemplate.spec.podPlacementPolicy` is an optional field. This can be used to provide the reference of the podPlacementPolicy. This will be used by our Petset controller to place the db pods throughout the region, zone & nodes according to the policy. It utilizes kubernetes affinity & podTopologySpreadContraints feature to do so.

`spec.podTemplate.spec.resources` is an optional field. This can be used to request compute resources required by the database pods. To learn more, visit [here](http://kubernetes.io/docs/user-guide/compute-resources/).
#### spec.podTemplate.spec.nodeSelector

`spec.podTemplate.spec.nodeSelector` is an optional field that specifies a map of key-value pairs. For the pod to be eligible to run on a node, the node must have each of the indicated key-value pairs as labels (it can have additional labels as well). To learn more, see [here](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) .

### spec.serviceTemplates

Expand All @@ -368,6 +379,25 @@ KubeDB allows following fields to set in `spec.serviceTemplates`:

See [here](https://github.com/kmodules/offshoot-api/blob/kubernetes-1.21.1/api/v1/types.go#L237) to understand these fields in detail.


#### spec.podTemplate.spec.containers

The `spec.podTemplate.spec.containers` can be used to provide the list containers and their configurations for to the database pod. some of the fields are described below,

##### spec.podTemplate.spec.containers[].name
The `spec.podTemplate.spec.containers[].name` field used to specify the name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.

##### spec.podTemplate.spec.containers[].args
`spec.podTemplate.spec.containers[].args` is an optional field. This can be used to provide additional arguments to database installation.

##### spec.podTemplate.spec.containers[].env

`spec.podTemplate.spec.containers[].env` is an optional field that specifies the environment variables to pass to the Redis containers.

##### spec.podTemplate.spec.containers[].resources

`spec.podTemplate.spec.containers[].resources` is an optional field. This can be used to request compute resources required by containers of the database pods. To learn more, visit [here](http://kubernetes.io/docs/user-guide/compute-resources/).

### spec.deletionPolicy

`deletionPolicy` gives flexibility whether to `nullify`(reject) the delete operation of `Kafka` crd or which resources KubeDB should keep or delete when you delete `Kafka` crd. KubeDB provides following four deletion policies:
Expand Down
41 changes: 31 additions & 10 deletions docs/guides/mariadb/concepts/mariadb/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ KubeDB accepts the following fields to set in `spec.podTemplate:`
- controller:
- annotations (petset's annotation)
- spec:
- args
- env
- resources
- containers
- volumes
- podPlacementPolicy
- initContainers
- imagePullSecrets
- nodeSelector
Expand All @@ -250,11 +250,36 @@ KubeDB accepts the following fields to set in `spec.podTemplate:`

Uses of some field of `spec.podTemplate` is described below,

#### spec.podTemplate.spec.args
You can check out the full list [here](https://github.com/kmodules/offshoot-api/blob/master/api/v2/types.go#L26C1-L279C1).
Uses of some field of `spec.podTemplate` is described below,

#### spec.podTemplate.spec.tolerations

The `spec.podTemplate.spec.tolerations` is an optional field. This can be used to specify the pod's tolerations.

#### spec.podTemplate.spec.volumes

The `spec.podTemplate.spec.volumes` is an optional field. This can be used to provide the list of volumes that can be mounted by containers belonging to the pod.

#### spec.podTemplate.spec.podPlacementPolicy

`spec.podTemplate.spec.podPlacementPolicy` is an optional field. This can be used to provide the reference of the podPlacementPolicy. This will be used by our Petset controller to place the db pods throughout the region, zone & nodes according to the policy. It utilizes kubernetes affinity & podTopologySpreadContraints feature to do so.

`spec.podTemplate.spec.args` is an optional field. This can be used to provide additional arguments for database installation. To learn about available args of `mysqld`, visit [here](https://mariadb.com/kb/en/mysqld-options/).
#### spec.podTemplate.spec.containers

#### spec.podTemplate.spec.env
The `spec.podTemplate.spec.containers` can be used to provide the list containers and their configurations for to the database pod. some of the fields are described below,

##### spec.podTemplate.spec.containers[].name
The `spec.podTemplate.spec.containers[].name` field used to specify the name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.

##### spec.podTemplate.spec.containers[].args
`spec.podTemplate.spec.containers[].args` is an optional field. This can be used to provide additional arguments to database installation.

##### spec.podTemplate.spec.containers[].resources

`spec.podTemplate.spec.containers[].resources` is an optional field. This can be used to request compute resources required by containers of the database pods. To learn more, visit [here](http://kubernetes.io/docs/user-guide/compute-resources/).

##### spec.podTemplate.spec.containers[].env

`spec.podTemplate.spec.env` is an optional field that specifies the environment variables to pass to the MariaDB docker image. To know about supported environment variables, please visit [here](https://hub.docker.com/_/mariadb/).

Expand Down Expand Up @@ -303,10 +328,6 @@ for: "./mariadb.yaml": admission webhook "mariadb.validators.kubedb.com" denied

If a service account name is given, and there's an existing service account by that name, the KubeDB operator will use that existing service account. Since this service account is not managed by KubeDB, users are responsible for providing necessary access permissions manually.

#### spec.podTemplate.spec.resources

`spec.podTemplate.spec.resources` is an optional field. This can be used to request compute resources required by the database pods. To learn more, visit [here](http://kubernetes.io/docs/user-guide/compute-resources/).

### spec.serviceTemplate

You can also provide a template for the services created by KubeDB operator for MariaDB database through `spec.serviceTemplate`. This will allow you to set the type and other properties of the services.
Expand Down
Loading

0 comments on commit 78e2f8f

Please sign in to comment.