Commit Graph
2368 Commits
Author SHA1 Message Date
Travis Nielsen 7c3cdbce50 ceph: use constants for k8s topology labels
Instead of directly defining our own constants, we should be using the k8s
constants for the well-known topology labels.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-11-05 09:23:58 -07:00
Travis Nielsen e72b69f8e0 ceph: validate pools for stretch clusters
Pools in stretch clusters will all use the same crush rule that
is generated by the operator when configuring the cluster for
stretch mode, with replica 4 and two replicas per failure domain.
Pools cannot create new crush rules, so we require that replica be
4 when the pools is created, EC is not allowed, and no new
crush rule will be created.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-11-05 09:23:57 -07:00
Travis Nielsen b91f4211c9 ceph: configure a stretched cluster
In clusters where only two datacenters (or similar failure domains)
are available, a different mon and osd approach is needed to deal
with the network partitions or some other reason for one of the failure
domains going down. The Ceph stretched cluster makes the mons aware
of the failure domains by configuring one as the arbiter in a third
zone, while keeping two replicas of the data in each of the data
zoens.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-11-05 09:17:52 -07:00
Travis Nielsen 3b188a447a ceph: reorganize admission controller validation helpers
The validation code for the admission controller is found in the
ceph.rook.io/v1 package, corresponding to each of the types.
To be better organized, the validators are now found in a source
file of the corresponding type name.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-11-05 09:17:52 -07:00
Travis Nielsen 09b84a4c26 ceph: allow pool subdomains from bucket types
The pool subdomains were being validated based on the names of the
crush buckets instead of the crush failure domains, or types.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-11-05 09:17:52 -07:00
Travis Nielsen 772865fa01 ceph: create and remove mon canaries in parallel
The mon canaries are now being added and removed at the same time
instead of starting or stopping them one-by-one. This will simplify
scheduling execution time to much more quickly detect where the mons
can be scheduled.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-11-05 09:17:50 -07:00
Sébastien Han d4c486bf0f Merge pull request #6535 from leseb/kms-tls-server-support
ceph: add support for VAULT_TLS_SERVER_NAME
2020-11-04 09:57:14 +01:00
Travis Nielsen 37a56f39a6 ceph: remove the osd pvc when purging the osd
The osd purge job was not removing the osd prepare job or the
osd pvc due to an invalid label query for the pvc. Now the
prepare job and pvc will be removed as expected from the job.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-11-03 08:32:37 -07:00
Sébastien Han b477d9c33d ceph: add support for VAULT_TLS_SERVER_NAME
We now support VAULT_TLS_SERVER_NAME which represents the name to use as
the SNI host when connecting via TLS.
This is typically needed when a single host has multiple certificates,
same as virtual hosts but for SSL certificates.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-11-03 14:59:15 +01:00
Jared Watts 8d445c919d Merge pull request #6202 from prksu/nfs-quota
nfs: implement disk quota
2020-11-02 08:34:54 -08:00
Sébastien Han b7e0e206d3 ceph: rework unit test
Golang maps order is not always guaranteed to be identical, which makes
the table driven test to fail. Because of the nature of the maps, it is
hard to predict the exact position of an element in the map. This
makes the table driven test flappy.
Reworked the unit test using a contains statement which achieves the
same validation.

Closes: https://github.com/rook/rook/issues/6522
Signed-off-by: Sébastien Han <seb@redhat.com>
2020-11-02 12:14:09 +01:00
Travis Nielsen 44bf443dca Merge pull request #6495 from LalitMaganti/preserve-fs
ceph: add option to preserve filesystem on CRD deletion
2020-10-30 16:56:38 -06:00
Lalit Maganti c6aec79c4f ceph: add option to preserve filesystem on CRD deletion
Due to #6492, preservePoolsOnDelete is not useful at all for CephFS;
after the filesystem is deleted, the leftover pools cannot be
reassocaited with a newly created filesystem without wiping all
metadata. The only way we can actually preserve data is keeping around
the entire filesystem.

This commit implements a `preserveFilesystemOnDelete` option which work
similar to the existing pool preservation option but instead keeps the
whole CephFS while taking it down and removing all MDSes.

