-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: daizhenyu <[email protected]>
- Loading branch information
Showing
14 changed files
with
564 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...re/sermant-agentcore-core/src/main/java/io/sermant/core/service/xds/config/XdsConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (C) 2024-2024 Sermant Authors. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.sermant.core.service.xds.config; | ||
|
||
import io.sermant.core.config.common.BaseConfig; | ||
import io.sermant.core.config.common.ConfigFieldKey; | ||
import io.sermant.core.config.common.ConfigTypeKey; | ||
|
||
/** | ||
* XdsConfig | ||
* | ||
* @author daizhenyu | ||
* @since 2024-05-08 | ||
**/ | ||
@ConfigTypeKey("xds.config") | ||
public class XdsConfig implements BaseConfig { | ||
@ConfigFieldKey("control.plane.address") | ||
private String controlPlaneAddress; | ||
|
||
@ConfigFieldKey("security.enable") | ||
private boolean securityEnable = false; | ||
|
||
@ConfigFieldKey("certificate.path") | ||
private String certificatePath; | ||
|
||
@ConfigFieldKey("private.key.path") | ||
private String privateKeyPath; | ||
|
||
public String getControlPlaneAddress() { | ||
return controlPlaneAddress; | ||
} | ||
|
||
public void setControlPlaneAddress(String controlPlaneAddress) { | ||
this.controlPlaneAddress = controlPlaneAddress; | ||
} | ||
|
||
public boolean isSecurityEnable() { | ||
return securityEnable; | ||
} | ||
|
||
public void setSecurityEnable(boolean securityEnable) { | ||
this.securityEnable = securityEnable; | ||
} | ||
|
||
public String getCertificatePath() { | ||
return certificatePath; | ||
} | ||
|
||
public void setCertificatePath(String certificatePath) { | ||
this.certificatePath = certificatePath; | ||
} | ||
|
||
public String getPrivateKeyPath() { | ||
return privateKeyPath; | ||
} | ||
|
||
public void setPrivateKeyPath(String privateKeyPath) { | ||
this.privateKeyPath = privateKeyPath; | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
...mant-agentcore-core/src/main/java/io/sermant/core/service/xds/entity/ServiceInstance.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright (C) 2024-2024 Sermant Authors. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.sermant.core.service.xds.entity; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* service instance interface | ||
* | ||
* @author daizhenyu | ||
* @since 2024-05-09 | ||
**/ | ||
public interface ServiceInstance { | ||
/** | ||
* get xds cluster name | ||
* | ||
* @return cluster name | ||
*/ | ||
String getClusterName(); | ||
|
||
/** | ||
* get service name | ||
* | ||
* @return service name | ||
*/ | ||
String getServiceName(); | ||
|
||
/** | ||
* get service instance host | ||
* | ||
* @return service instance host | ||
*/ | ||
String getHost(); | ||
|
||
/** | ||
* get service instance port | ||
* | ||
* @return service instance port | ||
*/ | ||
int getPort(); | ||
|
||
/** | ||
* get service instance metadata | ||
* | ||
* @return metadata | ||
*/ | ||
Map<String, String> getMetaData(); | ||
|
||
/** | ||
* get service instance health status | ||
* | ||
* @return service instance health status | ||
*/ | ||
boolean isHealthy(); | ||
} |
37 changes: 37 additions & 0 deletions
37
...-core/src/main/java/io/sermant/core/service/xds/listener/XdsServiceDiscoveryListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (C) 2024-2024 Sermant Authors. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.sermant.core.service.xds.listener; | ||
|
||
import io.sermant.core.service.xds.entity.ServiceInstance; | ||
|
||
import java.util.EventListener; | ||
import java.util.Set; | ||
|
||
/** | ||
* XdsServiceListener | ||
* | ||
* @author daizhenyu | ||
* @since 2024-05-08 | ||
**/ | ||
public interface XdsServiceDiscoveryListener extends EventListener { | ||
/** | ||
* Process the updated service instance | ||
* | ||
* @param instances updated service instance | ||
*/ | ||
void process(Set<ServiceInstance> instances); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.