Skip to content

Commit 28c0ed3

Browse files
Merge pull request kubernetes-csi#128 from shiftstack/merge-bot-master
Merge https://github.com/kubernetes-csi/csi-driver-nfs:master into master
2 parents e1dd453 + 063b91e commit 28c0ed3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+812
-254
lines changed

.github/workflows/codeql-analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
id: go
4545

4646
- name: Checkout repository
47-
uses: actions/checkout@v3
47+
uses: actions/checkout@v4
4848

4949
# Initializes the CodeQL tools for scanning.
5050
- name: Initialize CodeQL

.github/workflows/codespell.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
name: Check for spelling errors
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@v4
1212
- uses: codespell-project/actions-codespell@master
1313
with:
1414
check_filenames: true

.github/workflows/darwin.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
go-version: ^1.16
1414
id: go
1515
- name: Check out code into the Go module directory
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717
- name: Run unit tests
1818
run: |
1919
go version

.github/workflows/linux.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
id: go
1818

1919
- name: Check out code into the Go module directory
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
2121

2222
- name: Build Test
2323
run: |

.github/workflows/pluto.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212

1313
- name: Checkout
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515

1616
# https://pluto.docs.fairwinds.com/advanced/#display-options
1717
- name: Download pluto

.github/workflows/shellcheck.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
name: Shellcheck
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020
- name: Run ShellCheck
2121
uses: ludeeus/action-shellcheck@master
2222
env:

.github/workflows/trivy.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout code
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
1414

1515
- name: Install go
1616
uses: actions/setup-go@v4

.github/workflows/windows.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
with:
1616
go-version: ${{ matrix.go }}
1717
- name: Checkout code
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
1919
- name: Run Windows Unit Tests
2020
run: |
2121
go version
4 Bytes
Binary file not shown.

charts/latest/csi-driver-nfs/templates/csi-nfs-node.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ spec:
2424
{{- end }}
2525
hostNetwork: true # original nfs connection would be broken without hostNetwork setting
2626
dnsPolicy: {{ .Values.controller.dnsPolicy }}
27-
serviceAccountName: csi-nfs-node-sa
27+
serviceAccountName: {{ .Values.serviceAccount.node }}
2828
priorityClassName: {{ .Values.node.priorityClassName }}
2929
securityContext:
3030
seccompProfile:

charts/latest/csi-driver-nfs/values.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ image:
2828
serviceAccount:
2929
create: true # When true, service accounts will be created for you. Set to false if you want to use your own.
3030
controller: csi-nfs-controller-sa # Name of Service Account to be created or used
31+
node: csi-nfs-node-sa # Name of Service Account to be created or used
3132

3233
rbac:
3334
create: true
@@ -138,7 +139,7 @@ externalSnapshotter:
138139
requests:
139140
cpu: 10m
140141
memory: 20Mi
141-
# Create volume snapshot CRDs.
142+
# Create volume snapshot CRDs.
142143
customResourceDefinitions:
143144
enabled: true #if set true, VolumeSnapshot, VolumeSnapshotContent and VolumeSnapshotClass CRDs will be created. Set it false, If they already exist in cluster.
144145

