-
Notifications
You must be signed in to change notification settings - Fork 770
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
Added warning after PVC creation #519
Conversation
6d1dd80
to
dcbcfee
Compare
@@ -410,6 +410,7 @@ func (k *Kubernetes) ConfigVolumes(name string, service kobject.ServiceConfig) ( | |||
if err != nil { | |||
return nil, nil, nil, errors.Wrap(err, "k.CreatePVC failed") | |||
} | |||
log.Printf("volume %q of size \"100 Mi\" created, PersistentVolume should be created before in order to PersistentVolumeClaim start working, unless it will be in pending state \n If Cluster has dynamic Provisioning and Storage Classes, So you don't have to do anything", volumeName) |
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 should be INFO
log.Info
and this output is wayyyyy too long.
We already output when a PersistentVolumeClaim is created. This should be a small INFO.
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.
script/test/cmd/tests.sh
Outdated
# openshift test | ||
convert::expect_success "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/simple-vol-mounts/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/volume-mounts/simple-vol-mounts/output-os.json" | ||
convert::expect_success_and_warning "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/volume-mounts/simple-vol-mounts/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/volume-mounts/simple-vol-mounts/output-os.json" "volume ""httpd-claim0"" of size ""100 Mi"" created, PersistentVolume should be created before in order to PersistentVolumeClaim start working, unless it will be in pending state | ||
If Cluster has dynamic Provisioning and Storage Classes, So you don't have to do anything" |
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.
No need to write any tests for this, this is just a log output, no change to logic in code.
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.
As we are giving information after PVC creation now, we have to modify tests for fixture based on volumes.
dcbcfee
to
a76a976
Compare
@surajnarwade I commented earlier on the INFO but I still believe that your output is way too long:
This can be shortened to something along the lines of:
It should be straight-to-the-point! |
I think one of the tests may be giving a false positive... I believe this INFO needs to be added to |
Also, the additional information would be best added here: https://github.com/kubernetes-incubator/kompose/blob/master/pkg/transformer/kubernetes/kubernetes.go#L667 Or else you'll just get two outputs. |
a76a976
to
ef9fbb8
Compare
This LGTM. Sorry to nitpick again, but would it be better to get the |
b3ec791
to
309a1e3
Compare
@cdrage ,done with changes |
309a1e3
to
c37831c
Compare
@surajnarwade Could you change these lines too to take from the constant? |
c37831c
to
2882376
Compare
@@ -65,6 +65,9 @@ type OpenShift struct { | |||
// used when undeploying resources from OpenShift | |||
const TIMEOUT = 300 | |||
|
|||
//default value of Persistent Volume Claim | |||
const PVCValue = "100Mi" |
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 we need separate constant for openshift?
It might be better to reuse kubernetes.PVCValue
@@ -61,6 +61,9 @@ type Kubernetes struct { | |||
// used when undeploying resources from kubernetes | |||
const TIMEOUT = 300 | |||
|
|||
//default value of Persistent Volume Claim |
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 is not value of Persistent Volume Claim, it should say that this is default size of Persistent Volume Claim
@@ -61,6 +61,9 @@ type Kubernetes struct { | |||
// used when undeploying resources from kubernetes | |||
const TIMEOUT = 300 | |||
|
|||
//default value of Persistent Volume Claim | |||
const PVCValue = "100Mi" |
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.
can we have 'size' in name of variable? like PVCsize
or something like that. Or even better 'PVCRequestSize' as it says everything about what it does :-)
0760390
to
aa30acc
Compare
LGTM, does this look good to you too @kadel ? |
@@ -664,7 +667,7 @@ func (k *Kubernetes) Deploy(komposeObject kobject.KomposeObject, opt kobject.Con | |||
if err != nil { | |||
return err | |||
} | |||
log.Infof("Successfully created PersistentVolumeClaim: %s", t.Name) | |||
log.Infof("Successfully created PersistentVolumeClaim: %s of size %s. PVC's will not work unless a PersistentVolume has been created.", t.Name, PVCRequestSize) |
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.
Cluster can be also setup with dynamic provisioning. Even new minikube is setup like this by default.
How about this:
Successfully created PersistentVolumeClaim: %s of size %s. For PVC to work your cluster has to be setup with Dynamic provisioning of storage or PersistentVolume has to be created.
Or something in those lines that mentions dynamic provisioning. I bet there is better sentence to explain it than what I've put together ;-)
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.
@kadel, I had written something like this, but removed as @cdrage said, #519 (comment)
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 thought it was there before, but missed @cdrage's comment.
We can make it a bit shorter, but we have to mention that you don't have to do anything if you have dynamic provisioning, otherwise it will be confusing.
Another version:
PersistentVolumeClaim of size 100Mi created. If your cluster has dynamic storage provisioning, you don't have to do anything. Otherwise you have to create PersistentVolume to make PVC work.
This a bit shorter than original and says everything.
thoughts @cdrage ?
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.
@kadel That looks excellent! I approve 👍
Partially resolve kubernetes#376 and kubernetes#345 Added warning, such that PV should be created before PVC or if dynamic provision is there, no need to create PV.
aa30acc
to
9a6c1d9
Compare
cc @kadel |
Partially resolve #376
Added warning, such that PV should be created before PVC or
if dynamic provision is there, no need to create PV.