Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ flowchart LR
- `http://localhost:8000/adapters/{name}/mcp` (Streamable HTTP)
- `http://localhost:8000/adapters/{name}/sse` (SSE)

8. **Clean up the environment**
To remove all deployed resources, delete the Kubernetes namespace:
```sh
kubectl delete namespace adapter
```

## Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class KubernetesAdapterDeploymentManager : IAdapterDeploymentManager

public KubernetesAdapterDeploymentManager(string containerRegistryAddress, IKubeClientWrapper kubeClient, ILogger<KubernetesAdapterDeploymentManager> logger)
{
ArgumentException.ThrowIfNullOrEmpty(containerRegistryAddress, nameof(containerRegistryAddress));
ArgumentException.ThrowIfNullOrEmpty(containerRegistryAddress);

_containerRegistryAddress = containerRegistryAddress;
_kubeClient = kubeClient ?? throw new ArgumentNullException(nameof(kubeClient));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public async Task<AdapterResource> CreateAsync(ClaimsPrincipal accessContext, Ad

public async Task<AdapterResource?> GetAsync(ClaimsPrincipal accessContext, string name, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(accessContext, nameof(accessContext));
ArgumentException.ThrowIfNullOrEmpty(name, nameof(name));
ArgumentNullException.ThrowIfNull(accessContext);
ArgumentException.ThrowIfNullOrEmpty(name);

logger.LogInformation("Start getting /adapters/{name}.", name.Sanitize());

Expand Down Expand Up @@ -90,8 +90,8 @@ public async Task<AdapterResource> UpdateAsync(ClaimsPrincipal accessContext, Ad

public async Task DeleteAsync(ClaimsPrincipal accessContext, string name, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(accessContext, nameof(accessContext));
ArgumentException.ThrowIfNullOrEmpty(name, nameof(name));
ArgumentNullException.ThrowIfNull(accessContext);
ArgumentException.ThrowIfNullOrEmpty(name);

logger.LogInformation("Start deleting /adapters/{name}.", name.Sanitize());
await CheckWriteAccessAsync(accessContext, name, cancellationToken).ConfigureAwait(false);
Expand All @@ -105,7 +105,7 @@ public async Task DeleteAsync(ClaimsPrincipal accessContext, string name, Cancel

public async Task<IEnumerable<AdapterResource>> ListAsync(ClaimsPrincipal accessContext, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(accessContext, nameof(accessContext));
ArgumentNullException.ThrowIfNull(accessContext);

logger.LogInformation("Start listing /adapters for user.");
var adapterResources = await _store.ListAsync(cancellationToken).ConfigureAwait(false);
Expand All @@ -116,8 +116,8 @@ public async Task<IEnumerable<AdapterResource>> ListAsync(ClaimsPrincipal access

private async Task CheckWriteAccessAsync(ClaimsPrincipal accessContext, string resouceName, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(accessContext, nameof(accessContext));
ArgumentException.ThrowIfNullOrEmpty(resouceName, nameof(resouceName));
ArgumentNullException.ThrowIfNull(accessContext);
ArgumentException.ThrowIfNullOrEmpty(resouceName);

var existing = await _store.TryGetAsync(resouceName, cancellationToken).ConfigureAwait(false)
?? throw new ArgumentException("The adapter does not exist.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ private async Task StreamProxiedSseHttpResponseAsync(HttpContext context, string

private static Uri ReplaceUriAddress(Uri originalUri, string newAddress)
{
ArgumentNullException.ThrowIfNull(originalUri, nameof(originalUri));
ArgumentException.ThrowIfNullOrEmpty(newAddress, nameof(newAddress));
ArgumentNullException.ThrowIfNull(originalUri);
ArgumentException.ThrowIfNullOrEmpty(newAddress);

var segments = originalUri.AbsolutePath.Split('/', StringSplitOptions.RemoveEmptyEntries);

Expand Down