go.mod

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/onsi/gomega v1.27.10
1111
github.com/pborman/uuid v1.2.1
1212
github.com/stretchr/testify v1.8.4
13-
golang.org/x/net v0.13.0
13+
golang.org/x/net v0.15.0
1414
google.golang.org/grpc v1.57.0
1515
google.golang.org/protobuf v1.31.0
1616
k8s.io/api v0.24.15
@@ -81,11 +81,11 @@ require (
8181
go.opentelemetry.io/otel/sdk/metric v0.20.0 // indirect
8282
go.opentelemetry.io/otel/trace v0.20.0 // indirect
8383
go.opentelemetry.io/proto/otlp v0.7.0 // indirect
84-
golang.org/x/crypto v0.11.0 // indirect
84+
golang.org/x/crypto v0.13.0 // indirect
8585
golang.org/x/oauth2 v0.7.0 // indirect
86-
golang.org/x/sys v0.10.0 // indirect
87-
golang.org/x/term v0.10.0 // indirect
88-
golang.org/x/text v0.11.0 // indirect
86+
golang.org/x/sys v0.12.0 // indirect
87+
golang.org/x/term v0.12.0 // indirect
88+
golang.org/x/text v0.13.0 // indirect
8989
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
9090
google.golang.org/appengine v1.6.7 // indirect
9191
google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 // indirect

go.sum

+10-10
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
427427
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
428428
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
429429
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
430-
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
431-
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
430+
golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
431+
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
432432
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
433433
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
434434
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -509,8 +509,8 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx
509509
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
510510
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
511511
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
512-
golang.org/x/net v0.13.0 h1:Nvo8UFsZ8X3BhAC9699Z1j7XQ3rsZnUUm7jfBEk1ueY=
513-
golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
512+
golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8=
513+
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
514514
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
515515
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
516516
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -599,14 +599,14 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
599599
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
600600
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
601601
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
602-
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
603-
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
602+
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
603+
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
604604
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
605605
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
606606
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
607607
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
608-
golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c=
609-
golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
608+
golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU=
609+
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
610610
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
611611
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
612612
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -618,8 +618,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
618618
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
619619
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
620620
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
621-
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
622-
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
621+
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
622+
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
623623
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
624624
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
625625
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

release-tools/SIDECAR_RELEASE_PROCESS.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ naming convention `<hostpath-deployment-version>-on-<kubernetes-version>`.
102102
1. If release was a new major/minor version, create a new `release-<minor>`
103103
branch at that commit.
104104
1. Check [image build status](https://k8s-testgrid.appspot.com/sig-storage-image-build).
105-
1. Promote images from k8s-staging-sig-storage to k8s.gcr.io/sig-storage. From
105+
1. Promote images from k8s-staging-sig-storage to registry.k8s.io/sig-storage. From
106106
the [k8s image
107-
repo](https://github.com/kubernetes/k8s.io/tree/HEAD/k8s.gcr.io/images/k8s-staging-sig-storage),
107+
repo](https://github.com/kubernetes/k8s.io/tree/HEAD/registry.k8s.io/images/k8s-staging-sig-storage),
108108
run `./generate.sh > images.yaml`, and send a PR with the updated images.
109109
Once merged, the image promoter will copy the images from staging to prod.
110110
1. Update [kubernetes-csi/docs](https://github.com/kubernetes-csi/docs) sidecar

release-tools/build.make

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ DOCKER_BUILDX_CREATE_ARGS ?=
148148
$(CMDS:%=push-multiarch-%): push-multiarch-%: check-pull-base-ref build-%
149149
set -ex; \
150150
export DOCKER_CLI_EXPERIMENTAL=enabled; \
151-
docker buildx create $(DOCKER_BUILDX_CREATE_ARGS) --use --name multiarchimage-buildertest; \
151+
docker buildx create $(DOCKER_BUILDX_CREATE_ARGS) --use --name multiarchimage-buildertest --driver-opt image=moby/buildkit:v0.10.6; \
152152
trap "docker buildx rm multiarchimage-buildertest" EXIT; \
153153
dockerfile_linux=$$(if [ -e ./$(CMDS_DIR)/$*/Dockerfile ]; then echo ./$(CMDS_DIR)/$*/Dockerfile; else echo Dockerfile; fi); \
154154
dockerfile_windows=$$(if [ -e ./$(CMDS_DIR)/$*/Dockerfile.Windows ]; then echo ./$(CMDS_DIR)/$*/Dockerfile.Windows; else echo Dockerfile.Windows; fi); \

release-tools/cloudbuild.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See https://github.com/kubernetes/test-infra/blob/HEAD/config/jobs/image-pushing/README.md
1414
# for more details on image pushing process in Kubernetes.
1515
#
16-
# To promote release images, see https://github.com/kubernetes/k8s.io/tree/HEAD/k8s.gcr.io/images/k8s-staging-sig-storage.
16+
# To promote release images, see https://github.com/kubernetes/k8s.io/tree/HEAD/registry.k8s.io/images/k8s-staging-sig-storage.
1717

1818
# This must be specified in seconds. If omitted, defaults to 600s (10 mins).
1919
# Building three images in external-snapshotter takes more than an hour.
@@ -26,7 +26,7 @@ steps:
2626
# The image must contain bash and curl. Ideally it should also contain
2727
# the desired version of Go (currently defined in release-tools/prow.sh),
2828
# but that just speeds up the build and is not required.
29-
- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20210917-12df099d55'
29+
- name: 'gcr.io/k8s-testimages/gcb-docker-gcloud:v20230623-56e06d7c18'
3030
entrypoint: ./.cloudbuild.sh
3131
env:
3232
- GIT_TAG=${_GIT_TAG}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
# Copyright 2023 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import argparse
16+
import datetime
17+
import re
18+
from collections import defaultdict
19+
import subprocess
20+
import shutil
21+
from dateutil.relativedelta import relativedelta
22+
23+
def check_gh_command():
24+
"""
25+
Pretty much everything is processed from `gh`
26+
Check that the `gh` command is in the path before anything else
27+
"""
28+
if not shutil.which('gh'):
29+
print("Error: The `gh` command is not available in the PATH.")
30+
print("Please install the GitHub CLI (https://cli.github.com/) and try again.")
31+
exit(1)
32+
33+
def duration_ago(dt):
34+
"""
35+
Humanize duration outputs
36+
"""
37+
delta = relativedelta(datetime.datetime.now(), dt)
38+
if delta.years > 0:
39+
return f"{delta.years} year{'s' if delta.years > 1 else ''} ago"
40+
elif delta.months > 0:
41+
return f"{delta.months} month{'s' if delta.months > 1 else ''} ago"
42+
elif delta.days > 0:
43+
return f"{delta.days} day{'s' if delta.days > 1 else ''} ago"
44+
elif delta.hours > 0:
45+
return f"{delta.hours} hour{'s' if delta.hours > 1 else ''} ago"
46+
elif delta.minutes > 0:
47+
return f"{delta.minutes} minute{'s' if delta.minutes > 1 else ''} ago"
48+
else:
49+
return "just now"
50+
51+
def parse_version(version):
52+
"""
53+
Parse version assuming it is in the form of v1.2.3
54+
"""
55+
pattern = r"v(\d+)\.(\d+)\.(\d+)"
56+
match = re.match(pattern, version)
57+
if match:
58+
major, minor, patch = map(int, match.groups())
59+
return (major, minor, patch)
60+
61+
def end_of_life_grouped_versions(versions):
62+
"""
63+
Calculate the end of life date for a minor release version according to : https://kubernetes-csi.github.io/docs/project-policies.html#support
64+
65+
The input is an array of tuples of:
66+
* grouped versions (e.g. 1.0, 1.1)
67+
* array of that contains all versions and their release date (e.g. 1.0.0, 01-01-2013)
68+
69+
versions structure example :
70+
[((3, 5), [('v3.5.0', datetime.datetime(2023, 4, 27, 22, 28, 6))]),
71+
((3, 4),
72+
[('v3.4.1', datetime.datetime(2023, 4, 5, 17, 41, 15)),
73+
('v3.4.0', datetime.datetime(2022, 12, 27, 23, 43, 41))])]
74+
"""
75+
supported_versions = []
76+
# Prepare dates for later calculation
77+
now = datetime.datetime.now()
78+
one_year = datetime.timedelta(days=365)
79+
three_months = datetime.timedelta(days=90)
80+
81+
# get the newer versions on top
82+
sorted_versions_list = sorted(versions.items(), key=lambda x: x[0], reverse=True)
83+
84+
# the latest version is always supported no matter the release date
85+
latest = sorted_versions_list.pop(0)
86+
supported_versions.append(latest[1][-1])
87+
88+
for v in sorted_versions_list:
89+
first_release = v[1][-1]
90+
last_release = v[1][0]
91+
# if the release is less than a year old we support the latest patch version
92+
if now - first_release[1] < one_year:
93+
supported_versions.append(last_release)
94+
# if the main release is older than a year and has a recent path, this is supported
95+
elif now - last_release[1] < three_months:
96+
supported_versions.append(last_release)
97+
return supported_versions
98+
99+
def get_release_docker_image(repo, version):
100+
"""
101+
Extract docker image name from the release page documentation
102+
"""
103+
output = subprocess.check_output(['gh', 'release', '-R', repo, 'view', version], text=True)
104+
#Extract matching image name excluding `
105+
match = re.search(r"docker pull ([\.\/\-\:\w\d]*)", output)
106+
docker_image = match.group(1) if match else ''
107+
return((version, docker_image))
108+
109+
def get_versions_from_releases(repo):
110+
"""
111+
Using `gh` cli get the github releases page details then
112+
create a list of grouped version on major.minor
113+
and for each give all major.minor.patch with release dates
114+
"""
115+
# Run the `gh release` command to get the release list
116+
output = subprocess.check_output(['gh', 'release', '-R', repo, 'list'], text=True)
117+
# Parse the output and group by major and minor version numbers
118+
versions = defaultdict(lambda: [])
119+
for line in output.strip().split('\n'):
120+
parts = line.split('\t')
121+
# pprint.pprint(parts)
122+
version = parts[0]
123+
parsed_version = parse_version(version)
124+
if parsed_version is None:
125+
continue
126+
major, minor, patch = parsed_version
127+
128+
published = datetime.datetime.strptime(parts[3], '%Y-%m-%dT%H:%M:%SZ')
129+
versions[(major, minor)].append((version, published))
130+
return(versions)
131+
132+
133+
def main():
134+
manual = """
135+
This script lists the supported versions Github releases according to https://kubernetes-csi.github.io/docs/project-policies.html#support
136+
It has been designed to help to update the tables from : https://kubernetes-csi.github.io/docs/sidecar-containers.html\n\n
137+
It can take multiple repos as argument, for all CSI sidecars details you can run:
138+
./get_supported_version_csi-sidecar.py -R kubernetes-csi/external-attacher -R kubernetes-csi/external-provisioner -R kubernetes-csi/external-resizer -R kubernetes-csi/external-snapshotter -R kubernetes-csi/livenessprobe -R kubernetes-csi/node-driver-registrar -R kubernetes-csi/external-health-monitor\n
139+
With the output you can then update the documentation manually.
140+
"""
141+
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description=manual)
142+
parser.add_argument('--repo', '-R', required=True, action='append', dest='repos', help='The name of the repository in the format owner/repo.')
143+
parser.add_argument('--display', '-d', action='store_true', help='(default) Display EOL versions with their dates', default=True)
144+
parser.add_argument('--doc', '-D', action='store_true', help='Helper to https://kubernetes-csi.github.io/docs/ that prints Docker image for each EOL version')
145+
146+
args = parser.parse_args()
147+
148+
# Verify pre-reqs
149+
check_gh_command()
150+
151+
# Process all repos
152+
for repo in args.repos:
153+
versions = get_versions_from_releases(repo)
154+
eol_versions = end_of_life_grouped_versions(versions)
155+
156+
if args.display:
157+
print(f"Supported versions with release date and age of `{repo}`:\n")
158+
for version in eol_versions:
159+
print(f"{version[0]}\t{version[1].strftime('%Y-%m-%d')}\t{duration_ago(version[1])}")
160+
161+
# TODO : generate proper doc output for the tables of: https://kubernetes-csi.github.io/docs/sidecar-containers.html
162+
if args.doc:
163+
print("\nSupported Versions with docker images for each end of life version:\n")
164+
for version in eol_versions:
165+
_, image = get_release_docker_image(repo, version[0])
166+
print(f"{version[0]}\t{image}")
167+
print()
168+
169+
if __name__ == '__main__':
170+
main()

0 commit comments

Comments
 (0)