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

Use codec to encode/decode api objects in client and kubecfg parser #1115

Merged

Conversation

csrwng
Copy link
Contributor

@csrwng csrwng commented Aug 29, 2014

The purpose of this change is to allow core parser and client to work with other resource codecs that know how to encode/decode custom types.

@lavalamp
Copy link
Member

LGTM - restarting travis, it's a flake

@csrwng csrwng force-pushed the use_codec_in_printing_and_parsing branch from b1a4e28 to 0c52f1f Compare August 29, 2014 18:08
@lavalamp
Copy link
Member

One note - although this is a good thing to do, I expect that when we get custom api types in other packages, those packages will register themselves with the standard api package, such that everything should Just Work (tm). I'm going to try to do that to the v1beta1 package today.

@csrwng csrwng force-pushed the use_codec_in_printing_and_parsing branch from 0c52f1f to bf49013 Compare August 29, 2014 18:45
@csrwng
Copy link
Contributor Author

csrwng commented Aug 29, 2014

@lavalamp - One reason you may not want to reuse the standard api package is if you have your own conversionScheme to handle a different internal/external version for your api.

@lavalamp
Copy link
Member

@csrwng right, in that case I think you should still register your internal/external types with pkg/api-- then you can work with both.

@brendandburns
Copy link
Contributor

if I can haz a rebasez, you can haz a mergez

;)

--brendan

@csrwng csrwng force-pushed the use_codec_in_printing_and_parsing branch from bf49013 to e51a0b0 Compare September 3, 2014 13:30
@csrwng
Copy link
Contributor Author

csrwng commented Sep 3, 2014

:) done

@@ -88,13 +88,19 @@ type Client struct {
*RESTClient
}

type codec interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Godoc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smarterclayton - no objection. However, I thought we only added godoc to public interfaces.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case it's an interface that clients need to use in order to create a NewRestClient which is public. Actually our stance has been that this should then be a public interface anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@csrwng csrwng force-pushed the use_codec_in_printing_and_parsing branch from e51a0b0 to c3497ea Compare September 4, 2014 12:55
@csrwng csrwng force-pushed the use_codec_in_printing_and_parsing branch from c3497ea to 3f1a78d Compare September 8, 2014 15:37
@brendandburns
Copy link
Contributor

ugh, @csrwng need another rebase.. I promise I'll get it in super fast this time...

Thanks!
--brendan

@csrwng csrwng force-pushed the use_codec_in_printing_and_parsing branch from 3f1a78d to 333ceae Compare September 8, 2014 23:35
@csrwng
Copy link
Contributor Author

csrwng commented Sep 8, 2014

@brendanburns - Thank you, it's updated now.

@@ -93,13 +93,21 @@ type Client struct {
*RESTClient
}

// codec defines methods for serializing and deserializing API
// objects.
type codec interface {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to be a pain, but can I talk you into just using the runtime.Codec interface? Since this already links with runtime...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Done.

@csrwng csrwng force-pushed the use_codec_in_printing_and_parsing branch from 333ceae to 6551f4e Compare September 9, 2014 12:46
@lavalamp
Copy link
Member

lavalamp commented Sep 9, 2014

Great, thanks!

lavalamp added a commit that referenced this pull request Sep 9, 2014
Use codec to encode/decode api objects in client and kubecfg parser
@lavalamp lavalamp merged commit c61bc58 into kubernetes:master Sep 9, 2014
@csrwng csrwng deleted the use_codec_in_printing_and_parsing branch March 18, 2015 14:51
rphillips pushed a commit to rphillips/kubernetes that referenced this pull request Mar 3, 2022
Bug 2026380: Image policy should mutate DeploymentConfigs, StatefulSets, and new CronJobs
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.

5 participants