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 controller scaffold #104

Merged
merged 3 commits into from
Nov 21, 2022
Merged

Conversation

Xieql
Copy link
Contributor

@Xieql Xieql commented Nov 19, 2022

What type of PR is this?

/kind feature

What this PR does / why we need it:

part #96

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

@netlify
Copy link

netlify bot commented Nov 19, 2022

Deploy Preview for preliminary-kurator canceled.

Name Link
🔨 Latest commit 79d55ad
🔍 Latest deploy log https://app.netlify.com/sites/preliminary-kurator/deploys/637af50290b6690009ad46b2

@Xieql Xieql changed the title add-controller-scaffold add controller scaffold Nov 19, 2022
@Xieql Xieql force-pushed the add-controller-scaffold branch 2 times, most recently from 08923bb to 071ea69 Compare November 19, 2022 06:42
Makefile Outdated
@@ -152,3 +153,23 @@ gen-crd: init-codegen ## Generate WebhookConfiguration, ClusterRole and CustomRe
.PHONY: generate
generate: init-codegen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
hack/update-codegen.sh

.PHONY: install-crd
install-crd: gen-crd ## Install CRDs into the K8s cluster specified in ~/.kube/config.
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not think we need this; we use helm to install all stuffs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok,it has been removed

Makefile Outdated
install-crd: gen-crd ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build manifests/charts | kubectl apply -f -

.PHONY: uninstall-crd
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Makefile Outdated
$(KUSTOMIZE) build manifests/charts | kubectl delete --ignore-not-found=$(ignore-not-found) -f -

.PHONY: run-controller
run-controller: gen-crd generate fmt vet ## Run a controller from your host.
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Makefile Outdated
go run ./cmd/controller/main.go

.PHONY: fmt
fmt: ## Run go fmt against code.
Copy link
Contributor

Choose a reason for hiding this comment

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

why need this?

Makefile Outdated
go fmt ./...

.PHONY: vet
vet: ## Run go vet against code.
Copy link
Contributor

Choose a reason for hiding this comment

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

same with fmt

@@ -0,0 +1,121 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

should be part of cluster-operator

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -71,7 +71,7 @@ type Machine struct {
HostName string `json:"hostName,omitempty"`
// PrivateIP is the private ip address of the machine:
// +optional
PrivateIP string `json:"publicIP,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

split to a single commit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

Choose a reason for hiding this comment

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

good catch

@Xieql Xieql force-pushed the add-controller-scaffold branch 5 times, most recently from b308bcd to 197a279 Compare November 19, 2022 08:24
limitations under the License.
*/

// code in the package copied from: https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/v1.5.1/main.go
Copy link
Contributor

Choose a reason for hiding this comment

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

???

Copy link
Contributor Author

Choose a reason for hiding this comment

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

...... my mistake

Signed-off-by: Xieql <xieqianglong@huawei.com>
@Xieql Xieql force-pushed the add-controller-scaffold branch from fe2ee59 to 77653ec Compare November 21, 2022 02:22
@@ -71,7 +71,7 @@ type Machine struct {
HostName string `json:"hostName,omitempty"`
// PrivateIP is the private ip address of the machine:
// +optional
PrivateIP string `json:"publicIP,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

good catch

@@ -0,0 +1,48 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

CustomResources seems very general. how about customcluster.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

)

// CustomClusterReconciler reconciles a CustomCluster object
type CustomClusterReconciler struct {
Copy link
Member

Choose a reason for hiding this comment

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

s/CustomClusterReconciler/CustomClusterController

Copy link
Contributor Author

@Xieql Xieql Nov 21, 2022

Choose a reason for hiding this comment

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

ok

Signed-off-by: Xieql <xieqianglong@huawei.com>
)

// CustomMachineReconciler reconciles a CustomMachine object
type CustomMachineReconciler struct {
Copy link
Member

Choose a reason for hiding this comment

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

s/CustomMachineReconciler/CustomMachineController

@hzxuzhonghu
Copy link
Member

I think we still lack the clusterrolem but can be in a follow up

Signed-off-by: Xieql <xieqianglong@huawei.com>
@kurator-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

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

@kurator-bot kurator-bot merged commit 5390bf3 into kurator-dev:main Nov 21, 2022
@Xieql Xieql deleted the add-controller-scaffold branch December 22, 2022 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants