Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

Add YurtIngress operator implementation #32

Merged
merged 2 commits into from
Dec 31, 2021

Conversation

zzguang
Copy link
Member

@zzguang zzguang commented Dec 26, 2021

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:
/kind bug
/kind documentation
/kind enhancement
/kind good-first-issue
/kind feature
/kind question
/kind design
/sig ai
/sig iot
/sig network
/sig storage
/sig storage

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?


other Note

@openyurt-bot
Copy link
Collaborator

@zzguang: GitHub didn't allow me to assign the following users: your_reviewer.

Note that only openyurtio members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:
/kind bug
/kind documentation
/kind enhancement
/kind good-first-issue
/kind feature
/kind question
/kind design
/sig ai
/sig iot
/sig network
/sig storage
/sig storage

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?


other Note

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@zzguang
Copy link
Member Author

zzguang commented Dec 26, 2021

/assign @rambohe-ch, @kadisi

service:
name: yurtapp-webhook-service
namespace: kube-system
path: /validate-apps-openyurt-io-v1alpha1-yurtingress
Copy link
Member

Choose a reason for hiding this comment

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

lack of "mutate-apps-openyurt-io-v1alpha1-yurtingress" ?

Copy link
Member

Choose a reason for hiding this comment

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

only validating webhook is implemented, no mutating webhook.

Copy link
Member

Choose a reason for hiding this comment

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

mutate-apps-openyurt-io-v1alpha1-yurtingress shoud auto generated by pkg/yurtappmanager/webhook/yurtingress/mutating/webhooks.go:
/ +kubebuilder:webhook:path=/mutate-apps-openyurt-io-v1alpha1-yurtingress,mutating=true,failurePolicy=fail,groups=apps.openyurt.io,resources=yurtingresses,verbs=create;update,versions=v1alpha1,name=myurtingress.kb.io

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it is auto generated, and the generated codes are kept as well. But if we don't need to modify the request from user, why not leave this mutating webhook disabled? It might reduce the communication with webhook server as well.

Copy link
Member

Choose a reason for hiding this comment

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

ok, will add mutating webhook to keep consistent with other components. :-)

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it is auto generated, and the generated codes are kept as well. But if we don't need to modify the request from user, why not leave this mutating webhook disabled? It might reduce the communication with webhook server as well.

yes, if we don't need to modify the request from user , we need let this mutating webhook disabled 。 So we need to comment out this line / +kubebuilder:webhook:path=/mutate-apps-openyurt-io-v1alpha1-yurtingress,mutating=true,failurePolicy=fail,groups=apps.openyurt.io,resources=yurtingresses,verbs=create;update,versions=v1alpha1,name=myurtingress.kb.io in pkg/yurtappmanager/webhook/yurtingress/mutating/webhooks.go file. Otherwise, the mutate configuration will be generated in manager.yaml each time make generate-manifests is executed .

@zzguang zzguang changed the title Ingress submit Add YurtIngress operator implementation Dec 28, 2021
isIngressCRChanged = true
ownerRef := prepareDeploymentOwnerReferences(instance)
if currentPoolNames == nil {
yurtapputil.CreateNginxIngressCommonResource(r.Client)
Copy link
Member

Choose a reason for hiding this comment

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

need to deal error

}
err = client.Create(context.Background(), ns)
if err != nil {
return fmt.Errorf("fail to create the namespace/%s: %v", ns.Name, err)
Copy link
Member

Choose a reason for hiding this comment

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

need to check whether is exist

}
for _, pool := range addedPools {
replicas := instance.Spec.Replicas
yurtapputil.CreateNginxIngressSpecificResource(r.Client, pool, replicas, ownerRef)
Copy link
Member

Choose a reason for hiding this comment

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

need deal with error

isIngressCRChanged = true
for _, pool := range removedPools {
if desiredPoolNames == nil {
yurtapputil.DeleteNginxIngressSpecificResource(r.Client, pool, true)
Copy link
Member

Choose a reason for hiding this comment

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

need to deal with error

if desiredPoolNames == nil {
yurtapputil.DeleteNginxIngressSpecificResource(r.Client, pool, true)
} else {
yurtapputil.DeleteNginxIngressSpecificResource(r.Client, pool, false)
Copy link
Member

Choose a reason for hiding this comment

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

deal with error

}
}
if desiredPoolNames == nil {
yurtapputil.DeleteNginxIngressCommonResource(r.Client)
Copy link
Member

Choose a reason for hiding this comment

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

error

Copy link
Member

@kadisi kadisi left a comment

Choose a reason for hiding this comment

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

well done , just some nit

@zzguang
Copy link
Member Author

zzguang commented Dec 30, 2021

Thanks for @kadisi 's valuable suggestions, please review the updated version.

zhenggu1 and others added 2 commits December 31, 2021 00:22
YurtIngress operator is used to control and manage ingress controller in NodePools,
user can enable/disable ingress feature of multi NodePools through the singleton
YurtIngress CR, the init version only contains some basic functions such as which
NodePools to enable ingress, ingress controller replicas for every pool, and it can
be extended to support other functions according to user requirements in future.

Signed-off-by: zhenggu1 <zhengguang.zhang@intel.com>
Signed-off-by: Linda Yu <linda.yu@intel.com>
@kadisi
Copy link
Member

kadisi commented Dec 31, 2021

/lgtm

@kadisi
Copy link
Member

kadisi commented Dec 31, 2021

/approve

@openyurt-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kadisi, zzguang

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

@openyurt-bot openyurt-bot added the approved approved label Dec 31, 2021
@openyurt-bot openyurt-bot merged commit 457ddb5 into openyurtio:master Dec 31, 2021
@kadisi
Copy link
Member

kadisi commented Dec 31, 2021

@zzguang @LindaYu17 @gnunu Thank you for your contributions。

@gnunu
Copy link
Member

gnunu commented Dec 31, 2021

@zzguang @LindaYu17 @gnunu Thank you for your contributions。

THANKS!
HAPPY 2022!

zzguang referenced this pull request in zzguang/openyurt Jan 23, 2022
Signed-off-by: zhenggu1 <zhengguang.zhang@intel.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants