-
Notifications
You must be signed in to change notification settings - Fork 148
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
controller: create storage configmap on reconcile #227
Conversation
@rthallisey @mareklibra @aglitke @awels @jelkosz @rollandf - please review |
e0b82ba
to
ee89949
Compare
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 patch is sort of hardcoding the defaults, no matter a ConfigMap
is used.
Is automatic detection of StorageClass capabilities still in plan?
The ConfigMap should contain sc-specific defaults if these generic (Filesystem/RWM) can not be used (like for the local storage).
There is no way to hardcode the defaults right for a generic cluster, as recently implemented here.
If detection of SC capabilities will not land shortly, there should be a way how the administrator can change values in this ConfigMap. Via HCO configuration or manually while not-breaking the reconciliation logic.
Namespace: namespace, | ||
}, | ||
Data: map[string]string{ | ||
"accessMode": "ReadWriteMany", |
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.
With this set, no VM created by UI (Wizard) can be started when local SC is used.
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.
ok, so I'll add also local-sc.accessMode and local-sc.volumeMode then.
ee89949
to
2a87508
Compare
In 'ensureKubeVirtStorageConfig' func we create the ConfigMap only if doesn't exist, so admin should be able to modify it. |
db8e437
to
86f8412
Compare
I'm curious @rthallisey why we are against auto detecting. Originally I would have thought we would want to auto detect where possible. |
fe23e75
to
2cd7d8c
Compare
My thinking is that I want to avoid having code that checks for OpenShift specific things in tree wherever possible. Having a flag for the user to set isn't too bad of a trade-off IMO. |
Interesting, if I may offer a different perspective. I would suggest that "we", as the maintainers of the HCO, know best how to install all of the different KubeVirt components and the HyperConverged resource is our API. Every field in our HyperConverged's spec, we accept all of the supported values and support them -- consider a memcached-operator that accepts a version (but only 1, 2, 3, 4) then a user would expect to be able to put any of 1-4 in the spec.version (there could be issues where downgrades are not allowed but you get the idea). In our current scenario, we have no way of supporting |
@rthallisey So what's your take on that then? Should we keep the flag or revert to the previous solution (detect automatically by fetching the infrastructure's platform). |
Data: map[string]string{ | ||
"accessMode": "ReadWriteMany", | ||
"volumeMode": volumeMode, | ||
"local-sc.accessMode": "ReadWriteOnce", |
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.
@danielerez , this assumes that the target cluster has a storage class called local-sc
. It's up to cluster's admin how (s)he calls it and what particular SC is behind that name.
We can either
- autodetect
- or provide a way for manual intervention
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.
The admin can change it by modifying the ConfigMap (reconcile won't change it once already created). @rthallisey do we want to add the local class name to HyperConvergedSpec as well or is it too specific?
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.
@mareklibra @rthallisey Added 'LocalStorageClassName' key to HyperConverged spec, so it could be configured on deployment.
I understand the argument of "we can detect the configuration so we should", but I'm concerned about the cost of this UX. If we consume an openshift API I do think there is an argument to be made about adding something to our API. Adding this option requires we support and CRD changes in the future. It is a True/False bool so I don't think it will be hard, but No API is the best API. |
ci test please |
I think we should only be attempting to consume APIs that are available. That is, if some API (like I am in absolute agreement with you that we should not be making assumptions about the underlying platform or requiring some special OpenShift API, but I think it is correct for us to discover the APIs we want, handling their presence or absence and I don't believe this to be unique to what is now only OpenShift APIs (in the future I see it being some special API provided by another operator that we don't want to require). |
7194c83
to
21bd5db
Compare
/test hco-e2e-aws |
/retest |
@djzager and I talked offline. I'm advocating we don't include any openshift libraries or code. Specifically, that means nothing that ties us down to having to ask ourselves "if OpenShift, do this. Otherwise, do that". Having a flag with no validation is the safest way to do this, so we're going with a flag. |
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.
One last nit then this LG2M
@@ -17,6 +17,12 @@ type HyperConvergedSpec struct { | |||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster | |||
// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file | |||
// Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html | |||
|
|||
// BareMetalPlatform indicates whether the infrastructure is baremetal. | |||
BareMetalPlatform bool `json:"BareMetalPlatform,omitempty"` |
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.
We should expose this flag on the HCO's CR by default. Add to the template CSV then run /hack/build-manifests.sh
--- a/templates/olm-catalog/kubevirt-hyperconverged/VERSION/kubevirt-hyperconverged-operator.VERSION.clusterserviceversion.yaml.in
+++ b/templates/olm-catalog/kubevirt-hyperconverged/VERSION/kubevirt-hyperconverged-operator.VERSION.clusterserviceversion.yaml.in
@@ -10,6 +10,9 @@ metadata:
"metadata": {
"name": "kubevirt-hyperconverged",
"namespace": "kubevirt-hyperconverged"
+ },
+ "spec": {
+ "BareMetalPlatform": "false",
}{{if .Converged}}
},
{
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.
Added.
BareMetalPlatform bool `json:"BareMetalPlatform,omitempty"` | ||
|
||
// LocalStorageClassName the name of the local storage class. | ||
LocalStorageClassName string `json:"LocalStorageClassName,omitempty"` |
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.
We'll leave LocalStorageClassName
off the default CR. I think this string should be exposed primarily in the docs.
@danielerez Let's try to get this in tomorrow. |
Added a new ConfigMap for defining default values for storage according to the following logic: * For a BareMetal infrastructure: - volumeMode: Block - accessMode: ReadWriteMany * For all other deployments: - volumeMode: File - accessMode: ReadWriteMany Change-Id: Iea3cc601c66970c86ea21575c38db0487a18228f Signed-off-by: Daniel Erez <derez@redhat.com>
21bd5db
to
e0cebad
Compare
Added a new ConfigMap for defining default values for
storage according to the following logic: