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 fake apiserver #1610

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mquhuy
Copy link
Member

@mquhuy mquhuy commented Apr 22, 2024

Fake API server is a tool running inside a kubernetes cluster, and "generates" in-memory api server endpoints. These endpoints can be used, for e.g., to represent the clusters created by CAPM3 using fake hardware so that CAPI confirms that the cluster was provisioned successfully.

@metal3-io-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kashifest for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@metal3-io-bot metal3-io-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Apr 22, 2024
@mquhuy mquhuy force-pushed the mquhuy/add-fake-apiserver branch 2 times, most recently from e9a7158 to d4b4b60 Compare April 24, 2024 08:14
@metal3-io-bot metal3-io-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Apr 24, 2024
@mquhuy mquhuy force-pushed the mquhuy/add-fake-apiserver branch from 6a24a8f to a1e125f Compare May 15, 2024 08:40
@mquhuy
Copy link
Member Author

mquhuy commented May 15, 2024

/cc @lentzi90 @kashifest @Rozzii @tuminoid @adilGhaffarDev
This was proven to work, it's ready for reviews

@tuminoid
Copy link
Member

There is unrelated broken link failure, need to address that in another PR preferably.

Copy link
Member

@tuminoid tuminoid left a comment

Choose a reason for hiding this comment

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

Some nits for starters.

hack/fake-apiserver/Dockerfile Outdated Show resolved Hide resolved
hack/fake-apiserver/Dockerfile Outdated Show resolved Hide resolved
hack/fake-apiserver/Dockerfile Outdated Show resolved Hide resolved
hack/fake-apiserver/README.md Outdated Show resolved Hide resolved
@mquhuy mquhuy force-pushed the mquhuy/add-fake-apiserver branch 2 times, most recently from 02cc265 to 2ee5877 Compare May 15, 2024 11:18
Copy link
Member

@tuminoid tuminoid left a comment

Choose a reason for hiding this comment

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

The Dockerfile is broken now.

Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
hack/fake-apiserver/README.md Outdated Show resolved Hide resolved
@mquhuy mquhuy force-pushed the mquhuy/add-fake-apiserver branch 2 times, most recently from 4b229a6 to 2a3401d Compare May 15, 2024 11:33
hack/fake-apiserver/go.mod Outdated Show resolved Hide resolved
hack/fake-apiserver/main.go Outdated Show resolved Hide resolved
```

```shell
curl <pod_ip>:<port>/register?resource=<namespace>/<cluster_name>&caKey=<caKeyEncoded>&caCert=<caCertEncoded>&etcdKey=<etcdKeyEncoded>&etcdCert=<etcdCertEncoded>"
Copy link
Member

Choose a reason for hiding this comment

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

An example with everything written out would be useful here

hack/fake-apiserver/README.md Outdated Show resolved Hide resolved
Port int
}

func register(w http.ResponseWriter, r *http.Request) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you please add a docstring here describing what this function does? Include the URL parameters


}

func updateNode(w http.ResponseWriter, r *http.Request) {
Copy link
Member

Choose a reason for hiding this comment

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

Description would be nice here also


## How to use

After building the container image and deploy it to a kubernetes cluster,
Copy link
Member

Choose a reason for hiding this comment

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

A minimal example of how to do this would be very helpful.

docker build ...
kind load image ... # or docker push
kubectl create deploy ...
kubectl create service ... # or get IP of pod
kubectl port-forward ...

Makefile Show resolved Hide resolved
@Rozzii Rozzii added this to the 1.8.0 milestone Jun 28, 2024
@mquhuy mquhuy force-pushed the mquhuy/add-fake-apiserver branch from 2a3401d to 009fe7c Compare July 1, 2024 06:56
@mquhuy mquhuy force-pushed the mquhuy/add-fake-apiserver branch 3 times, most recently from 3a90e95 to d3d61a0 Compare August 2, 2024 09:32
Signed-off-by: Huy Mai <huy.mai@est.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
Status: CAPM3 WIP
Development

Successfully merging this pull request may close these issues.

None yet

5 participants