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 script for starting kind for local development. #1053

Merged
merged 13 commits into from
Jul 12, 2023

Conversation

smuda
Copy link
Contributor

@smuda smuda commented May 15, 2023

Closes #1052
A script for starting kind from Makefile, to be used during development.

@pb82
Copy link
Collaborator

pb82 commented May 16, 2023

@NissesSenap since you're using kind, would you mind giving this a try?

@weisdd
Copy link
Collaborator

weisdd commented May 16, 2023

@smuda Thanks for the PR! I'd think it's better to maintain all the manifests in a separate folder (whether it's a reference to existing deploy examples or new ones). With that, we'd get syntax highlighting, code autocompletion and other things. WDYT?

@smuda
Copy link
Contributor Author

smuda commented May 16, 2023

Sure! These manifests was retrieved in the same manner that the DEVELOPMENT.md instructed, but I agree. I'll extract the manifests to a separate folder.

Copy link
Collaborator

@NissesSenap NissesSenap left a comment

Choose a reason for hiding this comment

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

So after fixing missing defnition of KUBECONFIG when you create your kind cluster I get the following issue:

###############################
# 1. Start kind cluster       #
###############################
Creating cluster "kind" ...
 ✓ Ensuring node image (kindest/node:v1.25.3) 🖼
 ✓ Preparing nodes 📦  
 ✓ Writing configuration 📜 
 ✓ Starting control-plane 🕹️ 
 ✓ Installing CNI 🔌 
 ✓ Installing StorageClass 💾 
 ✓ Waiting ≤ 2m0s for control-plane = Ready ⏳ 
 • Ready after 19s 💚
Set kubectl context to "kind-kind"
You can now use your cluster with:

kubectl cluster-info --context kind-kind --kubeconfig /home/edvin/.kube/kind-grafana-operator

Not sure what to do next? 😅  Check out https://kind.sigs.k8s.io/docs/user/quick-start/
The connection to the server localhost:8080 was refused - did you specify the right host or port?
make: *** [Makefile:272: start-kind] Error 1

This is due to you don't specify the custom kubeconfig file wihtin your command

kubectl get pods --context kind-kind --kubeconfig /home/edvin/.kube/kind-grafana-operator

Please take a second look at at the script and I will be happy to merge.
Thanks allot @smuda

@@ -0,0 +1,260 @@
#!/usr/bin/env bash
KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME:-kind}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe it would be good to have a none standard name like grafana-kind or something like that.
This way we don't remove someone's cluster that they do other things on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've set the default name to "kind-grafana".

hack/kind/start-kind.sh Show resolved Hide resolved
@NissesSenap
Copy link
Collaborator

Sure! These manifests was retrieved in the same manner that the DEVELOPMENT.md instructed, but I agree. I'll extract the manifests to a separate folder.

Agree, my basic thinking was that people wanted something to copy and paste quickly + I haden't solved the file import feature in the UI that I found later when I did this document.

I think a separate folder with a kustomize file in it would be nice.

@smuda smuda force-pushed the feature/add-kind-script branch 3 times, most recently from 110f76a to f23b390 Compare May 31, 2023 13:44
@smuda
Copy link
Contributor Author

smuda commented May 31, 2023

I've moved resources to separate folders and added very simple kustomization.yaml.

With that, I think it's time for another round of reviews. :-)

Edit: I've also rebased on master.

@smuda smuda force-pushed the feature/add-kind-script branch 2 times, most recently from f9c8bbb to 85678fe Compare June 7, 2023 03:34
Copy link
Collaborator

@NissesSenap NissesSenap left a comment

Choose a reason for hiding this comment

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

You need a final fix in the makefile.
It would also be nice if you can mention the usage of this script in CONTRIBUTING.md.
Other than that, it looks good.

echo "# 3. Install CRDs #"
echo "###############################"
pushd "${SCRIPT_DIR}/../.."
make install
Copy link
Collaborator

Choose a reason for hiding this comment

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

You are not overwriting the default kubeconfig since you are doing make install

@smuda smuda force-pushed the feature/add-kind-script branch 2 times, most recently from 438575e to 0a7efba Compare July 1, 2023 03:39
@smuda
Copy link
Contributor Author

smuda commented Jul 1, 2023

Since I changed the default KUBECONFIG in the make file, I also had to explicitly specify the KUBECONFIG in the github e2e action.

@smuda smuda requested a review from NissesSenap July 1, 2023 11:45
Copy link
Collaborator

@NissesSenap NissesSenap left a comment

Choose a reason for hiding this comment

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

Sorry for the delay in looking at the PR.

Minor comment.

We should probably add something kind export kubeconfig -n kind-grafana or something like that to explain how to reach the instance after it's up and running.

# Will install the CRD:s
make install
# Will run the operator from your console
make run
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should probably still have something around, make run . Right now when you start the cluster nothing will happen.

Copy link
Contributor Author

@smuda smuda Jul 12, 2023

Choose a reason for hiding this comment

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

I added a small instruction on how to configure KUBECONFIG to be able to access the cluster.

Yes, once the cluster is up and running, nothing will happen. The idea was to create a cluster which is usable for development, much like the previous instructions in the CONTRIBUTING.md file. I've added an instruction pointing to make run to run the operator locally and changed the client.preferIngress=true so it works.

@NissesSenap NissesSenap enabled auto-merge (squash) July 12, 2023 06:37
Copy link
Collaborator

@NissesSenap NissesSenap left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @smuda for this. I think it will help a lot of other developers to kick-start their workflow.

@NissesSenap NissesSenap merged commit dc808c8 into grafana:master Jul 12, 2023
9 checks passed
@smuda smuda deleted the feature/add-kind-script branch July 12, 2023 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Script for preparing kind during development
4 participants