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

cherry-pick and merge oauth2 progress from ynqa #20

Merged
merged 13 commits into from
Jul 22, 2019
Merged

cherry-pick and merge oauth2 progress from ynqa #20

merged 13 commits into from
Jul 22, 2019

Conversation

clux
Copy link
Member

@clux clux commented May 24, 2019

Compiles, but crashes on the clusters I have with third party providers, so will have to visit it later. Help would be appreciated here.

See #19 for discussion.

@stephenmuss
Copy link

Just wanted to comment that the other changes in this PR work quite nicely on my AWS EKS clusters.

I was able to run the pod_reflector example and get a list of all my pods with a kubeconfig similar to the one below.

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCi0tLS0tQkVHSU4gQ0VSVElGSUNBVEUgUkVRVUVTVC0tLS0tCk1JSUNxRENDQVpBQ0FRQXdZekVMTUFrR0ExVUVCaE1DVUV3eEVEQU9CZ05WQkFNTUIyWnZieTVpWVhJeER6QU4KQmdOVkJBY01CbXhyYW5Oa1pqRVBNQTBHQTFVRUNnd0dhMnhyYW1aek1ROHdEUVlEVlFRSURBWnNhMnB6WkdZeApEekFOQmdOVkJBc01CbXhyYW5Oa1pqQ0NBU0l3RFFZSktvWklodmNOQVFFQkJRQURnZ0VQQURDQ0FRb0NnZ0VCCkFMOHdOMEM2NncwUnAwQkxVN2lRYWVUZHZMSDVwWGF3OEJDZjdyYzVKK2VqS3Q5R21FS1Q5a0RjeVEvY0xTL3QKLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQ==
    server: https://A736D1E5D65102DE509F10BF9582447C.yl4.us-east-1.eks.amazonaws.com
  name: arn:aws:eks:us-east-1:0123456789012:cluster/my-cluster
contexts:
- context:
    cluster: arn:aws:eks:us-east-1:0123456789012:cluster/my-cluster
    user: arn:aws:eks:us-east-1:0123456789012:cluster/my-cluster
  name: my-ctx
current-context: my-ctx
kind: Config
preferences: {}
users:
- name: arn:aws:eks:us-east-1:0123456789012:cluster/my-cluster
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      command: aws
      args:
      - --region
      - us-east-1
      - eks
      - get-token
      - --cluster-name
      - my-cluster
      - --role
      - arn:aws:iam::0123456789012:role/my-role

@clux
Copy link
Member Author

clux commented Jul 17, 2019

That's really helpful. Thanks a lot. I'll probably just speculatively merge this branch then for the next release. Unfortunately, I don't have an EKS cluster at hand to really verify with yet, but I can probably leave that part of the code-base alone for a while.

@clux
Copy link
Member Author

clux commented Jul 22, 2019

I've managed to make this branch compile with up to date master by doing a bunch of manual Error conversions. Will try to improve it later.

In the mean time, any chance you could see if this branch still works for you on EKS @stephenmuss ?

[dependencies]
kube = { git = "https://github.com/clux/kube-rs", rev = "8b7a0b832b04965027a639010c420bd2cc3a5bfa" }

@stephenmuss
Copy link

stephenmuss commented Jul 22, 2019

The branch doesn't work for me after the merge.

I get the following errors with the node_reflector and pod_reflector.

$ cargo run --example node_reflector
   Compiling kube v0.12.0 (/Users/steve/code/rs/kube-rs)
error[E0599]: no function or associated item named `v1Node` found for type `kube::api::typed::Api<_>` in the current scope
  --> examples/node_reflector.rs:14:25
   |
14 |     let resource = Api::v1Node(client);
   |                         ^^^^^^ function or associated item not found in `kube::api::typed::Api<_>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.
error: Could not compile `kube`.

To learn more, run the command again with --verbose.
$ cargo run --example pod_reflector
   Compiling kube v0.12.0 (/Users/steve/code/rs/kube-rs)
error[E0599]: no function or associated item named `v1Pod` found for type `kube::api::typed::Api<_>` in the current scope
  --> examples/pod_reflector.rs:14:25
   |
14 |     let resource = Api::v1Pod(client).within(&namespace);
   |                         ^^^^^ function or associated item not found in `kube::api::typed::Api<_>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.
error: Could not compile `kube`.

To learn more, run the command again with --verbose.

With an empty cargo project I also get an error with just this in Cargo.toml

