Skip to content
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 support for setting the replication bandwidth limits #273

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func GetReplicationBody(d *schema.ResourceData) models.ReplicationBody {
Deletion: d.Get("deletion").(bool),
DestNamespace: d.Get("dest_namespace").(string),
DestNamespaceReplace: d.Get("dest_namespace_replace").(int),
Speed: d.Get("speed").(int),
}

if action == "push" {
Expand Down
4 changes: 4 additions & 0 deletions docs/resources/replication.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ The following arguments are supported:

* **action** - (Required)

* **registry_id** - (Required) The registry ID of the Registry Endpoint

* **speed** - (Optional) The Maximum network bandwidth in Kbps for each execution. Default is `0` (unlimited).
flbla marked this conversation as resolved.
Show resolved Hide resolved

* **schedule** - (Optional) The scheduled time of when the container register will be push / pull. In cron base format. Hourly `"0 0 * * * *"`, Daily `"0 0 0 * * *"`, Monthly `"0 0 0 * * 0"`. Can be one of the following: `event_based`, `manual`, `cron format` (Default: `manual`)
* **override** - (Optional) Specify whether to override the resources at the destination if a resources with the same name exist. Can be set to `true` or `false` (Default: `true`)
* **enabled** - (Optional) Specify whether the replication is enabled. Can be set to `true` or `false` (Default: `true`)
Expand Down
1 change: 1 addition & 0 deletions models/replications.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type ReplicationBody struct {
Deletion bool `json:"deletion,omitempty"`
Override bool `json:"override,omitempty"`
Filters []ReplicationFilters `json:"filters,omitempty"`
Speed int `json:"speed,omitempty"`
}

type ReplicationFilters struct {
Expand Down
5 changes: 5 additions & 0 deletions provider/resource_replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ func resourceReplication() *schema.Resource {
},
},
},
"speed": {
Type: schema.TypeInt,
Optional: true,
Default: 0,
},
},
Create: resourceReplicationCreate,
Read: resourceReplicationRead,
Expand Down