-
Notifications
You must be signed in to change notification settings - Fork 37
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
Feat:Add Gateway Plugin Support #686
Conversation
✅ Deploy Preview for kurator-dev canceled.
|
662b895
to
f561601
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your PR is too large.
In fact, it can be split into multiple PRs such as API changes, fleet plugin installation implementation, feature implementation, etc.
It is convenient for development and review.
checkIntervalSeconds: 90 | ||
checkFailedTimes: 2 | ||
metrics: | ||
- name: my-metric |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name my-metric
is not accurate enough, so we suggest changing it to nginx-request-success-rate
.
checkIntervalSeconds: 90 | ||
checkFailedTimes: 2 | ||
metrics: | ||
- name: my-metric |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
examples/rollout/canaryKuma.yaml
Outdated
checkIntervalSeconds: 90 | ||
checkFailedTimes: 2 | ||
metrics: | ||
- name: my-metric |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
// number: application.syncPolicies.rollout.port | ||
// ``` | ||
// +optional | ||
Host string `json:"host,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your comments are confusing, what should I put in this field? Is it ingress.name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, you only need to fill in the host field as the host of the ingress. The other default items will be hard-coded in the code as configured above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the contents of this field are the contents of spec.rules.hos
t in the above?
// for kuma | ||
// Defaults to http | ||
// +optional | ||
Protocol string `json:"protocol,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this field only used by kuma?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
// PublicTestloader defines whether to install the publictestloader or not. | ||
// In addition to the public testloader you can configure here, | ||
// you can also specify a private testloader in the Application.Spec.SyncPolicies.Rollout.TestLoader | ||
PublicTestloader bool `json:"publicTestloader,omitempty"` | ||
// ProviderConfig defines the configuration for the TrafficRoutingProvider. | ||
// +optional | ||
ProviderConfig *Config `json:"config,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What can this field be configured for? Is it used to install TrafficRoutingProvider?
Please clarify in the comments
if err != nil { | ||
return ctrl.Result{}, errors.Wrapf(err, "failed to set namespace %s istio-injection enable", rolloutPolicy.Workload.Namespace) | ||
return ctrl.Result{}, errors.Wrapf(err, "failed to set namespace %s %s's Inject enable", rolloutPolicy.Workload.Namespace, provider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return ctrl.Result{}, errors.Wrapf(err, "failed to set namespace %s %s's Inject enable", rolloutPolicy.Workload.Namespace, provider) | |
return ctrl.Result{}, errors.Wrapf(err, "failed to set namespace %s %s's sidecar inject enable", rolloutPolicy.Workload.Namespace, provider) |
default: | ||
return ctrl.Result{}, errors.Errorf("unknown provider type %s", provider) | ||
} | ||
log.Info("pre-operation of operating canary success") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
@@ -270,6 +307,14 @@ func (a *ApplicationManager) deleteResourcesInMemberClusters(ctx context.Context | |||
} | |||
for _, cluster := range destinationClusters { | |||
newClient := cluster.Client.CtrlRuntimeClient() | |||
|
|||
ns := &corev1.Namespace{} | |||
if err := deleteResourceCreatedByKurator(ctx, namespacedName, newClient, ns); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why delete ns? Are you sure all the resources in this ns were created by Kurator?
@@ -569,6 +710,23 @@ func addLabels(obj client.Object, key, value string) client.Object { | |||
return obj | |||
} | |||
|
|||
func addAnnotations(obj client.Object, keysAndValues ...string) client.Object { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use map to store keysAndValues?
Signed-off-by: Gidi233 <qpbtyfh@gmail.com>
Signed-off-by: Gidi233 <qpbtyfh@gmail.com>
Signed-off-by: Gidi233 <qpbtyfh@gmail.com>
Signed-off-by: Gidi233 <qpbtyfh@gmail.com>
Signed-off-by: Gidi233 <qpbtyfh@gmail.com>
Signed-off-by: Gidi233 <qpbtyfh@gmail.com>
// number: application.syncPolicies.rollout.port | ||
// ``` | ||
// +optional | ||
Host string `json:"host,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the contents of this field are the contents of spec.rules.hos
t in the above?
@@ -239,6 +239,42 @@ type TrafficRoutingConfig struct { | |||
// +optional | |||
CorsPolicy *istiov1alpha3.CorsPolicy `json:"corsPolicy,omitempty"` | |||
|
|||
// Host defines the domain name you specify. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is `Host: spec.rules.host' ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes.
labels := ingress.GetLabels() | ||
if set := sets.New(strings.Split(labels[ingressLabelKey], ",")...); set.Contains(rollout.ServiceName) { | ||
if set.Len() == 1 { | ||
if deleteErr := kubeClient.Delete(ctx, ingress); deleteErr != nil && !apierrors.IsNotFound(deleteErr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to judge a NotFound Error
here? There a branch ingress already in the cluster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'll delete it.
if set := sets.New(strings.Split(labels[ingressLabelKey], ",")...); set.Contains(rollout.ServiceName) { | ||
if set.Len() == 1 { | ||
if deleteErr := kubeClient.Delete(ctx, ingress); deleteErr != nil && !apierrors.IsNotFound(deleteErr) { | ||
return errors.Wrapf(deleteErr, "failed to Delete ingress %s in %s", namespaceName.Name, namespaceName.Namespace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
return errors.Wrapf(deleteErr, "failed to Delete ingress %s in %s", namespaceName.Name, namespaceName.Namespace) | |
return errors.Wrapf(deleteErr, "failed to Delete ingress %s in %s", rollout.Workload.Namespace, ingress.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rollout.Workload.Namespace
is the same as namespaceName.Name
and I thought when an error occurs the ingress object will be null?
So I don't think it needs to be changed
labels[ingressLabelKey] = strings.Join(set.Delete(rollout.ServiceName).UnsortedList(), ",") | ||
ingress.SetLabels(labels) | ||
if err := kubeClient.Update(ctx, ingress); err != nil { | ||
return errors.Wrapf(err, "failed to Update ingress %s in %s", namespaceName.Name, namespaceName.Namespace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
ingress.Spec.Rules = newRules | ||
labels[ingressLabelKey] = strings.Join(set.Delete(rollout.ServiceName).UnsortedList(), ",") | ||
ingress.SetLabels(labels) | ||
if err := kubeClient.Update(ctx, ingress); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why put update
and delete
in one function?
Separate these two functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
} | ||
|
||
// create/update ingress configuration | ||
func renderIngress(ingress *ingressv1.Ingress, rollout *applicationapi.RolloutConfig) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this only used by nginx?
Maybe the function name can be replaced to renderNginxIngress
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
obj.SetAnnotations(ann) | ||
} else { | ||
for k, v := range ann { | ||
annotations[k] = v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may change the original annotations, which need to be evaluated to see if there is any .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checked
almost LGTM |
f8dfd2b
to
0cfb528
Compare
/lgtm |
Signed-off-by: Gidi233 <qpbtyfh@gmail.com>
Please fix lint error |
/cc @hzxuzhonghu This pr is ready to merge |
@LiZhenCheng9527: GitHub didn't allow me to request PR reviews from the following users: is, ready, to, merge, This, pr. Note that only kurator-dev members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
[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 |
/lgtm |
What type of PR is this?
/kind api-change
/kind feature
What this PR does / why we need it:
Users can choose kuma and nginx in the configuration of rollout and fleet flagger.
Specifically, you can set the chart and value of the helm deployment gateway in the fleet configuration.
You can specify the host of Ingress (required) and the protocol used by Kuma (default is http) in the rollout configuration.
Ingress can automatically complete the deployment of canary through application.
Kuma needs to manually install Prometheus and mesh in the target cluster.
Which issue(s) this PR fixes:
Fixes #651
Does this PR introduce a user-facing change?:
For application:
For Fleet