[dependencies]
kube = { git = "https://github.com/clux/kube-rs", rev = "8b7a0b832b04965027a639010c420bd2cc3a5bfa" }
Compiling kube v0.12.0 (https://github.com/clux/kube-rs?rev=8b7a0b832b04965027a639010c420bd2cc3a5bfa#8b7a0b83)
error[E0277]: the trait bound `chrono::datetime::DateTime<chrono::offset::utc::Utc>: _IMPL_SERIALIZE_FOR_ApiError::_serde::Serialize` is not satisfied
  --> /Users/steve/.cargo/git/checkouts/kube-rs-7892a19212f788e8/8b7a0b8/src/config/exec.rs:26:5
   |
26 |     #[serde(rename = "expirationTimestamp")]
   |     ^ the trait `_IMPL_SERIALIZE_FOR_ApiError::_serde::Serialize` is not implemented for `chrono::datetime::DateTime<chrono::offset::utc::Utc>`
   |
   = note: required because of the requirements on the impl of `_IMPL_SERIALIZE_FOR_ApiError::_serde::Serialize` for `std::option::Option<chrono::datetime::DateTime<chrono::offset::utc::Utc>>`
   = note: required by `_IMPL_SERIALIZE_FOR_ApiError::_serde::ser::SerializeStruct::serialize_field`

error[E0277]: the trait bound `chrono::datetime::DateTime<chrono::offset::utc::Utc>: _IMPL_SERIALIZE_FOR_ApiError::_serde::Deserialize<'_>` is not satisfied
  --> /Users/steve/.cargo/git/checkouts/kube-rs-7892a19212f788e8/8b7a0b8/src/config/exec.rs:26:5
   |
26 |     #[serde(rename = "expirationTimestamp")]
   |     ^ the trait `_IMPL_SERIALIZE_FOR_ApiError::_serde::Deserialize<'_>` is not implemented for `chrono::datetime::DateTime<chrono::offset::utc::Utc>`
   |
   = note: required because of the requirements on the impl of `_IMPL_SERIALIZE_FOR_ApiError::_serde::Deserialize<'_>` for `std::option::Option<chrono::datetime::DateTime<chrono::offset::utc::Utc>>`
   = note: required by `_IMPL_SERIALIZE_FOR_ApiError::_serde::de::SeqAccess::next_element`

error[E0277]: the trait bound `chrono::datetime::DateTime<chrono::offset::utc::Utc>: _IMPL_SERIALIZE_FOR_ApiError::_serde::Deserialize<'_>` is not satisfied
  --> /Users/steve/.cargo/git/checkouts/kube-rs-7892a19212f788e8/8b7a0b8/src/config/exec.rs:26:5
   |
26 |     #[serde(rename = "expirationTimestamp")]
   |     ^ the trait `_IMPL_SERIALIZE_FOR_ApiError::_serde::Deserialize<'_>` is not implemented for `chrono::datetime::DateTime<chrono::offset::utc::Utc>`
   |
   = note: required because of the requirements on the impl of `_IMPL_SERIALIZE_FOR_ApiError::_serde::Deserialize<'_>` for `std::option::Option<chrono::datetime::DateTime<chrono::offset::utc::Utc>>`
   = note: required by `_IMPL_SERIALIZE_FOR_ApiError::_serde::de::MapAccess::next_value`

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0277`.
error: Could not compile `kube`.

To learn more, run the command again with --verbose.

@clux
Copy link
Member Author

clux commented Jul 22, 2019

I think that's just the missing feature. How about:

[dependencies]
kube = { git = "https://github.com/clux/kube-rs", rev = "8b7a0b832b04965027a639010c420bd2cc3a5bfa", features = ["openapi"] }
k8s-openapi = { version = "0.4.0", features = ["v1_13"] }

We changed this interface for #44 so we can explicitly choose what k8s-openapi dependency variant we want.

If you are running the examples in here directly try running with the examples with --all-features, e.g.
cargo run --example pod_reflector --all-features

@stephenmuss
Copy link

👍 Yep, that did the trick.

Examples work and new cargo project looks good too.

@clux
Copy link
Member Author

clux commented Jul 22, 2019

Awesome. Thanks a lot. I'll clean up a few unrelated things and try to merge this ASAP.

@clux clux merged commit e58e887 into master Jul 22, 2019
@clux clux deleted the oauth2 branch July 22, 2019 22:35
@clux
Copy link
Member Author

clux commented Jul 22, 2019

Released in kube 0.13.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants