Skip to content

cluster manager: support dynamic add/remove#323

Merged
mattklein123 merged 4 commits intomasterfrom
cm_add_remove
Jan 6, 2017
Merged

cluster manager: support dynamic add/remove#323
mattklein123 merged 4 commits intomasterfrom
cm_add_remove

Conversation

@mattklein123
Copy link
Copy Markdown
Member

This is all of the plumbing required to support the CDS API. I will do the
actual polling API in a follow up as this change is large enough as it is
(it's also missing stats and some debug logging which I will also do in a follow
up).

What this change does:

  1. Add 2 new CM APIs which allow clusters to be added and removed at runtime.
  2. Changes the ownership logic of clusters such that primary clusters are now
    a unique_ptr and are inline destroyed on the main thread. Workers only have
    access to the backing shared ClusterInfo.
  3. Fixes DNS so that requests can be cancelled and correctly implements cancel
    in the relevant cluster destructors.
  4. Most of this change is actually a refactor so that the CM only interacts with
    the cluster interface. Otherwise testing all of the required scenarios is
    too complicated. With the refactor done it's much easier to test all of the
    different scenarios. This required generalizing a few things about how we
    were initializing SDS clusters.

A few notes about this implementation:

  1. Dynamic clusters are immediately added, without any initialize phase. This means
    that there will be a period of fetching/HC for dynamic clusters depending on the
    configuration.
  2. There are no integration tests. We should add those in the future.

This is all of the plumbing required to support the CDS API. I will do the
actual polling API in a follow up as this change is large enough as it is
(it's also missing stats and some debug logging which I will also do in a follow
up).

What this change does:
1) Add 2 new CM APIs which allow clusters to be added and removed at runtime.
2) Changes the ownership logic of clusters such that primary clusters are now
   a unique_ptr and are inline destroyed on the main thread. Workers only have
   access to the backing shared ClusterInfo.
3) Fixes DNS so that requests can be cancelled and correctly implements cancel
   in the relevant cluster destructors.
4) Most of this change is actually a refactor so that the CM only interacts with
   the cluster interface. Otherwise testing all of the required scenarios is
   too complicated. With the refactor done it's much easier to test all of the
   different scenarios. This required generalizing a few things about how we
   were initializing SDS clusters.

A few notes about this implementation:
1) Dynamic clusters are immediately added, without any initialize phase. This means
   that there will be a period of fetching/HC for dynamic clusters depending on the
   configuration.
2) There are no integration tests. We should add those in the future.
@mattklein123
Copy link
Copy Markdown
Member Author

@lyft/network-team


/**
* @return std::unordered_map<std::string, ConstClusterPtr> all current clusters. These are are
* the primary (not thread local) clusters so should just be used for stats/admin.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

typo: 'are are'

/**
* @return std::unordered_map<std::string, ConstClusterPtr> all current clusters. These are are
* the primary (not thread local) clusters so should just be used for stats/admin.
* @return ClusterInfoMap all current clusters. These are are the primary (not thread local)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

incomplete sentence.

class ClusterManagerFactory {
public:
virtual ~ClusterManagerFactory() {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

comments for both of the methods.


cluster_manager.thread_local_clusters_[new_cluster->name()].reset(
new ThreadLocalClusterManagerImpl::ClusterEntry(cluster_manager, new_cluster));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: new line not needed.

initialized_callback_();
}
} else if (pending_cluster_init_ == secondary_init_clusters_.size()) {
// All other clusters have initialized. Now we start up the SDS clusters since they will
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

update comment to not refer to SDS clusters.

@mattklein123 mattklein123 merged commit c60a979 into master Jan 6, 2017
@mattklein123 mattklein123 deleted the cm_add_remove branch January 6, 2017 18:12
rshriram pushed a commit to rshriram/envoy that referenced this pull request Oct 30, 2018
Automatic merge from submit-queue.

[DO NOT MERGE] Auto PR to update dependencies of mixerclient

This PR will be merged automatically once checks are successful.
```release-note
none
```
yxue pushed a commit to yxue/envoy that referenced this pull request Dec 3, 2019
Signed-off-by: Yaroslav Skopets <y.skopets@gmail.com>
lambdai pushed a commit to lambdai/envoy-dai that referenced this pull request Jul 21, 2021
jpsim pushed a commit that referenced this pull request Nov 28, 2022
Prevents warnings when building:

```
WARNING:
CONFIGURATION: bazel-out/android-x86-fastbuild/bin/examples/kotlin/shared/hello_envoy_shared_lib_base_processed_manifest/AndroidManifest.xml has no minSdkVersion. Using 1.
[204 / 242] Merging Android resources for @androidsdk//com.android.support:support-vector-drawable-25.0.0; 1s local ... (4 actions running)
INFO: From Validating Android resources for //dist:envoy_mobile_android:
Aug 12, 2019 10:21:21 PM com.google.devtools.build.android.AndroidManifest parseFrom
WARNING:
CONFIGURATION: bazel-out/android-x86-fastbuild/bin/dist/envoy_mobile_android_processed_manifest/AndroidManifest.xml has no minSdkVersion. Using 1.
```

Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit that referenced this pull request Nov 29, 2022
Prevents warnings when building:

```
WARNING:
CONFIGURATION: bazel-out/android-x86-fastbuild/bin/examples/kotlin/shared/hello_envoy_shared_lib_base_processed_manifest/AndroidManifest.xml has no minSdkVersion. Using 1.
[204 / 242] Merging Android resources for @androidsdk//com.android.support:support-vector-drawable-25.0.0; 1s local ... (4 actions running)
INFO: From Validating Android resources for //dist:envoy_mobile_android:
Aug 12, 2019 10:21:21 PM com.google.devtools.build.android.AndroidManifest parseFrom
WARNING:
CONFIGURATION: bazel-out/android-x86-fastbuild/bin/dist/envoy_mobile_android_processed_manifest/AndroidManifest.xml has no minSdkVersion. Using 1.
```

Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: JP Simard <jp@jpsim.com>
mathetake pushed a commit that referenced this pull request Mar 3, 2026
**Commit Message**

Add helm install.

**Related Issues/PRs (if applicable)**

Fixes #302

---------

Signed-off-by: Loong <long0dai@foxmail.com>
mathetake added a commit that referenced this pull request Mar 3, 2026
**Commit Message**

Since #323, helm is no longer needed to be locally installed.

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants