-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Test: Implemented ginkgo test against local kubeconfig #2015
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 |
---|---|---|
|
@@ -26,6 +26,8 @@ import ( | |
"k8s.io/apimachinery/pkg/api/resource" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"knative.dev/pkg/logging" | ||
"knative.dev/pkg/ptr" | ||
|
||
"github.com/aws/karpenter/pkg/apis/provisioning/v1alpha5" | ||
) | ||
|
@@ -44,7 +46,7 @@ type ProvisionerOptions struct { | |
Status v1alpha5.ProvisionerStatus | ||
} | ||
|
||
// Provisioner creates a test pod with defaults that can be overridden by ProvisionerOptions. | ||
// Provisioner creates a test provisioner with defaults that can be overridden by ProvisionerOptions. | ||
// Overrides are applied in order, with a last write wins semantic. | ||
func Provisioner(overrides ...ProvisionerOptions) *v1alpha5.Provisioner { | ||
options := ProvisionerOptions{} | ||
|
@@ -59,25 +61,35 @@ func Provisioner(overrides ...ProvisionerOptions) *v1alpha5.Provisioner { | |
if options.Limits == nil { | ||
options.Limits = v1.ResourceList{v1.ResourceCPU: resource.MustParse("1000")} | ||
} | ||
if options.Provider == nil { | ||
options.Provider = struct{}{} | ||
} | ||
provider, _ := json.Marshal(options.Provider) | ||
|
||
provisioner := &v1alpha5.Provisioner{ | ||
ObjectMeta: ObjectMeta(options.ObjectMeta), | ||
Spec: v1alpha5.ProvisionerSpec{ | ||
Requirements: options.Requirements, | ||
KubeletConfiguration: options.Kubelet, | ||
Provider: &runtime.RawExtension{Raw: provider}, | ||
ProviderRef: options.ProviderRef, | ||
Taints: options.Taints, | ||
StartupTaints: options.StartupTaints, | ||
Labels: options.Labels, | ||
Limits: &v1alpha5.Limits{Resources: options.Limits}, | ||
TTLSecondsAfterEmpty: ptr.Int64(10), | ||
}, | ||
Status: options.Status, | ||
} | ||
|
||
if options.ProviderRef == nil { | ||
if options.Provider == nil { | ||
options.Provider = struct{}{} | ||
} | ||
provider, err := json.Marshal(options.Provider) | ||
if err != nil { | ||
panic(err) | ||
} | ||
provisioner.Spec.Provider = &runtime.RawExtension{Raw: provider} | ||
} | ||
provisioner.SetDefaults(context.Background()) | ||
_ = provisioner.Validate(context.Background()) | ||
if err := provisioner.Validate(context.Background()); err != nil { | ||
logging.FromContext(context.TODO()).Info("TODO: Fix the tests that cause this") | ||
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. Can we report the error here too? I'm unsure if this is a logged TODO that should be used when running tests or a TODO for yourself. 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. A ton of existing tests break if I fail here, since the error was originally squashed incorrectly. I wanted to log and clean it up later, since I'm OOTO for a few days and wanted to unblock folks. |
||
} | ||
return provisioner | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,6 +1,5 @@ | ||||||
export CLUSTER_NAME="${CLUSTER_NAME:-karpenter-test-cluster}" | ||||||
export CLUSTER_NAME="${CLUSTER_NAME:-karpenter-test-infrastructure}" | ||||||
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. this would make the stack
Suggested change
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.
|
||||||
export AWS_PROFILE="${AWS_PROFILE:-karpenter-ci}" | ||||||
export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) | ||||||
export AWS_REGION="${AWS_REGION:-us-west-2}" | ||||||
export KARPENTER_VERSION="${KARPENTER_VERSION:-v0.9.0}" | ||||||
export AWS_PAGER="" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
echo "Installing Tekton" | ||
|
||
kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/previous/v0.33.2/release.yaml | ||
kubectl patch configmap config-defaults -n tekton-pipelines --patch '{"data": { "default-task-run-workspace-binding": "emptyDir: {}" } }' | ||
kubectl patch deployment tekton-pipelines-controller -n tekton-pipelines --patch '{"spec":{"template":{"spec":{"tolerations":[{"key":"CriticalAddonsOnly", "operator":"Exists"}]}}}}' | ||
kubectl patch deployment tekton-pipelines-webhook -n tekton-pipelines --patch '{"spec":{"template":{"spec":{"tolerations":[{"key":"CriticalAddonsOnly", "operator":"Exists"}]}}}}' | ||
sleep 10 | ||
|
||
kubectl apply -f https://storage.googleapis.com/tekton-releases/triggers/previous/v0.19.0/release.yaml | ||
kubectl patch deployment tekton-triggers-controller -n tekton-pipelines --patch '{"spec":{"template":{"spec":{"tolerations":[{"key":"CriticalAddonsOnly", "operator":"Exists"}]}}}}' | ||
kubectl patch deployment tekton-triggers-webhook -n tekton-pipelines --patch '{"spec":{"template":{"spec":{"tolerations":[{"key":"CriticalAddonsOnly", "operator":"Exists"}]}}}}' | ||
sleep 10 | ||
|
||
kubectl apply -f https://github.com/tektoncd/dashboard/releases/download/v0.24.1/tekton-dashboard-release.yaml | ||
kubectl patch deployment tekton-dashboard -n tekton-pipelines --patch '{"spec":{"template":{"spec":{"tolerations":[{"key":"CriticalAddonsOnly", "operator":"Exists"}]}}}}' | ||
sleep 10 |
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.
Any reason why we're picking 10 here? Can we parameterize empty and expired? I can imagine these are functions we'll need to test too.
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.
Eventually sure -- I wanted to default for 10 until we need to override.