Commit Graph
1548 Commits
Author SHA1 Message Date
Travis Nielsen c78e6a9e20 ceph: set active mgr label on mgr services
Other resources such as the service monitor need to match
the labels on the services to the active mgr, thus the active
mgr name is now set on the labels for the metrics service
and dashboard service.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-03-18 16:37:01 -06:00
subhamkraiandTravis Nielsen 319e4a41a4 ceph: placement in case of both PVC and non-PVC's
In the case of PVC,
We are giving lower priority to all placement.
We want deviceSet placement to applied and
override in case of overlapping settings and
we are merging nodeAffinity if applied in both
all placement and deviceSet.

In case of non-PVC,
we apply spec.placement

Signed-off-by: subhamkrai <srai@redhat.com>
Co-authored-by: Travis Nielsen <tnielsen@redhat.com>
2021-03-18 10:32:57 +05:30
Travis Nielsen c23238cddb ceph: refactor integration tests for simplification
The integration tests have long been painful to maintain with
settings in various places and copied to multiple types,
inconsistent variable names, and otherwise difficult to maintain
code. Now the settings for a test suite are all in one place and
they remain in the same settings type throughout the test.
The multi-cluster suite is also refactored to use the same install
and uninstall helpers as the other suites.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-03-17 11:26:10 -06:00
Travis Nielsen f50e49be3a ceph: object store user initialization check for nil
If the object store status is not yet initialized, the object store user should
fail its initialization and requeue the reconcile.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-03-17 08:39:26 -06:00
Travis Nielsen 64e28af741 ceph: allow flex driver and discovery to be enabled with configmap
For testing purposes, we need to configure the flex driver
and discovery daemon with the operator settings configmap.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-03-17 08:39:26 -06:00
Travis Nielsen 933113eac8 ceph: remove obsolete storeType setting
All clusters are configured with bluestore as the store type
therefore we can remove the settings where mentioned in the
docs and dead code.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-03-17 08:39:25 -06:00
Travis Nielsen 4d969a406f Merge pull request #7414 from sp98/skip-cluster-cleanup
ceph: skip cleanup if cluster is not configured correctly.
2021-03-16 08:24:24 -06:00
Santosh Pillai 7bd05d0d7c ceph: skip cleanup if cluster is not configured correctly
deletion of cluster is stuck when cluster is not configured. The PR skips the cleanup and removes the finalizers if the cluster was not configured, that is, if clusterInfo could not be loaded.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2021-03-16 18:59:43 +05:30
Satoru Takeuchi 756d4ecb89 Merge pull request #7259 from cybozu-go/ceph-improve-owner-reference-management-2
ceph: improve owner reference management
2021-03-16 20:22:57 +09:00
Satoru Takeuchi 26c8fd9bd1 ceph: improve owner reference management
It's better to validate ownerReferences when setting them. In addition, we should use
controllerrutil.Set{Controller,Owner}Reference, that have such validation, as possible.

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2021-03-16 10:29:33 +00:00
Sébastien Han 31db03fece ceph: auto-gen crds
Finally! We can now stop editing manually our crds definition. Simply
run `make crds-gen`. These two files:

* `cluster/examples/kubernetes/ceph/crds.yaml`
* `cluster/charts/rook-ceph/templates/resources.yaml`

will be autogenerated for us.

We rely on the controller-gen tool, it reads our API definitions from
`pkg/apis/` and produces the CRD files accordingly.

It uses "markers" to add extra yaml fields to the CRD, for instance we
have a lot fields with:

```
nullable: true
x-kubernetes-preserve-unknown-fields: true
```

The corresponding API type markers are:

```
// +kubebuilder:pruning:PreserveUnknownFields
// +nullable
```

For more API convention see
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#optional-vs-required
and for the markers see: https://book.kubebuilder.io/reference/markers/crd-validation.html

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-03-16 09:16:24 +01:00
Sébastien Han 7291ce950e ceph: fix variable name
Fix linter complain.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-03-16 08:35:36 +01:00
Sébastien Han f2c0546837 Merge pull request #7391 from leseb/enable-auto-pg-repair
ceph: enable pg auto repair
2021-03-15 15:18:40 +01:00
Sébastien Han a6ef1ff490 ceph: enable pg auto repair
As a recommendation from the core team we should turn on PG auto repair
when running on Bluestore OSDs. The Quincy release will enable this by
default but in the meantime let's enable it here.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-03-12 09:18:00 +01:00
Travis Nielsen c0eacc89d5 Merge pull request #7235 from travisn/mgr-sidecar
ceph: Allow two mgr daemons and actively reconcile the mgr services with a sidecar
2021-03-10 10:35:40 -07:00
Travis Nielsen c06a0090c3 Merge pull request #7354 from cybozu-go/ceph-fix-improper-json-parsing-in-radosgw-admin
ceph: fix improper json parsing
2021-03-10 10:13:19 -07:00
Satoru Takeuchi a89d35e5b6 ceph: fix improper json parsing in radosgw-admin
Sometimes `radosgw-admin` succeeds after showing logs to stderr. We should
skip non-json strings if parsing output as json.

