-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce label selector based class scheduling #48
Conversation
8a53de7
to
933c6de
Compare
crossplane/crossplane#926 crossplane/crossplane#927 crossplane/crossplane-runtime#48 Updates angryjet to reflect the above changes. Signed-off-by: Nic Cope <[email protected]>
crossplane/crossplane#926 crossplane/crossplane#927 crossplane/crossplane-runtime#48 Updates angryjet to reflect the above changes. Signed-off-by: Nic Cope <[email protected]>
crossplane/crossplane#926 crossplane/crossplane#927 crossplane/crossplane-runtime#48 Updates angryjet to reflect the above changes. Signed-off-by: Nic Cope <[email protected]>
crossplane/crossplane#926 crossplane/crossplane#927 crossplane/crossplane-runtime#48 Updates angryjet to reflect the above changes. Signed-off-by: Nic Cope <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Cross-checked with the stated design and feels like it adheres. None of my comments are blocking so I will go ahead and approve, but also will be looking for the first stack implementation to review. Awesome work :)
// garbage collection, to determine whether to delete a managed resource | ||
// when its claim is deleted per https://github.com/crossplaneio/crossplane/issues/550 | ||
|
||
// TODO(negz): Avoid setting this owner reference? Kubernetes specifies that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know what happens if we try and set this owner reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked at this for some time, but as far as I can tell it works. Currently we almost always dynamically provision a managed resource in a separate namespace from the resource claim, yet deleting the resource claim automatically deletes the managed resource (via owner reference based garbage collection).
What's interesting is that I have no idea how this works - I'm not sure how the garbage collector figures out what to delete without knowing the owner's namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to dive into this a little bit more, but I don't think my investigation needs to block here :)
25a5cfa
to
6bd3d20
Compare
Here's an example of simple resource class selection in action: $ kubectl get redisclass -l classy="true"
NAME PROVIDER-REF RECLAIM-POLICY AGE
azure-redis-labelled-a example Delete 51m
azure-redis-labelled-b example Delete 51m
azure-redis-labelled-c example Delete 51m
azure-redis-labelled-d example Delete 51m
azure-redis-labelled-e example Delete 51m
$ kubectl get cloudmemorystoreinstanceclass -l classy="true"
NAME PROVIDER-REF RECLAIM-POLICY AGE
gcp-redis-labelled-a example Delete 50m
gcp-redis-labelled-b example Delete 49m
gcp-redis-labelled-c example Delete 49m
gcp-redis-labelled-d example Delete 49m
gcp-redis-labelled-e example Delete 49m
$ kubectl get rediscluster
NAME STATUS CLASS-KIND CLASS-NAME RESOURCE-KIND RESOURCE-NAME AGE
app-redis-0 RedisClass azure-redis-labelled-b Redis default-app-redis-0-8rhkr 4m31s
app-redis-1 RedisClass azure-redis-labelled-b Redis default-app-redis-1-tbn7g 4m11s
app-redis-2 CloudMemorystoreInstanceClass gcp-redis-labelled-a CloudMemorystoreInstance default-app-redis-2-mrqpm 3m52s
app-redis-3 RedisClass azure-redis-labelled-c Redis default-app-redis-3-glr4s 3m36s
app-redis-4 RedisClass azure-redis-labelled-b Redis default-app-redis-4-vdzc9 3m27s
app-redis-5 CloudMemorystoreInstanceClass gcp-redis-labelled-b CloudMemorystoreInstance default-app-redis-5-2qt5r 3m20s
app-redis-6 RedisClass azure-redis-labelled-a Redis default-app-redis-6-t7g59 3m11s
app-redis-7 CloudMemorystoreInstanceClass gcp-redis-labelled-a CloudMemorystoreInstance default-app-redis-7-cwmpl 2m25s
app-redis-8 CloudMemorystoreInstanceClass gcp-redis-labelled-b CloudMemorystoreInstance default-app-redis-8-9dcm4 2m25s
app-redis-9 CloudMemorystoreInstanceClass gcp-redis-labelled-b CloudMemorystoreInstance default-app-redis-9-fdxqf 2m25s The claims are all variants of: ---
apiVersion: cache.crossplane.io/v1alpha1
kind: RedisCluster
metadata:
name: app-redis-0
spec:
classSelector:
matchLabels:
classy: "true"
writeConnectionSecretToRef:
name: app-redis-0 |
This commit renames "non portable resource class" back to "resource class", and requires that resource claims reference a (non portable) resource class in any namespace. Signed-off-by: Nic Cope <[email protected]>
Signed-off-by: Nic Cope <[email protected]>
This allows us to require that name (and namespace where appropriate) are set at the CRD level. In the case of cluster scoped resources that reference secrets this is less surprising than defaulting to the `default` namespace when the namespace is omitted. Signed-off-by: Nic Cope <[email protected]>
Signed-off-by: Nic Cope <[email protected]>
For resource claim controllers, now that we're unconcerned with indirect resource classes. Signed-off-by: Nic Cope <[email protected]>
Signed-off-by: Nic Cope <[email protected]>
200ms seems low enough that GCP consistently beats Azure when scheduling RedisCluster claims in my experiments. Signed-off-by: Nic Cope <[email protected]>
crossplane/crossplane#926 crossplane/crossplane#927 crossplane/crossplane-runtime#48 Updates angryjet to reflect the above changes. Signed-off-by: Nic Cope <[email protected]>
Description of your changes
This enables label based class matching per #926. Changes will also be required to crossplane, and all stacks.
Checklist
I have:
make reviewable
to ensure this PR is ready for review.clusterrole.yaml
to include any new types.