Commit Graph
149 Commits
Author SHA1 Message Date
Song Gao 8d0e6ea36d ceph: add label for CSI deployments/daemonsets/statefulsets
Add rook version label to CSI deployments/daemonsets/statefulsets just as the Ceph daemons.

Signed-off-by: Song Gao <2695690803@qq.com>
2019-10-24 23:42:45 +08:00
travisn a64b604b4a ceph: improved log message for retry interval
The retry interval was showing an incorrect message in the
log

Signed-off-by: travisn <tnielsen@redhat.com>
2019-10-23 11:32:21 -06:00
Madhu Rajanna 9d298fe4f0 Add Toleration and NodeAffinity to CSI
Add support for setting Toleration and NodeAffinity
to CSI Provisioner deployment or statefulset and
plugin daemonset through ENV variables.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2019-09-27 10:23:12 +05:30
Madhu Rajanna 3af3cd63ab Rename AddNodeAffinity to GenerateNodeAffinity
function AddNodeAffinity was not adding any node
affinity instead it was forming the nodeaffinity
object. renamed it to GenerateNodeAffinity for more
meaningful

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2019-09-27 10:05:45 +05:30
Madhu Rajanna bdfdac8ee4 Update service if already present
previously we are not updating the service
if it's already present. with this change,
we will update the service. this does not
trigger any error message if service
already present.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2019-09-24 09:43:02 +05:30
travisn 57d446ec6f ceph: osds to always use hostname for node selector
The node selector for running OSDs on PVCs was using the node name
rather than the node's hostname. In clusters where the node name
is different from the hostname this would cause the osd daemons
to be in pending state indefinitely. Now the node selector will
use the hostname as expected.

Signed-off-by: travisn <tnielsen@redhat.com>
2019-09-19 16:01:52 -06:00
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
Madhu Rajanna 8d5d9b9117 Fix liveness service creation
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2019-08-30 13:16:55 +05:30
Madhu Rajanna 11293393ca Fix logging in csi
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2019-08-30 13:16:55 +05:30
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
rohan47 21deea9d64 OSD: CRUSH map can be based on node or PVC in case of PVC backed OSD
Signed-off-by: rohan47 <rohgupta@redhat.com>
2019-08-29 04:01:41 +05:30
Travis Nielsen 164491bff7 Merge pull request #3642 from Madhu-1/csi-leader-election
Use Deployment with leader election instead of StatefulSet
2019-08-26 13:00:46 -06:00
Madhu Rajanna 78fb35a93d Use Deployment with leader election instead of StatefulSet
Deployment behaves better when a node gets disconnected
from the rest of the cluster - new provisioner leader
is elected in ~15 seconds, while it may take up to
5 minutes for StatefulSet to start a new replica.

if kube version is 1.13.x deploy provisioner as statefulset.
if kube version is higher than 1.14+ deploy provisioner
as deployment.

Refer: kubernetes-csi/external-provisioner@52d1fbc
Refer: ceph/ceph-csi#497

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2019-08-26 19:29:37 +05:30
giovanism 4974be4b20 rook: Move network util functions to k8sutil
rook: Remove NetworkSelector type alias

rook: Add error return value for multus funcs

Signed-off-by: giovanism <giovanism@outlook.co.id>
2019-08-26 16:17:04 +07:00
Sébastien Han 83eca4b7ae ceph: fix various debug messages
Debug was used instead of Debugf so types were not interpreted
correctly.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-08-22 17:19:33 +02:00
rohan47andAshish Ranjan d2f52aebe5 Adds support for storageClassDeviceSet in rook-ceph operator
- Added code to support StorageClassDeviceSet spec provided in the cluster-on-pvc.yaml
- The code reads the StorageClassDeviceSet spec and creates pvc based on the ‘count’ field for each device set.
- OSD prepare job is started for each PVC which activates the ceph-volume on each PVC
- Finally OSD is started on each of the PVC device.

Co-authored-by: rohan47 <rohgupta@redhat.com>
Co-authored-by: Ashish Ranjan <aranjan@redhat.com>
Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2019-08-12 09:24:13 -06:00
Travis Nielsen 7fb43d72eb Merge pull request #3546 from noahdesu/mon-pvc
ceph: base monitor storage of pvc
2019-08-02 22:25:57 -06:00
Noah Watkins 4173c5544e ceph: base monitor storage of pvc
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2019-08-02 10:30:23 -07:00
AllenZMC 4616f17a26 fix word ressource to resource
Signed-off-by: czm <zhongming.chang@daocloud.io>
2019-07-31 20:53:33 +08:00
Nick McKinney d9aec6bad6 Allow control over K8s service type via CRD
Signed-off-by: Nick McKinney <nmckinney@breakpoint-labs.com>
2019-07-25 15:49:18 -04:00
Mateusz Gozdek f936394764 ceph: allow to set multiple tolerations for agent and discover pods
Closes #2896

Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
2019-07-17 23:11:18 +02: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 9824bd2ff9 ceph: improve upgrade procedure
When a cluster is updated with a different image version, this triggers
a serialized restart of all the pods. Prior to this commit, no safety
check were performed and rook was hoping for the best outcome.

