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

e2e: defend on k8s version for snap-controller install #1534

Merged
merged 3 commits into from Oct 14, 2020

Conversation

pkalever
Copy link

@pkalever pkalever commented Sep 28, 2020

Describe what this PR does

Currently the scripts/install-snapshot.sh script needs to be called
depending on the Kubernetes version. It would be much easier to use the
script if it is intelligent enough to decide itself whether k8s snapshot
controller needs to be installed or not.

Fixes: #1139
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>

@pkalever
Copy link
Author

@nixpanic as mentioned this will only fix a part of issue #1139.

The second part is to detect 'what version of the snapshot components to install' right?
Where can I find the k8s server version => snap comp version mapping?

Thanks!

@pkalever
Copy link
Author

I have come across this reference but again this doesn't have any mapping for the latest releases > v2.1.0

@pkalever
Copy link
Author

pkalever commented Sep 28, 2020

Went through each release notes at https://github.com/kubernetes-csi/external-snapshotter/tags

If I understand it right, for our ceph-csi we need atleast k8s >= v1.14.0,

So the map should be:

---------------------------------------------------------------------------
|   Kube versions                |      External snapshotter version      |
---------------------------------------------------------------------------
|      v1.14.0 - v1.16.0         |                 v1.2.2                 |
---------------------------------------------------------------------------
|      v1.17.0 - Latest          |              v2.1.0 or v3.0.0          |
---------------------------------------------------------------------------

Does it look good?

@nixpanic nixpanic added component/testing Additional test cases or CI work enhancement New feature or request labels Sep 29, 2020
Copy link
Member

@nixpanic nixpanic left a comment

Choose a reason for hiding this comment

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

Looks mostly good to me. Note that with the Partially Fixes: #... comment, the issue will be closed because GitHub detects Fixes: #...

scripts/install-snapshot.sh Outdated Show resolved Hide resolved
@Madhu-1
Copy link
Collaborator

Madhu-1 commented Sep 29, 2020

Went through each release notes at https://github.com/kubernetes-csi/external-snapshotter/tags

If I understand it right, for our ceph-csi we need atleast k8s >= v1.14.0,

So the map should be:

---------------------------------------------------------------------------
|   Kube versions                |      External snapshotter version      |
---------------------------------------------------------------------------
|      v1.14.0 - v1.16.0         |                 v1.2.2                 |
---------------------------------------------------------------------------
|      v1.17.0 - Latest          |              v2.1.0 or v3.0.0          |
---------------------------------------------------------------------------

Does it look good?

we don't need to support snapshots if the kubernetes version is <1.17 as snapshotter beta is not backward compatible with alpha version


KUBE_VERSION=$(kubectl version --short 2>/dev/null | grep "^Server Version" | cut -d' ' -f3)
if [[ -z ${KUBE_VERSION} ]]; then
echo "could not get kube server version"
Copy link
Collaborator

Choose a reason for hiding this comment

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

could not get Kubernetes server version

Copy link
Author

Choose a reason for hiding this comment

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

sure

@pkalever
Copy link
Author

Looks mostly good to me. Note that with the Partially Fixes: #... comment, the issue will be closed because GitHub detects Fixes: #...

Yep, I'm aware of this, my intention was to fix the other part of the issue as part of this PR.

@nixpanic @Madhu-1 @humblec can I have at least one ack on the table of mapping at #1534 (comment)

Logically:

if v1.14.0 <= KUBE_VERSION <= v1.16.0; then
    SNAPSHOT_VERSION=v1.2.2
elif KUBE_VERSION >= v1.17.0; then
   SNAPSHOT_VERSION=v3.0.0
fi

We also need to fix in the current patch, like we need to skip the snapshot controller install if k8s version < 1.14.0, rather than 1.17.0

Does this all sound good?

Thanks!

@Madhu-1
Copy link
Collaborator

Madhu-1 commented Sep 29, 2020

Looks mostly good to me. Note that with the Partially Fixes: #... comment, the issue will be closed because GitHub detects Fixes: #...

Yep, I'm aware of this, my intention was to fix the other part of the issue as part of this PR.

@nixpanic @Madhu-1 @humblec can I have at least one ack on the table of mapping at #1534 (comment)

Logically:

if v1.14.0 <= KUBE_VERSION <= v1.16.0; then
    SNAPSHOT_VERSION=v1.2.2
elif KUBE_VERSION >= v1.17.0; then
   SNAPSHOT_VERSION=v3.0.0
fi

We also need to fix in the current patch, like we need to skip the snapshot controller install if k8s version < 1.14.0, rather than 1.17.0

Does this all sound good?

Thanks!

already added here #1534 (comment)

@pkalever
Copy link
Author

we don't need to support snapshots if the kubernetes version is <1.17 as snapshotter beta is not backward compatible with alpha version

Thanks Madhu, this means the current patch is good enough to fix #1139

@Madhu-1 we got a new release out for External snapshotter v3.0.0 a couple of weeks ago.
I hope we are good to update the SNAPSHOT_VERSION to v3.0.0?

@Madhu-1
Copy link
Collaborator

Madhu-1 commented Sep 29, 2020

we don't need to support snapshots if the kubernetes version is <1.17 as snapshotter beta is not backward compatible with alpha version

Thanks Madhu, this means the current patch is good enough to fix #1139

@Madhu-1 we got a new release out for External snapshotter v3.0.0 a couple of weeks ago.
I hope we are good to update the SNAPSHOT_VERSION to v3.0.0?

Yes, @agarwal-mudit is already working on updating sidecar containers. and also can you please update the version from v2.1.1 to 3.0.0 here

