diff --git a/CHANGELOG.md b/CHANGELOG.md index 33999512d..6387e4971 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ UNRELEASED =================== * see https://github.com/kube-rs/kube-rs/compare/0.62.0...master + * rust `edition` bumped to `2021` - #664 0.62.0 / 2021-10-22 =================== diff --git a/Cargo.toml b/Cargo.toml index 4aefc21fc..3b640fb3a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,5 @@ [workspace] default-members = ["kube"] -resolver = "1" members = [ "kube", "kube-client", diff --git a/Makefile b/Makefile index 91460da7b..21bf3d476 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ clippy: fmt: #rustup component add rustfmt --toolchain nightly - rustfmt +nightly --edition 2018 $$(find . -type f -iname *.rs) + rustfmt +nightly --edition 2021 $$(find . -type f -iname *.rs) doc: RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --lib --workspace --features=derive,ws,oauth,jsonpatch,client,derive,runtime,admission --open @@ -22,7 +22,7 @@ test: cd kube && cargo test --lib --features=derive readme: - rustdoc README.md --test --edition=2018 + rustdoc README.md --test --edition=2021 kind-create: kind create cluster diff --git a/examples/Cargo.toml b/examples/Cargo.toml index bc23c9067..d130204b9 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -7,7 +7,7 @@ authors = [ "kazk ", ] publish = false -edition = "2018" +edition = "2021" license = "Apache-2.0" [package.metadata.release] diff --git a/examples/admission_controller.rs b/examples/admission_controller.rs index 358b35a66..fda6e284a 100644 --- a/examples/admission_controller.rs +++ b/examples/admission_controller.rs @@ -2,10 +2,7 @@ use kube::core::{ admission::{AdmissionRequest, AdmissionResponse, AdmissionReview}, DynamicObject, ResourceExt, }; -use std::{ - convert::{Infallible, TryInto}, - error::Error, -}; +use std::{convert::Infallible, error::Error}; #[macro_use] extern crate log; use warp::{reply, Filter, Reply}; diff --git a/kube-client/Cargo.toml b/kube-client/Cargo.toml index 779328f7b..be95e2cc6 100644 --- a/kube-client/Cargo.toml +++ b/kube-client/Cargo.toml @@ -12,7 +12,7 @@ repository = "https://github.com/kube-rs/kube-rs" readme = "../README.md" keywords = ["kubernetes", "client",] categories = ["web-programming::http-client"] -edition = "2018" +edition = "2021" [features] default = ["client", "native-tls"] diff --git a/kube-client/src/client/auth/mod.rs b/kube-client/src/client/auth/mod.rs index fd08e23d2..7c41f9c7c 100644 --- a/kube-client/src/client/auth/mod.rs +++ b/kube-client/src/client/auth/mod.rs @@ -1,4 +1,4 @@ -use std::{convert::TryFrom, process::Command, sync::Arc}; +use std::{process::Command, sync::Arc}; use chrono::{DateTime, Duration, Utc}; use http::HeaderValue; diff --git a/kube-client/src/client/config_ext.rs b/kube-client/src/client/config_ext.rs index 91be8f1d4..c7140cd2b 100644 --- a/kube-client/src/client/config_ext.rs +++ b/kube-client/src/client/config_ext.rs @@ -1,5 +1,3 @@ -use std::convert::TryFrom; - use tower::util::Either; #[cfg(any(feature = "native-tls", feature = "rustls-tls"))] use super::tls; diff --git a/kube-client/src/client/middleware/refresh_token.rs b/kube-client/src/client/middleware/refresh_token.rs index e73bba931..83488c0ee 100644 --- a/kube-client/src/client/middleware/refresh_token.rs +++ b/kube-client/src/client/middleware/refresh_token.rs @@ -130,7 +130,7 @@ where mod tests { use super::*; - use std::{convert::TryFrom, matches, sync::Arc}; + use std::{matches, sync::Arc}; use chrono::{Duration, Utc}; use futures::pin_mut; diff --git a/kube-client/src/client/mod.rs b/kube-client/src/client/mod.rs index 5148e6654..07cb64134 100644 --- a/kube-client/src/client/mod.rs +++ b/kube-client/src/client/mod.rs @@ -7,9 +7,6 @@ //! //! The [`Client`] can also be used with [`Discovery`](crate::Discovery) to dynamically //! retrieve the resources served by the kubernetes API. - -use std::convert::TryFrom; - use bytes::Bytes; use either::{Either, Left, Right}; use futures::{self, Stream, StreamExt, TryStream, TryStreamExt}; diff --git a/kube-core/Cargo.toml b/kube-core/Cargo.toml index 6225e4e3a..0096de1af 100644 --- a/kube-core/Cargo.toml +++ b/kube-core/Cargo.toml @@ -6,7 +6,7 @@ authors = [ "clux ", "kazk ", ] -edition = "2018" +edition = "2021" license = "Apache-2.0" repository = "https://github.com/kube-rs/kube-rs" readme = "../README.md" diff --git a/kube-core/src/admission.rs b/kube-core/src/admission.rs index e8771e582..82921b8ed 100644 --- a/kube-core/src/admission.rs +++ b/kube-core/src/admission.rs @@ -13,7 +13,7 @@ use crate::{ Error, Result, }; -use std::{collections::HashMap, convert::TryInto}; +use std::collections::HashMap; use k8s_openapi::{ api::authentication::v1::UserInfo, @@ -64,7 +64,6 @@ impl TryInto> for AdmissionReview { /// An incoming [`AdmissionReview`] request. /// ```ignore /// use kube::api::{admission::{AdmissionRequest, AdmissionReview}, DynamicObject}; -/// use std::convert::TryInto; /// /// // The incoming AdmissionReview received by the controller. /// let body: AdmissionReview; @@ -187,7 +186,6 @@ pub enum Operation { /// admission::{AdmissionRequest, AdmissionResponse, AdmissionReview}, /// DynamicObject, /// }; -/// use std::convert::TryInto; /// /// // The incoming AdmissionReview received by the controller. /// let body: AdmissionReview; @@ -335,8 +333,6 @@ pub enum PatchType { mod test { const WEBHOOK_BODY: &str = r#"{"kind":"AdmissionReview","apiVersion":"admission.k8s.io/v1","request":{"uid":"0c9a8d74-9cb7-44dd-b98e-09fd62def2f4","kind":{"group":"","version":"v1","kind":"Pod"},"resource":{"group":"","version":"v1","resource":"pods"},"requestKind":{"group":"","version":"v1","kind":"Pod"},"requestResource":{"group":"","version":"v1","resource":"pods"},"name":"echo-pod","namespace":"colin-coder","operation":"CREATE","userInfo":{"username":"colin@coder.com","groups":["system:authenticated"],"extra":{"iam.gke.io/user-assertion":["REDACTED"],"user-assertion.cloud.google.com":["REDACTED"]}},"object":{"kind":"Pod","apiVersion":"v1","metadata":{"name":"echo-pod","namespace":"colin-coder","creationTimestamp":null,"labels":{"app":"echo-server"},"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"v1\",\"kind\":\"Pod\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"echo-server\"},\"name\":\"echo-pod\",\"namespace\":\"colin-coder\"},\"spec\":{\"containers\":[{\"image\":\"jmalloc/echo-server\",\"name\":\"echo-server\",\"ports\":[{\"containerPort\":8080,\"name\":\"http-port\"}]}]}}\n"},"managedFields":[{"manager":"kubectl","operation":"Update","apiVersion":"v1","time":"2021-03-29T23:02:16Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:kubectl.kubernetes.io/last-applied-configuration":{}},"f:labels":{".":{},"f:app":{}}},"f:spec":{"f:containers":{"k:{\"name\":\"echo-server\"}":{".":{},"f:image":{},"f:imagePullPolicy":{},"f:name":{},"f:ports":{".":{},"k:{\"containerPort\":8080,\"protocol\":\"TCP\"}":{".":{},"f:containerPort":{},"f:name":{},"f:protocol":{}}},"f:resources":{},"f:terminationMessagePath":{},"f:terminationMessagePolicy":{}}},"f:dnsPolicy":{},"f:enableServiceLinks":{},"f:restartPolicy":{},"f:schedulerName":{},"f:securityContext":{},"f:terminationGracePeriodSeconds":{}}}}]},"spec":{"volumes":[{"name":"default-token-rxbqq","secret":{"secretName":"default-token-rxbqq"}}],"containers":[{"name":"echo-server","image":"jmalloc/echo-server","ports":[{"name":"http-port","containerPort":8080,"protocol":"TCP"}],"resources":{},"volumeMounts":[{"name":"default-token-rxbqq","readOnly":true,"mountPath":"/var/run/secrets/kubernetes.io/serviceaccount"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"Always"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","serviceAccountName":"default","serviceAccount":"default","securityContext":{},"schedulerName":"default-scheduler","tolerations":[{"key":"node.kubernetes.io/not-ready","operator":"Exists","effect":"NoExecute","tolerationSeconds":300},{"key":"node.kubernetes.io/unreachable","operator":"Exists","effect":"NoExecute","tolerationSeconds":300}],"priority":0,"enableServiceLinks":true},"status":{}},"oldObject":null,"dryRun":false,"options":{"kind":"CreateOptions","apiVersion":"meta.k8s.io/v1"}}}"#; - use std::convert::TryInto; - use crate::{ admission::{AdmissionResponse, AdmissionReview}, DynamicObject, Result, diff --git a/kube-derive/Cargo.toml b/kube-derive/Cargo.toml index 3e032a2e0..035b09c2c 100644 --- a/kube-derive/Cargo.toml +++ b/kube-derive/Cargo.toml @@ -6,7 +6,7 @@ authors = [ "clux ", "kazk ", ] -edition = "2018" +edition = "2021" license = "Apache-2.0" repository = "https://github.com/kube-rs/kube-rs" readme = "../README.md" diff --git a/kube-runtime/Cargo.toml b/kube-runtime/Cargo.toml index 484b0585e..ec4885ad8 100644 --- a/kube-runtime/Cargo.toml +++ b/kube-runtime/Cargo.toml @@ -10,7 +10,7 @@ license = "Apache-2.0" repository = "https://github.com/kube-rs/kube-rs" keywords = ["kubernetes", "runtime", "reflector", "watcher", "controller"] categories = ["web-programming::http-client"] -edition = "2018" +edition = "2021" [dependencies] futures = "0.3.17" diff --git a/kube/Cargo.toml b/kube/Cargo.toml index f3d3d2a36..92969158b 100644 --- a/kube/Cargo.toml +++ b/kube/Cargo.toml @@ -12,7 +12,7 @@ repository = "https://github.com/kube-rs/kube-rs" readme = "../README.md" keywords = ["kubernetes", "client", "runtime"] categories = ["web-programming::http-client"] -edition = "2018" +edition = "2021" [features] default = ["client", "native-tls"] diff --git a/release.toml b/release.toml index efb6baa71..ed40d9dfb 100644 --- a/release.toml +++ b/release.toml @@ -2,7 +2,7 @@ # # 0. (optional) cargo release minor ; verify readme + changelog bumped; then git reset --hard # 1. PUBLISH_GRACE_SLEEP=20 cargo release minor --execute -# 1X. - on failure: follow plan manually, cd into next dir to publish and run cargo publish +# 1X. - on failure: follow plan manually, cd into next dirs and publish insequence with cargo publish --features=k8s-openapi/v1_22 # 2. check consolidated commit # 2X. - on failure: git commit --amend and insert version # 3. ./scripts/release-post.sh @@ -18,3 +18,6 @@ pre-release-commit-message = "release {{version}}" # leave tagging + pushing to postrelease script (due to potential failures in 1 and 2) push = false tag = false +# A Kubernetes version is normally supplied by the application consuming the library in the end. +# Since we don't have that when verifying, supply one ourselves. +enable-features = ["k8s-openapi/v1_22"] diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 35bda6e85..be57df0f6 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -3,7 +3,7 @@ name = "tests" version = "0.1.0" authors = ["clux "] publish = false -edition = "2018" +edition = "2021" license = "Apache-2.0" [package.metadata.release]