-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Adding a script to update etcd objects as per the latest API Version #7819
Conversation
935cd99
to
9c27979
Compare
# Read and then write it back as is. | ||
filename="/tmp/${resource}-${instance}.json" | ||
${KUBECTL} get ${resource} ${instance} -o json > $filename | ||
${KUBECTL} update -f $filename |
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 an update loop-- repeat the get/update if the update fails.
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.
Done.
Added a loop of 5 retries.
filename="/tmp/${resource}-${instance}.json" | ||
${KUBECTL} get ${resource} ${instance} -o json > $filename | ||
${KUBECTL} update -f $filename | ||
done |
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.
Remove the tmp files.
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.
Done.
"pods" | ||
"persistentvolumes" | ||
"persistentvolumeclaims" | ||
"rc" |
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.
replicationcontrollers
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.
Done
9c27979
to
68229ae
Compare
Thanks for all the comments. |
68229ae
to
7507e51
Compare
# TODO: Get this list of resources from server once | ||
# https://github.com/GoogleCloudPlatform/kubernetes/issues/2057 is fixed. | ||
declare -a resources=( | ||
# "endpoints" |
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.
Are these commented out intentionally?
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 sorry. Fixed
7507e51
to
5175c87
Compare
Updated the code as per comments. |
I'm worried about testing-- can we copy/modify test-cmd.sh to make some v1beta1 objects, then restart apiserver, then run this script, then verify that the objects all got converted? |
We need the following to add tests:
Will work on those as separate PRs and then come back and add a test here. |
8487d51
to
9481bcd
Compare
Have added hack/test-update-etcd-objects.sh to test the update script. It:
Have made a few other changes to make the test work:
|
36d5cee
to
3bd8819
Compare
@@ -30,7 +30,6 @@ function cleanup() | |||
[[ -n ${APISERVER_PID-} ]] && kill ${APISERVER_PID} 1>&2 2>/dev/null | |||
[[ -n ${CTLRMGR_PID-} ]] && kill ${CTLRMGR_PID} 1>&2 2>/dev/null | |||
[[ -n ${KUBELET_PID-} ]] && kill ${KUBELET_PID} 1>&2 2>/dev/null | |||
[[ -n ${PROXY_PID-} ]] && kill ${PROXY_PID} 1>&2 2>/dev/null |
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.
why this removal?
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.
Doesnt seem to be used anywhere in this script.
UPDATE_ETCD_OBJECTS_SCRIPT="${KUBE_ROOT}/hack/update-etcd-objects.sh" | ||
|
||
function startApiServer() { | ||
kube::log::status "Starting kube-apiserver with KUBE_API_VERSIONS: ${KUBE_API_VERSIONS} and runtime_config: ${RUNTIME_CONFIG}" |
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.
indentation?
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.
Fixed
3bd8819
to
9663281
Compare
limitations under the License. | ||
*/ | ||
|
||
// Package to keep track of API Versions that have been registered in api.Scheme. |
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.
"should be registered"? This package doesn't actually do the registering, it just records intentions.
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.
Updated
9663281
to
1aae948
Compare
Updated the code as per comments. |
1aae948
to
c62875e
Compare
disableV1beta3 = true | ||
// "api/all=false" allows users to selectively enable specific api versions. | ||
disableAllAPIs := false | ||
allAPIFlagValue, ok := s.RuntimeConfig["api/all"] |
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 had to go look this thing up. Is it documented anywhere? I would greatly prefer not having magic keys like "api/all" or "api/legacy"; I'd prefer an opt-out or opt-in list, and clarification (in the command line flag help message!) that it determines which api versions are served (as opposed to the other env var which determines which are understood).
I guess you didn't add api/legacy, so let's not touch that one. But can we avoid adding api/all?
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.
Updated https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/cluster_management.md#turn-on-or-off-an-api-version-for-your-cluster and also updated the help message for runtime_config flag.
Looking pretty good, I basically just have one last complaint. |
c62875e
to
a955c4a
Compare
a955c4a
to
fa9f864
Compare
LGTM |
Shippable is green! |
Adding a script to update etcd objects as per the latest API Version
Fixes #6583
Its a simple script that reads all objects and then writes them back as is to ensure that they are written using the latest API version.
cc @bgrant0607 @smarterclayton @lavalamp