k8s/io/kubernetes/pkg/api/unversioned.Time 示例代码

2022-03-03

以下示例是关于golang中包含unversioned.Time用法的示例代码,想了解unversioned.Time的具体用法?unversioned.Time怎么用?unversioned.Time使用的例子?那么可以参考以下10个相关示例代码来学习它的具体使用方法。

示例1:
nodecontroller_test.go开发语言: Go项目名称: amygdala代码行数: 1188
421			testNodeStartupGracePeriod, testNodeMonitorPeriod, nil, false)
422		nodeController.now = func() unversioned.Time { return fakeNow }
423		for _, ds := range item.daemonSets {
429		if item.timeToPass > 0 {
430			nodeController.now = func() unversioned.Time { return unversioned.Time{Time: fakeNow.Add(item.timeToPass)} }
431			item.fakeNodeHandler.Existing[0].Status = item.newNodeStatus
669								LastHeartbeatTime:  unversioned.Date(2015, 1, 1, 12, 0, 0, 0, time.UTC),
670								LastTransitionTime: unversioned.Time{Time: unversioned.Date(2015, 1, 1, 12, 0, 0, 0, time.UTC).Add(time.Hour)},
671							},
728		if item.timeToPass > 0 {
729			nodeController.now = func() unversioned.Time { return unversioned.Time{Time: fakeNow.Add(item.timeToPass)} }
730			item.fakeNodeHandler.Existing[0].Status = item.newNodeStatus
878		if item.timeToPass > 0 {
879			nodeController.now = func() unversioned.Time { return unversioned.Time{Time: fakeNow.Add(item.timeToPass)} }
880			item.fakeNodeHandler.Existing[0].Status = item.newNodeStatus
示例2:
resource_printer_test.go开发语言: Go项目名称: amygdala代码行数: 1449
383								Running: &api.ContainerStateRunning{
384									StartedAt: unversioned.Time{},
385								},
400								Running: &api.ContainerStateRunning{
401									StartedAt: unversioned.Time{},
402								},
408								Running: &api.ContainerStateRunning{
409									StartedAt: unversioned.Time{},
410								},
648			Name:              "test1",
649			CreationTimestamp: unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)},
650			Labels: map[string]string{
1250	tl := stringTestList{
1251		{"a while from now", translateTimestamp(unversioned.Time{Time: time.Now().Add(2.1e9)}), "<invalid>"},
1252		{"almost now", translateTimestamp(unversioned.Time{Time: time.Now().Add(1.9e9)}), "0s"},
示例3:
types.go开发语言: Go项目名称: amygdala代码行数: 940
135	// used by the autoscaler to control how often the number of pods is changed.
136	LastScaleTime *unversioned.Time `json:"lastScaleTime,omitempty"`
137
577	// It is represented in RFC3339 form and is in UTC.
578	StartTime *unversioned.Time `json:"startTime,omitempty"`
579
582	// It is represented in RFC3339 form and is in UTC.
583	CompletionTime *unversioned.Time `json:"completionTime,omitempty"`
584
611	// Last time the condition was checked.
612	LastProbeTime unversioned.Time `json:"lastProbeTime,omitempty"`
613	// Last time the condition transit from one status to another.
614	LastTransitionTime unversioned.Time `json:"lastTransitionTime,omitempty"`
615	// (brief) reason for the condition's last transition.
示例4:
types.go开发语言: Go项目名称: amygdala代码行数: 1037
130	// used by the autoscaler to control how often the number of pods is changed.
131	LastScaleTime *unversioned.Time `json:"lastScaleTime,omitempty"`
132
588	// It is represented in RFC3339 form and is in UTC.
589	StartTime *unversioned.Time `json:"startTime,omitempty"`
590
593	// It is represented in RFC3339 form and is in UTC.
594	CompletionTime *unversioned.Time `json:"completionTime,omitempty"`
595
622	// Last time the condition was checked.
623	LastProbeTime unversioned.Time `json:"lastProbeTime,omitempty"`
624	// Last time the condition transit from one status to another.
625	LastTransitionTime unversioned.Time `json:"lastTransitionTime,omitempty"`
626	// (brief) reason for the condition's last transition.
示例5:
cmd_test.go开发语言: Go项目名称: amygdala代码行数: 734
359			Labels:            map[string]string{"foo": "bar"},
360			CreationTimestamp: unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)},
361		},
403			Labels:            map[string]string{"foo": "bar"},
404			CreationTimestamp: unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)},
405		},
447			Name:              "test1",
448			CreationTimestamp: unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)},
449		},
482			Name:              "test1",
483			CreationTimestamp: unversioned.Time{Time: time.Now().AddDate(-10, 0, 0)},
484			Labels: map[string]string{
516					Name:              "test1",
517					CreationTimestamp: unversioned.Time{time.Now().AddDate(-10, 0, 0)},
518				},
示例6:
namespace_controller_utils.go开发语言: Go项目名称: amygdala代码行数: 480
253	namespace string,
254	namespaceDeletedAt unversioned.Time,
255) (int64, error) {
313	namespace string,
314	namespaceDeletedAt unversioned.Time,
315) (int64, error) {
409// estimateGrracefulTermination will estimate the graceful termination required for the specific entity in the namespace
410func estimateGracefulTermination(kubeClient clientset.Interface, groupVersionResource unversioned.GroupVersionResource, ns string, namespaceDeletedAt unversioned.Time) (int64, error) {
411	groupResource := groupVersionResource.GroupResource()
示例7:
types.go开发语言: Go项目名称: amygdala代码行数: 2539
106	// Clients may not set this value. It is represented in RFC3339 form and is in UTC.
107	CreationTimestamp unversioned.Time `json:"creationTimestamp,omitempty"`
108
117	// will send a hard termination signal to the container.
118	DeletionTimestamp *unversioned.Time `json:"deletionTimestamp,omitempty"`
119
992type ContainerStateRunning struct {
993	StartedAt unversioned.Time `json:"startedAt,omitempty"`
994}
1000	Message     string           `json:"message,omitempty"`
1001	StartedAt   unversioned.Time `json:"startedAt,omitempty"`
1002	FinishedAt  unversioned.Time `json:"finishedAt,omitempty"`
1064	Status             ConditionStatus  `json:"status"`
1065	LastProbeTime      unversioned.Time `json:"lastProbeTime,omitempty"`
1066	LastTransitionTime unversioned.Time `json:"lastTransitionTime,omitempty"`
示例8:
conversion_generated.go开发语言: Go项目名称: amygdala代码行数: 455
45	}
46	// unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time
47	if in.DeletionTimestamp != nil {
48		out.DeletionTimestamp = new(unversioned.Time)
49		if err := api.Convert_unversioned_Time_To_unversioned_Time(in.DeletionTimestamp, out.DeletionTimestamp, s); err != nil {
97	}
98	// unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time
99	if in.DeletionTimestamp != nil {
259	}
260	// unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time
261	if in.LastScaleTime != nil {
407	}
408	// unable to generate simple pointer conversion for unversioned.Time -> unversioned.Time
409	if in.LastScaleTime != nil {
示例9:
drain_test.go开发语言: Go项目名称: amygdala代码行数: 494
52			Name:              "node",
53			CreationTimestamp: unversioned.Time{time.Now()},
54		},
211			Namespace:         "default",
212			CreationTimestamp: unversioned.Time{time.Now()},
213			Labels:            labels,
227			Namespace:         "default",
228			CreationTimestamp: unversioned.Time{time.Now()},
229			Labels:            labels,
240			Namespace:         "default",
241			CreationTimestamp: unversioned.Time{time.Now()},
242			SelfLink:          "/apis/extensions/v1beta1/namespaces/default/daemonsets/ds",
255			Namespace:         "default",
256			CreationTimestamp: unversioned.Time{time.Now()},
257			Labels:            labels,
示例10:
deep_copy_generated.go开发语言: Go项目名称: amygdala代码行数: 3068
553	} else {
554		out.StartedAt = newVal.(unversioned.Time)
555	}
566	} else {
567		out.StartedAt = newVal.(unversioned.Time)
568	}
571	} else {
572		out.FinishedAt = newVal.(unversioned.Time)
573	}
825	} else {
826		out.FirstTimestamp = newVal.(unversioned.Time)
827	}
830	} else {
831		out.LastTimestamp = newVal.(unversioned.Time)
832	}

本文地址:https://www.itbaoku.cn/snippets/415815.html