Merge pull request #2831 from galexrt/feature_2308

crds: Set annotations pods, deployments and so on
This commit is contained in:
Alexander Trost authored and GitHub committed 2019-04-17 10:27:14 +02:00
commit ea03048ef1
103 files changed
+881 -156

No files matched your search

+13 -5
View File
@@ -22,6 +22,9 @@ spec:
version: 3.11.1
repository: my-private-repo.io/cassandra
mode: cassandra
# A key/value list of annotations
annotations:
# key: value
datacenter:
name: us-east-1
racks:
@@ -43,6 +46,9 @@ spec:
limits:
cpu: 8
memory: 32Gi
# A key/value list of annotations
annotations:
# key: value
placement:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
@@ -50,35 +56,37 @@ spec:
- matchExpressions:
- key: failure-domain.beta.kubernetes.io/region
operator: In
values:
values:
- us-east-1
- key: failure-domain.beta.kubernetes.io/zone
operator: In
values:
values:
- us-east-1a
```
## Settings Explanation
Cluster Settings:
### Cluster Settings
* `version`: The version of Cassandra to use. It is used as the image tag to pull.
* `repository`: Optional field. Specifies a custom image repo. If left unset, the official docker hub repo is used.
* `mode`: Optional field. Specifies if this is a Cassandra or Scylla cluster. If left unset, it defaults to cassandra. Values: {scylla, cassandra}
* `annotations`: Key value pair list of annotations to add.
In the Cassandra model, each cluster contains datacenters and each datacenter contains racks. At the moment, the operator only supports single datacenter setups.
Datacenter Settings:
### Datacenter Settings
* `name`: Name of the datacenter. Usually, a datacenter corresponds to a region.
* `racks`: List of racks for the specific datacenter.
Rack Settings:
### Rack Settings
* `name`: Name of the rack. Usually, a rack corresponds to an availability zone.
* `members`: Number of Cassandra members for the specific rack. (In Cassandra documentation, they are called nodes. We don't call them nodes to avoid confusion as a Cassandra Node corresponds to a Kubernetes Pod, not a Kubernetes Node).
* `storage`: Defines the volumes to use for each Cassandra member. Currently, only 1 volume is supported.
* `resources`: Defines the CPU and RAM resources for the Cassandra Pods.
* `annotations`: Key value pair list of annotations to add.
* `placement`: Defines the placement of Cassandra Pods. Has the following subfields:
* [`nodeAffinity`](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity)
* [`podAffinity`](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity)
+20 -5
View File
@@ -68,6 +68,7 @@ For more details on the mons and when to choose a number other than `3`, see the
- `rbdMirroring`: The settings for rbd mirror daemon(s). Configuring which pools or images to be mirrored must be completed in the rook toolbox by running the
[rbd mirror](http://docs.ceph.com/docs/mimic/rbd/rbd-mirroring/) command.
- `workers`: The number of rbd daemons to perform the rbd mirroring between clusters.
- `annotations`: [annotations configuration settings](#annotations-configuration-settings)
- `placement`: [placement configuration settings](#placement-configuration-settings)
- `resources`: [resources configuration settings](#cluster-wide-resources-configuration-settings)
- `storage`: Storage selection and configuration that will be used across the cluster. Note that these settings can be overridden for specific nodes.
@@ -159,8 +160,21 @@ The following storage selection settings are specific to Ceph and do not apply t
- Mimic 13.2.3 or newer
- Nautilus
### Annotations Configuration Settings
Annotations can be specified so that the Rook components will have those annotations added to them.
You can set annotations for Rook components through the a list of key value pairs:
- `all`: Set annotations for all components.
- `mgr`: Set annotations for MGRs.
- `mon`: Set annotations for Mons.
- `osd`: Set annotations for OSDs.
- `rbdmirror`: Set annotations for RBD Mirrors.
When other keys are set, `all` will be merged together with the specific component.
### Placement Configuration Settings
Placement configuration for the cluster services. It includes the following keys: `mgr`, `mon`, `osd` and `all`. Each service will have its placement configuration generated by merging the generic configuration under `all` with the most specific one (which will override any attributes).
Placement configuration for the cluster services. It includes the following keys: `mgr`, `mon`, `osd`, `rbdmirror` and `all`. Each service will have its placement configuration generated by merging the generic configuration under `all` with the most specific one (which will override any attributes).
A Placement configuration is specified (according to the kubernetes PodSpec) as:
@@ -176,14 +190,15 @@ See the [mon design doc](https://github.com/rook/rook/blob/master/design/mon-hea
The Rook Ceph operator creates a Job called `rook-ceph-detect-version` to detect the full Ceph version used by the given `cephVersion.image`. The placement from the `mon` section is used for the Job.
### Cluster-wide Resources Configuration Settings
Resources should be specified so that the rook components are handled after [Kubernetes Pod Quality of Service classes](https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/).
This allows to keep rook components running when for example a node runs out of memory and the rook components are not killed depending on their Quality of Service class.
Resources should be specified so that the Rook components are handled after [Kubernetes Pod Quality of Service classes](https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/).
This allows to keep Rook components running when for example a node runs out of memory and the Rook components are not killed depending on their Quality of Service class.
You can set resource requests/limits for rook components through the [Resource Requirements/Limits](#resource-requirementslimits) structure in the following keys:
You can set resource requests/limits for Rook components through the [Resource Requirements/Limits](#resource-requirementslimits) structure in the following keys:
- `mgr`: Set resource requests/limits for MGRs.
- `mon`: Set resource requests/limits for Mons.
- `osd`: Set resource requests/limits for OSDs.
- `rbdmirror`: Set resource requests/limits for RBD Mirrors.
### Resource Requirements/Limits
For more information on resource requests/limits see the official Kubernetes documentation: [Kubernetes - Managing Compute Resources for Containers](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#resource-requests-and-limits-of-pod-and-container)
@@ -352,7 +367,7 @@ spec:
```
### Resource Requests/Limits
To control how many resources the rook components can request/use, you can set requests and limits in Kubernetes for them.
To control how many resources the Rook components can request/use, you can set requests and limits in Kubernetes for them.
You can override these requests/limits for OSDs per node when using `useAllNodes: false` in the `node` item in the `nodes` list.
**WARNING** Before setting resource requests/limits, please take a look at the Ceph documentation for recommendations for each component: [Ceph - Hardware Recommendations](http://docs.ceph.com/docs/master/start/hardware-recommendations/).
+4
View File
@@ -41,6 +41,9 @@ spec:
metadataServer:
activeCount: 1
activeStandby: true
# A key/value list of annotations
annotations:
# key: value
placement:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
@@ -116,5 +119,6 @@ The metadata server settings correspond to the MDS daemon settings.
- `activeCount`: The number of active MDS instances. As load increases, CephFS will automatically partition the file system across the MDS instances. Rook will create double the number of MDS instances as requested by the active count. The extra instances will be in standby mode for failover.
- `activeStandby`: If true, the extra MDS instances will be in active standby mode and will keep a warm cache of the file system metadata for faster failover. The instances will be assigned by CephFS in failover pairs. If false, the extra MDS instances will all be on passive standby mode and will not maintain a warm cache of the metadata.
- `annotations`: Key value pair list of annotations to add.
- `placement`: The mds pods can be given standard Kubernetes placement restrictions with `nodeAffinity`, `tolerations`, `podAffinity`, and `podAntiAffinity` similar to placement defined for daemons configured by the [cluster CRD](https://github.com/rook/rook/blob/{{ branchName }}/cluster/examples/kubernetes/ceph/cluster.yaml).
- `resources`: Set resource requests/limits for the Filesystem MDS Pod(s), see [Resource Requirements/Limits](ceph-cluster-crd.md#resource-requirementslimits).
+3
View File
@@ -32,6 +32,9 @@ spec:
server:
# the number of active NFS servers
active: 2
# A key/value list of annotations
annotations:
# key: value
# where to run the NFS server
placement:
# nodeAffinity:
+4
View File
@@ -37,6 +37,9 @@ spec:
securePort:
instances: 1
allNodes: false
# A key/value list of annotations
annotations:
# key: value
placement:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
@@ -84,6 +87,7 @@ The gateway settings correspond to the RGW daemon settings.
- `securePort`: The secure port on which RGW pods will be listening. An SSL certificate must be specified.
- `instances`: The number of pods that will be started to load balance this object store. Ignored if `allNodes` is true.
- `allNodes`: Whether RGW pods should be started on all nodes. If true, a daemonset is created. If false, `instances` must be set.
- `annotations`: Key value pair list of annotations to add.
- `placement`: The Kubernetes placement settings to determine where the RGW pods should be started in the cluster.
- `resources`: Set resource requests/limits for the Gateway Pod(s), see [Resource Requirements/Limits](ceph-cluster-crd.md#resource-requirementslimits).
+4
View File
@@ -38,6 +38,9 @@ spec:
secure: false
cachePercent: 25
maxSQLMemoryPercent: 25
# A key/value list of annotations
annotations:
# key: value
```
## Cluster Settings
@@ -49,6 +52,7 @@ The settings below are specific to CockroachDB database clusters:
* `secure`: `true` to create a secure cluster installation using certificates and encryption. `false` to create an insecure installation (strongly discouraged for production usage). Currently, only insecure is supported.
* `cachePercent`: The total size used for caches, expressed as a percentage of total physical memory.
* `maxSQLMemoryPercent`: The maximum memory capacity available to store temporary data for SQL clients, expressed as a percentage of total physical memory.
* `annotations`: Key value pair list of annotations to add.
### Storage Scope
+14
View File
@@ -22,6 +22,13 @@ spec:
dataDirHostPath: /data
storage:
useAllNodes: true
# A key/value list of annotations
annotations:
# all:
# key: value
# prepare:
# mgr:
# target:
```
or if you have raw block devices provisioned, it can dynamically detect, format and utilize all raw devices on all nodes with simple CRD as below:
@@ -39,6 +46,13 @@ spec:
storage:
useAllNodes: true
useAllDevices: true
# A key/value list of annotations
annotations:
# all:
# key: value
# prepare:
# mgr:
# target:
```
In addition to the CRD, you will also need to create a namespace, role, and role binding as seen in the [common cluster resources](#common-cluster-resources) below.
+4
View File
@@ -41,6 +41,9 @@ spec:
# requests:
# cpu: "500m"
# memory: "1024Mi"
# A key/value list of annotations
annotations:
# key: value
```
### Metadata
@@ -56,6 +59,7 @@ spec:
- `MaxBurstLength`: Value in range 512..16777215. Default is 1048576.
- `MaxQueueCmd`: Value in range 1..128. Default is 64.
- `chunkCacheSize`: Limit amount of memory allocated for dynamic chunk cache. By default iSCSI pod uses up to 75% of available memory as chunk caching area. This option can influence this allocation strategy.
- `annotations`: Key value pair list of annotations to add.
- `placement`: The iSCSI pods can be given standard Kubernetes placement restrictions with `nodeAffinity`, `tolerations`, `podAffinity`, and `podAntiAffinity` similar to placement defined for daemons configured by the [cluster CRD](/cluster/examples/kubernetes/edgefs/cluster.yaml).
- `resourceProfile`: iSCSI pod resource utilization profile (Memory and CPU). Can be `embedded` or `performance` (default). In case of `performance` an iSCSI pod trying to increase amount of internal I/O resources that results in higher performance at the cost of additional memory allocation and more CPU load. In `embedded` profile case, iSCSI pod gives preference to preserving memory over I/O and limiting chunk cache (see `chunkCacheSize` option). The `performance` profile is the default unless cluster wide `embedded` option is defined.
- `resources`: Set resource requests/limits for the iSCSI pods, see [Resource Requirements/Limits](edgefs-cluster-crd.md#resource-requirementslimits).
+5 -1
View File
@@ -69,13 +69,16 @@ spec:
# podAffinity:
# podAntiAffinity:
#resourceProfile: embedded
#resources:
resources:
# limits:
# cpu: "2"
# memory: "4Gi"
# requests:
# cpu: "2"
# memory: "4Gi"
# A key/value list of annotations
annotations:
# key: value
```
### Metadata
@@ -90,6 +93,7 @@ spec:
- `localAddr`: Defines local cluster pod service address and port. Used by ISGW link endpoint. Kubernetes ExternalIP will be automatically constructed if address is provided. Default is 0.0.0.0:14000.
- `useEncryptedTunnel`: If true, enables usage of encrypted SSH tunnel. By default, transferred metadata and data chunks are just compressed but unencrypted. Enable encryption if ISGW links crossing boundaries of single data center or multiple clouds.
- `chunkCacheSize`: Limit amount of memory allocated for dynamic chunk cache. By default ISGW pod uses up to 75% of available memory as chunk caching area. This option can influence this allocation strategy.
- `annotations`: Key value pair list of annotations to add.
- `placement`: The ISGW pods can be given standard Kubernetes placement restrictions with `nodeAffinity`, `tolerations`, `podAffinity`, and `podAntiAffinity` similar to placement defined for daemons configured by the [cluster CRD](/cluster/examples/kubernetes/edgefs/cluster.yaml).
- `resourceProfile`: ISGW pod resource utilization profile (Memory and CPU). Can be `embedded` or `performance` (default). In case of `performance` an ISGW pod trying to increase amount of internal I/O resources that results in higher performance at the cost of additional memory allocation and more CPU load. In `embedded` profile case, ISGW pod gives preference to preserving memory over I/O and limiting chunk cache (see `chunkCacheSize` option). The `performance` profile is the default unless cluster wide `embedded` option is defined.
- `resources`: Set resource requests/limits for the ISGW pods, see [Resource Requirements/Limits](edgefs-cluster-crd.md#resource-requirementslimits).
+4
View File
@@ -21,6 +21,9 @@ spec:
instances: 3
#relaxedDirUpdates: true
#chunkCacheSize: 1Gi
# A key/value list of annotations
annotations:
# key: value
placement:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
@@ -52,6 +55,7 @@ spec:
- `instances`: The number of active NFS service instances. EdgeFS NFS service is Multi-Head capable, such so that multiple PODs can mount same tenant's buckets via different endpoints. [EdgeFS CSI provisioner](edgefs-csi.md) orchestrates distribution and load balancing across NFS service instances in round-robin or random policy ways.
- `relaxedDirUpdates`: If set to `true` then it will significantly improve performance of directory operations by defering updates, guaranteeing eventual directory consistency. This option is recommended when a bucket exported via single NFS instance and it is not a destination for ISGW Link synchronization.
- `chunkCacheSize`: Limit amount of memory allocated for dynamic chunk cache. By default NFS pod uses up to 75% of available memory as chunk caching area. This option can influence this allocation strategy.
- `annotations`: Key value pair list of annotations to add.
- `placement`: The NFS PODs can be given standard Kubernetes placement restrictions with `nodeAffinity`, `tolerations`, `podAffinity`, and `podAntiAffinity` similar to placement defined for daemons configured by the [cluster CRD](/cluster/examples/kubernetes/edgefs/cluster.yaml).
- `resourceProfile`: NFS pod resource utilization profile (Memory and CPU). Can be `embedded` or `performance` (default). In case of `performance` an NFS pod trying to increase amount of internal I/O resources that results in higher performance at the cost of additional memory allocation and more CPU load. In `embedded` profile case, NFS pod gives preference to preserving memory over I/O and limiting chunk cache (see `chunkCacheSize` option). The `performance` profile is the default unless cluster wide `embedded` option is defined.
- `resources`: Set resource requests/limits for the NFS Pod(s), see [Resource Requirements/Limits](edgefs-cluster-crd.md#resource-requirementslimits).
+4
View File
@@ -21,6 +21,9 @@ spec:
instances: 3
#s3type: s3s
#chunkCacheSize: 1Gi
# A key/value list of annotations
annotations:
# key: value
placement:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
@@ -55,6 +58,7 @@ spec:
- `securePort`: The secure port on which S3 pods will be listening. If not defined then default SSL certificates will be used. Default port is 8443 for `s3` and 8444 for `s3s`.
- `chunkCacheSize`: Limit amount of memory allocated for dynamic chunk cache. By default S3 pod uses up to 75% of available memory as chunk caching area. This option can influence this allocation strategy.
- `instances`: The number of active S3 service instances. For load balancing we recommend to use nginx and the like solutions.
- `annotations`: Key value pair list of annotations to add.
- `placement`: The S3 pods can be given standard Kubernetes placement restrictions with `nodeAffinity`, `tolerations`, `podAffinity`, and `podAntiAffinity` similar to placement defined for daemons configured by the [cluster CRD](/cluster/examples/kubernetes/edgefs/cluster.yaml).
- `resourceProfile`: S3 pod resource utilization profile (Memory and CPU). Can be `embedded` or `performance` (default). In case of `performance` an S3 pod trying to increase amount of internal I/O resources that results in higher performance at the cost of additional memory allocation and more CPU load. In `embedded` profile case, S3 pod gives preference to preserving memory over I/O and limiting chunk cache (see `chunkCacheSize` option). The `performance` profile is the default unless cluster wide `embedded` option is defined.
- `resources`: Set resource requests/limits for the S3 pods, see [Resource Requirements/Limits](edgefs-cluster-crd.md#resource-requirementslimits).
+4
View File
@@ -24,6 +24,9 @@ metadata:
spec:
instances: 3
#chunkCacheSize: 1Gi
# A key/value list of annotations
annotations:
# key: value
placement:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
@@ -57,6 +60,7 @@ spec:
- `securePort`: The secure port on which Edge-X S3 pods will be listening. If not defined then default SSL certificates will be used. Default port is 3001.
- `instances`: The number of active Edge-X S3 service instances. For load balancing we recommend to use nginx and the like solutions.
- `chunkCacheSize`: Limit amount of memory allocated for dynamic chunk cache. By default S3X pod uses up to 75% of available memory as chunk caching area. This option can influence this allocation strategy.
- `annotations`: Key value pair list of annotations to add.
- `placement`: The Edge-X S3 PODs can be given standard Kubernetes placement restrictions with `nodeAffinity`, `tolerations`, `podAffinity`, and `podAntiAffinity` similar to placement defined for daemons configured by the [cluster CRD](/cluster/examples/kubernetes/edgefs/cluster.yaml).
- `resourceProfile`: S3X pod resource utilization profile (Memory and CPU). Can be `embedded` or `performance` (default). In case of `performance` an S3X pod trying to increase amount of internal I/O resources that results in higher performance at the cost of additional memory allocation and more CPU load. In `embedded` profile case, S3X pod gives preference to preserving memory over I/O and limiting chunk cache (see `chunkCacheSize` option). The `performance` profile is the default unless cluster wide `embedded` option is defined.
- `resources`: Set resource requests/limits for the Edge-X S3 Pod(s), see [Resource Requirements/Limits](edgefs-cluster-crd.md#resource-requirementslimits).
+4
View File
@@ -20,6 +20,9 @@ metadata:
spec:
instances: 3
#chunkCacheSize: 1Gi
# A key/value list of annotations
annotations:
# key: value
placement:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
@@ -53,6 +56,7 @@ spec:
- `securePort`: The secure port on which SWIFT pods will be listening. If not defined then default SSL certificates will be used. Default port is 443.
- `instances`: The number of active SWIFT service instances. For load balancing we recommend to use nginx and the like solutions.
- `chunkCacheSize`: Limit amount of memory allocated for dynamic chunk cache. By default SWIFT pod uses up to 75% of available memory as chunk caching area. This option can influence this allocation strategy.
- `annotations`: Key value pair list of annotations to add.
- `placement`: The SWIFT pods can be given standard Kubernetes placement restrictions with `nodeAffinity`, `tolerations`, `podAffinity`, and `podAntiAffinity` similar to placement defined for daemons configured by the [cluster CRD](/cluster/examples/kubernetes/edgefs/cluster.yaml).
- `resourceProfile`: SWIFT pod resource utilization profile (Memory and CPU). Can be `embedded` or `performance` (default). In case of `performance` an SWIFT pod trying to increase amount of internal I/O resources that results in higher performance at the cost of additional memory allocation and more CPU load. In `embedded` profile case, SWIFT pod gives preference to preserving memory over I/O and limiting chunk cache (see `chunkCacheSize` option). The `performance` profile is the default unless cluster wide `embedded` option is defined.
- `resources`: Set resource requests/limits for the SWIFT pods, see [Resource Requirements/Limits](edgefs-cluster-crd.md#resource-requirementslimits).
+5 -1
View File
@@ -49,6 +49,9 @@ spec:
name: minio-my-store-access-keys
namespace: rook-minio
clusterDomain:
# A key/value list of annotations
annotations:
# key: value
```
## Cluster Settings
@@ -57,9 +60,10 @@ spec:
The settings below are specific to Minio object stores:
* `scope`: See [Storage Scope](#storage-scope).
* `credentials`: This accepts the `name` and `namespace` strings of an existing Secret to specify the access credentials for the object store.
* `storageAmount`: The size of the volume that will be mounted at the data directory.
* `clusterDomain`: The local cluster domain for this cluster. This should be set if an alternative cluster domain is in use. If not set, then the default of cluster.local will be assumed. This field is needed to workaround https://github.com/minio/minio/issues/6775, and is expected to be removed in the future.
* `annotations`: Key value pair list of annotations to add.
### Storage Scope
+19 -15
View File
@@ -32,27 +32,31 @@ spec:
squash: none
persistentVolumeClaim:
claimName: googlePD-claim
# A key/value list of annotations
annotations:
# key: value
```
## Settings
The table below explains in detail each configuration option that is available in the NFS CRD.
| Parameter | Description | Default |
|-------------------------------------------|------------------------------------------|-------------------------------|
| `replicas` | The number of NFS daemon to start | `1` |
| `exports` | Parameters for creating an export | `<empty>` |
| `exports.name` | Name of the volume being shared | `<empty>` |
| `exports.server` | NFS server configuration | `<empty>` |
| `exports.server.accessMode` | Volume access modes (Reading and Writing) for the share (Valid options are `ReadOnly`, `ReadWrite` and `none`) | `ReadWrite` |
| `exports.server.squash` | This prevents root users connected remotely from having root privileges (valid options are `none`, `rootId`, `root` and `all`) | `none` |
| `exports.server.allowedClients` | Access configuration for clients that can consume the NFS volume | `<empty>` |
| `exports.server.allowedClients.name` | Name of the host/hosts | `<empty>` |
| `exports.server.allowedClients.clients` | The host or network to which the export is being shared. Valid entries for this field are host names, IP addresses, netgroups, and CIDR network addresses. | `<empty>` |
| `exports.server.allowedClients.accessMode` | Reading and Writing permissions for the client* (valid options are same as `exports.server.accessMode`) | `ReadWrite` |
| `exports.server.allowedClients.squash` | Squash option for the client* (valid options are same as `exports.server.squash`) | `none` |
| `exports.persistentVolumeClaim` | The PVC that will serve as the backing volume to be exported by the NFS server. Any PVC is allowed, such as host paths, CephFS, Ceph RBD, Google PD, Amazon EBS, etc.. | `<empty>` |
| `exports.persistentVolumeClaim.claimName` | Name of the PVC | `<empty>` |
| Parameter | Description | Default |
| ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| `replicas` | The number of NFS daemon to start | `1` |
| `annotations` | Key value pair list of annotations to add. | `[]` |
| `exports` | Parameters for creating an export | `<empty>` |
| `exports.name` | Name of the volume being shared | `<empty>` |
| `exports.server` | NFS server configuration | `<empty>` |
| `exports.server.accessMode` | Volume access modes (Reading and Writing) for the share (Valid options are `ReadOnly`, `ReadWrite` and `none`) | `ReadWrite` |
| `exports.server.squash` | This prevents root users connected remotely from having root privileges (valid options are `none`, `rootId`, `root` and `all`) | `none` |
| `exports.server.allowedClients` | Access configuration for clients that can consume the NFS volume | `<empty>` |
| `exports.server.allowedClients.name` | Name of the host/hosts | `<empty>` |
| `exports.server.allowedClients.clients` | The host or network to which the export is being shared. Valid entries for this field are host names, IP addresses, netgroups, and CIDR network addresses. | `<empty>` |
| `exports.server.allowedClients.accessMode` | Reading and Writing permissions for the client* (valid options are same as `exports.server.accessMode`) | `ReadWrite` |
| `exports.server.allowedClients.squash` | Squash option for the client* (valid options are same as `exports.server.squash`) | `none` |
| `exports.persistentVolumeClaim` | The PVC that will serve as the backing volume to be exported by the NFS server. Any PVC is allowed, such as host paths, CephFS, Ceph RBD, Google PD, Amazon EBS, etc.. | `<empty>` |
| `exports.persistentVolumeClaim.claimName` | Name of the PVC | `<empty>` |
*note: if `exports.server.allowedClients.accessMode` and `exports.server.allowedClients.squash` options are specified, `exports.server.accessMode` and `exports.server.squash` are overridden respectively.
@@ -72,6 +72,9 @@ metadata:
spec:
version: 3.11.1
mode: cassandra
# A key/value list of annotations
annotations:
# key: value
datacenter:
name: us-east-1
racks:
@@ -92,4 +95,3 @@ spec:
limits:
cpu: 1
memory: 2Gi
@@ -71,6 +71,12 @@ spec:
# mon:
# osd:
# mgr:
annotations:
# all:
# mon:
# osd:
# If no mgr annotations are set, prometheus scrape annotations will be set by default.
# mgr:
resources:
# The requests and limits set here, allow the mgr pod to use half of one CPU core and 1 gigabyte of memory
# mgr:
@@ -43,6 +43,9 @@ spec:
# operator: Exists
# podAffinity:
# podAntiAffinity:
# A key/value list of annotations
annotations:
# key: value
resources:
# The requests and limits set here, allow the filesystem MDS Pod(s) to use half of one CPU core and 1 gigabyte of memory
# limits:
@@ -41,6 +41,9 @@ spec:
# operator: Exists
# podAffinity:
# podAntiAffinity:
# A key/value list of annotations
annotations:
# key: value
resources:
# The requests and limits set here, allow the filesystem MDS Pod(s) to use half of one CPU core and 1 gigabyte of memory
# limits:
@@ -30,6 +30,9 @@ spec:
# operator: Exists
# podAffinity:
# podAntiAffinity:
# A key/value list of annotations
annotations:
# key: value
# The requests and limits set here allow the ganesha pod(s) to use half of one CPU core and 1 gigabyte of memory
resources:
# limits:
@@ -50,6 +50,9 @@ spec:
# operator: Exists
# podAffinity:
# podAntiAffinity:
# A key/value list of annotations
annotations:
# key: value
resources:
# The requests and limits set here, allow the object store gateway Pod(s) to use half of one CPU core and 1 gigabyte of memory
# limits:
@@ -49,6 +49,9 @@ spec:
# operator: Exists
# podAffinity:
# podAntiAffinity:
# A key/value list of annotations
annotations:
# key: value
resources:
# The requests and limits set here, allow the object store gateway Pod(s) to use half of one CPU core and 1 gigabyte of memory
# limits:
@@ -49,6 +49,9 @@ spec:
# operator: Exists
# podAffinity:
# podAntiAffinity:
# A key/value list of annotations
annotations:
# key: value
resources:
# The requests and limits set here, allow the object store gateway Pod(s) to use half of one CPU core and 1 gigabyte of memory
# limits:
@@ -17,3 +17,6 @@ spec:
erasureCoded:
dataChunks: 2
codingChunks: 1
# A key/value list of annotations
annotations:
# key: value
@@ -15,3 +15,6 @@ spec:
# For a pool based on raw copies, specify the number of copies. A size of 1 indicates no redundancy.
replicated:
size: 3
# A key/value list of annotations
annotations:
# key: value
@@ -34,3 +34,6 @@ spec:
secure: false
cachePercent: 25
maxSQLMemoryPercent: 25
# A key/value list of annotations
annotations:
# key: value
@@ -54,7 +54,7 @@ subjects:
- kind: ServiceAccount
name: rook-edgefs-cluster
namespace: rook-edgefs
---
---
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
@@ -176,3 +176,10 @@ spec:
# requests:
# cpu: "2"
# memory: "4096Mi"
# A key value list of annotations
annotations:
# all:
# key: value
# mgr:
# prepare:
# target:
@@ -4,7 +4,7 @@ metadata:
name: iscsi01
namespace: rook-edgefs
spec:
#targetName:
#targetName:
#placement:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
@@ -26,3 +26,10 @@ spec:
# requests:
# cpu: "2"
# memory: "4Gi"
# A key value list of annotations
annotations:
# all:
# key: value
# mgr:
# prepare:
# target:
@@ -35,3 +35,10 @@ spec:
# requests:
# cpu: "2"
# memory: "4Gi"
# A key value list of annotations
annotations:
# all:
# key: value
# mgr:
# prepare:
# target:
@@ -26,3 +26,10 @@ spec:
# requests:
# cpu: "2"
# memory: "4Gi"
# A key value list of annotations
annotations:
# all:
# key: value
# mgr:
# prepare:
# target:
@@ -30,3 +30,11 @@ spec:
# requests:
# cpu: "2"
# memory: "4Gi"
# A key value list of annotations
# A key value list of annotations
annotations:
# all:
# key: value
# mgr:
# prepare:
# target:
@@ -27,3 +27,10 @@ spec:
# requests:
# cpu: "2"
# memory: "4Gi"
# A key value list of annotations
annotations:
# all:
# key: value
# mgr:
# prepare:
# target:
@@ -29,3 +29,10 @@ spec:
# requests:
# cpu: "2"
# memory: "4Gi"
# A key value list of annotations
annotations:
# all:
# key: value
# mgr:
# prepare:
# target:
@@ -45,6 +45,9 @@ spec:
# resources:
# requests:
# storage: "8Gi"
# A key value list of annotations
annotations:
# key: value
placement:
tolerations:
nodeAffinity:
@@ -36,3 +36,6 @@ spec:
# Create a ceph PVC after creating the rook ceph cluster using ceph-pvc.yaml
persistentVolumeClaim:
claimName: nfs-ceph-claim
# A key value list of annotations
annotations:
# key: value
+3
View File
@@ -31,3 +31,6 @@ spec:
# A Persistent Volume Claim must be created before creating NFS CRD instance.
persistentVolumeClaim:
claimName: nfs-default-claim
# A key/value list of annotations
annotations:
# key: value
+2 -1
View File
@@ -18,6 +18,8 @@ package cassandra
import (
"fmt"
"os"
"github.com/rook/rook/cmd/rook/rook"
"github.com/rook/rook/pkg/operator/cassandra/sidecar"
"github.com/rook/rook/pkg/operator/k8sutil"
@@ -27,7 +29,6 @@ import (
"k8s.io/apiserver/pkg/server"
kubeinformers "k8s.io/client-go/informers"
"k8s.io/client-go/informers/internalinterfaces"
"os"
)
var sidecarCmd = &cobra.Command{
@@ -58,6 +58,8 @@ type ClusterList struct {
// ClusterSpec is the desired state for a Cassandra Cluster.
type ClusterSpec struct {
// The annotations-related configuration to add/set on each Pod related object.
Annotations rook.Annotations
// Version of Cassandra to use.
Version string `json:"version"`
// Repository to pull the image from.
@@ -95,6 +97,8 @@ type RackSpec struct {
ConfigMapName *string `json:"configMapName,omitempty"`
// Storage describes the underlying storage that Cassandra will consume.
Storage rook.StorageScopeSpec `json:"storage"`
// The annotations-related configuration to add/set on each Pod related object.
Annotations rook.Annotations
// Placement describes restrictions for the nodes Cassandra is scheduled on.
Placement *rook.Placement `json:"placement,omitempty"`
// Resources the Cassandra Pods will use.
@@ -89,6 +89,13 @@ func (in *ClusterList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
*out = *in
if in.Annotations != nil {
in, out := &in.Annotations, &out.Annotations
*out = make(v1alpha2.Annotations, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.Repository != nil {
in, out := &in.Repository, &out.Repository
*out = new(string)
+46
View File
@@ -0,0 +1,46 @@
/*
Copyright 2019 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1
import (
rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
)
// GetMgrAnnotations returns the Annotations for the MGR service
func GetMgrAnnotations(a rook.AnnotationsSpec) rook.Annotations {
return a.All().Merge(a[KeyMgr])
}
// GetMonAnnotations returns the Annotations for the MON service
func GetMonAnnotations(a rook.AnnotationsSpec) rook.Annotations {
return a.All().Merge(a[KeyMon])
}
// GetOSDAnnotations returns the annotations for the OSD service
func GetOSDAnnotations(a rook.AnnotationsSpec) rook.Annotations {
return a.All().Merge(a[KeyOSD])
}
// GetRGWAnnotations returns the Annotations for the RBD mirrors
func GetRGWAnnotations(a rook.AnnotationsSpec) rook.Annotations {
return a.All().Merge(a[KeyRGWMirror])
}
// GetRBDMirrorAnnotations returns the Annotations for the RBD mirrors
func GetRBDMirrorAnnotations(a rook.AnnotationsSpec) rook.Annotations {
return a.All().Merge(a[KeyRBDMirror])
}
+29
View File
@@ -0,0 +1,29 @@
/*
Copyright 2018 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1
import (
rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
)
const (
KeyMon rook.KeyType = "mon"
KeyMgr rook.KeyType = "mgr"
KeyOSD rook.KeyType = "osd"
KeyRBDMirror rook.KeyType = "rbdmirror"
KeyRGWMirror rook.KeyType = "rgw"
)
+4 -11
View File
@@ -19,29 +19,22 @@ import (
rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
)
const (
PlacementKeyMgr = "mgr"
PlacementKeyMon = "mon"
PlacementKeyOSD = "osd"
PlacementKeyRBDMirror = "rbdmirror"
)
// GetMgrPlacement returns the placement for the MGR service
func GetMgrPlacement(p rook.PlacementSpec) rook.Placement {
return p.All().Merge(p[PlacementKeyMgr])
return p.All().Merge(p[KeyMgr])
}
// GetMonPlacement returns the placement for the MON service
func GetMonPlacement(p rook.PlacementSpec) rook.Placement {
return p.All().Merge(p[PlacementKeyMon])
return p.All().Merge(p[KeyMon])
}
// GetOSDPlacement returns the placement for the OSD service
func GetOSDPlacement(p rook.PlacementSpec) rook.Placement {
return p.All().Merge(p[PlacementKeyOSD])
return p.All().Merge(p[KeyOSD])
}
// GetRBDMirrorPlacement returns the placement for the RBD mirrors
func GetRBDMirrorPlacement(p rook.PlacementSpec) rook.Placement {
return p.All().Merge(p[PlacementKeyRBDMirror])
return p.All().Merge(p[KeyRBDMirror])
}
+12
View File
@@ -54,6 +54,9 @@ type ClusterSpec struct {
// A spec for available storage in the cluster and how it should be used
Storage rook.StorageScopeSpec `json:"storage,omitempty"`
// The annotations-related configuration to add/set on each Pod related object.
Annotations rook.AnnotationsSpec `json:"annotations,omitempty"`
// The placement-related configuration to pass to kubernetes (affinity, node selector, tolerations).
Placement rook.PlacementSpec `json:"placement,omitempty"`
@@ -227,6 +230,9 @@ type MetadataServerSpec struct {
// The affinity to place the mds pods (default is to place on all available node) with a daemonset
Placement rook.Placement `json:"placement"`
// The annotations-related configuration to add/set on each Pod related object.
Annotations rook.Annotations `json:"annotations,omitempty"`
// The resource requirements for the rgw pods
Resources v1.ResourceRequirements `json:"resources"`
}
@@ -306,6 +312,9 @@ type GatewaySpec struct {
// The affinity to place the rgw pods (default is to place on any available node)
Placement rook.Placement `json:"placement"`
// The annotations-related configuration to add/set on each Pod related object.
Annotations rook.Annotations `json:"annotations,omitempty"`
// The resource requirements for the rgw pods
Resources v1.ResourceRequirements `json:"resources"`
}
@@ -350,6 +359,9 @@ type GaneshaServerSpec struct {
// The affinity to place the ganesha pods
Placement rook.Placement `json:"placement"`
// The annotations-related configuration to add/set on each Pod related object.
Annotations rook.Annotations `json:"annotations,omitempty"`
// Resources set resource requests and limits
Resources v1.ResourceRequirements `json:"resources,omitempty"`
}
@@ -446,6 +446,23 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
*out = *in
out.CephVersion = in.CephVersion
in.Storage.DeepCopyInto(&out.Storage)
if in.Annotations != nil {
in, out := &in.Annotations, &out.Annotations
*out = make(v1alpha2.AnnotationsSpec, len(*in))
for key, val := range *in {
var outVal map[string]string
if val == nil {
(*out)[key] = nil
} else {
in, out := &val, &outVal
*out = make(v1alpha2.Annotations, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
(*out)[key] = outVal
}
}
if in.Placement != nil {
in, out := &in.Placement, &out.Placement
*out = make(v1alpha2.PlacementSpec, len(*in))
@@ -578,6 +595,13 @@ func (in *GaneshaRADOSSpec) DeepCopy() *GaneshaRADOSSpec {
func (in *GaneshaServerSpec) DeepCopyInto(out *GaneshaServerSpec) {
*out = *in
in.Placement.DeepCopyInto(&out.Placement)
if in.Annotations != nil {
in, out := &in.Annotations, &out.Annotations
*out = make(v1alpha2.Annotations, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
in.Resources.DeepCopyInto(&out.Resources)
return
}
@@ -596,6 +620,13 @@ func (in *GaneshaServerSpec) DeepCopy() *GaneshaServerSpec {
func (in *GatewaySpec) DeepCopyInto(out *GatewaySpec) {
*out = *in
in.Placement.DeepCopyInto(&out.Placement)
if in.Annotations != nil {
in, out := &in.Annotations, &out.Annotations
*out = make(v1alpha2.Annotations, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
in.Resources.DeepCopyInto(&out.Resources)
return
}
@@ -614,6 +645,13 @@ func (in *GatewaySpec) DeepCopy() *GatewaySpec {
func (in *MetadataServerSpec) DeepCopyInto(out *MetadataServerSpec) {
*out = *in
in.Placement.DeepCopyInto(&out.Placement)
if in.Annotations != nil {
in, out := &in.Annotations, &out.Annotations
*out = make(v1alpha2.Annotations, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
in.Resources.DeepCopyInto(&out.Resources)
return
}
@@ -46,6 +46,8 @@ type ClusterList struct {
}
type ClusterSpec struct {
// The annotations-related configuration to add/set on each Pod related object.
Annotations rook.Annotations `json:"annotations,omitempty"`
Storage rook.StorageScopeSpec `json:"scope,omitempty"`
Network rook.NetworkSpec `json:"network,omitempty"`
Secure bool `json:"secure,omitempty"`
@@ -21,6 +21,7 @@ limitations under the License.
package v1alpha1
import (
v1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@@ -87,6 +88,13 @@ func (in *ClusterList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
*out = *in
if in.Annotations != nil {
in, out := &in.Annotations, &out.Annotations
*out = make(v1alpha2.Annotations, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
in.Storage.DeepCopyInto(&out.Storage)
in.Network.DeepCopyInto(&out.Network)
return
@@ -0,0 +1,36 @@
/*
Copyright 2019 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
)
// GetPrepareAnnotations returns the Annotations for the prepare service
func GetPrepareAnnotations(a rook.AnnotationsSpec) rook.Annotations {
return a.All().Merge(a[KeyPrepare])
}
// GetMgrAnnotations returns the Annotations for the MGR service
func GetMgrAnnotations(a rook.AnnotationsSpec) rook.Annotations {
return a.All().Merge(a[KeyMgr])
}
// GetTargetAnnotations returns the Annotations for the target service
func GetTargetAnnotations(a rook.AnnotationsSpec) rook.Annotations {
return a.All().Merge(a[KeyTarget])
}
+23
View File
@@ -0,0 +1,23 @@
/*
Copyright 2019 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
const (
KeyPrepare = "prepare"
KeyMgr = "mgr"
KeyTarget = "target"
)
+12
View File
@@ -54,6 +54,8 @@ type ClusterList struct {
type ClusterSpec struct {
Storage rook.StorageScopeSpec `json:"storage,omitempty"`
// The annotations-related configuration to add/set on each Pod related object.
Annotations rook.AnnotationsSpec `json:"annotations,omitempty"`
// The placement-related configuration to pass to kubernetes (affinity, node selector, tolerations).
Placement rook.PlacementSpec `json:"placement,omitempty"`
Network NetworkSpec `json:"network,omitempty"`
@@ -112,6 +114,8 @@ type NFSList struct {
// NFSSpec represent the spec of a pool
type NFSSpec struct {
// The annotations-related configuration to add/set on each Pod related object.
Annotations rook.Annotations `json:"annotations,omitempty"`
// The affinity to place the NFS pods (default is to place on any available nodes in EdgeFS running namespace)
Placement rook.Placement `json:"placement"`
// Resources set resource requests and limits
@@ -143,6 +147,8 @@ type S3List struct {
// S3Spec represent the spec of a s3 service
type S3Spec struct {
// The annotations-related configuration to add/set on each Pod related object.
Annotations rook.Annotations `json:"annotations,omitempty"`
// The affinity to place the S3 pods (default is to place on any available nodes in EdgeFS running namespace)
Placement rook.Placement `json:"placement"`
// Resources set resource requests and limits
@@ -217,6 +223,8 @@ type S3XList struct {
// S3XSpec represent the spec of a s3 service
type S3XSpec struct {
// The annotations-related configuration to add/set on each Pod related object.
Annotations rook.Annotations `json:"annotations,omitempty"`
// The affinity to place the S3X pods (default is to place on any available nodes in EdgeFS running namespace)
Placement rook.Placement `json:"placement"`
// Resources set resource requests and limits
@@ -253,6 +261,8 @@ type ISCSIList struct {
// ISCSISpec represent the spec of a iscsi service
type ISCSISpec struct {
// The annotations-related configuration to add/set on each Pod related object.
Annotations rook.Annotations `json:"annotations,omitempty"`
// The affinity to place the ISCSI pods (default is to place on any available nodes in EdgeFS running namespace)
Placement rook.Placement `json:"placement"`
// Resources set resource requests and limits
@@ -296,6 +306,8 @@ type ISGWList struct {
// ISGWSpec represent the spec of a isgw service
type ISGWSpec struct {
// The annotations-related configuration to add/set on each Pod related object.
Annotations rook.Annotations `json:"annotations,omitempty"`
// The affinity to place the ISGW pods (default is to place on any available nodes in EdgeFS running namespace)
Placement rook.Placement `json:"placement"`
// Resources set resource requests and limits
+3
View File
@@ -56,6 +56,9 @@ type ObjectStoreSpec struct {
// A spec for available storage in the cluster and how it should be used
Storage rook.StorageScopeSpec `json:"scope,omitempty"`
// The annotations to add/set on each Pod related object.
Annotations rook.Annotations `json:"annotations,omitempty"`
// The placement-related configuration to pass to kubernetes (affinity, node selector,
// tolerations).
Placement rook.PlacementSpec `json:"placement,omitempty"`
@@ -89,6 +89,13 @@ func (in *ObjectStoreList) DeepCopyObject() runtime.Object {
func (in *ObjectStoreSpec) DeepCopyInto(out *ObjectStoreSpec) {
*out = *in
in.Storage.DeepCopyInto(&out.Storage)
if in.Annotations != nil {
in, out := &in.Annotations, &out.Annotations
*out = make(v1alpha2.Annotations, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.Placement != nil {
in, out := &in.Placement, &out.Placement
*out = make(v1alpha2.PlacementSpec, len(*in))
+4 -1
View File
@@ -16,6 +16,7 @@ limitations under the License.
package v1alpha1
import (
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@@ -46,6 +47,9 @@ type NFSServerList struct {
// NFSSpec represents the spec of NFS daemon
type NFSServerSpec struct {
// The annotations-related configuration to add/set on each Pod related object.
Annotations rookalpha.Annotations `json:"annotations,omitempty"`
// Replicas of the NFS daemon
Replicas int `json:"replicas,omitempty"`
@@ -67,7 +71,6 @@ type ExportsSpec struct {
// ServerSpec represents the spec for configuring the NFS server
type ServerSpec struct {
// Reading and Writing permissions on the export
// Valid values are "ReadOnly", "ReadWrite" and "none"
AccessMode string `json:"accessMode,omitempty"`
@@ -21,6 +21,7 @@ limitations under the License.
package v1alpha1
import (
v1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@@ -126,6 +127,13 @@ func (in *NFSServerList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NFSServerSpec) DeepCopyInto(out *NFSServerSpec) {
*out = *in
if in.Annotations != nil {
in, out := &in.Annotations, &out.Annotations
*out = make(v1alpha2.Annotations, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.Exports != nil {
in, out := &in.Exports, &out.Exports
*out = make([]ExportsSpec, len(*in))
+59
View File
@@ -0,0 +1,59 @@
/*
Copyright 2019 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha2
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func (a AnnotationsSpec) All() Annotations {
return a[KeyAll]
}
// ApplyToObjectMeta adds or overwrites if exists annotations to object meta.
func (a Annotations) ApplyToObjectMeta(t *metav1.ObjectMeta) {
if t.Annotations == nil {
t.Annotations = map[string]string{}
}
for k, v := range a {
if _, ok := t.Annotations[k]; !ok {
t.Annotations[k] = v
}
}
}
// Merge returns an Annotations which results from merging the attributes of the
// original Annotations with the attributes of the supplied one. The supplied
// Placement's attributes will override the original ones if defined.
func (a Annotations) Merge(with Annotations) Annotations {
ret := a
for k, v := range with {
if _, ok := ret[k]; !ok {
ret[k] = v
}
}
return ret
}
// GetMapStringString return the Annotations as a
func (a Annotations) GetMapStringString() map[string]string {
res := map[string]string{}
for k, v := range a {
res[k] = v
}
return res
}
@@ -0,0 +1,84 @@
/*
Copyright 2019 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha2
import (
"encoding/json"
"testing"
"github.com/ghodss/yaml"
"github.com/stretchr/testify/assert"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func TestAnnotationsSpec(t *testing.T) {
specYaml := []byte(`
mgr:
foo: bar
hello: world
mon:
`)
// convert the raw spec yaml into JSON
rawJSON, err := yaml.YAMLToJSON(specYaml)
assert.Nil(t, err)
// unmarshal the JSON into a strongly typed annotations spec object
var annotations AnnotationsSpec
err = json.Unmarshal(rawJSON, &annotations)
assert.Nil(t, err)
// the unmarshalled annotations spec should equal the expected spec below
expected := AnnotationsSpec{
"mgr": map[string]string{
"foo": "bar",
"hello": "world",
},
"mon": nil,
}
assert.Equal(t, expected, annotations)
}
func TestAnnotations_ApplyToPodSpec(t *testing.T) {
objMeta := &metav1.ObjectMeta{}
testAnnotations := Annotations{
"foo": "bar",
"hello": "world",
}
testAnnotations.ApplyToObjectMeta(objMeta)
assert.Equal(t, testAnnotations.GetMapStringString(), objMeta.Annotations)
testAnnotations["isthisatest"] = "test"
testAnnotations.ApplyToObjectMeta(objMeta)
assert.Equal(t, testAnnotations.GetMapStringString(), objMeta.Annotations)
}
func TestAnnotations_Merge(t *testing.T) {
testAnnotationsPart1 := Annotations{
"foo": "bar",
"hello": "world",
}
testAnnotationsPart2 := Annotations{
"bar": "foo",
"hello": "earth",
}
assert.Equal(t, map[string]string{
"foo": "bar",
"bar": "foo",
"hello": "world",
}, testAnnotationsPart1.Merge(testAnnotationsPart2).GetMapStringString())
}
+21
View File
@@ -0,0 +1,21 @@
/*
Copyright 2018 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha2
const (
KeyAll = "all"
)
+1 -5
View File
@@ -19,12 +19,8 @@ import (
"k8s.io/api/core/v1"
)
const (
PlacementKeyAll = "all"
)
func (p PlacementSpec) All() Placement {
return p[PlacementKeyAll]
return p[KeyAll]
}
// ApplyToPodSpec adds placement to a pod spec
+8 -1
View File
@@ -67,7 +67,7 @@ type Selection struct {
VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"`
}
type PlacementSpec map[string]Placement
type PlacementSpec map[KeyType]Placement
type Placement struct {
NodeAffinity *v1.NodeAffinity `json:"nodeAffinity,omitempty"`
@@ -119,3 +119,10 @@ type VolumeList struct {
metav1.ListMeta `json:"metadata"`
Items []Volume `json:"items"`
}
// KeyType
type KeyType string
type AnnotationsSpec map[KeyType]Annotations
type Annotations map[string]string
@@ -25,6 +25,60 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in Annotations) DeepCopyInto(out *Annotations) {
{
in := &in
*out = make(Annotations, len(*in))
for key, val := range *in {
(*out)[key] = val
}
return
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Annotations.
func (in Annotations) DeepCopy() Annotations {
if in == nil {
return nil
}
out := new(Annotations)
in.DeepCopyInto(out)
return *out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in AnnotationsSpec) DeepCopyInto(out *AnnotationsSpec) {
{
in := &in
*out = make(AnnotationsSpec, len(*in))
for key, val := range *in {
var outVal map[string]string
if val == nil {
(*out)[key] = nil
} else {
in, out := &val, &outVal
*out = make(Annotations, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
(*out)[key] = outVal
}
return
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnnotationsSpec.
func (in AnnotationsSpec) DeepCopy() AnnotationsSpec {
if in == nil {
return nil
}
out := new(AnnotationsSpec)
in.DeepCopyInto(out)
return *out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Attachment) DeepCopyInto(out *Attachment) {
*out = *in
+3 -5
View File
@@ -18,6 +18,7 @@ package controller
import (
"fmt"
cassandrav1alpha1 "github.com/rook/rook/pkg/apis/cassandra.rook.io/v1alpha1"
"github.com/rook/rook/pkg/operator/cassandra/constants"
"github.com/rook/rook/pkg/operator/cassandra/controller/util"
@@ -29,7 +30,6 @@ import (
// It doesn't post the result to the API Server yet.
// That will be done at the end of the sync loop.
func (cc *ClusterController) updateStatus(c *cassandrav1alpha1.Cluster) error {
clusterStatus := cassandrav1alpha1.ClusterStatus{
Racks: map[string]*cassandrav1alpha1.RackStatus{},
}
@@ -91,7 +91,6 @@ func (cc *ClusterController) updateStatus(c *cassandrav1alpha1.Cluster) error {
// SyncCluster checks the Status and performs reconciliation for
// the given Cassandra Cluster.
func (cc *ClusterController) syncCluster(c *cassandrav1alpha1.Cluster) error {
// Check if any rack isn't created
for _, rack := range c.Spec.Datacenter.Racks {
// For each rack, check if a status entry exists
@@ -144,8 +143,9 @@ func (cc *ClusterController) syncCluster(c *cassandrav1alpha1.Cluster) error {
// createRack creates a new Cassandra Rack with 0 Members.
func (cc *ClusterController) createRack(r cassandrav1alpha1.RackSpec, c *cassandrav1alpha1.Cluster) error {
sts := util.StatefulSetForRack(r, c, cc.rookImage)
c.Spec.Annotations.Merge(r.Annotations).ApplyToObjectMeta(&sts.Spec.Template.ObjectMeta)
c.Spec.Annotations.Merge(r.Annotations).ApplyToObjectMeta(&sts.ObjectMeta)
existingStatefulset, err := cc.statefulSetLister.StatefulSets(sts.Namespace).Get(sts.Name)
if err == nil {
return util.VerifyOwner(existingStatefulset, c)
@@ -175,7 +175,6 @@ func (cc *ClusterController) createRack(r cassandrav1alpha1.RackSpec, c *cassand
// scaleUpRack handles scaling up for an existing Cassandra Rack.
// Calling this action implies all members of the Rack are Ready.
func (cc *ClusterController) scaleUpRack(r cassandrav1alpha1.RackSpec, c *cassandrav1alpha1.Cluster) error {
sts, err := cc.statefulSetLister.StatefulSets(c.Namespace).Get(util.StatefulSetNameForRack(r, c))
if err != nil {
return fmt.Errorf("error trying to scale rack %s in namespace %s, underlying StatefulSet not found", r.Name, c.Namespace)
@@ -201,7 +200,6 @@ func (cc *ClusterController) scaleUpRack(r cassandrav1alpha1.RackSpec, c *cassan
// scaleDownRack handles scaling down for an existing Cassandra Rack.
// Calling this action implies all members of the Rack are Ready.
func (cc *ClusterController) scaleDownRack(r cassandrav1alpha1.RackSpec, c *cassandrav1alpha1.Cluster) error {
logger.Infof("Scaling down rack %s", r.Name)
// Get the current actual number of Members
@@ -18,6 +18,8 @@ package controller
import (
"fmt"
"testing"
cassandrav1alpha1 "github.com/rook/rook/pkg/apis/cassandra.rook.io/v1alpha1"
"github.com/rook/rook/pkg/operator/cassandra/constants"
"github.com/rook/rook/pkg/operator/cassandra/controller/util"
@@ -26,11 +28,9 @@ import (
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"testing"
)
func TestCreateRack(t *testing.T) {
simpleCluster := casstest.NewSimpleCluster(3)
tests := []struct {
@@ -77,14 +77,14 @@ func TestCreateRack(t *testing.T) {
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
cc := newFakeClusterController(test.kubeObjects, nil)
err := cc.createRack(test.rack, test.cluster)
if err == nil {
if err := cc.createRack(test.rack, test.cluster); err == nil {
if test.expectedErr {
t.Errorf("Expected an error, got none.")
} else {
sts, err := cc.kubeClient.AppsV1().StatefulSets(test.cluster.Namespace).
var sts *appsv1.StatefulSet
sts, err = cc.kubeClient.AppsV1().StatefulSets(test.cluster.Namespace).
Get(util.StatefulSetNameForRack(test.rack, test.cluster), metav1.GetOptions{})
if err != nil {
t.Errorf("Couldn't retrieve expected StatefulSet: %s", err.Error())
@@ -92,8 +92,7 @@ func TestCreateRack(t *testing.T) {
t.Logf("Got StatefulSet as expected: %s", sts.Name)
}
}
}
if err != nil {
} else {
if test.expectedErr {
t.Logf("Got an error as expected: %s", err.Error())
} else {
+1 -1
View File
@@ -26,7 +26,7 @@ const (
// SuccessSynced is used as part of the Event 'reason' when a Cluster is
// synced.
SuccessSynced = "Synced"
// ErrResourceExists is used as part of the Event 'reason' when a
// ErrSyncFailed is used as part of the Event 'reason' when a
// Cluster fails to sync due to a resource of the same name already
// existing.
ErrSyncFailed = "ErrSyncFailed"
+6 -4
View File
@@ -195,8 +195,8 @@ func (c *cluster) doOrchestration(rookImage string, cephVersion cephver.CephVers
}
mgrs := mgr.New(c.Info, c.context, c.Namespace, rookImage,
spec.CephVersion, cephv1.GetMgrPlacement(spec.Placement), spec.Network.HostNetwork,
spec.Dashboard, cephv1.GetMgrResources(spec.Resources), c.ownerRef, c.Spec.DataDirHostPath)
spec.CephVersion, cephv1.GetMgrPlacement(spec.Placement), cephv1.GetMgrAnnotations(c.Spec.Annotations),
spec.Network.HostNetwork, spec.Dashboard, cephv1.GetMgrResources(spec.Resources), c.ownerRef, c.Spec.DataDirHostPath)
err = mgrs.Start()
if err != nil {
return fmt.Errorf("failed to start the ceph mgr. %+v", err)
@@ -204,7 +204,8 @@ func (c *cluster) doOrchestration(rookImage string, cephVersion cephver.CephVers
// Start the OSDs
osds := osd.New(c.Info, c.context, c.Namespace, rookImage, spec.CephVersion, spec.Storage, spec.DataDirHostPath,
cephv1.GetOSDPlacement(spec.Placement), spec.Network.HostNetwork, cephv1.GetOSDResources(spec.Resources), c.ownerRef)
cephv1.GetOSDPlacement(spec.Placement), cephv1.GetOSDAnnotations(spec.Annotations), spec.Network.HostNetwork,
cephv1.GetOSDResources(spec.Resources), c.ownerRef)
err = osds.Start()
if err != nil {
return fmt.Errorf("failed to start the osds. %+v", err)
@@ -212,7 +213,8 @@ func (c *cluster) doOrchestration(rookImage string, cephVersion cephver.CephVers
// Start the rbd mirroring daemon(s)
rbdmirror := rbd.New(c.Info, c.context, c.Namespace, rookImage, spec.CephVersion, cephv1.GetRBDMirrorPlacement(spec.Placement),
spec.Network.HostNetwork, spec.RBDMirroring, cephv1.GetRBDMirrorResources(spec.Resources), c.ownerRef, c.Spec.DataDirHostPath)
cephv1.GetRBDMirrorAnnotations(spec.Annotations), spec.Network.HostNetwork, spec.RBDMirroring,
cephv1.GetRBDMirrorResources(spec.Resources), c.ownerRef, c.Spec.DataDirHostPath)
err = rbdmirror.Start()
if err != nil {
return fmt.Errorf("failed to start the rbd mirrors. %+v", err)
+2
View File
@@ -51,6 +51,7 @@ type Cluster struct {
Namespace string
Replicas int
placement rookalpha.Placement
annotations rookalpha.Annotations
context *clusterd.Context
dataDir string
HostNetwork bool
@@ -70,6 +71,7 @@ func New(
namespace, rookVersion string,
cephVersion cephv1.CephVersionSpec,
placement rookalpha.Placement,
annotations rookalpha.Annotations,
hostNetwork bool,
dashboard cephv1.DashboardSpec,
resources v1.ResourceRequirements,
@@ -60,6 +60,7 @@ func TestStartMGR(t *testing.T) {
"myversion",
cephv1.CephVersionSpec{},
rookalpha.Placement{},
rookalpha.Annotations{},
false,
cephv1.DashboardSpec{Enabled: true},
v1.ResourceRequirements{},
+9 -2
View File
@@ -37,8 +37,6 @@ func (c *Cluster) makeDeployment(mgrConfig *mgrConfig) *apps.Deployment {
ObjectMeta: metav1.ObjectMeta{
Name: mgrConfig.ResourceName,
Labels: c.getPodLabels(mgrConfig.DaemonID),
Annotations: map[string]string{"prometheus.io/scrape": "true",
"prometheus.io/port": strconv.Itoa(metricsPort)},
},
Spec: v1.PodSpec{
InitContainers: []v1.Container{
@@ -60,6 +58,7 @@ func (c *Cluster) makeDeployment(mgrConfig *mgrConfig) *apps.Deployment {
if c.HostNetwork {
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
}
c.annotations.ApplyToObjectMeta(&podSpec.ObjectMeta)
c.placement.ApplyToPodSpec(&podSpec.Spec)
if c.clusterInfo.CephVersion.IsLuminous() {
// prepend the keyring-copy workaround for luminous clusters
@@ -87,6 +86,14 @@ func (c *Cluster) makeDeployment(mgrConfig *mgrConfig) *apps.Deployment {
},
}
k8sutil.AddRookVersionLabelToDeployment(d)
if len(c.annotations) == 0 {
prometheusAnnotations := map[string]string{
"prometheus.io/scrape": "true",
"prometheus.io/port": strconv.Itoa(metricsPort),
}
podSpec.ObjectMeta.Annotations = prometheusAnnotations
d.ObjectMeta.Annotations = prometheusAnnotations
}
k8sutil.SetOwnerRef(c.context.Clientset, c.Namespace, &d.ObjectMeta, &c.ownerRef)
return d
}
@@ -41,6 +41,7 @@ func TestPodSpec(t *testing.T) {
"rook/rook:myversion",
cephv1.CephVersionSpec{Image: "ceph/ceph:myceph"},
rookalpha.Placement{},
rookalpha.Annotations{},
false,
cephv1.DashboardSpec{},
v1.ResourceRequirements{
@@ -88,6 +89,7 @@ func TestServiceSpec(t *testing.T) {
"myversion",
cephv1.CephVersionSpec{},
rookalpha.Placement{},
rookalpha.Annotations{},
false,
cephv1.DashboardSpec{},
v1.ResourceRequirements{},
@@ -110,6 +112,7 @@ func TestHostNetwork(t *testing.T) {
"myversion",
cephv1.CephVersionSpec{},
rookalpha.Placement{},
rookalpha.Annotations{},
true,
cephv1.DashboardSpec{},
v1.ResourceRequirements{},
+8 -8
View File
@@ -165,16 +165,16 @@ func TestConvertLegacyCluster(t *testing.T) {
},
Network: rookv1alpha2.NetworkSpec{HostNetwork: true},
Placement: rookv1alpha2.PlacementSpec{
rookv1alpha2.PlacementKeyAll: rookv1alpha2.Placement{Tolerations: []v1.Toleration{{Key: "storage-node", Operator: v1.TolerationOpExists}}},
cephv1.PlacementKeyMon: rookv1alpha2.Placement{
rookv1alpha2.KeyAll: rookv1alpha2.Placement{Tolerations: []v1.Toleration{{Key: "storage-node", Operator: v1.TolerationOpExists}}},
cephv1.KeyMon: rookv1alpha2.Placement{
PodAntiAffinity: &v1.PodAntiAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: []v1.PodAffinityTerm{
{LabelSelector: &metav1.LabelSelector{MatchLabels: map[string]string{"label": "value"}}},
},
},
},
cephv1.PlacementKeyMgr: rookv1alpha2.Placement{},
cephv1.PlacementKeyOSD: rookv1alpha2.Placement{},
cephv1.KeyMgr: rookv1alpha2.Placement{},
cephv1.KeyOSD: rookv1alpha2.Placement{},
},
Resources: rookv1alpha2.ResourceSpec{
cephv1.ResourcesKeyOSD: v1.ResourceRequirements{Limits: v1.ResourceList{v1.ResourceMemory: resource.MustParse("250Mi")}},
@@ -251,16 +251,16 @@ func TestConvertLegacyCluster(t *testing.T) {
},
Network: rookv1alpha2.NetworkSpec{HostNetwork: true},
Placement: rookv1alpha2.PlacementSpec{
rookv1alpha2.PlacementKeyAll: rookv1alpha2.Placement{Tolerations: []v1.Toleration{{Key: "storage-node", Operator: v1.TolerationOpExists}}},
cephv1.PlacementKeyMon: rookv1alpha2.Placement{
rookv1alpha2.KeyAll: rookv1alpha2.Placement{Tolerations: []v1.Toleration{{Key: "storage-node", Operator: v1.TolerationOpExists}}},
cephv1.KeyMon: rookv1alpha2.Placement{
PodAntiAffinity: &v1.PodAntiAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: []v1.PodAffinityTerm{
{LabelSelector: &metav1.LabelSelector{MatchLabels: map[string]string{"label": "value"}}},
},
},
},
cephv1.PlacementKeyMgr: rookv1alpha2.Placement{},
cephv1.PlacementKeyOSD: rookv1alpha2.Placement{},
cephv1.KeyMgr: rookv1alpha2.Placement{},
cephv1.KeyOSD: rookv1alpha2.Placement{},
},
Resources: rookv1alpha2.ResourceSpec{
cephv1.ResourcesKeyOSD: v1.ResourceRequirements{Limits: v1.ResourceList{v1.ResourceMemory: resource.MustParse("250Mi")}},
+2 -3
View File
@@ -432,9 +432,8 @@ func (c *Cluster) waitForMonsToJoin(mons []*monConfig, requireAllInQuorum bool)
func (c *Cluster) saveMonConfig() error {
configMap := &v1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: EndpointConfigMapName,
Namespace: c.Namespace,
Annotations: map[string]string{},
Name: EndpointConfigMapName,
Namespace: c.Namespace,
},
}
k8sutil.SetOwnerRef(c.context.Clientset, c.Namespace, &configMap.ObjectMeta, &c.ownerRef)
+2 -2
View File
@@ -138,8 +138,8 @@ func TestNodeAffinity(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, 3, len(nodes))
c.spec.Placement = map[string]rookalpha.Placement{}
c.spec.Placement["mon"] = rookalpha.Placement{NodeAffinity: &v1.NodeAffinity{
c.spec.Placement = map[rookalpha.KeyType]rookalpha.Placement{}
c.spec.Placement[cephv1.KeyMon] = rookalpha.Placement{NodeAffinity: &v1.NodeAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{
NodeSelectorTerms: []v1.NodeSelectorTerm{
{
+5 -4
View File
@@ -57,6 +57,7 @@ func (c *Cluster) makeDeployment(monConfig *monConfig, hostname string) *apps.De
},
}
k8sutil.AddRookVersionLabelToDeployment(d)
cephv1.GetMonAnnotations(c.spec.Annotations).ApplyToObjectMeta(&d.ObjectMeta)
k8sutil.SetOwnerRef(c.context.Clientset, c.Namespace, &d.ObjectMeta, &c.ownerRef)
pod := c.makeMonPod(monConfig, hostname)
@@ -109,13 +110,13 @@ func (c *Cluster) makeMonPod(monConfig *monConfig, hostname string) *v1.Pod {
pod := &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: monConfig.ResourceName,
Namespace: c.Namespace,
Labels: c.getLabels(monConfig.DaemonName),
Annotations: map[string]string{},
Name: monConfig.ResourceName,
Namespace: c.Namespace,
Labels: c.getLabels(monConfig.DaemonName),
},
Spec: podSpec,
}
cephv1.GetMonAnnotations(c.spec.Annotations).ApplyToObjectMeta(&pod.ObjectMeta)
return pod
}
+3 -1
View File
@@ -63,6 +63,7 @@ type Cluster struct {
context *clusterd.Context
Namespace string
placement rookalpha.Placement
annotations rookalpha.Annotations
Keyring string
rookVersion string
cephVersion cephv1.CephVersionSpec
@@ -85,16 +86,17 @@ func New(
storageSpec rookalpha.StorageScopeSpec,
dataDirHostPath string,
placement rookalpha.Placement,
annotations rookalpha.Annotations,
hostNetwork bool,
resources v1.ResourceRequirements,
ownerRef metav1.OwnerReference,
) *Cluster {
return &Cluster{
clusterInfo: clusterInfo,
context: context,
Namespace: namespace,
placement: placement,
annotations: annotations,
rookVersion: rookVersion,
cephVersion: cephVersion,
DesiredStorage: storageSpec,
+5 -5
View File
@@ -47,7 +47,7 @@ func TestStart(t *testing.T) {
CephVersion: cephver.Nautilus,
}
c := New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns", "myversion", cephv1.CephVersionSpec{},
rookalpha.StorageScopeSpec{}, "", rookalpha.Placement{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
rookalpha.StorageScopeSpec{}, "", rookalpha.Placement{}, rookalpha.Annotations{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
// Start the first time
err := c.Start()
@@ -125,7 +125,7 @@ func TestAddRemoveNode(t *testing.T) {
CephVersion: cephver.Nautilus,
}
c := New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns-add-remove", "myversion", cephv1.CephVersionSpec{},
storageSpec, "/foo", rookalpha.Placement{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
storageSpec, "/foo", rookalpha.Placement{}, rookalpha.Annotations{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
// kick off the start of the orchestration in a goroutine
var startErr error
@@ -210,7 +210,7 @@ func TestAddRemoveNode(t *testing.T) {
// modify the storage spec to remove the node from the cluster
storageSpec.Nodes = []rookalpha.Node{}
c = New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: mockExec}, "ns-add-remove", "myversion", cephv1.CephVersionSpec{},
storageSpec, "", rookalpha.Placement{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
storageSpec, "", rookalpha.Placement{}, rookalpha.Annotations{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
// reset the orchestration status watcher
statusMapWatcher = watch.NewFake()
@@ -252,7 +252,7 @@ func TestDiscoverOSDs(t *testing.T) {
CephVersion: cephver.Nautilus,
}
c := New(clusterInfo, &clusterd.Context{}, "ns", "myversion", cephv1.CephVersionSpec{},
rookalpha.StorageScopeSpec{}, "", rookalpha.Placement{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
rookalpha.StorageScopeSpec{}, "", rookalpha.Placement{}, rookalpha.Annotations{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
node1 := "n1"
node2 := "n2"
@@ -323,7 +323,7 @@ func TestAddNodeFailure(t *testing.T) {
CephVersion: cephver.Nautilus,
}
c := New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns-add-remove", "myversion", cephv1.CephVersionSpec{},
storageSpec, "/foo", rookalpha.Placement{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
storageSpec, "/foo", rookalpha.Placement{}, rookalpha.Annotations{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
// kick off the start of the orchestration in a goroutine
var startErr error
+15 -10
View File
@@ -279,7 +279,6 @@ func (c *Cluster) makeDeployment(nodeName string, selection rookalpha.Selection,
k8sutil.ClusterAttr: c.Namespace,
osdLabelKey: fmt.Sprintf("%d", osd.ID),
},
Annotations: map[string]string{},
},
Spec: v1.PodSpec{
NodeSelector: map[string]string{apis.LabelHostname: nodeName},
@@ -319,6 +318,8 @@ func (c *Cluster) makeDeployment(nodeName string, selection rookalpha.Selection,
},
}
k8sutil.AddRookVersionLabelToDeployment(deployment)
c.annotations.ApplyToObjectMeta(&deployment.ObjectMeta)
c.annotations.ApplyToObjectMeta(&deployment.Spec.Template.ObjectMeta)
k8sutil.SetOwnerRef(c.context.Clientset, c.Namespace, &deployment.ObjectMeta, &c.ownerRef)
c.placement.ApplyToPodSpec(&deployment.Spec.Template.Spec)
return deployment, nil
@@ -388,20 +389,24 @@ func (c *Cluster) provisionPodTemplateSpec(devices []rookalpha.Device, selection
}
c.placement.ApplyToPodSpec(&podSpec)
podMeta := metav1.ObjectMeta{
Name: appName,
Labels: map[string]string{
k8sutil.AppAttr: prepareAppName,
k8sutil.ClusterAttr: c.Namespace,
},
Annotations: map[string]string{},
}
c.annotations.ApplyToObjectMeta(&podMeta)
// ceph-volume --dmcrypt uses cryptsetup that synchronizes with udev on
// host through semaphore
podSpec.HostIPC = storeConfig.EncryptedDevice
return &v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Name: appName,
Labels: map[string]string{
k8sutil.AppAttr: prepareAppName,
k8sutil.ClusterAttr: c.Namespace,
},
Annotations: map[string]string{},
},
Spec: podSpec,
ObjectMeta: podMeta,
Spec: podSpec,
}, nil
}
+4 -4
View File
@@ -79,7 +79,7 @@ func testPodDevices(t *testing.T, dataDir, deviceName string, allDevices bool) {
CephVersion: cephver.Nautilus,
}
c := New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns", "rook/rook:myversion", cephVersion,
storageSpec, dataDir, rookalpha.Placement{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
storageSpec, dataDir, rookalpha.Placement{}, rookalpha.Annotations{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
devMountNeeded := deviceName != "" || allDevices
@@ -165,7 +165,7 @@ func TestStorageSpecDevicesAndDirectories(t *testing.T) {
CephVersion: cephver.Nautilus,
}
c := New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns", "rook/rook:myversion", cephv1.CephVersionSpec{},
storageSpec, "/var/lib/rook", rookalpha.Placement{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
storageSpec, "/var/lib/rook", rookalpha.Placement{}, rookalpha.Annotations{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
n := c.DesiredStorage.ResolveNode(storageSpec.Nodes[0].Name)
osd := OSDInfo{
@@ -260,7 +260,7 @@ func TestStorageSpecConfig(t *testing.T) {
CephVersion: cephver.Nautilus,
}
c := New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns", "rook/rook:myversion", cephv1.CephVersionSpec{},
storageSpec, "", rookalpha.Placement{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
storageSpec, "", rookalpha.Placement{}, rookalpha.Annotations{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
n := c.DesiredStorage.ResolveNode(storageSpec.Nodes[0].Name)
storeConfig := config.ToStoreConfig(storageSpec.Nodes[0].Config)
@@ -315,7 +315,7 @@ func TestHostNetwork(t *testing.T) {
CephVersion: cephver.Nautilus,
}
c := New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns", "myversion", cephv1.CephVersionSpec{},
storageSpec, "", rookalpha.Placement{}, true, v1.ResourceRequirements{}, metav1.OwnerReference{})
storageSpec, "", rookalpha.Placement{}, rookalpha.Annotations{}, true, v1.ResourceRequirements{}, metav1.OwnerReference{})
n := c.DesiredStorage.ResolveNode(storageSpec.Nodes[0].Name)
osd := OSDInfo{
+1 -1
View File
@@ -42,7 +42,7 @@ func TestOrchestrationStatus(t *testing.T) {
CephVersion: cephver.Nautilus,
}
c := New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns", "myversion", cephv1.CephVersionSpec{},
rookalpha.StorageScopeSpec{}, "", rookalpha.Placement{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
rookalpha.StorageScopeSpec{}, "", rookalpha.Placement{}, rookalpha.Annotations{}, false, v1.ResourceRequirements{}, metav1.OwnerReference{})
kv := k8sutil.NewConfigMapKVStore(c.Namespace, clientset, metav1.OwnerReference{})
nodeName := "mynode"
cmName := fmt.Sprintf(orchestrationStatusMapName, nodeName)
+3
View File
@@ -43,6 +43,7 @@ type Mirroring struct {
ClusterInfo *cephconfig.ClusterInfo
Namespace string
placement rookalpha.Placement
annotations rookalpha.Annotations
context *clusterd.Context
resources v1.ResourceRequirements
ownerRef metav1.OwnerReference
@@ -60,6 +61,7 @@ func New(
namespace, rookVersion string,
cephVersion cephv1.CephVersionSpec,
placement rookalpha.Placement,
annotations rookalpha.Annotations,
hostNetwork bool,
spec cephv1.RBDMirroringSpec,
resources v1.ResourceRequirements,
@@ -71,6 +73,7 @@ func New(
context: context,
Namespace: namespace,
placement: placement,
annotations: annotations,
rookVersion: rookVersion,
cephVersion: cephVersion,
spec: spec,
@@ -51,6 +51,7 @@ func TestRBDMirror(t *testing.T) {
"rook/rook:myversion",
cephv1.CephVersionSpec{Image: "ceph/ceph:myceph"},
rookalpha.Placement{},
rookalpha.Annotations{},
false,
cephv1.RBDMirroringSpec{Workers: 2},
v1.ResourceRequirements{},
+4 -3
View File
@@ -49,9 +49,10 @@ func (m *Mirroring) makeDeployment(daemonConfig *daemonConfig) *apps.Deployment
replicas := int32(1)
d := &apps.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: daemonConfig.ResourceName,
Namespace: m.Namespace,
Labels: opspec.PodLabels(appName, m.Namespace, string(config.RbdMirrorType), daemonConfig.DaemonID),
Name: daemonConfig.ResourceName,
Namespace: m.Namespace,
Annotations: m.annotations,
Labels: opspec.PodLabels(appName, m.Namespace, string(config.RbdMirrorType), daemonConfig.DaemonID),
},
Spec: apps.DeploymentSpec{
Selector: &metav1.LabelSelector{
@@ -40,6 +40,7 @@ func TestPodSpec(t *testing.T) {
"rook/rook:myversion",
cephv1.CephVersionSpec{Image: "ceph/ceph:myceph"},
rookalpha.Placement{},
rookalpha.Annotations{},
false,
cephv1.RBDMirroringSpec{Workers: 2},
v1.ResourceRequirements{
+4 -3
View File
@@ -40,9 +40,8 @@ const (
func (c *Cluster) makeDeployment(mdsConfig *mdsConfig) *apps.Deployment {
podSpec := v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Name: mdsConfig.ResourceName,
Labels: c.podLabels(mdsConfig),
Annotations: map[string]string{},
Name: mdsConfig.ResourceName,
Labels: c.podLabels(mdsConfig),
},
Spec: v1.PodSpec{
InitContainers: []v1.Container{},
@@ -57,6 +56,7 @@ func (c *Cluster) makeDeployment(mdsConfig *mdsConfig) *apps.Deployment {
if c.HostNetwork {
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
}
c.fs.Spec.MetadataServer.Annotations.ApplyToObjectMeta(&podSpec.ObjectMeta)
c.fs.Spec.MetadataServer.Placement.ApplyToPodSpec(&podSpec.Spec)
replicas := int32(1)
@@ -78,6 +78,7 @@ func (c *Cluster) makeDeployment(mdsConfig *mdsConfig) *apps.Deployment {
},
}
k8sutil.AddRookVersionLabelToDeployment(d)
c.fs.Spec.MetadataServer.Annotations.ApplyToObjectMeta(&d.ObjectMeta)
k8sutil.SetOwnerRefs(c.context.Clientset, c.fs.Namespace, &d.ObjectMeta, c.ownerRefs)
return d
}
+4 -3
View File
@@ -85,6 +85,7 @@ func (c *CephNFSController) makeDeployment(n cephv1.CephNFS, name, configName st
Namespace: n.Namespace,
},
}
n.Spec.Server.Annotations.ApplyToObjectMeta(&deployment.ObjectMeta)
k8sutil.SetOwnerRef(c.context.Clientset, n.Namespace, &deployment.ObjectMeta, &c.ownerRef)
configMapSource := &v1.ConfigMapVolumeSource{
LocalObjectReference: v1.LocalObjectReference{Name: configName},
@@ -110,12 +111,12 @@ func (c *CephNFSController) makeDeployment(n cephv1.CephNFS, name, configName st
podTemplateSpec := v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Name: instanceName(n, name),
Labels: getLabels(n, name),
Annotations: map[string]string{},
Name: instanceName(n, name),
Labels: getLabels(n, name),
},
Spec: podSpec,
}
n.Spec.Server.Annotations.ApplyToObjectMeta(&podTemplateSpec.ObjectMeta)
// Multiple replicas of the nfs service would be handled by creating a service and a new deployment for each one, rather than increasing the pod count here
replicas := int32(1)
+7 -5
View File
@@ -48,6 +48,7 @@ func (c *clusterConfig) startDeployment() (*apps.Deployment, error) {
},
}
k8sutil.AddRookVersionLabelToDeployment(d)
c.store.Spec.Gateway.Annotations.ApplyToObjectMeta(&d.ObjectMeta)
k8sutil.SetOwnerRefs(c.context.Clientset, c.store.Namespace, &d.ObjectMeta, c.ownerRefs)
logger.Debugf("starting rgw deployment: %+v", d)
@@ -147,17 +148,18 @@ func (c *clusterConfig) makeRGWPodSpec() v1.PodTemplateSpec {
}}}}
podSpec.Volumes = append(podSpec.Volumes, certVol)
}
c.store.Spec.Gateway.Placement.ApplyToPodSpec(&podSpec)
return v1.PodTemplateSpec{
podTemplateSpec := v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Name: c.instanceName(),
Labels: c.getLabels(),
Annotations: map[string]string{},
Name: c.instanceName(),
Labels: c.getLabels(),
},
Spec: podSpec,
}
c.store.Spec.Gateway.Annotations.ApplyToObjectMeta(&podTemplateSpec.ObjectMeta)
return podTemplateSpec
}
func (c *clusterConfig) makeDaemonContainer() v1.Container {
+12 -8
View File
@@ -86,18 +86,20 @@ func NewClusterController(context *clusterd.Context, containerImage string) *Clu
}
type cluster struct {
context *clusterd.Context
namespace string
spec cockroachdbv1alpha1.ClusterSpec
ownerRef metav1.OwnerReference
context *clusterd.Context
namespace string
spec cockroachdbv1alpha1.ClusterSpec
annotations rookv1alpha2.Annotations
ownerRef metav1.OwnerReference
}
func newCluster(c *cockroachdbv1alpha1.Cluster, context *clusterd.Context) *cluster {
return &cluster{
context: context,
namespace: c.Namespace,
spec: c.Spec,
ownerRef: clusterOwnerRef(c.Namespace, string(c.UID)),
context: context,
namespace: c.Namespace,
spec: c.Spec,
annotations: c.Spec.Annotations,
ownerRef: clusterOwnerRef(c.Namespace, string(c.UID)),
}
}
@@ -337,6 +339,8 @@ func (c *ClusterController) createStatefulSet(cluster *cluster) error {
VolumeClaimTemplates: cluster.spec.Storage.VolumeClaimTemplates,
},
}
cluster.annotations.ApplyToObjectMeta(&statefulSet.Spec.Template.ObjectMeta)
cluster.annotations.ApplyToObjectMeta(&statefulSet.ObjectMeta)
k8sutil.SetOwnerRef(c.context.Clientset, cluster.namespace, &statefulSet.ObjectMeta, &cluster.ownerRef)
if _, err := c.context.Clientset.AppsV1().StatefulSets(cluster.namespace).Create(statefulSet); err != nil {
+5 -4
View File
@@ -134,18 +134,19 @@ func (c *cluster) createInstance(rookImage string) error {
//
c.targets = target.New(c.context, c.Namespace, "latest", c.Spec.ServiceAccount, c.Spec.Storage, c.Spec.DataDirHostPath, c.Spec.DataVolumeSize,
edgefsv1alpha1.GetTargetPlacement(c.Spec.Placement), c.Spec.Network, c.Spec.Resources, c.Spec.ResourceProfile, c.Spec.ChunkCacheSize,
c.ownerRef, deploymentConfig)
edgefsv1alpha1.GetTargetAnnotations(c.Spec.Annotations), edgefsv1alpha1.GetTargetPlacement(c.Spec.Placement), c.Spec.Network, c.Spec.Resources,
c.Spec.ResourceProfile, c.Spec.ChunkCacheSize, c.ownerRef, deploymentConfig)
err = c.targets.Start(rookImage, clusterNodes, dro)
if err != nil {
return fmt.Errorf("failed to start the targets. %+v", err)
}
//
// Create and start EdgeFS manager Deployment (gRPC proxy, Prometheus metrics)
//
c.mgrs = mgr.New(c.context, c.Namespace, "latest", c.Spec.ServiceAccount, c.Spec.DataDirHostPath, c.Spec.DataVolumeSize,
edgefsv1alpha1.GetMgrPlacement(c.Spec.Placement), c.Spec.Network, c.Spec.Dashboard,
edgefsv1alpha1.GetMgrAnnotations(c.Spec.Annotations), edgefsv1alpha1.GetMgrPlacement(c.Spec.Placement), c.Spec.Network, c.Spec.Dashboard,
v1.ResourceRequirements{}, c.Spec.ResourceProfile, c.ownerRef)
err = c.mgrs.Start(rookImage)
if err != nil {
@@ -158,7 +159,7 @@ func (c *cluster) createInstance(rookImage string) error {
func (c *cluster) prepareHostNodes(rookImage string, deploymentConfig edgefsv1alpha1.ClusterDeploymentConfig) error {
prep := prepare.New(c.context, c.Namespace, "latest", c.Spec.ServiceAccount,
prep := prepare.New(c.context, c.Namespace, "latest", c.Spec.ServiceAccount, edgefsv1alpha1.GetPrepareAnnotations(c.Spec.Annotations),
edgefsv1alpha1.GetTargetPlacement(c.Spec.Placement), v1.ResourceRequirements{}, c.ownerRef)
for nodeName, devicesConfig := range deploymentConfig.DevConfig {
+21 -10
View File
@@ -46,8 +46,8 @@ const (
defaultRestPort = 8080
defaultRestSPort = 4443
defaultMetricsPort = 8881
defaultUiPort = 3000
defaultUiSPort = 3443
defaultUIPort = 3000
defaultUISPort = 3443
/* Volumes definitions */
dataVolumeName = "edgefs-datadir"
@@ -63,6 +63,7 @@ type Cluster struct {
Replicas int
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
context *clusterd.Context
hostNetworkSpec edgefsv1alpha1.NetworkSpec
@@ -78,6 +79,7 @@ func New(
serviceAccount string,
dataDirHostPath string,
dataVolumeSize resource.Quantity,
annotations rookalpha.Annotations,
placement rookalpha.Placement,
hostNetworkSpec edgefsv1alpha1.NetworkSpec,
dashboardSpec edgefsv1alpha1.DashboardSpec,
@@ -96,6 +98,7 @@ func New(
context: context,
Namespace: namespace,
serviceAccount: serviceAccount,
annotations: annotations,
placement: placement,
Version: version,
Replicas: 1,
@@ -155,7 +158,7 @@ func (c *Cluster) Start(rookImage string) error {
}
// create the ui/dashboard service
uiService := c.makeUiService(uiSvcName)
uiService := c.makeUIService(uiSvcName)
if _, err := c.context.Clientset.CoreV1().Services(c.Namespace).Create(uiService); err != nil {
if !errors.IsAlreadyExists(err) {
return fmt.Errorf("failed to create ui service. %+v", err)
@@ -228,7 +231,7 @@ func (c *Cluster) makeRestapiService(name string) *v1.Service {
return svc
}
func (c *Cluster) makeUiService(name string) *v1.Service {
func (c *Cluster) makeUIService(name string) *v1.Service {
labels := c.getLabels()
svc := &v1.Service{
ObjectMeta: metav1.ObjectMeta{
@@ -242,12 +245,12 @@ func (c *Cluster) makeUiService(name string) *v1.Service {
Ports: []v1.ServicePort{
{
Name: "http-ui",
Port: int32(defaultUiPort),
Port: int32(defaultUIPort),
Protocol: v1.ProtocolTCP,
},
{
Name: "https-ui",
Port: int32(defaultUiSPort),
Port: int32(defaultUISPort),
Protocol: v1.ProtocolTCP,
},
},
@@ -310,8 +313,6 @@ func (c *Cluster) makeDeployment(name, clusterName, rookImage string, replicas i
ObjectMeta: metav1.ObjectMeta{
Name: name,
Labels: c.getDaemonLabels(clusterName),
Annotations: map[string]string{"prometheus.io/scrape": "true",
"prometheus.io/port": strconv.Itoa(defaultMetricsPort)},
},
Spec: v1.PodSpec{
ServiceAccountName: c.serviceAccount,
@@ -327,6 +328,15 @@ func (c *Cluster) makeDeployment(name, clusterName, rookImage string, replicas i
if isHostNetworkDefined(c.hostNetworkSpec) {
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
}
// Add the prometheus.io scrape annoations by default when no annotations have been given.
if len(c.annotations) == 0 {
podSpec.ObjectMeta.Annotations = map[string]string{
"prometheus.io/scrape": "true",
"prometheus.io/port": strconv.Itoa(defaultMetricsPort),
}
} else {
c.annotations.ApplyToObjectMeta(&podSpec.ObjectMeta)
}
c.placement.ApplyToPodSpec(&podSpec.Spec)
d := &apps.Deployment{
@@ -343,6 +353,7 @@ func (c *Cluster) makeDeployment(name, clusterName, rookImage string, replicas i
},
}
k8sutil.SetOwnerRef(c.context.Clientset, c.Namespace, &d.ObjectMeta, &c.ownerRef)
c.annotations.ApplyToObjectMeta(&d.ObjectMeta)
return d
}
@@ -383,12 +394,12 @@ func (c *Cluster) uiContainer(name string, containerImage string) v1.Container {
Ports: []v1.ContainerPort{
{
Name: "http-ui",
ContainerPort: int32(defaultUiPort),
ContainerPort: int32(defaultUIPort),
Protocol: v1.ProtocolTCP,
},
{
Name: "https-ui",
ContainerPort: int32(defaultUiSPort),
ContainerPort: int32(defaultUISPort),
Protocol: v1.ProtocolTCP,
},
},
+7 -9
View File
@@ -46,7 +46,7 @@ func TestStartMGR(t *testing.T) {
ConfigDir: configDir,
Clientset: testop.New(3)}
volSize := resource.NewQuantity(100000.0, resource.BinarySI)
c := New(context, "ns", "myversion", "", "", *volSize, rookalpha.Placement{}, edgefsv1alpha1.NetworkSpec{},
c := New(context, "ns", "myversion", "", "", *volSize, rookalpha.Annotations{}, rookalpha.Placement{}, edgefsv1alpha1.NetworkSpec{},
edgefsv1alpha1.DashboardSpec{}, v1.ResourceRequirements{}, "", metav1.OwnerReference{})
// start a basic service
@@ -72,8 +72,8 @@ func validateStart(t *testing.T, c *Cluster) {
func TestPodSpec(t *testing.T) {
volSize := resource.NewQuantity(100000.0, resource.BinarySI)
c := New(&clusterd.Context{Clientset: testop.New(1)}, "ns", "rook/rook:myversion", "", "", *volSize, rookalpha.Placement{},
edgefsv1alpha1.NetworkSpec{}, edgefsv1alpha1.DashboardSpec{}, v1.ResourceRequirements{
c := New(&clusterd.Context{Clientset: testop.New(1)}, "ns", "rook/rook:myversion", "", "", *volSize, rookalpha.Annotations{},
rookalpha.Placement{}, edgefsv1alpha1.NetworkSpec{}, edgefsv1alpha1.DashboardSpec{}, v1.ResourceRequirements{
Limits: v1.ResourceList{
v1.ResourceCPU: *resource.NewQuantity(100.0, resource.BinarySI),
},
@@ -114,9 +114,8 @@ func TestPodSpec(t *testing.T) {
func TestServiceSpec(t *testing.T) {
volSize := resource.NewQuantity(100000.0, resource.BinarySI)
c := New(&clusterd.Context{}, "ns", "myversion", "", "", *volSize, rookalpha.Placement{},
edgefsv1alpha1.NetworkSpec{}, edgefsv1alpha1.DashboardSpec{}, v1.ResourceRequirements{},
"", metav1.OwnerReference{})
c := New(&clusterd.Context{}, "ns", "myversion", "", "", *volSize, rookalpha.Annotations{}, rookalpha.Placement{},
edgefsv1alpha1.NetworkSpec{}, edgefsv1alpha1.DashboardSpec{}, v1.ResourceRequirements{}, "", metav1.OwnerReference{})
s := c.makeMgrService("rook-edgefs-mgr")
assert.NotNil(t, s)
@@ -126,9 +125,8 @@ func TestServiceSpec(t *testing.T) {
func TestHostNetwork(t *testing.T) {
volSize := resource.NewQuantity(100000.0, resource.BinarySI)
c := New(&clusterd.Context{Clientset: testop.New(1)}, "ns", "myversion", "", "", *volSize, rookalpha.Placement{},
edgefsv1alpha1.NetworkSpec{ServerIfName: "eth0"}, edgefsv1alpha1.DashboardSpec{}, v1.ResourceRequirements{},
"", metav1.OwnerReference{})
c := New(&clusterd.Context{Clientset: testop.New(1)}, "ns", "myversion", "", "", *volSize, rookalpha.Annotations{}, rookalpha.Placement{},
edgefsv1alpha1.NetworkSpec{ServerIfName: "eth0"}, edgefsv1alpha1.DashboardSpec{}, v1.ResourceRequirements{}, "", metav1.OwnerReference{})
d := c.makeDeployment("mgr-a", "a", "edgefs", 1)
assert.NotNil(t, d)
@@ -45,6 +45,7 @@ type Cluster struct {
Namespace string
Version string
serviceAccount string
annotations rookalpha.Annotations
placement rookalpha.Placement
context *clusterd.Context
resources v1.ResourceRequirements
@@ -56,6 +57,7 @@ type Cluster struct {
func New(
context *clusterd.Context, namespace, version string,
serviceAccount string,
annotations rookalpha.Annotations,
placement rookalpha.Placement,
resources v1.ResourceRequirements,
ownerRef metav1.OwnerReference,
@@ -71,6 +73,7 @@ func New(
context: context,
Namespace: namespace,
serviceAccount: serviceAccount,
annotations: annotations,
placement: placement,
Version: version,
resources: resources,
@@ -442,6 +442,8 @@ func (c *Cluster) makeStatefulSet(replicas int32, rookImage string, dro edgefsv1
}
k8sutil.SetOwnerRef(c.context.Clientset, c.Namespace, &statefulSet.ObjectMeta, &c.ownerRef)
c.annotations.ApplyToObjectMeta(&statefulSet.ObjectMeta)
c.annotations.ApplyToObjectMeta(&statefulSet.Spec.Template.ObjectMeta)
c.placement.ApplyToPodSpec(&statefulSet.Spec.Template.Spec)
return statefulSet, nil
@@ -65,7 +65,7 @@ func TestStorageSpecConfig(t *testing.T) {
clientset := fake.NewSimpleClientset()
deploymentConfig := edgefsv1alpha1.ClusterDeploymentConfig{}
c := New(&clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns", "rook/rook:myversion", "",
storageSpec, "", *resource.NewQuantity(100000.0, resource.BinarySI),
storageSpec, "", *resource.NewQuantity(100000.0, resource.BinarySI), rookalpha.Annotations{},
rookalpha.Placement{}, edgefsv1alpha1.NetworkSpec{}, v1.ResourceRequirements{}, "", *resource.NewQuantity(0.0, resource.BinarySI),
metav1.OwnerReference{}, deploymentConfig)
@@ -51,6 +51,7 @@ const (
type Cluster struct {
context *clusterd.Context
Namespace string
annotations rookalpha.Annotations
placement rookalpha.Placement
Version string
Storage rookalpha.StorageScopeSpec
@@ -75,6 +76,7 @@ func New(
storageSpec rookalpha.StorageScopeSpec,
dataDirHostPath string,
dataVolumeSize resource.Quantity,
annotations rookalpha.Annotations,
placement rookalpha.Placement,
hostNetworkSpec edgefsv1alpha1.NetworkSpec,
resources v1.ResourceRequirements,
@@ -93,6 +95,7 @@ func New(
context: context,
Namespace: namespace,
serviceAccount: serviceAccount,
annotations: annotations,
placement: placement,
Version: version,
Storage: storageSpec,
+1
View File
@@ -58,6 +58,7 @@ type ISCSIController struct {
dataDirHostPath string
dataVolumeSize resource.Quantity
placement rookalpha.Placement
annotations rookalpha.Annotations
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
+3
View File
@@ -169,6 +169,7 @@ func (c *ISCSIController) makeDeployment(svcname, namespace, rookImage string, i
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
}
iscsiSpec.Annotations.ApplyToObjectMeta(&podSpec.ObjectMeta)
// apply current ISCSI CRD options to pod's specification
iscsiSpec.Placement.ApplyToPodSpec(&podSpec.Spec)
@@ -187,6 +188,8 @@ func (c *ISCSIController) makeDeployment(svcname, namespace, rookImage string, i
},
}
k8sutil.SetOwnerRef(c.context.Clientset, namespace, &d.ObjectMeta, &c.ownerRef)
iscsiSpec.Annotations.ApplyToObjectMeta(&d.ObjectMeta)
return d
}
+1
View File
@@ -57,6 +57,7 @@ type ISGWController struct {
hostNetwork bool
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
resources v1.ResourceRequirements
resourceProfile string
+1
View File
@@ -57,6 +57,7 @@ type NFSController struct {
hostNetwork bool
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
resources v1.ResourceRequirements
resourceProfile string
+2
View File
@@ -171,6 +171,7 @@ func (c *NFSController) makeDeployment(svcname, namespace, rookImage string, nfs
if c.hostNetwork {
podSpec.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet
}
nfsSpec.Annotations.ApplyToObjectMeta(&podSpec.ObjectMeta)
// apply current NFS CRD options to pod's specification
nfsSpec.Placement.ApplyToPodSpec(&podSpec.Spec)
@@ -189,6 +190,7 @@ func (c *NFSController) makeDeployment(svcname, namespace, rookImage string, nfs
},
}
k8sutil.SetOwnerRef(c.context.Clientset, namespace, &d.ObjectMeta, &c.ownerRef)
nfsSpec.Annotations.ApplyToObjectMeta(&d.ObjectMeta)
return d
}
+1
View File
@@ -57,6 +57,7 @@ type S3Controller struct {
hostNetwork bool
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
resources v1.ResourceRequirements
resourceProfile string
+2
View File
@@ -225,6 +225,7 @@ func (c *S3Controller) makeDeployment(svcname, namespace, rookImage, imageArgs s
// apply current S3 CRD options to pod's specification
s3Spec.Placement.ApplyToPodSpec(&podSpec.Spec)
s3Spec.Annotations.ApplyToObjectMeta(&podSpec.ObjectMeta)
d := &apps.Deployment{
ObjectMeta: metav1.ObjectMeta{
@@ -240,6 +241,7 @@ func (c *S3Controller) makeDeployment(svcname, namespace, rookImage, imageArgs s
},
}
k8sutil.SetOwnerRef(c.context.Clientset, namespace, &d.ObjectMeta, &c.ownerRef)
s3Spec.Annotations.ApplyToObjectMeta(&d.ObjectMeta)
return d
}
+1
View File
@@ -57,6 +57,7 @@ type S3XController struct {
hostNetwork bool
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
resources v1.ResourceRequirements
resourceProfile string
+2
View File
@@ -198,6 +198,7 @@ func (c *S3XController) makeDeployment(svcname, namespace, rookImage string, s3x
}
// apply current S3X CRD options to pod's specification
s3xSpec.Annotations.ApplyToObjectMeta(&podSpec.ObjectMeta)
s3xSpec.Placement.ApplyToPodSpec(&podSpec.Spec)
d := &apps.Deployment{
@@ -214,6 +215,7 @@ func (c *S3XController) makeDeployment(svcname, namespace, rookImage string, s3x
},
}
k8sutil.SetOwnerRef(c.context.Clientset, namespace, &d.ObjectMeta, &c.ownerRef)
s3xSpec.Annotations.ApplyToObjectMeta(&d.ObjectMeta)
return d
}
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff. Show more