Skip to content

Commit f3a3464

Browse files
saintubeshenxin
and
shenxin
authored
release v1.5.0 (#9)
Signed-off-by: saintube <[email protected]> Co-authored-by: shenxin <[email protected]>
1 parent 90c864c commit f3a3464

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3582
-1104
lines changed

analysis/v1alpha1/condition.go

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
Copyright 2022 The Koordinator 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 v1alpha1
18+
19+
const (
20+
// LowConfidenceCondition indicates the low confidence for the current forecasting result.
21+
LowConfidenceCondition string = "LowConfidence"
22+
// NoObjectsMatchedCondition indicates that the current description didn't match any objects.
23+
NoObjectsMatchedCondition string = "NoObjectsMatched"
24+
// FetchingHistoryCondition indicates that forecaster is in the process of loading additional
25+
// history samples.
26+
FetchingHistoryCondition string = "FetchingHistory"
27+
// ConfigDeprecatedCondition indicates that this configuration is deprecated and will stop being
28+
// supported soon.
29+
ConfigDeprecatedCondition string = "ConfigDeprecated"
30+
// ConfigUnsupportedCondition indicates that this configuration is unsupported and will not be provided for it.
31+
ConfigUnsupportedCondition string = "ConfigUnsupported"
32+
)
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
Copyright 2022 The Koordinator 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 v1alpha1 contains API Schema definitions for the analysis v1alpha1 API group
18+
// +kubebuilder:object:generate=true
19+
// +groupName=analysis.koordinator.sh
20+
package v1alpha1
21+
22+
import (
23+
"github.com/koordinator-sh/apis/scheme"
24+
"k8s.io/apimachinery/pkg/runtime/schema"
25+
)
26+
27+
var (
28+
// GroupVersion is group version used to register these objects
29+
GroupVersion = schema.GroupVersion{Group: "analysis.koordinator.sh", Version: "v1alpha1"}
30+
31+
SchemeGroupVersion = GroupVersion
32+
33+
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
34+
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
35+
36+
// AddToScheme adds the types in this group-version to the given scheme.
37+
AddToScheme = SchemeBuilder.AddToScheme
38+
)
39+
40+
// Resource is required by pkg/client/listers/...
41+
func Resource(resource string) schema.GroupResource {
42+
return SchemeGroupVersion.WithResource(resource).GroupResource()
43+
}
+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/*
2+
Copyright 2022 The Koordinator 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 v1alpha1
18+
19+
import (
20+
corev1 "k8s.io/api/core/v1"
21+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
)
23+
24+
// RecommendationTargetType defines the type of analysis target
25+
type RecommendationTargetType string
26+
27+
const (
28+
// RecommendationTargetWorkload defines the k8s workload type
29+
RecommendationTargetWorkload RecommendationTargetType = "workload"
30+
// RecommendationPodSelector defines the pod selector type
31+
RecommendationPodSelector RecommendationTargetType = "podSelector"
32+
)
33+
34+
// RecommendationTarget defines the target of analysis, which can be a k8s workload or a series of pods
35+
type RecommendationTarget struct {
36+
// Type indicates the type of target
37+
Type RecommendationTargetType `json:"type"`
38+
// Workload indicates the target is a k8s workload, which is effective when Type is "workload"
39+
Workload *CrossVersionObjectReference `json:"workload,omitempty"`
40+
// PodSelector defines the reference of a series of pods, which is effective when Type is "podSelector"
41+
PodSelector *metav1.LabelSelector `json:"podSelector,omitempty"`
42+
}
43+
44+
// CrossVersionObjectReference contains enough information to let you identify the referred resource.
45+
type CrossVersionObjectReference struct {
46+
// Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"
47+
Kind string `json:"kind"`
48+
// Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names
49+
Name string `json:"name"`
50+
// API version of the referent
51+
APIVersion string `json:"apiVersion,omitempty"`
52+
}
53+
54+
// RecommendationSpec is the specification of the client object.
55+
type RecommendationSpec struct {
56+
// Target is the object to be analyzed, which can be a workload or a series of pods
57+
Target RecommendationTarget `json:"target"`
58+
// TODO add more tuning knobs about aggregation policy
59+
}
60+
61+
// RecommendedPodStatus defines the observed state of pod
62+
type RecommendedPodStatus struct {
63+
// ContainerStatuses records the most recently computed amount of resources recommended
64+
ContainerStatuses []RecommendedContainerStatus `json:"containerStatuses,omitempty"`
65+
}
66+
67+
// RecommendedContainerStatus defines the observed state of container
68+
type RecommendedContainerStatus struct {
69+
// Name of the container.
70+
ContainerName string `json:"containerName,omitempty"`
71+
// Recommended resources of container
72+
Resources corev1.ResourceList `json:"resources,omitempty"`
73+
}
74+
75+
// RecommendationStatus defines the observed state of Recommendation
76+
type RecommendationStatus struct {
77+
// PodStatus records the most recently computed amount of resources recommended
78+
PodStatus *RecommendedPodStatus `json:"podStatus,omitempty"`
79+
// UpdateTime is the update time of the distribution
80+
UpdateTime *metav1.Time `json:"updateTime,omitempty"`
81+
// Conditions is the list of conditions representing the status of the distribution
82+
Conditions []metav1.Condition `json:"conditions,omitempty"`
83+
}
84+
85+
// +genclient
86+
// +kubebuilder:object:root=true
87+
// +kubebuilder:subresource:status
88+
// +kubebuilder:resource:shortName=recom
89+
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
90+
// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".spec.target.type"
91+
// +kubebuilder:printcolumn:name="Kind",type="string",JSONPath=".spec.target.workload.kind"
92+
// +kubebuilder:printcolumn:name="Name",type="string",JSONPath=".spec.target.workload.name"
93+
// +kubebuilder:printcolumn:name="LastUpdateTime",type="date",JSONPath=".status.updateTime"
94+
95+
// Recommendation is the Schema for the recommendations API
96+
type Recommendation struct {
97+
metav1.TypeMeta `json:",inline"`
98+
metav1.ObjectMeta `json:"metadata,omitempty"`
99+
100+
Spec RecommendationSpec `json:"spec,omitempty"`
101+
Status RecommendationStatus `json:"status,omitempty"`
102+
}
103+
104+
// +kubebuilder:object:root=true
105+
106+
// RecommendationList contains a list of Recommendation
107+
type RecommendationList struct {
108+
metav1.TypeMeta `json:",inline"`
109+
metav1.ListMeta `json:"metadata,omitempty"`
110+
Items []Recommendation `json:"items"`
111+
}
112+
113+
func init() {
114+
SchemeBuilder.Register(&Recommendation{}, &RecommendationList{})
115+
}

0 commit comments

Comments
 (0)