-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alex Castilio dos Santos <[email protected]>
- Loading branch information
1 parent
b3cd0ec
commit 154185d
Showing
11 changed files
with
295 additions
and
51 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Daily Scale Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- alexcastilio/scale-test-workflow | ||
# schedule: | ||
# - cron: "0 0 * * *" | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
jobs: | ||
call-scale-test: | ||
uses: ./.github/workflows/scale-test.yaml | ||
with: | ||
num_deployments: 10 | ||
num_replicas: 10 | ||
# TODO: Fix value | ||
num_netpol: 0 | ||
cleanup: false | ||
secrets: inherit |
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
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,76 @@ | ||
package kubernetes | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"log" | ||
"fmt" | ||
"time" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
"k8s.io/client-go/kubernetes" | ||
"k8s.io/client-go/tools/clientcmd" | ||
) | ||
|
||
type patchStringValue struct { | ||
Op string `json:"op"` | ||
Path string `json:"path"` | ||
Value string `json:"value"` | ||
} | ||
|
||
type LabelNodes struct { | ||
KubeConfigFilePath string | ||
Labels map[string]string | ||
} | ||
|
||
func (l *LabelNodes) Prevalidate() error { | ||
return nil | ||
} | ||
|
||
func (l *LabelNodes) Run() error { | ||
config, err := clientcmd.BuildConfigFromFlags("", l.KubeConfigFilePath) | ||
if err != nil { | ||
return fmt.Errorf("error building kubeconfig: %w", err) | ||
} | ||
|
||
clientset, err := kubernetes.NewForConfig(config) | ||
if err != nil { | ||
return fmt.Errorf("error creating Kubernetes client: %w", err) | ||
} | ||
|
||
ctx, cancel := context.WithTimeout(context.Background(), defaultTimeoutSeconds*time.Second) | ||
defer cancel() | ||
|
||
nodes, err := clientset.CoreV1().Nodes().List(ctx, metav1.ListOptions{}) | ||
if err != nil { | ||
return fmt.Errorf("failed to get nodes: %w", err) | ||
} | ||
|
||
patch := []patchStringValue{} | ||
for k, v := range l.Labels { | ||
patch = append(patch, patchStringValue{ | ||
Op: "add", | ||
Path: "/metadata/labels/" + k, | ||
Value: v, | ||
}) | ||
} | ||
b, err := json.Marshal(patch) | ||
if err != nil { | ||
return fmt.Errorf("failed to marshal patch: %w", err) | ||
} | ||
|
||
for _, node := range nodes.Items { | ||
Check failure on line 63 in test/e2e/framework/kubernetes/label-nodes.go GitHub Actions / Lint (linux, amd64)
Check failure on line 63 in test/e2e/framework/kubernetes/label-nodes.go GitHub Actions / Lint (linux, arm64)
Check failure on line 63 in test/e2e/framework/kubernetes/label-nodes.go GitHub Actions / Lint (windows, amd64)
|
||
log.Println("Labeling node", node.Name) | ||
_, err = clientset.CoreV1().Nodes().Patch(ctx, node.Name, types.JSONPatchType, b, metav1.PatchOptions{}) | ||
if err != nil { | ||
return fmt.Errorf("failed to patch pod: %w", err) | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (l *LabelNodes) Stop() error { | ||
return nil | ||
} |
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,17 @@ | ||
package params | ||
|
||
import ( | ||
"os" | ||
) | ||
|
||
var ( | ||
Location = os.Getenv("LOCATION") | ||
SubscriptionID = os.Getenv("AZURE_SUBSCRIPTION_ID") | ||
ResourceGroup = os.Getenv("AZURE_RESOURCE_GROUP") | ||
ClusterName = os.Getenv("CLUSTER_NAME") | ||
NodesPerPool = os.Getenv("NODES_PER_POOL") | ||
NumDeployments = os.Getenv("NUM_DEPLOYMENTS") | ||
NumReplicas = os.Getenv("NUM_REPLICAS") | ||
NumNetworkPolicies = os.Getenv("NUM_NET_POL") | ||
CleanUp = os.Getenv("CLEANUP") | ||
) |
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
Oops, something went wrong.