-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from konpyutaika/auto-scaler
[Feature/NiFiCluster] Auto scaler
- Loading branch information
Showing
93 changed files
with
10,496 additions
and
169 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,4 +125,6 @@ testbin/* | |
|
||
# editor and IDE paraphernalia | ||
|
||
*~ | ||
*~ | ||
|
||
vendor/ |
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 |
---|---|---|
@@ -1,81 +1,61 @@ | ||
domain: konpyutaika.com | ||
layout: go.kubebuilder.io/v3 | ||
layout: | ||
- go.kubebuilder.io/v3 | ||
plugins: | ||
manifests.sdk.operatorframework.io/v2: {} | ||
scorecard.sdk.operatorframework.io/v2: {} | ||
projectName: nifikop | ||
repo: github.com/konpyutaika/nifikop | ||
resources: | ||
- api: | ||
crdVersion: v1 | ||
# TODO(user): Uncomment the below line if this resource's CRD is namespace scoped, else delete it. | ||
# namespaced: true | ||
# TODO(user): Uncomment the below line if this resource implements a controller, else delete it. | ||
# controller: true | ||
domain: konpyutaika.com | ||
group: nifi | ||
kind: NifiCluster | ||
# TODO(user): Update the package path for your API if the below value is incorrect. | ||
path: github.com/konpyutaika/nifikop/api/v1alpha1 | ||
version: v1alpha1 | ||
- api: | ||
crdVersion: v1 | ||
# TODO(user): Uncomment the below line if this resource's CRD is namespace scoped, else delete it. | ||
# namespaced: true | ||
# TODO(user): Uncomment the below line if this resource implements a controller, else delete it. | ||
# controller: true | ||
domain: konpyutaika.com | ||
group: nifi | ||
kind: NifiUserGroup | ||
# TODO(user): Update the package path for your API if the below value is incorrect. | ||
path: github.com/konpyutaika/nifikop/api/v1alpha1 | ||
version: v1alpha1 | ||
- api: | ||
crdVersion: v1 | ||
# TODO(user): Uncomment the below line if this resource's CRD is namespace scoped, else delete it. | ||
# namespaced: true | ||
# TODO(user): Uncomment the below line if this resource implements a controller, else delete it. | ||
# controller: true | ||
domain: konpyutaika.com | ||
group: nifi | ||
kind: NifiUser | ||
# TODO(user): Update the package path for your API if the below value is incorrect. | ||
path: github.com/Okonpyutaika/nifikop/api/v1alpha1 | ||
version: v1alpha1 | ||
- api: | ||
crdVersion: v1 | ||
# TODO(user): Uncomment the below line if this resource's CRD is namespace scoped, else delete it. | ||
# namespaced: true | ||
# TODO(user): Uncomment the below line if this resource implements a controller, else delete it. | ||
# controller: true | ||
domain: konpyutaika.com | ||
group: nifi | ||
kind: NifiRegistryClient | ||
# TODO(user): Update the package path for your API if the below value is incorrect. | ||
path: github.com/Okonpyutaika/nifikop/api/v1alpha1 | ||
version: v1alpha1 | ||
- api: | ||
crdVersion: v1 | ||
# TODO(user): Uncomment the below line if this resource's CRD is namespace scoped, else delete it. | ||
# namespaced: true | ||
# TODO(user): Uncomment the below line if this resource implements a controller, else delete it. | ||
# controller: true | ||
domain: konpyutaika.com | ||
group: nifi | ||
kind: NifiDataflow | ||
# TODO(user): Update the package path for your API if the below value is incorrect. | ||
path: github.com/konpyutaika/nifikop/api/v1alpha1 | ||
version: v1alpha1 | ||
- api: | ||
crdVersion: v1 | ||
# TODO(user): Uncomment the below line if this resource's CRD is namespace scoped, else delete it. | ||
# namespaced: true | ||
# TODO(user): Uncomment the below line if this resource implements a controller, else delete it. | ||
# controller: true | ||
domain: konpyutaika.com | ||
group: nifi | ||
kind: NifiParameterContext | ||
# TODO(user): Update the package path for your API if the below value is incorrect. | ||
path: github.com/konpyutaika/nifikop/api/v1alpha1 | ||
version: v1alpha1 | ||
- api: | ||
crdVersion: v1 | ||
namespaced: true | ||
controller: true | ||
domain: konpyutaika.com | ||
group: nifi | ||
kind: NifiNodeGroupAutoscaler | ||
path: github.com/konpyutaika/nifikop/api/v1alpha1 | ||
version: v1alpha1 | ||
version: "3" | ||
plugins: | ||
manifests.sdk.operatorframework.io/v2: {} | ||
scorecard.sdk.operatorframework.io/v2: {} |
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
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,51 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
"k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
func TestGetCreationTimeOrderedNodes(t *testing.T) { | ||
time1 := v1.NewTime(time.Now().UTC().Add(time.Duration(5) * time.Hour)) | ||
time2 := v1.NewTime(time.Now().UTC().Add(time.Duration(10) * time.Hour)) | ||
time3 := v1.NewTime(time.Now().UTC().Add(time.Duration(15) * time.Hour)) | ||
time4 := v1.NewTime(time.Now().UTC().Add(time.Duration(20) * time.Hour)) | ||
|
||
cluster := &NifiCluster{ | ||
Spec: NifiClusterSpec{ | ||
Nodes: []Node{ | ||
{Id: 2, NodeConfigGroup: "scale-group", Labels: map[string]string{"scale_me": "true"}}, | ||
{Id: 3, NodeConfigGroup: "scale-group", Labels: map[string]string{"scale_me": "true"}}, | ||
{Id: 4, NodeConfigGroup: "scale-group", Labels: map[string]string{"scale_me": "true"}}, | ||
{Id: 5, NodeConfigGroup: "other-group", Labels: map[string]string{"other_group": "true"}}, | ||
}, | ||
}, | ||
Status: NifiClusterStatus{ | ||
NodesState: map[string]NodeState{ | ||
"2": { | ||
CreationTime: &time1, | ||
}, | ||
"3": { | ||
CreationTime: &time3, | ||
}, | ||
"4": { | ||
CreationTime: &time2, | ||
}, | ||
"5": { | ||
CreationTime: &time4, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
nodeList := cluster.GetCreationTimeOrderedNodes() | ||
|
||
if len(nodeList) != 4 { | ||
t.Errorf("Incorrect node list: %v+", nodeList) | ||
} | ||
if nodeList[0].Id != 2 || nodeList[1].Id != 4 || nodeList[2].Id != 3 || nodeList[3].Id != 5 { | ||
t.Errorf("Incorrect node list: %v+", nodeList) | ||
} | ||
} |
Oops, something went wrong.