Now before doing restarting a daemon we check it can be restarted. Once
it's restarted we also check we can pursue with the rest of the
platform. For instance, with monitors we check that they are in quorum,
for OSD we check that PGs are clean and for MDS we make sure they are
 all active.

Fixes: https://github.com/rook/rook/issues/2889
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-07-17 00:37:43 +02:00
Sébastien Han 487ded50f3 Merge pull request #3355 from noahdesu/mon-sched2
ceph: schedule mons across failure domains
2019-07-16 22:47:07 +02:00
Blaine Gardner aa6925ae79 cmdreporter: fix minor error bug
Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-07-15 10:08:51 -06:00
Kristoffer Grönlund f79fe5fa28 k8sutil: Docstrings for some funcs in pod.go
Add missing docstrings for container image
functions in pod.go, noting the behavior
when getting a container image from a pod
which only has a single container defined.

Signed-off-by: Kristoffer Grönlund <kgronlund@suse.com>
2019-07-12 14:12:57 +02:00
Kristoffer Grönlund 3873251ce6 k8sutil: Use label max length constant from k8s
Follow-up to #3436:

The validation module has a defined constant for
label value max length. It makes sense to use it
here.

Signed-off-by: Kristoffer Grönlund <kgronlund@suse.com>
2019-07-12 13:37:58 +02:00
Sébastien Han 562633ce99 Merge pull request #3436 from krig/label-validation
k8sutil: Ensure rook version label has valid syntax
2019-07-12 11:35:52 +02:00
Kristoffer Grönlund 6ff69a4e72 k8sutil: Ensure rook version label has valid syntax
Replace any invalid characters and ensure length
and format for the rook version label, to avoid
problems with version strings that contain
illegal characters (common characters that aren't
valid in labels would be + and ~, for example).

Kubernetes label syntax:
https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set

Fixes: #3434
Signed-off-by: Kristoffer Grönlund <kgronlund@suse.com>
2019-07-12 10:20:30 +02:00
Blaine Gardner 5fc99a6266 Merge pull request #3369 from SUSE/cmd-reporter
Add cmd-reporter daemon; use it to get ceph version
2019-07-11 16:05:14 -06:00
Noah Watkins f034f000e1 ceph: schedule mons across failure domains
this patch introduces failure-domain aware scheduling for monitor pods.
previously the only policy was to avoid scheduling monitors on the same
nodes. the new policy tries to spread monitors across zones and nodes.

   NOTE: this patch only enforces the well-known k8s "zone"
   failure-domain label (i.e. it does not look for region labels). this
   decision is made for two reasons. first, eliminating explicit
   scheduling is an important goal and will be done as part of upcoming
   work. this will enable all supported failure-domain labels to be
   handled. second, the "zone" domain is likely more appropriate for a
   larger portion of users (as opposed to the geographical distinction
   made with region), and supporting multiple failure domain types would
   add significant complexity for a temporary resolution to failure
   domain scheduling.

at a high-level this patch introduces a data structure `NodeUsage` that
is a pairing of a v1.Node and metadata relevant to scheduling: number of
monitor pods on the node, and its status w.r.t. to being scheduable for
new monitor pods.

each scheduling event computes a unified data structure that organizes
for each node a `NodeUsage` structure into per-failure-zone groups.
subsequent algorithms rely soley on this unified structure to make
scheduling decisions.

there are two entry points to the changes made:

1) during orchestration mon:Cluster:assignMons is invoked to make a
place new monitor pods onto nodes. the core scheduling logic is now
self-contained in mon:scheduleMonitor which implements node and zone
aware scheduling policies.

2) periodic health checks resolve any conflicts that may occur due to
changes to the cluster (e.g. new nodes, configuration changes, etc...).
the two existing checks: mons on invalid nodes, and overloaded nodes are
both handled.

fixes: #2603

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2019-07-11 14:23:15 -07:00
Noah Watkins 60cace8f7b util: add ValidNode variant without sched check
this adds a variant of ValidNode that doesn't check for no-sched taint
(e.g. kubectl cordon).

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2019-07-11 14:21:40 -07:00
Umanga Chapagain 732f3030d0 integrate prometheus based monitoring with rook-ceph
> add new field to cluster spec
> deploy servicemonitor
> deploy prometheusRule