Here is an example.

```
2021-02-26 04:10:44.190418 I | op-bucket-prov: creating Ceph user "ceph-user-aSzNqgE7"
E0226 04:11:37.901310       8 controller.go:199] error syncing 'logging/loki-bucket': error provisioning bucket: Provision: can't create ceph user: error creating ceph user "ceph-user-aSzNqgE7": failed to unmarshal json. 2021-02-26T04:11:21.425+0000 7f6714be4980  1 robust_notify: If at first you don't succeed: (110) Connection timed out
2021-02-26T04:11:21.426+0000 7f6714be4980  0 ERROR: failed to distribute cache for ceph-hdd-object-store.rgw.meta:users.uid:ceph-user-aSzNqgE7
2021-02-26T04:11:32.168+0000 7f6714be4980  1 robust_notify: If at first you don't succeed: (110) Connection timed out
2021-02-26T04:11:32.168+0000 7f6714be4980  0 ERROR: failed to distribute cache for ceph-hdd-object-store.rgw.meta:users.keys:23Z8GUEXR0TJDO86PSJR
{
    "user_id": "ceph-user-aSzNqgE7",
    "display_name": "ceph-user-aSzNqgE7",
...
    "mfa_ids": []
}: invalid character '-' after top-level value: failed to unmarshal json.
```

In this case, some logs like "robust_notify:..." was shown in stderr.
Unmarsharing was failed due to tried to parse these logs as json.

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2021-03-10 16:06:56 +00:00
Travis Nielsen 51996be952 ceph: remove extra mgr deployments if count is reduced
If the count of mgr daemons is reduced, we remove the extra one.
The check is made during each reconcile.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-03-10 08:37:18 -07:00
Travis Nielsen 38efe8ceba ceph: get active mgr with new pacific command
In Pacific the simple command to retrieve the active mgr is with
ceph mgr stat instead of retrieving the full ceph mgr dump.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-03-10 08:37:18 -07:00
Travis Nielsen a1c6a706f1 ceph: configure resources for the mgr sidecar
The mgr sidecar container has a new mgr-sidecar section
for specifying resources if desired.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-03-10 08:37:17 -07:00
Travis Nielsen e7331b0191 ceph: multiple mgrs have antiaffinity across hosts or zones
If there are multiple mgrs running, the operator will automatically
add pod antiaffinity across hosts by default. For stretch clusters,
antiaffinity across the stretch failure domain (e.g. zones)
will be added. Required antiaffinity will be created unless the
test setting allowMultiplePerNode is set to true.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-03-10 08:37:17 -07:00
Travis Nielsen 142ba63b6a ceph: enforce anti-affinity to multiple mgrs
If there are two mgr daemons, they should be running on different
hosts or zones, depending on the failure domain.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-03-10 08:37:17 -07:00
Travis Nielsen 388ff3e78b ceph: start sidecar to monitor active mgr
The mgr daemon may be failed over by ceph if the active mgr is not
responding and the standby mgr is available. If the active mgr changes
the services for the dashboard and metrics will be updated with a
label selector for the new active mgr. The services cannot direct
traffic to the standby mgr or else they will be incorrectly redirected
to the active mgr.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-03-10 08:37:17 -07:00
Travis Nielsen d93ff428ec ceph: reconcile the mgr services with the active mgr
The active mgr should match the labels on the services that
are available for prometheus and the dashboard. The selector
labels must be updated whenever there is a new active mgr.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-03-10 08:29:16 -07:00
ushen 7e691af439 ceph: allow user decide num of mgrs
Allow user to decide how many mgrs to be used
by make mgr replicas configurable

Signed-off-by: shenjiatong <yshxxsjt715@gmail.com>
2021-03-10 08:29:14 -07:00
Madhu Rajanna 0a81ce2251 ceph: disable CSI GRPC metrics by default
The GRPC metrics exposed by both the provisioner pod
and the node plugin pod on some port. Provisioner pod
is running on the pod network and the daemonset pods
run on the host network. sometimes starting the GRPC
metrics by default can lead to node plugin pods
crashloopback state this is due to the port conflict.
Moreover, the GRPC metrics are not for the user it's
for the one which will help to debug the time taken
by cephcsi to serve each GRPC call. Enabling it by
default won't be a good idea. So the plan is to
disable it by default, If someone faces any issue it
can be enabled later at some point in time.

