-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
init commit for scheduled scaling #370
Open
randytqwjp
wants to merge
15
commits into
main
Choose a base branch
from
scheduledscaling
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3f5ba3f
init commit for scheduled scaling
randytqwjp 19dd498
make manifests
randytqwjp d62ede6
make manifests
randytqwjp 9c39e80
make manifests
randytqwjp 29ed82d
make manifests
randytqwjp 57b26db
Merge branch 'main' of github.com:mercari/tortoise into scheduledscaling
randytqwjp 976bcd1
go import
randytqwjp fb215a6
manual import
randytqwjp 4a5215c
fix test
randytqwjp de18d63
fix comments
randytqwjp 0ea2f8c
make manifests
randytqwjp 045cd29
lint
randytqwjp bff5b46
fix comment
randytqwjp 5a9c864
Merge branch 'main' of github.com:mercari/tortoise into scheduledscaling
randytqwjp 48cdfa1
fix comment
randytqwjp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
MIT License | ||
|
||
Copyright (c) 2023 mercari | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
*/ | ||
|
||
// Package v1alpha1 contains API Schema definitions for the autoscaling v1alpha1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=autoscaling.mercari.com | ||
package v1alpha1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/scheme" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version used to register these objects | ||
GroupVersion = schema.GroupVersion{Group: "autoscaling.mercari.com", Version: "v1alpha1"} | ||
|
||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
||
// AddToScheme adds the types in this group-version to the given scheme. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,117 @@ | ||||||
/* | ||||||
MIT License | ||||||
|
||||||
Copyright (c) 2023 mercari | ||||||
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||||||
of this software and associated documentation files (the "Software"), to deal | ||||||
in the Software without restriction, including without limitation the rights | ||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||||
copies of the Software, and to permit persons to whom the Software is | ||||||
furnished to do so, subject to the following conditions: | ||||||
|
||||||
The above copyright notice and this permission notice shall be included in all | ||||||
copies or substantial portions of the Software. | ||||||
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||||
SOFTWARE. | ||||||
|
||||||
*/ | ||||||
|
||||||
package v1alpha1 | ||||||
|
||||||
import ( | ||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
|
||||||
autoscalingv1beta3 "github.com/mercari/tortoise/api/v1beta3" | ||||||
) | ||||||
|
||||||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! | ||||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||||||
|
||||||
// ScheduledScalingSpec defines the desired state of ScheduledScaling | ||||||
type ScheduledScalingSpec struct { | ||||||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster | ||||||
// Important: Run "make" to regenerate code after modifying this file | ||||||
|
||||||
/// Schedule RFC3339 format e.g., "2006-01-02T15:04:05Z09:00" | ||||||
Schedule Schedule `json:"schedule" protobuf:"bytes,1,name=schedule"` | ||||||
|
||||||
// TargetRef is the targets that need to be scheduled | ||||||
TargetRefs TargetRefs `json:"targetRefs" protobuf:"bytes,2,name=targetRefs"` | ||||||
|
||||||
// Strategy describes how this ScheduledScaling scales the target workload. | ||||||
// Currently, it only supports the static strategy. | ||||||
Strategy Strategy `json:"strategy" protobuf:"bytes,3,name=strategy"` | ||||||
} | ||||||
|
||||||
// ScheduledScalingStatus defines the observed state of ScheduledScaling | ||||||
type ScheduledScalingStatus struct { | ||||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster | ||||||
// Important: Run "make" to regenerate code after modifying this file | ||||||
|
||||||
ScheduledScalingPhase ScheduledScalingPhase `json:"scheduledScalingPhase" protobuf:"bytes,1,name=scheduledScalingPhase"` | ||||||
} | ||||||
|
||||||
type ScheduledScalingPhase string | ||||||
|
||||||
//+kubebuilder:object:root=true | ||||||
//+kubebuilder:subresource:status | ||||||
|
||||||
// ScheduledScaling is the Schema for the scheduledscalings API | ||||||
type ScheduledScaling struct { | ||||||
metav1.TypeMeta `json:",inline"` | ||||||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||||||
|
||||||
Spec ScheduledScalingSpec `json:"spec,omitempty"` | ||||||
Status ScheduledScalingStatus `json:"status,omitempty"` | ||||||
} | ||||||
|
||||||
//+kubebuilder:object:root=true | ||||||
|
||||||
// ScheduledScalingList contains a list of ScheduledScaling | ||||||
type ScheduledScalingList struct { | ||||||
metav1.TypeMeta `json:",inline"` | ||||||
metav1.ListMeta `json:"metadata,omitempty"` | ||||||
Items []ScheduledScaling `json:"items"` | ||||||
} | ||||||
|
||||||
type TargetRefs struct { | ||||||
//Tortoise to be targeted for scheduled scaling | ||||||
TortoiseName *string `json:"tortoiseName,omitempty" protobuf:"bytes,2,name=tortoiseName"` | ||||||
} | ||||||
|
||||||
type Schedule struct { | ||||||
/// RFC3339 format e.g., "2006-01-02T15:04:05Z09:00" | ||||||
// start of schedule | ||||||
StartAt *string `json:"startAt" protobuf:"bytes,1,name=startAt"` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. StartAt is required.
Suggested change
|
||||||
// end of schedule | ||||||
FinishAt *string `json:"finishAt" protobuf:"bytes,2,name=finishAt"` | ||||||
} | ||||||
|
||||||
type Strategy struct { | ||||||
// Resource scaling requirements | ||||||
randytqwjp marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
// Static strategy receives the static value of the replica number and resource requests | ||||||
// that users want to give to Pods during this ScheduledScaling is valid. | ||||||
// This field is optional for the future when we add another strategy here though, | ||||||
// until then this strategy is the only supported strategy | ||||||
// you must set this. | ||||||
// +optional | ||||||
Static *Static `json:"static,omitempty" protobuf:"bytes,1,opt,name=static"` | ||||||
} | ||||||
|
||||||
type Static struct { | ||||||
// MinimumMinReplicas means the minimum MinReplicas that Tortoise gives to HPA during this ScheduledScaling is valid. | ||||||
MinimumMinReplicas *int `json:"minimumMinReplica,omitempty" protobuf:"bytes,1,opt,name=minimumMinReplica"` | ||||||
// MinAllowedResources means the minimum resource requests that Tortoise gives to each container. | ||||||
MinAllocatedResources []autoscalingv1beta3.ContainerResourceRequests `json:"minAllocatedResourcesomitempty,omitempty" protobuf:"bytes,2,opt,name=minAllocatedResources"` | ||||||
} | ||||||
|
||||||
func init() { | ||||||
SchemeBuilder.Register(&ScheduledScaling{}, &ScheduledScalingList{}) | ||||||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing protobuf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protobuf is missing in tortoise_types.go as well