-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add atlasScheduledAutoscaling (SRE-720) #18
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -51,6 +51,33 @@ type MongoDBClusterSpec struct { | |||||
|
||||||
// If this is set, along with useAtlasApi, all the kubernetes nodes on the cluster will be added to the Atlas firewall. The only available value right now is "rancher-annotation", which uses the rke.cattle.io/external-ip annotation. | ||||||
AtlasNodeIPAccessStrategy string `json:"atlasNodeIpAccessStrategy,omitempty"` | ||||||
|
||||||
AtlasScheduledAutoscaling *AtlasScheduledAutoscaling `json:"atlasScheduledAutoscaling,omitempty"` | ||||||
} | ||||||
|
||||||
type AtlasScheduledAutoscaling struct { | ||||||
// If this is set, the cluster will be enabled for scheduled autoscaling. | ||||||
// The way it works is that the cluster will be scaled up to the high tier at the specified time, and scaled down to the lowTier at the specified time. | ||||||
// +kubebuilder:default=false | ||||||
Enabled bool `json:"enabled,omitempty"` | ||||||
|
||||||
// The minimum tier the cluster can scale down to. | ||||||
// +kubebuilder:validation:Enum=M0;M2;M5;M10;M20;M30;M40;M50;M60;M80;M140;M200;M300;M400;M500;M700;M900;M1000 | ||||||
// +kubebuilder:default="M20" | ||||||
LowTier string `json:"lowTier,omitempty"` | ||||||
|
||||||
// The maximum tier the cluster can scale up to. | ||||||
// +kubebuilder:validation:Enum=M0;M2;M5;M10;M20;M30;M40;M50;M60;M80;M140;M200;M300;M400;M500;M700;M900;M1000 | ||||||
// +kubebuilder:default="M50" | ||||||
HighTier string `json:"highTier,omitempty"` | ||||||
|
||||||
// Cron expression for the time the cluster should be scaled down. | ||||||
// +kubebuilder:default="0 20 * * 1-5" | ||||||
ScaleDownExpression string `json:"scaleDownExpression,omitempty"` | ||||||
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.
Suggested change
|
||||||
|
||||||
// Cron expression for the time the cluster should be scaled up. | ||||||
// +kubebuilder:default="0 6 * * 1-5" | ||||||
ScaleUpExpression string `json:"scaleUpExpression,omitempty"` | ||||||
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.
Suggested change
being more verbose as expression can mean plain texts too. |
||||||
} | ||||||
|
||||||
// MongoDBClusterStatus defines the observed state of MongoDBCluster | ||||||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ metadata: | |
name: teste-atlas1 | ||
spec: | ||
# The host with port that clients will receive when requesting credentials. | ||
hostTemplate: "cluster0.vpz0mct.mongodb.net" | ||
hostTemplate: "cluster0.4h0sjun.mongodb.net" | ||
|
||
# Secret in which Airlock will look for a ConnectionString or Atlas credentials, that will be used to connect to the cluster. | ||
connectionSecret: airlock-atlas-connection | ||
|
@@ -38,6 +38,22 @@ spec: | |
# Optional. If this is set, along with useAtlasApi, all the kubernetes nodes on the cluster will be added to the Atlas firewall. The only available value right now is "rancher-annotation", which uses the rke.cattle.io/external-ip annotation. | ||
atlasNodeIpAccessStrategy: rancher-annotation | ||
|
||
atlasScheduledAutoscaling: | ||
# Whether the autoscaling is enabled or not. Defaults to false. | ||
enabled: true | ||
|
||
# The low tier the cluster will scale down to. Defaults to "M20". | ||
lowTier: "M10" | ||
|
||
# The high tier the cluster will scale up to. Defaults to "M50". | ||
highTier: "M20" | ||
|
||
# The cron expression that will be used to scale down the cluster. Defaults to "0 20 * * 1-5". | ||
scaleDownExpression: "* * * * *" | ||
|
||
# The cron expression that will be used to scale up the cluster. Defaults to "0 6 * * 1-5". | ||
scaleUpExpression: "0 0 * * *" | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
|
@@ -47,7 +63,7 @@ metadata: | |
type: Opaque | ||
stringData: | ||
# It should have enough privileges to manage users and access. This is not gonna be used by the created users. | ||
connectionString: "mongodb://rcadmin:[email protected]/test?replicaSet=rs0" | ||
connectionString: "mongodb://rcadmin:[email protected]/test?replicaSet=rs*" | ||
|
||
--- | ||
apiVersion: v1 | ||
|
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.
should shared tiers be listed as valid scale downs or scale ups? likely we don't want to scale down so much or up, we could avoid mistakes like typos by not having them in validation.
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.
Yeah, doesn't make sense to have anything below M10 there, and I'll cap it at M200. That way we don't acidentally typo in an M400 and go bankrupt in a month.