closes #7378

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2021-03-10 11:30:50 +05:30
Sébastien Han 395feddbc2 Merge pull request #7374 from leseb/fix-vault-kv-2
ceph: fix vault when used with kv version 2
2021-03-09 17:02:54 +01:00
Sébastien Han 33be24d1a1 ceph: fix vault when used with kv version 2
The API path when the KV enfine is used in version is different and must
be adapted. We need to append a 'data' path, thus the path and response
are changing.

v1 is https://vault.local.com:8200/v1/test-kv1/key
v2 is https://vault.local.com:8200/v1/test-kv2/data/key

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-03-09 16:36:26 +01:00
Sébastien Han 2a035b2f99 Merge pull request #7333 from subhamkrai/port-check
ceph: webhook check if one of port or securePort are non-zero
2021-03-09 09:33:11 +01:00
subhamkrai 40a99a20ff ceph: webhook check if one of port or securePort are non-zero
this commit adds new crd to admission webhooks to check
if one of the port or securePort are set to non-zero
value in objectstore crd.

If both are set to 0 in crd we'll see error like
```
Error from server (invalid create: either of port or securePort
fields should be not be zero): error when creating "object-test.yaml":
admission webhook
"cephobjectstore-wh-rook-ceph-admission-controller-rook-ceph.rook.io"
denied the request: invalid create: either of port or securePort fields
should be not be zero.
```

Signed-off-by: subhamkrai <srai@redhat.com>
2021-03-03 21:22:04 +05:30
Sébastien Han 3dde2609fa ceph: add raw mode for non-pvc osd
For simple OSD scenario that don't require the following:

* an encrypted osd
* an osd with a backing device
* multiple osd on the same block device

The OSD will be prepared using the ceph-volume raw mode which does
not use LVM on non-pvc case.

Closes: https://github.com/rook/rook/issues/4768
Signed-off-by: Sébastien Han <seb@redhat.com>
2021-03-03 14:11:26 +01:00
Sébastien Han c28fdfa371 Merge pull request #7307 from leseb/ceph-multi-fs
ceph: rework multiple filesystem support
2021-03-03 07:57:40 +01:00
Travis Nielsen 15d0537cec ceph: only raise conditions that represent current state
The conditions on the cephcluster CR were being set to false
when not in progress, which is misleading to the purpose of
conditions. The conditions will now always represent current
state of the cluster. Transient conditions that show progress of
a reconcile will be removed from the status.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-03-02 14:15:47 -07:00
Travis Nielsen ddedecabac Merge pull request #7334 from thotz/livenessprobergwsslenabled
ceph: handle ssl cases for RGW's livenessprobe
2021-03-02 11:42:06 -07:00
Sébastien Han 8dfa99e01d ceph: rework multiple filesystem support
The upcoming Rook release 1.6 will support Ceph Pacific which introduces
stable support for multiple Ceph Filesystems in the same cluster. So we
now allow the creation of multiple Filesystem if the release is Pacific.

Also, we remove the Operator config flag which was not necessary.

Here I have 2 filesystems:

```
[root@rook-ceph-tools-6b4889fdfd-vncck /]# ceph fs ls
name: myfs, metadata pool: myfs-metadata, data pools: [myfs-data0 ]
name: myfs2, metadata pool: myfs2-metadata, data pools: [myfs2-data0 ]
```

```
  cluster:
    id:     cc747950-589a-4862-bad2-ff7de1217b1a
    health: HEALTH_WARN
            mons a,b,c are low on available space
            6 pool(s) have no replicas configured

  services:
    mon: 3 daemons, quorum a,b,c (age 2d)
    mgr: a(active, since 2d)
    mds: myfs:1 myfs2:1 {myfs2:0=myfs2-b=up:active,myfs:0=myfs-b=up:active} 2 up:standby-replay
    osd: 3 osds: 3 up (since 2m), 3 in (since 6d)

  data:
    pools:   6 pools, 717 pgs
    objects: 44 objects, 4.2 KiB
    usage:   46 MiB used, 90 GiB / 90 GiB avail
    pgs:     717 active+clean

  io:
    client:   1.8 KiB/s rd, 4 op/s rd, 0 op/s wr

  progress:
    Global Recovery Event (45s)
      [===========================.]
```

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-03-02 18:27:04 +01:00
Sébastien Han 0534b5a180 ceph: expose vault warnings better
If there is a warning coming from the Vault server we must catch it and
exit immediately to reflect it if no key was retrieved.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-03-02 10:49:19 +01:00
Sébastien Han a134d1df6e Merge pull request #7336 from leseb/revert-vault-backend
ceph: revert kms VAULT_KV_VERS to VAULT_BACKEND
2021-03-02 10:44:43 +01:00
Jiffin Tony Thottan 785aa5a322 ceph: handle ssl cases for RGW's livenessprobe
The livenessprobe for swift/health always check with RGW internal port if host network disabled,
but won't work if only secure port is configured

