Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
76f99aab
Commit
76f99aab
authored
May 18, 2015
by
Tim Hockin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7481 from erictune/apiprincip
Add API change suggestions.
parents
fadc7642
6d054b14
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
api_changes.md
docs/devel/api_changes.md
+9
-3
No files found.
docs/devel/api_changes.md
View file @
76f99aab
...
@@ -12,7 +12,7 @@ not all API changes will need all of these steps.
...
@@ -12,7 +12,7 @@ not all API changes will need all of these steps.
## Operational overview
## Operational overview
It
'
s important to have a high level understanding of the API system used in
It
i
s important to have a high level understanding of the API system used in
Kubernetes in order to navigate the rest of this document.
Kubernetes in order to navigate the rest of this document.
As mentioned above, the internal representation of an API object is decoupled
As mentioned above, the internal representation of an API object is decoupled
...
@@ -24,13 +24,13 @@ a GET involves a great deal of machinery.
...
@@ -24,13 +24,13 @@ a GET involves a great deal of machinery.
The conversion process is logically a "star" with the internal form at the
The conversion process is logically a "star" with the internal form at the
center. Every versioned API can be converted to the internal form (and
center. Every versioned API can be converted to the internal form (and
vice-versa), but versioned APIs do not convert to other versioned APIs directly.
vice-versa), but versioned APIs do not convert to other versioned APIs directly.
This sounds like a heavy process, but in reality we do
n'
t intend to keep more
This sounds like a heavy process, but in reality we do
no
t intend to keep more
than a small number of versions alive at once. While all of the Kubernetes code
than a small number of versions alive at once. While all of the Kubernetes code
operates on the internal structures, they are always converted to a versioned
operates on the internal structures, they are always converted to a versioned
form before being written to storage (disk or etcd) or being sent over a wire.
form before being written to storage (disk or etcd) or being sent over a wire.
Clients should consume and operate on the versioned APIs exclusively.
Clients should consume and operate on the versioned APIs exclusively.
To demonstrate the general process,
let's walk through
a (hypothetical) example:
To demonstrate the general process,
here is
a (hypothetical) example:
1.
A user POSTs a
`Pod`
object to
`/api/v7beta1/...`
1.
A user POSTs a
`Pod`
object to
`/api/v7beta1/...`
2.
The JSON is unmarshalled into a
`v7beta1.Pod`
structure
2.
The JSON is unmarshalled into a
`v7beta1.Pod`
structure
...
@@ -176,6 +176,12 @@ If your change includes new fields for which you will need default values, you
...
@@ -176,6 +176,12 @@ If your change includes new fields for which you will need default values, you
need to add cases to
`pkg/api/<version>/defaults.go`
. Of course, since you
need to add cases to
`pkg/api/<version>/defaults.go`
. Of course, since you
have added code, you have to add a test:
`pkg/api/<version>/defaults_test.go`
.
have added code, you have to add a test:
`pkg/api/<version>/defaults_test.go`
.
Do use pointers to scalars when you need to distinguish between an unset value
and an an automatic zero value. For example,
`PodSpec.TerminationGracePeriodSeconds`
is defined as
`*int64`
the go type
definition. A zero value means 0 seconds, and a nil value asks the system to
pick a default.
Don't forget to run the tests!
Don't forget to run the tests!
### Edit conversion.go
### Edit conversion.go
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment