Skip to content

Commit 7687cec

Browse files
Split fundamental docker types
1 parent 9fb299d commit 7687cec

File tree

8 files changed

+350
-505
lines changed

8 files changed

+350
-505
lines changed

Diff for: hack/import-restrictions.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,15 @@
150150

151151
{
152152
"checkedPackages": [
153-
"github.com/openshift/origin/pkg/image/apis/image",
154153
"github.com/openshift/origin/pkg/image/apis/image/docker10",
154+
],
155+
"allowedImportPackageRoots": [],
156+
"allowedImportPackages": []
157+
},
158+
159+
{
160+
"checkedPackages": [
161+
"github.com/openshift/origin/pkg/image/apis/image",
155162
"github.com/openshift/origin/pkg/image/apis/image/dockerpre012",
156163
"github.com/openshift/origin/pkg/image/apis/image/v1"
157164
],

Diff for: pkg/image/apis/image/docker10/doc.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
// Package docker10 is the docker10 version of the API.
1+
// Package docker10 provides types used by docker/distribution and moby/moby.
2+
// This package takes no dependency on external types.
23
package docker10

Diff for: pkg/image/apis/image/docker10/register.go

-23
This file was deleted.

Diff for: pkg/image/apis/image/docker10/types.go

+156
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
package docker10
2+
3+
import (
4+
"time"
5+
)
6+
7+
// DockerImage is the type representing a docker image and its various properties when
8+
// retrieved from the Docker client API.
9+
type DockerImage struct {
10+
ID string `json:"Id"`
11+
Parent string `json:"Parent,omitempty"`
12+
Comment string `json:"Comment,omitempty"`
13+
Created time.Time `json:"Created,omitempty"`
14+
Container string `json:"Container,omitempty"`
15+
ContainerConfig DockerConfig `json:"ContainerConfig,omitempty"`
16+
DockerVersion string `json:"DockerVersion,omitempty"`
17+
Author string `json:"Author,omitempty"`
18+
Config *DockerConfig `json:"Config,omitempty"`
19+
Architecture string `json:"Architecture,omitempty"`
20+
Size int64 `json:"Size,omitempty"`
21+
}
22+
23+
// DockerConfig is the list of configuration options used when creating a container.
24+
type DockerConfig struct {
25+
Hostname string `json:"Hostname,omitempty"`
26+
Domainname string `json:"Domainname,omitempty"`
27+
User string `json:"User,omitempty"`
28+
Memory int64 `json:"Memory,omitempty"`
29+
MemorySwap int64 `json:"MemorySwap,omitempty"`
30+
CPUShares int64 `json:"CpuShares,omitempty"`
31+
CPUSet string `json:"Cpuset,omitempty"`
32+
AttachStdin bool `json:"AttachStdin,omitempty"`
33+
AttachStdout bool `json:"AttachStdout,omitempty"`
34+
AttachStderr bool `json:"AttachStderr,omitempty"`
35+
PortSpecs []string `json:"PortSpecs,omitempty"`
36+
ExposedPorts map[string]struct{} `json:"ExposedPorts,omitempty"`
37+
Tty bool `json:"Tty,omitempty"`
38+
OpenStdin bool `json:"OpenStdin,omitempty"`
39+
StdinOnce bool `json:"StdinOnce,omitempty"`
40+
Env []string `json:"Env,omitempty"`
41+
Cmd []string `json:"Cmd,omitempty"`
42+
DNS []string `json:"Dns,omitempty"` // For Docker API v1.9 and below only
43+
Image string `json:"Image,omitempty"`
44+
Volumes map[string]struct{} `json:"Volumes,omitempty"`
45+
VolumesFrom string `json:"VolumesFrom,omitempty"`
46+
WorkingDir string `json:"WorkingDir,omitempty"`
47+
Entrypoint []string `json:"Entrypoint,omitempty"`
48+
NetworkDisabled bool `json:"NetworkDisabled,omitempty"`
49+
SecurityOpts []string `json:"SecurityOpts,omitempty"`
50+
OnBuild []string `json:"OnBuild,omitempty"`
51+
Labels map[string]string `json:"Labels,omitempty"`
52+
}
53+
54+
// Descriptor describes targeted content. Used in conjunction with a blob
55+
// store, a descriptor can be used to fetch, store and target any kind of
56+
// blob. The struct also describes the wire protocol format. Fields should
57+
// only be added but never changed.
58+
type Descriptor struct {
59+
// MediaType describe the type of the content. All text based formats are
60+
// encoded as utf-8.
61+
MediaType string `json:"mediaType,omitempty"`
62+
63+
// Size in bytes of content.
64+
Size int64 `json:"size,omitempty"`
65+
66+
// Digest uniquely identifies the content. A byte stream can be verified
67+
// against against this digest.
68+
Digest string `json:"digest,omitempty"`
69+
}
70+
71+
// DockerImageManifest represents the Docker v2 image format.
72+
type DockerImageManifest struct {
73+
SchemaVersion int `json:"schemaVersion"`
74+
MediaType string `json:"mediaType,omitempty"`
75+
76+
// schema1
77+
Name string `json:"name"`
78+
Tag string `json:"tag"`
79+
Architecture string `json:"architecture"`
80+
FSLayers []DockerFSLayer `json:"fsLayers"`
81+
History []DockerHistory `json:"history"`
82+
83+
// schema2
84+
Layers []Descriptor `json:"layers"`
85+
Config Descriptor `json:"config"`
86+
}
87+
88+
// DockerFSLayer is a container struct for BlobSums defined in an image manifest
89+
type DockerFSLayer struct {
90+
// DockerBlobSum is the tarsum of the referenced filesystem image layer
91+
// TODO make this digest.Digest once docker/distribution is in Godeps
92+
DockerBlobSum string `json:"blobSum"`
93+
}
94+
95+
// DockerHistory stores unstructured v1 compatibility information
96+
type DockerHistory struct {
97+
// DockerV1Compatibility is the raw v1 compatibility information
98+
DockerV1Compatibility string `json:"v1Compatibility"`
99+
}
100+
101+
// DockerV1CompatibilityImage represents the structured v1
102+
// compatibility information.
103+
type DockerV1CompatibilityImage struct {
104+
ID string `json:"id"`
105+
Parent string `json:"parent,omitempty"`
106+
Comment string `json:"comment,omitempty"`
107+
Created time.Time `json:"created"`
108+
Container string `json:"container,omitempty"`
109+
ContainerConfig DockerConfig `json:"container_config,omitempty"`
110+
DockerVersion string `json:"docker_version,omitempty"`
111+
Author string `json:"author,omitempty"`
112+
Config *DockerConfig `json:"config,omitempty"`
113+
Architecture string `json:"architecture,omitempty"`
114+
Size int64 `json:"size,omitempty"`
115+
}
116+
117+
// DockerV1CompatibilityImageSize represents the structured v1
118+
// compatibility information for size
119+
type DockerV1CompatibilityImageSize struct {
120+
Size int64 `json:"size,omitempty"`
121+
}
122+
123+
// DockerImageConfig stores the image configuration
124+
type DockerImageConfig struct {
125+
ID string `json:"id"`
126+
Parent string `json:"parent,omitempty"`
127+
Comment string `json:"comment,omitempty"`
128+
Created time.Time `json:"created"`
129+
Container string `json:"container,omitempty"`
130+
ContainerConfig DockerConfig `json:"container_config,omitempty"`
131+
DockerVersion string `json:"docker_version,omitempty"`
132+
Author string `json:"author,omitempty"`
133+
Config *DockerConfig `json:"config,omitempty"`
134+
Architecture string `json:"architecture,omitempty"`
135+
Size int64 `json:"size,omitempty"`
136+
RootFS *DockerConfigRootFS `json:"rootfs,omitempty"`
137+
History []DockerConfigHistory `json:"history,omitempty"`
138+
OS string `json:"os,omitempty"`
139+
OSVersion string `json:"os.version,omitempty"`
140+
OSFeatures []string `json:"os.features,omitempty"`
141+
}
142+
143+
// DockerConfigHistory stores build commands that were used to create an image
144+
type DockerConfigHistory struct {
145+
Created time.Time `json:"created"`
146+
Author string `json:"author,omitempty"`
147+
CreatedBy string `json:"created_by,omitempty"`
148+
Comment string `json:"comment,omitempty"`
149+
EmptyLayer bool `json:"empty_layer,omitempty"`
150+
}
151+
152+
// DockerConfigRootFS describes images root filesystem
153+
type DockerConfigRootFS struct {
154+
Type string `json:"type"`
155+
DiffIDs []string `json:"diff_ids,omitempty"`
156+
}

0 commit comments

Comments
 (0)