Commit Graph
73 Commits
Author SHA1 Message Date
Travis Nielsen 3d5addc282 Merge pull request #4123 from thotz/obc
objectstore: set quota for max_bucket into -1 in Grant()
2019-10-28 13:40:39 -06:00
travisn 879971f19a ceph: create object user immediately if obj store available
Creating an object user was always waiting at least 15 seconds before
attempting to create the user. With this change the operator will check
immediately if the object store is already initialized instead
of waiting for the initial 15 seconds delay to elapse.

Signed-off-by: travisn <tnielsen@redhat.com>
2019-10-19 22:46:17 -06:00
Owen Tuz 15e3ecad54 ceph: add 'rgw.buckets.non-ec' to list of RGW metadataPools
This is used for S3 multipart uploads and should be configured in the same way as other metadata pools.

Signed-off-by: Owen Tuz <owen@segfault.re>
2019-10-17 18:44:59 +01:00
Jiffin Tony Thottan 85cea8233c objectstore: set quota for max_bucket into -1 in Grant()
This issue is seen in brownfield cases in which max_bucket
size for the user is set to 0. In rgw, if the max_bucket is 0
then the user can create an unlimited no of buckets.
So for preventing users creating new buckets, set the value to
any negative value

Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
2019-10-17 11:37:27 +05:30
Blaine Gardner db7a6da09e ceph: do ceph:ceph chown in init containers
Following the Ceph OSD rework, my test environment regularly failed to
start OSDs, as they would start before the postStart lifecyle hook which
was chown'ing the log and data directories could finish. Pods failed to
start for an arbitrarily long time before starting successfully. This
was a manifestation of a race condition identified in Ceph monitors in
https://github.com/rook/rook/pull/3594#discussion_r312279176

Create a Ceph operator-level method to create an init container that
will chown the necessary directories for all Ceph daemons (any daemon
which runs as the ceph:ceph user-and-group). Also add this container to
expectations for Ceph pod templates in unit tests.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-10-15 12:12:46 -06:00
travisn 5db209fc5b ceph: allow resources to be deleted via owner references
The resources for rgw, mds, and nfs were being cleaned up explicitly when
the CR was deleted. This is legacy from before the owner references were
set on the CRs. Now the owner references are set to the appropriate CRs so
the resources will be cleaned up upon deletion of the specific CR
rather than the cluster CR.

Signed-off-by: travisn <tnielsen@redhat.com>
2019-10-14 09:29:45 -06:00
Jiffin Tony Thottan 3f3af19a13 objectstore: remove user unlink in Revoke()
The access of user will be revoked by Droppolicy(). And user unlink
need to perform only if it is the owner. For Delete() it makes sense
to call user unlink, but it is not required for Revoke()

Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
2019-10-10 19:21:45 +05:30
Jiffin Tony Thottan 69e4144b0f objectstore: modify existing bucket policy for brownfield cases
Following corrections are needed for bucket policy to work properly

* Change Principal:{"AWS":["<username>"]} to Principal:{"AWS":["arn:aws:iam:::user/<username>"]}
* Add missing "PutObject" policy in Action[]
* Add <bucket/*> to Resource[] for accessing contents inside the bucket

Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
2019-10-10 19:21:17 +05:30
Sébastien Han 148f8da1fb ceph: relax pre-requisite for external cluster
We now differentiate the cases where:

* we only consume the external cluster
* we consume the external cluster as well as creating stateless
resources in Kubernetes (bootstrap mds,rgw, nfs)

This is mostly controlled via the image property spec. If not defined,
not extra CRs won't be able to be created.

Now the external cluster feature supports Ceph cluster as of Luminous 12.2.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-10-08 10:52:01 +02:00
Juan Miguel Olmo Martínez 2de0787fc8 New setting to avoid delete pools on <fs>/<os> resources deletion
A new CRD property `PreservePoolsOnDelete` has been added to Filesystem(fs) and
Object Store(os) resources in order to increase protection against data loss.
If it is set to `true`, associated pools won't be deleted when the main
resource(fs/os) is deleted. Creating again the deleted fs/os with the same name
 will reuse the preserved pools.

Signed-off-by: Juan Miguel Olmo Martínez <jolmomar@redhat.com>
2019-09-30 08:13:39 +02:00
Madhu Rajanna 4efba0247d Check Pools is in use before deleting it
currently we are not checking the pool is empty or
not before deleting, This PR adds a check to check
if any images/snapshots using the pool, if yes it will
not delete the pool

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2019-09-26 11:41:47 +05:30
Sébastien Han 087d71106b ceph: add a new CR property to force upgrades
On rare occasion, the ceph checks might not be 100% correct and the user
might decide to force an upgrade anyway.
Correctly, if we are in an upgrade, we perform `ok-to-stop` check for
each daemon, if one of them fails, we retry and eventually fail.
They are corner-cases where users would like to force the upgrade anyway.

Enhance the new CR property: "skipUpgradeChecks: true".

Closes: https://github.com/rook/rook/issues/3872
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-09-19 10:55:56 +02:00
travisn 533ac5b693 ceph: refactor version detection of external cluster
Reduce the duplication of detecting the version of the external cluster
by refactoring to a single method that retrieves and validates the
version

Signed-off-by: travisn <tnielsen@redhat.com>
2019-09-04 19:02:08 -06:00
Sébastien Han 9c1bb7c62d ceph: external be a bit more flexible on upgrade
Add various upgrade tests so that the local cluster does not fail if
an upgrade is available on the external cluster.

Also, add better upgrades handling on update and on add. We now rely as
much as possible on a unique function that works both local and external
cluster 'detectAndValidateCephVersion()'. So the code will act the same
way wether a CR update is triggered or if the operator is restarted.

The health check now reports any topology changes on the external
cluster such as odd number of mons and low number. It will also detect
if the external cluster has been upgraded and will log that information,
  helping the admin in his/her decision to trigger an image upgrade.

Finally, we prevent the creation of new CRs if the external cluster
version has a higher major number than the local one.

Closes: https://github.com/rook/rook/issues/3731
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-09-04 19:02:08 -06:00
Blaine Gardner 1be43290be Ceph: override configs in CRD
Allow users to specify overrides in the CephCluster CRD. The override
ConfigMap still exists for emergency situations and is mounted into
daemon pods directly instead of being merged into a Rook-created config
file.

Rook Ceph no longer uses a config file for managing daemons with the
exception of the OSDs which still generate a config in an init
container.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-08-29 15:38:27 -06:00
Sébastien Han bed14cfd71 ceph: improve upgrade on image change
From now on, Rook will only perform check before upgrades when there is
an actual upgrade. So if the Ceph image changed and a new version is
desired Rook will go through all the daemons and update them one by one
and perform checks in between.

Closes: https://github.com/rook/rook/issues/3583
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-08-29 10:18:19 +02:00
Umanga Chapagain da47c23c23 adds wait.Poll to create ObjectUser
creating an objectstore user requires that the objectstore is
created first. This commits adds changes to wait for the object
store to be created before the objectstore user can be created.
It'll retry every 15sec for 5mins.

Signed-off-by: Umanga Chapagain <chapagainumanga@gmail.com>
2019-08-27 15:41:27 +05:30
Sébastien Han 0bdc98f333 Merge pull request #3576 from giovanism/multus
Multi-homing networking
2019-08-26 15:17:24 +02:00
giovanism cc62702d39 ceph: Use rook's NetworkSpec with type embedding
ceph: Use the new NetworkSpec api

ceph: Change all tests to use the NetworkSpec

ceph: Remove TypeMeta field from NetworkSpec

ceph: Change IsHost network func signature

Signed-off-by: giovanism <giovanism@outlook.co.id>
2019-08-26 16:17:03 +07:00
jiffin abe3678990 adding smoke test for bucket store
Signed-off-by: jiffin <thottanjiffin@gmail.com>
Signed-off-by: Jon Cope <jcope@redhat.com>
Signed-off-by: jeffvance <jeff.h.vance@gmail.com>
2019-08-22 19:54:44 -06:00
c852e86fe9 ceph-rook object bucket provisioner
Signed-off-by: travisn <tnielsen@redhat.com>
Signed-off-by: jeffvance <jeff.h.vance@gmail.com>
Signed-off-by: Jon Cope <jcope@redhat.com>

Co-authored-by: Jon Cope <copejon@users.noreply.github.com>
Co-authored-by: Jeff Vance <jeff.h.vance@gmail.com>
2019-08-22 19:54:43 -06:00
Sébastien Han c7174b6b8e ceph: allow deployment of crds on external cluster
We can now deploy all the other Rook's CRDs. They will be deployed in
Kubernetes but will consume the external cluster storage.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-08-22 17:19:33 +02:00
travisn 70e4c0ac19 ceph: skip local setup for an external ceph cluster
When configuring an external cluster the orchestration of discover and all the ceph
daemons will be skipped. The operator will still watch for the creation of
crds for this namespace. When a filesystem, object, object user, or
ganesha crd are created, the operator will simply print an error
to the log.

Signed-off-by: travisn <tnielsen@redhat.com>
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-08-22 17:19:32 +02:00
travisn 7ab689ee8e ceph: skip local setup for an external ceph cluster
When configuring an external cluster the orchestration of discover and all the ceph
daemons will be skipped. The operator will still watch for the creation of
crds for this namespace. When a filesystem, object, object user, or
ganesha crd are created, the operator will simply print an error
to the log.

Signed-off-by: travisn <tnielsen@redhat.com>
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-08-22 17:19:32 +02:00
Sébastien Han fdaf3bfc9c ceph: run pod with privileged
Before each pod starts, the daemon changes the ownership of
/var/log/ceph which is bindmounted on a hostPath.

On OpenShift envionments, the container must be privileged in order to
successfully change the owernship.

Closes: https://github.com/rook/rook/issues/3485
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-07-23 07:43:10 +02:00
Sébastien Han 9120791e24 ceph: chown ceph directories
At the beginning of every container startup we now change the ownership
of every known ceph directories to ceph:ceph.

This will allow daemons to start properly as well as allowing daemon to
writes their logs on files.

This is needed because ceph daemon now run as 'ceph' instead of 'root'

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-07-19 11:13:42 +02:00
Travis Nielsen 41005b53a6 Merge pull request #3456 from travisn/remove-legacy-conversion
Remove legacy Ceph CRD conversion from v1beta1 to v1
2019-07-17 11:52:41 -06:00
Sébastien Han 05d8d23f18 ceph: upgrade: pass daemonType and Name directly
We do not determine the daemon type and name by string parsing anymore
but passing that info directly in the update call, it's more reliable.
Also removing a bunch of unused functions.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-07-17 00:58:31 +02:00
Sébastien Han 7eb7e8a192 ceph: upgrade: always retrieve cluster version
Do not consider clusterInfo Ceph version since it's the one picked by
the spec image.
The CephVersion provided here needs to be the current running version
of Ceph for when it is later passed to OkToStop and checked with
IsAtLeast. If you are upgrading from a pre 14.2.1 version to a
version 14.2.1 or newer, IsAtLeast will incorrectly return true and
then fail trying to run mon ok-to-stop on a mon pod running a pre 14.2.1 version.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-07-17 00:39:18 +02:00
Sébastien Han 32a9435c29 ceph: rgw: rename startDeployment()
This method does not start anything but creates the deployment. So let's
rename it to createDeployment() instead.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-07-17 00:37:43 +02:00
Sébastien Han ae9d33061c rgw: implement UpdateDeploymentAndWait()
rgw wasn't using UpdateDeploymentAndWait() to update its deployment
configuration. We now use it so that it's consistent with the other
daemons configuration.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-07-17 00:37:43 +02:00
travisn 9e073857c5 ceph: remove legacy conversion from v1beta1 to v1
In the 0.9 release rook converted the v1beta1 CRD resources
to v1 resources. This conversion code is no longer necessary
as we will be using v1 resources going forward.
The code paths will not be triggered anymore, thus
removing the dead code.

Signed-off-by: travisn <tnielsen@redhat.com>
2019-07-15 16:58:37 -06:00
Sébastien Han 7d54cac453 ceph: rgw: set proper port syntax on beast
The beast fronted configuration for rgw is quite different than civetweb
so we adapted the construct of the arg line based on that configuration
requirement.

Closes: https://github.com/rook/rook/issues/3411
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-07-08 17:54:43 +02:00
travisn 8226d577f6 remove obsolete check for setting the resource ownerreferences
The check for whether to set the OwnerReferences is no longer
necessary. When passing the correct value to the apiVersion,
the OwnerReferences can be successfully set for OpenShift.

Signed-off-by: travisn <tnielsen@redhat.com>
2019-07-01 06:55:07 -06:00
Sébastien Han 93b2448619 ceph: refactor rgw bootstrap
This commit does multiple things:

* remove support for AllNodes where we would deploy one rgw per node on
all the nodes.
* a transition path is implemented in the code so that if someone has an
existing deployment, daemonsets will be removed and replaced by an
deployments.
* when using "instances", each rgw deployed has its own key which makes
Ceph reporting the exact number of rgw running, see:

```
[root@rook-ceph-operator-775cf575c5-bh4sr /]# ceph -s
  cluster:
    id:     611fcf39-0669-4864-9a12-debb35c0397a
    health: HEALTH_OK

  services:
    mon: 3 daemons, quorum a,b,c (age 12h)
    mgr: a(active, since 12h)
    osd: 3 osds: 3 up (since 12h), 3 in (since 12h)
    rgw: 3 daemons active (my.store.a, my.store.b, my.store.c)

  data:
    pools:   6 pools, 600 pgs
    objects: 235 objects, 3.8 KiB
    usage:   3.0 GiB used, 84 GiB / 87 GiB avail
    pgs:     600 active+clean
```

Closes: https://github.com/rook/rook/issues/2474, https://github.com/rook/rook/issues/2957 and https://github.com/rook/rook/issues/3245
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-06-14 17:55:15 +02:00
Sébastien Han f6f1aa772f rgw: remove legacy code
This code can be removed since 1.0 shipped.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-06-14 16:28:17 +02:00
Sébastien Han 0317de9096 rgw: change default frontend on nautilus
As per: ceph/ceph#26599, Beast is now the
default fronted for rados gateway.
Newly created cluster as of Nautilus will use it by default.

Re-added version of 03587352d5
Resolves: #2707
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-06-07 23:10:11 +02:00
Sébastien Han 241296be8a ceph: rgw add liveness probe check
We now check if the pod responds on http port 80.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-06-05 14:35:15 +02:00
Santosh Pillai 7d5afa29b8 added device class pool property
- Updated code to use deviceClass property when a pool is created for both "replicated" and "erasure code".
- Updated "ceph crush rule create-..." command to use "create-replicated" instead of "create-simple"
- Updated unit tests
- Updated (ceph-pool-crd.md) documentation to reflect the changes.
- Updated pending release notes.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2019-05-15 16:45:39 +05:30
travisn 9dcddb5bed ceph: upgrade all daemons during ceph upgrade
The CephCluster CR contains settings that are needed by other
CRs to configure the Ceph daemons. When the CephCluster CR
is updated, the updates will now be passed on to each of the
CR controllers to ensure the daemons are updated properly
without requiring an operator restart.

When calling the controllers from another controller,
we ensure that only a single goroutine is handling
CRs at any given time to prevent contention across
multiple CRs of the same type.

Signed-off-by: travisn <tnielsen@redhat.com>
2019-04-23 13:36:45 -06:00
Blaine Gardner f4e2be50a6 ceph spec: add ceph-version label to controllers
Add a 'ceph-version' label to application controllers in the same manner
as the prior 'rook-version' label to help with upgrades.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-04-18 15:09:33 -06:00
Alexander Trost 0c6eb7aa3d crds: Set annotations pods, deployments and so on
Allow the user to set annotations in the CRDs of the following operators which will then be set on
the resulting Pods (Deployments, StatefulSets and so on).
Operators:
* Cassandra
* Ceph
* CockroachDB
* EdgeFS
* Minio
* NFS

The Annotations related structures have been added to the
rook.io/v1alpha2 pkg.

Signed-off-by: Alexander Trost <galexrt@googlemail.com>
2019-04-16 20:47:05 +02:00
Sébastien Han d4c48bb293 ceph: expose /var/log/ceph to the host
It's quite convinient to expose /var/log/ceph so that we can decide to
activate logs locally on the machine and see what's going on.
This is only a placeholder when a daemon is stuck crashlooping and we
want to allow administrator to gather log files.
We still do not log on file but this can be activated via a config
option passed to the centralized config option store.

For some daemons, which typically do not store any data (rgw, rbd-mirror
and mds) we had to propagate dataDirHostPath from the cluster spec to
each creation call so that the bindmount can happen.

Fixes: https://github.com/rook/rook/issues/2881
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-04-15 10:47:09 +02:00
Blaine Gardner 685a8df08d ceph: add 'rook-version' label to controllers
Add a `rook-version` label to all controller resources used by Ceph:
deployments, daemonsets, and jobs. Labels are added to controller
resources only and not to the pod templates within because changing pod
templates causes updates due to the label change. The controller
resources themselves are not updated with the label addition and
therefore don't cause an unnecessary upgrade.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-04-12 13:56:31 -06:00
Alexander Trost 8bc26d9096 k8sclient: Update all operators to use apps/v1
All usages of k8s go client are now also using the versioned `AppsV1() `
call for the client.

Updated MySQL and Wordpress, and Kube Registy examples to use apps/v1
Deployments.

Signed-off-by: Alexander Trost <galexrt@googlemail.com>
2019-04-12 09:25:42 +02:00
Travis Nielsen b15391819b Merge pull request #2910 from SUSE/mon-port-upgrade-fix-2854
ceph: fix for masked upgrade failures and getting integrations running again
2019-04-08 17:11:32 -06:00
Keith Schincke 878ef8ff00 Issue 2660: Deleting CephObjectStoreUser does not delete secret
When deleting a CephObjectStoreUser the deleteUser function
attempts to delete the stored secret using the wrong name. This
patch updates deleteUser to use the same fmt.Sprintf call used in
the createUser function.

Updated CI to delete the correct CRD and check the secret is deleted.

Signed-off-by: Keith Schincke <keith.schincke@gmail.com>
2019-04-05 10:52:15 -05:00
Blaine Gardner 5c41da6705 ceph rgw: more robust update for selector change
Upgrading a Ceph objectstore was failing the upgrade test because the
existing method for handling the case where update errors occurred
because labels and label selectors have changed was not robust enough.
Make this more robust by attempting delete-and-create if a normal update
does not work on an rgw deployment.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-04-04 09:02:09 -06:00
Noah Watkins 379cb98689 ceph: replace release name with fine-grained version
The basic idea here is to replace the release name in the ClusterInfo
object with the fine grained version information queried at runtime.
This patch also removes the Name field from the cluster spec, which was
also runtime determined and was redundant with ClusterInfo relase name.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2019-03-18 12:57:29 -07:00
Sébastien Han 871054e887 ceph: implement pod restriction on memory
If someone sets limits to pod, we want to ensure the possible
experience, so we want to make sure that people do not configure
inapropriate values for certain daemons.
We decide to fail if the memory.limit is too low.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-03-15 17:35:44 +01:00