Skip to content
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

Merged
merged 1 commit into from
Apr 18, 2017

Conversation

surajnarwade
Copy link
Contributor

Partially resolve #376
Added warning, such that PV should be created before PVC or
if dynamic provision is there, no need to create PV.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 28, 2017
@@ -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)
Copy link
Member

@cdrage cdrage Mar 28, 2017

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cdrage @kadel , as discussed in the issue, we have to tell user that 100 mb PVC is created and create PV, so that PVC will start working, correct me if I am wrong.

# 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"
Copy link
Member

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.

Copy link
Contributor Author

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.

@cdrage
Copy link
Member

cdrage commented Mar 30, 2017

@surajnarwade I commented earlier on the INFO but I still believe that your output is way too long:

			log.Infof("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)

This can be shortened to something along the lines of:

PersistentVolumeClaim of size 100Mi created. PVC's will not work unless a PersistentVolume has been created.

It should be straight-to-the-point!

@cdrage
Copy link
Member

cdrage commented Mar 30, 2017

I think one of the tests may be giving a false positive... I believe this INFO needs to be added to openshift.go.

@cdrage
Copy link
Member

cdrage commented Mar 30, 2017

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.

@surajnarwade
Copy link
Contributor Author

cc @cdrage @kadel

@cdrage
Copy link
Member

cdrage commented Mar 31, 2017

This LGTM. Sorry to nitpick again, but would it be better to get the 100 value from a constant? (so we don't have to change the log info if we decide to change the default value)

@surajnarwade surajnarwade force-pushed the fix-pvc-info branch 2 times, most recently from b3ec791 to 309a1e3 Compare March 31, 2017 14:03
@surajnarwade
Copy link
Contributor Author

@cdrage ,done with changes

@cdrage
Copy link
Member

cdrage commented Apr 3, 2017

@@ -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"
Copy link
Member

@kadel kadel Apr 3, 2017

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
Copy link
Member

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"
Copy link
Member

@kadel kadel Apr 3, 2017

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 :-)

@surajnarwade surajnarwade force-pushed the fix-pvc-info branch 2 times, most recently from 0760390 to aa30acc Compare April 4, 2017 05:40
@cdrage
Copy link
Member

cdrage commented Apr 10, 2017

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)
Copy link
Member

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 ;-)

Copy link
Contributor Author

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)

Copy link
Member

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 ?

Copy link
Member

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.
@surajnarwade
Copy link
Contributor Author

cc @kadel

@cdrage cdrage merged commit 87fc1b5 into kubernetes:master Apr 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should we not generate PVC's by default?
4 participants