This commit also changes all documentation to refer to this new option
with the intent of essentially deprecating `preservePoolsOnDelete`. IMO,
keeping around `preservePoolsOnDelete` is actively harmful because it
lulls users into thinking their data will be safe but, in reality,
recovering from this situation is highly complex and has large potential
for data loss.

Signed-off-by: Lalit Maganti <lalitm@google.com>
2020-10-30 17:04:18 +00:00
Sébastien Han a60351a8c5 Merge pull request #6474 from leseb/osd-encryption-vault
ceph: add vault kms support for osd encryption
2020-10-30 17:11:40 +01:00
Sébastien Han 032e6b5d77 ceph: remove osd pvc when the cluster is gone
Just like we do for the monitors, we set an ownerref to the OSD PVC so
when the cluster is deleted we remove the PVC too.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-10-30 16:17:15 +01:00
Sébastien Han ea1d71cbfb ceph: add vault kms support for osd encryption
When the Ceph cluster runs on PVC and the OSDs are encrypted we can
store LUKS's Key Encryption Key inside a Key Management System. Today,
Rook only supports HashiCorp Vault: https://www.vaultproject.io/

The CephCluster has now a new "security" field which will plug onto the
KMS. Here is an example:

security:
  kms:
    tokenSecretName: <name of the secret containing a Vault token, used
    to authenticate>
    connectionDetails: < a map of strings containing connection
    information>

Refer to the ceph-cluster-crd documentation to lear more.

Closes: https://github.com/rook/rook/issues/6105
Signed-off-by: Sébastien Han <seb@redhat.com>
2020-10-30 16:16:33 +01:00
Yusei Nishiyama beaddb9c22 ceph: propagte labels to mon pods
To align it with how the other components are implemented in #6084

Signed-off-by: Yusei Nishiyama <yusei.nishiyama@soundcloud.com>
2020-10-30 13:43:18 +01:00
Yusei Nishiyama 2967bceca8 test: improve TestLabelsApply
To clarify the spec of ApplyToObjectMeta This also fixes the misleading
comments on the method.

Signed-off-by: Yusei Nishiyama <yusei.nishiyama@soundcloud.com>
2020-10-30 13:40:42 +01:00
Travis Nielsen 22a1630249 Merge pull request #5483 from cloudandheat/feature/configurable-crush-root
ceph: make root= CRUSH label value configurable
2020-10-29 10:21:02 -06:00
Sébastien Han 9dd53cce9d Merge pull request #6494 from LalitMaganti/master
ceph: ignore MDS_ALL_DOWN during reconciliation
2020-10-29 11:30:09 +01:00
Jonas Schäfer 7ace6ac255 ceph: make root= CRUSH label value configurable
The CRUSH map does not allow duplicate values (nor keys) for the
labels. That means that if the currently hardcoded label value
`default` occurs anywhere else in the tree (for example, because
some of the topology labels provided by the cloud provider use it),
the cluster cannot sucessfully spawn.

By giving the user control over the label value used for the root
CRUSH map label, it is possible to adapt the cluster to this
situation.

To be able to actually use the `default` value, the root=default
node which is created by default by ceph itself has to be removed;
since that node is accompanied by a replicated crush rule, we have
to remove that rule, too.

The integration tests are modified to sometimes use the custom
crushRoot (based on an arbitrary criterium) to get coverage across
the various suites. Separate tests could be added, but were not
deemed necessary at this point.

Fixes #4993.

Signed-off-by: Jonas Schäfer <jonas.schaefer@cloudandheat.com>
2020-10-29 09:22:41 +01:00
Lalit Maganti 88f16e4980 ceph: ignore MDS_ALL_DOWN during reconciliation
This allows the catch-22 situation where the filesystem cannot be
reconciled because there is no MDS but there is no MDS because the
operator has not reconciled the filesystem and brought up the MDS pods.

Closes #5967, #5846

Signed-off-by: Lalit Maganti <lalitm@google.com>
2020-10-29 01:11:36 +00:00
Travis Nielsen 0134a3c453 Merge pull request #6503 from leseb/do-not-assume-error-type
ceph: assert error type before using it
2020-10-28 13:21:37 -06:00
subhamkrai cfdc5e7c50 ceph: remove allNode option for rgw
this commit removes unnecessary allNodes option
from rgw.