Signed-off-by: Jiffin Tony Thottan <thottanjiffin@gmail.com>
2021-03-02 14:39:57 +05:30
Sébastien Han e4c3a4cef7 ceph: revert kms VAULT_KV_VERS to VAULT_BACKEND
The vault env variable VAULT_BACKEND is read by the secret library so we
must not change it. This is reverting
ee6a03dfb8 with a few extra fixes for the
rgw code.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-03-02 10:08:39 +01:00
Blaine Gardner efa7d66d45 ceph: remove driveGroup support
Remove features and design that supports adding OSDs to Ceph clusters
via `spec:driveGroups`. Update the Ceph upgrade doc that informs users
who currently use Drive Groups (we believe there are none of these
users) how to migrate to using the `spec:storage` config.

Resolves https://github.com/rook/rook/issues/7275

Revert "ceph: fix drive group deployment failure"
This reverts commit 76f1d9944e.

Revert "ceph: osd: add drive groups spec to cluster CR"
This reverts commit 7117fc12b7.

Revert "design: ceph orchestrator module add/remove OSDs"
This reverts commit 178187d035.

Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
2021-02-25 17:08:47 -07:00
Blaine Gardner d5983e8d4b ceph: change osd on pvc unit test to use t.Log()
Change the TestOSDsOnPVC unit test to use t.Log()/t.Logf() to avoid
having a special infof() function that was unnecessary since our unit
tests run with `go test -v` where the `-v` flag interleaves t.Log()
output.

Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
2021-02-25 11:52:00 -07:00
Blaine Gardner 82941ff8fa Merge pull request #7304 from BlaineEXE/fix-flaky-pvc-unit-test
ceph: fix flaky OSD on PVC unit test
2021-02-25 11:25:29 -07:00
Travis Nielsen 65c410ee13 Merge pull request #7266 from rohan47/clean_terminating_pods
ceph: removed individual force delete pod code for mons and osds
2021-02-25 10:10:54 -07:00
Sébastien Han 447f9c97ff Merge pull request #7299 from jshen28/remove-generatekeyring-for-osd
ceph: remove unnecessary generate key for osd
2021-02-25 14:51:35 +01:00
shenjiatong fb33d87d33 ceph: remove generateKeyring for osd
After adopting `ceph-volume`, secret key for
user osd.x will be generated by `ceph-volume` and
thus method `generateKeyring` is not necessary
anymore.

Executing ceph command takes
extra half of second to complete, executing it
in serial is rather expensive, remove it for better
performance.

Signed-off-by: shenjiatong <yshxxsjt715@gmail.com>
2021-02-25 08:21:08 +08:00
Blaine Gardner 98466d4706 ceph: fix flaky OSD on PVC unit test
This was a race condition where the test would sometimes finish before a
deferred watcher.Stop() command was called and sometimes would not.

Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
2021-02-24 15:43:21 -07:00
Sébastien Han 4b8ec15b69 ceph: do not use curl ca-cert for signed certificates
cURL's ca-cert and Golang TLS config for ca-certs have a different
meaning, it seems that the Golang implementation will always lookup the
local certs first and then proceeds with the specificed cert, if the
system's certs works it will never go to the specificied certificate.
cURL however, does the opposite by strictly checking the specified cert.
If the certificate is signed we don't need to force a specific
certificate, thus by using capath instead we let cURL determine what's
best to validate against.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-02-24 11:49:56 +01:00
Sébastien Han dad4e4effa Merge pull request #7292 from leseb/bz-1931839
ceph: show error even in silent curl
2021-02-23 17:40:10 +01:00
Sébastien Han 069ff22d53 ceph: show error even in silent curl
The --silent option will remove the progress bar of the curl but also
silence any errors of stderr, so adding --show-error will display the
error even if --silent is used.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-02-23 17:15:31 +01:00
Sébastien Han 91343f4fdd Merge pull request #7283 from leseb/rm-index-cephfs-mirror
ceph: misc improvement for the ceph-fs-mirror implementation
2021-02-23 17:06:29 +01:00