forked from jetstack/tarmak
/
types.go
57 lines (45 loc) · 2.21 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
// Copyright Jetstack Ltd. See LICENSE for details.
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type Instance struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
InstanceID string `json:"instanceID,omitempty"`
InstancePool string `json:"instancePool,omitempty"`
Spec *InstanceSpec `json:"spec,omitempty"`
Status *InstanceStatus `json:"status,omitempty"`
}
// InstanceSpec defines the desired state of Instance
type InstanceSpec struct {
Converge *InstanceSpecManifest `json:"converge,omitempty"`
DryRun *InstanceSpecManifest `json:"dryRun,omitempty"`
}
// InstaceSpecManifest defines location and hash for a specific manifest
type InstanceSpecManifest struct {
Path string `json:"path,omitempty"` // PATH to manifests (tar.gz)
Hash string `json:"hash,omitempty"` // hash of manifests, prefixed with type (eg: sha256:xyz)
RequestTimestamp metav1.Time `json:"requestTimestamp,omitempty"` // timestamp when a converge was requested
}
// InstanceStatus defines the observed state of Instance
type InstanceStatus struct {
Converge *InstanceStatusManifest `json:"converge,omitempty"`
DryRun *InstanceStatusManifest `json:"dryRun,omitempty"`
}
// InstaceSpecManifest defines the state and hash of a run manifest
type InstanceStatusManifest struct {
State InstanceManifestState `json:"state,omitempty"`
Hash string `json:"hash,omitempty"` // hash of manifests, prefixed with type (eg: sha256:xyz)
LastUpdateTimestamp metav1.Time `json:"lastUpdateTimestamp,omitempty"` // timestamp when a converge was requested
Messages []string `json:"messages,omitempty"` // contains output of the retries
ExitCodes []int `json:"exitCodes,omitempty"` // return code of the retries
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type InstanceList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Instance `json:"items"`
}