Signed-off-by: subhamkrai <srai@redhat.com>
2020-10-28 22:38:11 +05:30
Sébastien Han 1168dbc6ca ceph: assert error type before using it
We don't always get an error of the type "*exec.ExitError" so we must
validate the type before printing it otherwise the interface conversion
will fail.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-10-28 17:08:38 +01:00
Travis Nielsen 725e978a79 Merge pull request #6493 from travisn/check-orphan-mon-pvcs
ceph: Check for orphaned mon resources with every reconcile
2020-10-27 07:44:10 -06:00
subhamkrai dd7a1a895a ceph: export the storage capacity of the ceph cluster
adding fields `TotalBytes`, `UsedBytes`, `AvailableBytes`
`LastUpdated` to the ceph cluster CR's status section to
report the storage details of ceph cluster.

`TotalBytes`: Total storage capacity in bytes
`UsedBytes`: Total storage used in bytes
`AvailableBytes`: Total storage used in bytes(Total - Used)
`LastUpdated`: Last update time

for example(I have added 10GB disk):

`kubectl get cephclusters.ceph.rook.io -o yaml`

```
status:
    ceph:
      capacity:
        bytesAvailable: 9657188352
        bytesTotal: 10733223936
        bytesUsed: 1076035584
        lastUpdated: "2020-10-23T12:57:48Z"
```

Signed-off-by: subhamkrai <srai@redhat.com>
2020-10-27 17:35:02 +05:30
Travis Nielsen efb1cc9f72 ceph: check for orphaned mon resources with every reconcile
The mon resources may be orphaned if there is a mon failover
that was cancelled, for example a mon pvc may remain if the
original mon comes up and the operator was restarted before
the mon failover completed. The cleaning up of mon resources
was only happening was each successful mon failover, now we
perform the check with every reconcile since the resources
were not being cleaned up predictably enough.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-10-26 14:06:17 -06:00
Ali Maredia 8964941d44 ceph: add unit tests for object store controller with multisite
Add unit tests for when the "Zone" is configured
in an object store so that the object store joins
the CephObjectZone and the zone's corresponding
multisite configuration.

Signed-off-by: Ali Maredia <amaredia@redhat.com>
2020-10-22 11:36:06 -04:00
Travis Nielsen 6da0609b70 Merge pull request #6469 from sp98/fix-mon-pdb-reconcile
ceph: fix mon pdb reconcile
2020-10-21 15:45:34 -06:00
Santosh Pillai 28cd611eb4 ceph: fix mon pdb reconcile
updated mon pdb reconcile to delete mon pdb and create a new one when mon count changes in the cluster spec

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2020-10-21 23:15:29 +05:30
Satoru Takeuchi 081c7c4dba ceph: reduce the number of admission controller pods in small cluster
The number of admission controller pods is 2. When there is only one
node as the CI environment, one of these becomes Pending state.
Although it's harmless, it's better to reduce this value to 1.

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2020-10-21 11:47:08 +00:00
subhamkrai cb0ca66a6b ci: enable gosec linter in golangci-lint
golangci-lint linter gosec showing more errors
than gosec gh. This commit resolve
new errors. And, removing
nosec comments from autogenerated files.

Signed-off-by: subhamkrai <srai@redhat.com>
2020-10-19 11:50:06 +05:30
Ahmad Nurus S 72bf7873c9 nfs: implement disk quota
Signed-off-by: Ahmad Nurus S <prksu.sh@gmail.com>
2020-10-19 10:20:12 +07:00
Satoru Takeuchi e22bedbd9b ceph: reduce the number of provisioner pods in small K8s cluster
The default number of provisioner pods are 2. When there is only one node,
for example the CI environment, one of these becomes Pending state.
Although it's harmless, it's better to reduce this value to 1.

Closes: https://github.com/rook/rook/issues/6294

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2020-10-15 18:25:27 +00:00
Sébastien Han f0b2c6eacf Merge pull request #6184 from cybozu-go/ceph-raw-mode-on-lv-backed-pvc
ceph: raw mode OSD on LV-backed PVC
2020-10-15 09:46:56 +02:00
Daichi Sakaue b9f29349ed ceph: use raw mode instead of lvm mode even if lv-backed PVC
It can simplify OSD management in many ways and can avoid many problems
that come from LVM.

