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 kind-dev command to start a kind dev cluster #338

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Julian-Chu
Copy link

@Julian-Chu Julian-Chu commented Apr 13, 2023

Description of changes:
Add make kind-dev SERVICE=$SERVICE to setup a cluster for development or debug quickly.

the command will execute the following actions:

  • create kind cluster
  • install CRD and RBAC into cluster without controller

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ack-prow ack-prow bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 13, 2023
@ack-prow ack-prow bot requested review from jaypipes and jljaco April 13, 2023 15:26
@Julian-Chu Julian-Chu marked this pull request as ready for review April 13, 2023 16:42
@ack-prow ack-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 13, 2023
@ack-prow ack-prow bot requested review from a-hilaly and vijtrip2 April 13, 2023 16:42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think run-dev is a very descriptive name for this file. Could you please rename it to something like setup-kind-cluster or create-dev-cluster?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya , renamed to create-dev-cluster

Comment on lines 26 to 32
ensure_cluster() {
info_msg "Creating KIND cluster ..."
setup_kind_cluster "$CLUSTER_NAME" "$CONTROLLER_NAMESPACE"

info_msg "Installing CRDs , common and RBAC manifest..."
install_crd_and_rbac "$CONTROLLER_NAMESPACE"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have an ensure_cluster method in another file that achieves a similar premise - https://github.com/aws-controllers-k8s/test-infra/blob/main/scripts/run-e2e-tests.sh#L31-L44

This method also uses the config YAML to determine the name, in case the user wants to use a statically named cluster. Rather than redefining this method here, maybe you could modify that one to have a similar effect and then import and use it in this script.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactor here refactor ensure_cluster

ensure_aws_credentials
ensure_cluster
local kubeconfig_path="$ROOT_DIR/build/clusters/$CLUSTER_NAME/kubeconfig"
info_msg "Before running the controller, you need kubeconfig and aws credentials."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Probably don't need this line of explanation. I think we can assume anyone using this method already knows this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Comment on lines 44 to 45
info_msg "if you run the controller from your code editor/IDE, you can set the following environment variables:"
echo "KUBECONFIG=$kubeconfig_path"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already called out from inside the setup_kind_cluster method. See https://github.com/aws-controllers-k8s/test-infra/blob/main/scripts/kind.sh#L27

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the source command set the kubeconfig in current terminal only, if starting the controller from goland or vscode, we have to set KUBECONFIG into them. but you're right, better to mention in document rather than here.

info_msg "After executing the above source command to set the kubeconfig to environment, "
info_msg "run the following command to start the controller from the controller repo:"
echo ""
echo "go run ./cmd/controller/main.go --aws-region eu-central-1 --log-level debug --enable-development-logging"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Instead of hardcoding eu-central-1, get the region from the config YAML (like this)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, good stuff!
nit: can you please update the title and description of PR to reflect your latest changes? They will be part of your git commit

@ack-prow
Copy link

ack-prow bot commented Apr 17, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: A-Hilaly, Julian-Chu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-prow ack-prow bot added the approved label Apr 17, 2023
@Julian-Chu Julian-Chu changed the title Feat/add kind dev Add kind-dev command to start a kind dev cluster Apr 18, 2023
@Julian-Chu
Copy link
Author

@a-hilaly thanks for review, just see your comments. the title and description have been updated!

_ensure_existing_context
else
local cluster_name=$(get_cluster_name)
local controller_install=${2:-true}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please move all of the positional arguments into local variables at the top of this method, so that it's clear what the inputs are. Then you can copy them into their respective variables further down in the method as needed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved 4c321c2

else
info_msg "Testing connection to existing cluster ..."
_ensure_existing_context
info_msg "Installing CRDs , common and RBAC manifest..."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
info_msg "Installing CRDs , common and RBAC manifest..."
info_msg "Installing CRD and RBAC manifests..."

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed 4ed9f07

@ack-bot
Copy link
Collaborator

ack-bot commented Oct 19, 2023

Issues go stale after 180d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 60d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Provide feedback via https://github.com/aws-controllers-k8s/community.
/lifecycle stale

@ack-prow ack-prow bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 19, 2023
@ack-bot
Copy link
Collaborator

ack-bot commented Dec 19, 2023

Stale issues rot after 60d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 60d of inactivity.
If this issue is safe to close now please do so with /close.
Provide feedback via https://github.com/aws-controllers-k8s/community.
/lifecycle rotten

@ack-prow ack-prow bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Dec 19, 2023
@a-hilaly a-hilaly removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Dec 31, 2023
@a-hilaly
Copy link
Member

@Julian-Chu Are we ready to ship this?

@a-hilaly
Copy link
Member

Just want to double check that this is not gonna break the existing testing rule

@ack-bot
Copy link
Collaborator

ack-bot commented Jun 29, 2024

Issues go stale after 180d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 60d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Provide feedback via https://github.com/aws-controllers-k8s/community.
/lifecycle stale

@ack-prow ack-prow bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
4 participants