-
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.
* Added NifiNodeGroupAutoscaler with basic scaling strategies * fix typo, update CRDs * update changelog, add CRD documentation to site * Add missing finalizer * fix docs * Update api/v1alpha1/nifinodegroupautoscaler_types.go Co-authored-by: Alexandre Guitton <[email protected]> * do not create HPA, centralize nodeId assignment, refactor scaling strategies, added CreationTime to NifiCluster.Status.NodeState, various PR feedback * added NodeConfig to autoscaler spec * Update docs * relocate nodeId assignment logic to strategy package since that's where it's used * Added NifiNodeGroupAutoscaler with basic scaling strategies * fix typo, update CRDs * update changelog, add CRD documentation to site * Add missing finalizer * fix docs * Update api/v1alpha1/nifinodegroupautoscaler_types.go Co-authored-by: Alexandre Guitton <[email protected]> * do not create HPA, centralize nodeId assignment, refactor scaling strategies, added CreationTime to NifiCluster.Status.NodeState, various PR feedback * added NodeConfig to autoscaler spec * Update docs * relocate nodeId assignment logic to strategy package since that's where it's used * make node status creation time optional to avoid breaking pre-existing clusters * fixed LIFO downscale bug, added unit tests * revert minor change * update CRDs after merging master * update CRDs after merging master in * remove pods restart at scale up * rework creationTime to be node creationTime instead of pod creationTime & changes log level according to review * correct unit tests * allow to scale to 0 nodes * regenerate go sum * Bump to version 0.13.0 * Bump to version 0.13.0 Co-authored-by: Michael H <[email protected]> Co-authored-by: michael81877 <[email protected]>
- Loading branch information
1 parent
ec551e8
commit affc89a
Showing
93 changed files
with
10,498 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.