SNAPSHOT_VERSION=${SNAPSHOT_VERSION:-"v2.1.1"}

@pkalever pkalever changed the title e2e: defend on kube version for snap-controller install e2e: defend on k8s version for snap-controller install Sep 29, 2020
Madhu-1
Madhu-1 previously approved these changes Sep 29, 2020
@Madhu-1
Copy link
Collaborator

Madhu-1 commented Sep 29, 2020

/test ci/centos/mini-e2e

@Madhu-1
Copy link
Collaborator

Madhu-1 commented Sep 29, 2020

/test ci/centos/mini-e2e/k8s-1.18

@pkalever
Copy link
Author

/test ci/centos/mini-e2e/k8s-1.19

@pkalever
Copy link
Author

/test ci/centos/mini-e2e/k8s-1.18

@pkalever
Copy link
Author

/test ci/centos/mini-e2e-helm/k8s-1.19

@pkalever
Copy link
Author

CI fails with:

error: unable to read URL "https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v3.0.0/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml", server reported 404 Not Found, status code=404

Maybe we need to wait until Mudit patches land and rebase this on top of them.

@agarwal-mudit
Copy link
Contributor

CI fails with:

error: unable to read URL "https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v3.0.0/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml", server reported 404 Not Found, status code=404

Maybe we need to wait until Mudit patches land and rebase this on top of them.

Will try to raise a PR by tomorrow.

Copy link
Member

@nixpanic nixpanic left a comment

Choose a reason for hiding this comment

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

The failed tests complain that the v3.0.0 VolumeSnapshotClass CRD can not be found:

error: unable to read URL "https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v3.0.0/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml", server reported 404 Not Found, status code=404

Please check where the CRD needs to come from with newer versions.

scripts/install-snapshot.sh Outdated Show resolved Hide resolved
@pkalever
Copy link
Author

pkalever commented Oct 1, 2020

Please check where the CRD needs to come from with newer versions.

Indeed, as dicussed in the above comments, this should be rebased on Mudit's changes, once the changes are merged. 👍

@agarwal-mudit
Copy link
Contributor

Please check where the CRD needs to come from with newer versions.

Indeed, as dicussed in the above comments, this should be rebased on Mudit's changes, once the changes are merged.

On a second look, is this path hard coded in the script because the crd path is changed in v3.0.0.
This is the new path: https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v3.0.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml

@Madhu-1
Copy link
Collaborator

Madhu-1 commented Oct 1, 2020

@pkalever Mudit PR won't fix this one I think. we can go and make the below changes, please double-check once again

@pkalever
Copy link
Author

pkalever commented Oct 5, 2020

@Madhu-1 you are right, starting from external snapshotter v2.0 they are at external-snapshotter/config/crd/, at v3.0 they moved to external-snapshotter/config/crd/client/.

Also came across kubernetes-csi/external-snapshotter#365 :-)

Based on Neils's comments, I'm inclined to move the SNAPSHOT_VERSION variable to build.env.

Do we need to still support v2.1.1? Meaning do we need to defend on the versions and select the appropriate link/path in this script? I'm not sure if we have a strong reason to support <3.0 anymore.

Thanks!

@mergify mergify bot dismissed Madhu-1’s stale review October 5, 2020 10:42

Pull request has been modified.

humblec
humblec previously approved these changes Oct 5, 2020
scripts/install-snapshot.sh Outdated Show resolved Hide resolved
@mergify mergify bot dismissed humblec’s stale review October 6, 2020 14:43

Pull request has been modified.

@Madhu-1
Copy link
Collaborator

Madhu-1 commented Oct 7, 2020

/test all

@pkalever
Copy link
Author

@Madhu-1 ready for merge?

Madhu-1
Madhu-1 previously approved these changes Oct 12, 2020
@Madhu-1
Copy link
Collaborator

Madhu-1 commented Oct 12, 2020

@Madhu-1 ready for merge?

will wait for @nixpanic to review it.

build.env Show resolved Hide resolved
scripts/install-snapshot.sh Outdated Show resolved Hide resolved
echo "${KUBE_VERSION}" | sed 's/^v//' | cut -d'.' -f"${1}"
}

KUBE_VERSION=$(kubectl version --short 2>/dev/null | grep "^Server Version" | cut -d' ' -f3)
Copy link
Member

Choose a reason for hiding this comment

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

Redirecting stderr to /dev/null might make debugging more difficult in case an error occurs. Is there a good reason to not display potential errors here?

Copy link
Author

Choose a reason for hiding this comment

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

Because we do not want the next line (condition) to return false in case of error.

Copy link
Member

Choose a reason for hiding this comment

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

But the output of stderr is not captured in KUBE_VERSION if you do not use 2>&1 or a similar redirection?

Copy link
Author

Choose a reason for hiding this comment

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

fixed now. Thanks Neils.

humblec
humblec previously approved these changes Oct 12, 2020
@pkalever
Copy link
Author

/test all

Prasanna Kumar Kalever added 3 commits October 14, 2020 08:24
Currently the scripts/install-snapshot.sh script needs to be called
depending on the Kubernetes version. It would be much easier to use the
script if it is intelligent enough to decide itself whether k8s snapshot
controller needs to be installed or not.

Fixes: ceph#1139
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
For external-snapshotter v3.0.1,
Supported CSI Spec Versions: 1.0.0, 1.1.0, 1.2.0
Minimum Kubernetes version: 1.17
Recommended Kubernetes version: 1.17

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/testing Additional test cases or CI work enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make scripts/install-snapshot.sh easier to re-use
5 participants