-
Notifications
You must be signed in to change notification settings - Fork 880
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 support for Istio multicluster setup. Fixes #1191. #1274
feat: Add support for Istio multicluster setup. Fixes #1191. #1274
Conversation
e731ccc
to
4004f62
Compare
4004f62
to
631bdd9
Compare
Verified the change in our multicluster setup. I will update the docs on how to set it up next. In brief:
|
@jessesuen Please take a look whenever you find the time. Thanks. |
@jessesuen could you please take a look and provide any feedback for the approach? Thanks. |
7cff585
to
0c7cc07
Compare
0c7cc07
to
3fd8284
Compare
Codecov Report
@@ Coverage Diff @@
## master #1274 +/- ##
==========================================
- Coverage 81.40% 81.28% -0.12%
==========================================
Files 106 107 +1
Lines 9778 9818 +40
==========================================
+ Hits 7960 7981 +21
- Misses 1278 1295 +17
- Partials 540 542 +2
Continue to review full report at Codecov.
|
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.
Looks good. Just some minor questions. Thanks.
name: argo-rollouts-istio-primary | ||
namespace: <any-namespace-preferrably-config-namespace> | ||
``` | ||
2. Create a `ClusterRole` that provides access to Rollout controller in the Istio primary 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.
The default role in the manifest folder should be good
argo-rollouts/manifests/role/argo-rollouts-clusterrole.yaml
Lines 139 to 150 in 460262e
# virtualservice/destinationrule access needed for using the Istio provider | |
- apiGroups: | |
- networking.istio.io | |
resources: | |
- virtualservices | |
- destinationrules | |
verbs: | |
- watch | |
- get | |
- update | |
- patch | |
- list |
Could you put a note there so that user doesn't need to create extra clusterrole.
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.
Good point. If Argo controller is also installed in the primary cluster (not mandatory), then we could just use the default argo-rollouts-clusterrole
instead of creating another in the primary cluster. I will add a note to mention the same. Thanks.
PrimaryClusterSecretLabel = "istio.argoproj.io/primary-cluster" | ||
) | ||
|
||
func GetPrimaryClusterDynamicClient(kubeClient kubernetes.Interface, namespace string) (string, dynamic.Interface) { |
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.
Shall we return an error here? If a user sets up the PrimaryClusterSecretLabel
, the intention is to use the multi-cluster feature. Without returning an error, user may miss the error message in the caller.
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.
It depends on do we want to stop the controller from starting up if there is an error in this setup? The current behavior is that the error related to the primary cluster setup will be logged as an error, but it won't stop the argo controller from starting up. The controller will just continue doing what it does now, i.e., assume the cluster it's running on as the cluster where Istio config is available.
utils/istio/multicluster.go
Outdated
primaryClusterConfig, err := buildKubeClientConfig(kubeConfig) | ||
if err != nil { | ||
log.Errorf("Error building kubeconfig for primary cluster %s: %v", clusterId, err) | ||
return clusterId, nil, err |
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.
can we include the clusterID in the returned error message, fmt.Errorf("Error building kubeconfig for primary cluster %s: %v", clusterId, err)
} | ||
|
||
func getKubeClientConfig(secret *corev1.Secret) (string, clientcmd.ClientConfig, error) { | ||
for clusterId, kubeConfig := range secret.Data { |
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.
Could you elaborate a bit on how to determine the clusterid to return its config? Thanks.
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 Secret
passed to this method is the secret generated via istioctl x create-remote-secret
and labeled istio.argoproj.io/primary-cluster: true
. The istioctl x create-remote-secret
command generates a Secret with the data
as: clusterId
: encoded-cluster-config
. Here we read that data and build the kube config for the primary cluster.
3fd8284
to
68a2408
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.
Great work!
Change LGTM. @shakti-das - can you fix linting errors and I can merge it in |
Signed-off-by: Shakti <[email protected]>
Signed-off-by: Shakti <[email protected]>
Signed-off-by: Shakti <[email protected]>
Signed-off-by: Shakti <[email protected]>
Signed-off-by: Shakti <[email protected]>
Signed-off-by: Shakti <[email protected]>
Signed-off-by: Shakti <[email protected]>
feb4b9a
to
ba80df2
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@jessesuen did a
Could you please re-trigger the workflows? Thanks. |
The log in Lint Go job:
|
Yep this was a hiccup in the github action. Reran and linting has passed |
Fixes #1191
Checklist:
"fix(controller): Updates such and such. Fixes #1234"
.