Closes: https://github.com/rook/rook/issues/5939
Signed-off-by: Yuji Ito <llamerada.jp@gmail.com>
Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2020-10-14 01:46:25 +00:00
Sébastien Han b70b098405 ceph: add support for stretched cluster crush rule
The pool spec has now a new property called "replicasPerFailureDomain"
which essentially represents the number of replicas to store in each
failure domain.
Assuming the failure domain is a datacenter (if the cluster is
stretched) then you will have 2 replicas per datacenter where each
replica ends up on a different host. This gives you a total of 4
replicas and for this, the "size" must be set to 4.

Closes: https://github.com/rook/rook/issues/5591
Signed-off-by: Sébastien Han <seb@redhat.com>
2020-10-13 16:33:34 +02:00
Sébastien Han 6c73493f8a Merge pull request #6420 from travisn/disallow-two-mons
ceph: Require an odd number of mons and sufficient nodes for mons
2020-10-13 16:10:19 +02:00
Travis Nielsen fe602e0902 Merge pull request #6426 from leseb/add-cv-log-to-non-pvc
ceph: add ceph-volume log to non-pvc scenario
2020-10-13 07:48:47 -06:00
Travis Nielsen c7e0338d5e ceph: require an odd number of mons and sufficient nodes
The ceph mons should never be started with an even number in quorum.
The desired state should always be an odd number of mons to ensure
a healthy majority quorum. The operator now rejects a request for
an even number of mons.

If there are not a sufficient number of nodes for mons to be on a
unique host, the operator also returns an early error instead of
getting stuck waiting for a pending mon. This is not foolproof since
there might be fewer available nodes for the mons, but at least it
is a quick check for the common case.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-10-12 15:21:27 -06:00
Thomas Bechtold ede4b9cb1a ceph: improve watcher debug message when node is not tolerable
When a node is not tolerable, also output the node name so it's clear
which not it is which is not tolerable.

Signed-off-by: Thomas Bechtold <tbechtold@suse.com>
2020-10-12 14:19:17 +02:00
Sébastien Han b623133fb6 ceph: add ceph-volume log to non-pvc scenario
When deploying on non-PVC, we still need to gather c-v logs on failures.
Now if the bootstrap fails, the c-v log will be printed.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-10-12 14:10:17 +02:00
Sébastien Han 7bdbc0a4fc Merge pull request #6397 from leseb/fix-6134
ceph: tune osd tcmalloc thread cache bytes
2020-10-08 18:56:04 +02:00
Sébastien Han fe6b321bc6 Merge pull request #6395 from leseb/log-err-exec-file
ceph: log stderr in error when exec with output file
2020-10-08 17:56:00 +02:00
Sébastien Han eba561f13e Merge pull request #6408 from leseb/fix-bz-1885971
ceph: reduce s3 max retry
2020-10-08 17:30:27 +02:00
Travis Nielsen fd5c1982d1 Merge pull request #6407 from varshar16/update-nfs-ganesha-rados-url
ceph: update nfs ganesha rados config object
2020-10-08 08:56:23 -06:00
Sébastien Han d01a35cadd ceph: reduce s3 max retry
When rgw is not responding the aws-sdk retries using exponential
backoff. Having 20 retries means we would wait for a while (hours) to
eventually fail. This is a problem as we cannot reflect the status of
the bucket properly.
Now we use 5 max retries which means around 8 seconds.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-10-08 16:20:00 +02:00
Varsha Rao f5d125f8c9 ceph: update ganesha config object name
In cephadm and volume/nfs module, all ganesha daemons within a cluster watch
single config object. Each ganesha daemon in rook watches it's own config
object. This patch updates the ganesha config object name to maintain
uniformity.

Signed-off-by: Varsha Rao <varao@redhat.com>
2020-10-08 14:42:25 +05:30
Sébastien Han 35d524c7ed Merge pull request #6322 from alimaredia/object-zone-unit-tests
ceph: add unit tests for object/zone
2020-10-08 10:24:05 +02:00