Signed-off-by: Umanga Chapagain <chapagainumanga@gmail.com>
2019-07-08 11:40:17 +05:30
Blaine Gardner 0a58d3dfdd k8sutil: add cmd-reporter wrapper
Add a wrapper for the cmd-reporter function of the 'rook' binary to
k8sutil so that it's easier for operators to use the functionality.

Operators still need to have some idea of how CmdReporter works. It runs
the requested command in a job, but if the calling operator needs the
job to have special configuration, the operator must request the pointer
to the job struct from CmdReporter to modify it before calling the
CmdReporter's Run method.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-07-05 15:37:13 -06:00
Blaine Gardner 867145f6d0 k8sutil: add additional godoc comments to jobs.go
Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-07-05 12:03:59 -06:00
Blaine Gardner 10508a886f k8sutil: add DeleteConfigMap with DeleteResource
Implement a DeleteConfigMap function with the new DeleteResource
functionality.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-07-05 12:03:59 -06:00
Blaine Gardner bc29aa33be k8sutil: add reusable delete function with opts
Add a `DeleteResource` function that accepts new `DeleteOptions` and
`WaitOptions` structs as inputs. This new funciton is reusable and
extensible for any Kubernetes resource.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-07-05 12:03:58 -06:00
Umanga Chapagain 25e4275082 Rook: Added NodeAffinity to agent and discovery daemon
Previously, Rook Agent and Discovery DaemonSet deployment didn't allow
adding nodeAffinity. This commit adds nodeAffinity spec to daemonSet
deployment, which can be configured through environment variables in
operator deployment yaml.

+ Support multiple LabelKey, each with multiple LabelValue
+ Support multiple LabelKey with no value

Signed-off-by: Umanga Chapagain <chapagainumanga@gmail.com>
2019-07-05 13:48:09 +05:30
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
Jose A. Rivera f3a1512983 Read node labels for provider topology
Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
2019-05-14 13:18:00 -05:00
Alexander Trost 7cf8e99a8c ceph-op: Remove taint check in "is node scheduable" func
This removes the unnecessary check for taints on nodes in the
`GetNodeSchedulable()` function. This fixes that even though the user
has specified `tolerations` for, e.g., `NoSchedule` taints, that would
be ignored and the node(s) directly be "marked" as unschedulable.

Signed-off-by: Alexander Trost <galexrt@googlemail.com>
2019-05-02 18:05:46 +02:00
Kaushal M 5e8375e921 ceph: Delete and recreate rook-ceph-detect-version job
The ceph controller will delete and recreate the detec-version job, when
an already existing job is found. This helps avoid cluster creation from
getting hung up on waiting for an already existing/stale job to finish.

Fixes #3081.

Signed-off-by: Kaushal M <kshlmster@gmail.com>
2019-04-30 18:19:56 +05:30
travisn bc87b440fb update to the k8s 1.14 client libraries
Signed-off-by: travisn <tnielsen@redhat.com>
2019-04-18 07:51:41 -06:00
travisn 91e9a5cd04 reference K8s1.13 and client-go 1.10 and the external provisioner for flex
Signed-off-by: travisn <tnielsen@redhat.com>
2019-04-18 07:51:41 -06:00
Blaine Gardner 966aef8681 ceph mds: update keyring before deployment update
Because the deployment update-and-wait function waits for the deployment
to be ready, and that cannot happen due to the keyring not
having been updated yet. The keyring has its
owner set to the deployment so that no special keyring handling must
be done, but it must be created after the deployment UID is known.
Change the order of operations so that the existing deployment's UID can
be retrieved if it exists and the keyring created/updated before the
update-and-wait function is called.

This order-of-operations issue currently only applies to the mds. Other
daemons whose keyrings are owned by the replication controller do not
use the update-and-wait function.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-04-15 12:26:46 -06: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
Blaine Gardner a80082988d ceph: remove osds only when certain
Make the Ceph operator more cautious about when it decides to remove
nodes from the Rook-Ceph cluster which are acting as osd hosts.

When `useAllNodes` is set to `true` we assume that the user wants to
have the most hands-off experience. Node removals are allowed when a
node is delted from Kubernetes and when a node has its taints/affinities
modified by the user (but not by automatic k8s modification as much as
possible).

When `useAllnodes` is set to `false` the only time a node is removed is
if it is removed from the Ceph cluster definition.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-04-11 09:41:54 -06:00
Blaine Gardner 9c0369f264 k8sutil: extract granular node validity functions
Node validity is not always as simple as a true/false. Refactor each
validity test into its own function for operators that wish to check
validity more granularly. Ceph will use these changes.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-04-10 12:43:43 -06:00