Skip to content

Commit

Permalink
Backout 2021 (kube-rs#666)
Browse files Browse the repository at this point in the history
* Revert "2021 edition"

This reverts commit 979b7c9.

* backout resolver document

Signed-off-by: clux <sszynrae@gmail.com>
  • Loading branch information
clux authored Oct 22, 2021
1 parent a97d9fc commit 11559f7
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 14 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ UNRELEASED
* `kube::runtime::wait::conditions` added `is_crd_established` helper - #659
* `kube::CustomResource` derive can now take an arbitrary `#[kube_core]` path for `kube::core` - #658
* `kube::core` consistently re-exported across crates
* rust `edition` bumped to `2021` - #664
* docs: major overhaul + [architecture.md](./architecture.md) - #416 via #652

0.61.0 / 2021-10-09
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ clippy:

fmt:
#rustup component add rustfmt --toolchain nightly
rustfmt +nightly --edition 2021 $$(find . -type f -iname *.rs)
rustfmt +nightly --edition 2018 $$(find . -type f -iname *.rs)

doc:
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --lib --workspace --features=derive,ws,oauth,jsonpatch,client,derive,runtime,admission --open
Expand All @@ -22,7 +22,7 @@ test:
cd kube && cargo test --lib --features=derive

readme:
rustdoc README.md --test --edition=2021
rustdoc README.md --test --edition=2018

kind-create:
kind create cluster
Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors = [
"kazk <kazk.dev@gmail.com>",
]
publish = false
edition = "2021"
edition = "2018"
license = "Apache-2.0"

[package.metadata.release]
Expand Down
5 changes: 4 additions & 1 deletion examples/admission_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ use kube::core::{
admission::{AdmissionRequest, AdmissionResponse, AdmissionReview},
DynamicObject, ResourceExt,
};
use std::{convert::Infallible, error::Error};
use std::{
convert::{Infallible, TryInto},
error::Error,
};
#[macro_use] extern crate log;
use warp::{reply, Filter, Reply};

Expand Down
2 changes: 1 addition & 1 deletion kube-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repository = "https://github.com/kube-rs/kube-rs"
readme = "../README.md"
keywords = ["kubernetes", "client",]
categories = ["web-programming::http-client"]
edition = "2021"
edition = "2018"

[features]
default = ["client", "native-tls"]
Expand Down
2 changes: 1 addition & 1 deletion kube-client/src/client/auth/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{process::Command, sync::Arc};
use std::{convert::TryFrom, process::Command, sync::Arc};

use chrono::{DateTime, Duration, Utc};
use http::HeaderValue;
Expand Down
2 changes: 2 additions & 0 deletions kube-client/src/client/config_ext.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::convert::TryFrom;

use tower::util::Either;

#[cfg(any(feature = "native-tls", feature = "rustls-tls"))] use super::tls;
Expand Down
2 changes: 1 addition & 1 deletion kube-client/src/client/middleware/refresh_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ where
mod tests {
use super::*;

use std::{matches, sync::Arc};
use std::{convert::TryFrom, matches, sync::Arc};

use chrono::{Duration, Utc};
use futures::pin_mut;
Expand Down
3 changes: 3 additions & 0 deletions kube-client/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
//!
//! 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};
Expand Down
2 changes: 1 addition & 1 deletion kube-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = [
"clux <sszynrae@gmail.com>",
"kazk <kazk.dev@gmail.com>",
]
edition = "2021"
edition = "2018"
license = "Apache-2.0"
repository = "https://github.com/kube-rs/kube-rs"
readme = "../README.md"
Expand Down
6 changes: 5 additions & 1 deletion kube-core/src/admission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
Error, Result,
};

use std::collections::HashMap;
use std::{collections::HashMap, convert::TryInto};

use k8s_openapi::{
api::authentication::v1::UserInfo,
Expand Down Expand Up @@ -64,6 +64,7 @@ impl<T: Resource> TryInto<AdmissionRequest<T>> for AdmissionReview<T> {
/// 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<DynamicObject>;
Expand Down Expand Up @@ -186,6 +187,7 @@ pub enum Operation {
/// admission::{AdmissionRequest, AdmissionResponse, AdmissionReview},
/// DynamicObject,
/// };
/// use std::convert::TryInto;
///
/// // The incoming AdmissionReview received by the controller.
/// let body: AdmissionReview<DynamicObject>;
Expand Down Expand Up @@ -333,6 +335,8 @@ 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,
Expand Down
2 changes: 1 addition & 1 deletion kube-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = [
"clux <sszynrae@gmail.com>",
"kazk <kazk.dev@gmail.com>",
]
edition = "2021"
edition = "2018"
license = "Apache-2.0"
repository = "https://github.com/kube-rs/kube-rs"
readme = "../README.md"
Expand Down
2 changes: 1 addition & 1 deletion kube-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "2021"
edition = "2018"

[dependencies]
futures = "0.3.17"
Expand Down
2 changes: 1 addition & 1 deletion kube/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "2021"
edition = "2018"

[features]
default = ["client", "native-tls"]
Expand Down
2 changes: 1 addition & 1 deletion tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "tests"
version = "0.1.0"
authors = ["clux <sszynrae@gmail.com>"]
publish = false
edition = "2021"
edition = "2018"
license = "Apache-2.0"

[package.metadata.release]
Expand Down

0 comments on commit 11559f7

Please sign in to comment.