1 /* 2 Copyright 2018 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package pkg 18 19 import ( 20 corev1 "k8s.io/api/core/v1" 21 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 22 ) 23 24 // ChaosPodSpec defines the desired state of ChaosPod 25 type ChaosPodSpec struct { 26 Template corev1.PodTemplateSpec `json:"template"` 27 // +optional 28 NextStop metav1.Time `json:"nextStop,omitempty"` 29 } 30 31 // ChaosPodStatus defines the observed state of ChaosPod. 32 // It should always be reconstructable from the state of the cluster and/or outside world. 33 type ChaosPodStatus struct { 34 LastRun metav1.Time `json:"lastRun,omitempty"` 35 } 36 37 // +kubebuilder:object:root=true 38 39 // ChaosPod is the Schema for the randomjobs API 40 // +kubebuilder:printcolumn:name="next stop",type="string",JSONPath=".spec.nextStop",format="date" 41 // +kubebuilder:printcolumn:name="last run",type="string",JSONPath=".status.lastRun",format="date" 42 type ChaosPod struct { 43 metav1.TypeMeta `json:",inline"` 44 metav1.ObjectMeta `json:"metadata,omitempty"` 45 46 Spec ChaosPodSpec `json:"spec,omitempty"` 47 Status ChaosPodStatus `json:"status,omitempty"` 48 } 49 50 // +kubebuilder:object:root=true 51 52 // ChaosPodList contains a list of ChaosPod 53 type ChaosPodList struct { 54 metav1.TypeMeta `json:",inline"` 55 metav1.ListMeta `json:"metadata,omitempty"` 56 Items []ChaosPod `json:"items"` 57 } 58 59 func init() { 60 SchemeBuilder.Register(&ChaosPod{}, &ChaosPodList{}) 61 } 62