forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
185 lines (159 loc) · 7.25 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
package v1beta3
import (
"k8s.io/kubernetes/pkg/api/unversioned"
kapi "k8s.io/kubernetes/pkg/api/v1beta3"
"k8s.io/kubernetes/pkg/runtime"
)
// ImageList is a list of Image objects.
type ImageList struct {
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []Image `json:"items"`
}
// Image is an immutable representation of a Docker image and metadata at a point in time.
type Image struct {
unversioned.TypeMeta `json:",inline"`
kapi.ObjectMeta `json:"metadata,omitempty"`
// The string that can be used to pull this image.
DockerImageReference string `json:"dockerImageReference,omitempty"`
// Metadata about this image
DockerImageMetadata runtime.RawExtension `json:"dockerImageMetadata,omitempty"`
// This attribute conveys the version of the object, which if empty defaults to "1.0"
DockerImageMetadataVersion string `json:"dockerImageMetadataVersion,omitempty"`
// The raw JSON of the manifest
DockerImageManifest string `json:"dockerImageManifest,omitempty"`
// DockerImageLayers represents the layers in the image. May not be set if the image does not define that data.
DockerImageLayers []ImageLayer `json:"dockerImageLayers"`
}
// ImageLayer represents a single layer of the image. Some images may have multiple layers. Some may have none.
type ImageLayer struct {
// Name of the layer as defined by the underlying store.
Name string `json:"name"`
// Size of the layer as defined by the underlying store.
Size int64 `json:"size"`
}
// ImageStreamList is a list of ImageStream objects.
type ImageStreamList struct {
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []ImageStream `json:"items"`
}
// ImageStream stores a mapping of tags to images, metadata overrides that are applied
// when images are tagged in a stream, and an optional reference to a Docker image
// repository on a registry.
type ImageStream struct {
unversioned.TypeMeta `json:",inline"`
kapi.ObjectMeta `json:"metadata,omitempty"`
// Spec describes the desired state of this stream
Spec ImageStreamSpec `json:"spec"`
// Status describes the current state of this stream
Status ImageStreamStatus `json:"status,omitempty"`
}
// ImageStreamSpec represents options for ImageStreams.
type ImageStreamSpec struct {
// Optional, if specified this stream is backed by a Docker repository on this server
DockerImageRepository string `json:"dockerImageRepository,omitempty"`
// Tags map arbitrary string values to specific image locators
Tags []TagReference `json:"tags,omitempty"`
}
// TagReference specifies optional annotations for images using this tag and an optional reference to an ImageStreamTag, ImageStreamImage, or DockerImage this tag should track.
type TagReference struct {
Name string `json:"name"`
Annotations map[string]string `json:"annotations"`
From *kapi.ObjectReference `json:"from,omitempty"`
// Reference states if the tag will be imported. Default value is false, which means the tag will be imported.
Reference bool `json:"reference,omitempty"`
// Generation is the image stream generation that updated this tag - setting it to 0 is an indication that the generation must be updated.
// Legacy clients will send this as nil, which means the client doesn't know or care.
Generation *int64 `json:"generation"`
// Import is information that controls how images may be imported by the server.
ImportPolicy TagImportPolicy `json:"importPolicy,omitempty"`
}
type TagImportPolicy struct {
// Insecure is true if the server may bypass certificate verification or connect directly over HTTP during image import.
Insecure bool `json:"insecure,omitempty"`
// Scheduled indicates to the server that this tag should be periodically checked to ensure it is up to date, and imported
Scheduled bool `json:"scheduled,omitempty"`
}
// ImageStreamStatus contains information about the state of this image stream.
type ImageStreamStatus struct {
// Represents the effective location this stream may be accessed at. May be empty until the server
// determines where the repository is located
DockerImageRepository string `json:"dockerImageRepository"`
// A historical record of images associated with each tag. The first entry in the TagEvent array is
// the currently tagged image.
Tags []NamedTagEventList `json:"tags,omitempty"`
}
// NamedTagEventList relates a tag to its image history.
type NamedTagEventList struct {
Tag string `json:"tag"`
Items []TagEvent `json:"items"`
// Conditions is an array of conditions that apply to the tag event list.
Conditions []TagEventCondition `json:"conditions"`
}
// TagEvent is used by ImageStreamStatus to keep a historical record of images associated with a tag.
type TagEvent struct {
// Created holds the time the TagEvent was created
Created unversioned.Time `json:"created"`
// DockerImageReference is the string that can be used to pull this image
DockerImageReference string `json:"dockerImageReference"`
// Image is the image
Image string `json:"image"`
// Generation is the spec tag generation that resulted in this tag being updated
Generation int64 `json:"generation"`
}
type TagEventConditionType string
// These are valid conditions of TagEvents.
const (
// ImportSuccess with status False means the import of the specific tag failed
ImportSuccess TagEventConditionType = "ImportSuccess"
)
// TagEventCondition contains condition information for a tag event.
type TagEventCondition struct {
// Type of tag event condition, currently only ImportSuccess
Type TagEventConditionType `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status kapi.ConditionStatus `json:"status"`
// Last time the condition transit from one status to another.
LastTransitionTime unversioned.Time `json:"lastTransitionTime,omitempty"`
// (brief) reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
// Human readable message indicating details about last transition.
Message string `json:"message,omitempty"`
// Generation is the spec tag generation that this status corresponds to
Generation int64 `json:"generation"`
}
// ImageStreamMapping represents a mapping from a single tag to a Docker image as
// well as the reference to the Docker image repository the image came from.
type ImageStreamMapping struct {
unversioned.TypeMeta `json:",inline"`
kapi.ObjectMeta `json:"metadata,omitempty"`
// A Docker image.
Image Image `json:"image"`
// A string value this image can be located with inside the repository.
Tag string `json:"tag"`
}
// ImageStreamTag represents an Image that is retrieved by tag name from an ImageStream.
type ImageStreamTag struct {
Image `json:",inline"`
ImageName string `json:"imageName"`
}
// ImageStreamTagList is a list of ImageStreamTag objects.
type ImageStreamTagList struct {
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []ImageStreamTag `json:"items"`
}
// ImageStreamImage represents an Image that is retrieved by image name from an ImageStream.
type ImageStreamImage struct {
Image `json:",inline"`
ImageName string `json:"imageName"`
}
// DockerImageReference points to a Docker image.
type DockerImageReference struct {
Registry string
Namespace string
Name string
Tag string
ID string
}