Skip to content
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

Feature/environment #43

Merged
merged 3 commits into from
Nov 15, 2024
Merged

Feature/environment #43

merged 3 commits into from
Nov 15, 2024

Conversation

0xF6
Copy link
Member

@0xF6 0xF6 commented Nov 15, 2024

Summary by CodeRabbit

  • New Features

    • Added support for recognizing "dockerenv" as a valid word in the user dictionary.
    • Introduced extension methods to determine the environment type (Kubernetes, Docker, Classic Host, Managed).
  • Enhancements

    • Updated environment checks for Kubernetes and Managed environments in various components, improving resource management and service configurations.
  • Bug Fixes

    • Adjusted logic to ensure proper handling of CPU metrics based on the environment type.
  • Documentation

    • Added new import statement for environment features in the main program file.

@0xF6 0xF6 requested a review from urumo November 15, 2024 00:04
Copy link

coderabbitai bot commented Nov 15, 2024

Walkthrough

The changes in this pull request primarily involve the addition of a user dictionary entry in the Argon.Server.sln.DotSettings file, the introduction of a new static class for environment extensions in EnvironmentExtensions.cs, and modifications to existing files that adjust how the application identifies and configures itself based on the environment (Kubernetes, Docker, etc.). Key methods and conditions have been updated to reflect these changes, influencing the initialization and resource management within the application.

Changes

File Path Change Summary
Argon.Server.sln.DotSettings Added entry: <s:Boolean x:Key="/Default/UserDictionary/Words/=dockerenv/@EntryIndexedValue">True</s:Boolean> to recognize "dockerenv" as a valid word.
src/Argon.Api/Argon.Api.csproj Modified XML declaration by adding a non-visible character at the beginning of the file.
src/Argon.Api/Features/Env/EnvironmentExtensions.cs Introduced EnvironmentExtensions class with methods: IsKube, IsDocker, IsClassicHost, IsManaged, and an enum ArgonEnvironmentKind to identify different environment types.
src/Argon.Api/Features/Orleanse/BalanceRule.cs Updated conditions in AddKubeResources and KubeResources methods to check for Kubernetes and managed environments instead of production, affecting resource initialization and CPU metrics fetching.
src/Argon.Api/Features/Orleanse/OrleansExtension.cs Modified AddOrleans method to replace development environment checks with Kubernetes checks for clustering strategy.
src/Argon.Api/Program.cs Added import for Argon.Api.Features.Env and changed environment checks from production to managed in service configuration and middleware setup.

Suggested reviewers

  • risen228
  • urumo

🐇 In the land of code where changes bloom,
A new word added to dispel the gloom.
With extensions for environments wide,
Kubernetes and Docker now take pride.
So hop along, let the features play,
In the world of Argon, we leap and sway! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@@ -86,6 +86,7 @@
<s:Boolean x:Key="/Default/InstalledDictionaries/InstalledDictionaries/=C_003A_005Cgit_005Chunspell_002Ddictionaries_005Cru_005FRU_005Cru_005FRU_002Edic/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=appsettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Behaviours/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=dockerenv/@EntryIndexedValue">True</s:Boolean>
Copy link
Contributor

Choose a reason for hiding this comment

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

???

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
Copy link
Contributor

Choose a reason for hiding this comment

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

??????????

@0xF6 0xF6 merged commit 629b059 into master Nov 15, 2024
5 of 6 checks passed
@0xF6 0xF6 deleted the feature/environment branch November 15, 2024 00:08
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (4)
src/Argon.Api/Features/Orleanse/OrleansExtension.cs (1)

36-39: Add logging and validation for environment detection.

Consider adding logging to track which clustering strategy is being used and validate the Kubernetes configuration when IsKube() is true.

 if (builder.Environment.IsKube())
+{
+    builder.Services.AddLogging(logging =>
+        logging.AddDebug().AddConsole());
+    var logger = builder.Services.BuildServiceProvider()
+        .GetRequiredService<ILogger<OrleansExtension>>();
+    logger.LogInformation("Configuring Orleans for Kubernetes clustering");
     siloBuilder.UseKubeMembership();
+}
 else
+{
+    var logger = builder.Services.BuildServiceProvider()
+        .GetRequiredService<ILogger<OrleansExtension>>();
+    logger.LogInformation("Using localhost clustering for development");
     siloBuilder.UseLocalhostClustering();
+}
src/Argon.Api/Program.cs (1)

47-47: Address TODO comment regarding AutoMapper configuration

The comment suggests that the AutoMapper configuration might need attention or improvement.

Would you like me to help create a more explicit AutoMapper configuration or open an issue to track this task?

src/Argon.Api/Features/Orleanse/BalanceRule.cs (2)

Line range hint 31-40: Consider making the polling interval configurable and optimize the polling loop.

The current implementation has two potential improvements:

  1. The polling interval should be configurable to support different environments and requirements.
  2. The Task.Yield() call seems unnecessary and could be removed.

Consider this implementation:

 protected async override Task ExecuteAsync(CancellationToken stoppingToken)
 {
+    var interval = TimeSpan.FromSeconds(
+        double.Parse(configuration["Kubernetes:PollingIntervalSeconds"] ?? "5"));
     while (!stoppingToken.IsCancellationRequested)
     {
-        await Task.Yield();
         await resources.FetchAsync();
-        await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken);
+        await Task.Delay(interval, stoppingToken);
     }
 }

Line range hint 95-121: Consider making timing parameters configurable and add documentation.

The balancing logic could be improved in several ways:

  1. The smoothing factor (0.1) should be configurable
  2. The minimum rebalance interval (0.5 minutes) should be configurable
  3. The mathematical formula for calculating the result needs documentation explaining its rationale

Consider these improvements:

 public class BalanceRule(ISiloStatusOracle oracle, IConfiguration config, IKubeResources kubeResources) :
     IImbalanceToleranceRule, ILifecycleParticipant<ISiloLifecycle>, ILifecycleObserver, ISiloStatusListener
 {
     private readonly object guarder = new();
     private readonly ConcurrentDictionary<SiloAddress, SiloStatus> silos = new();
     private ulong ImbalanceDelta;
     private readonly double Base = double.Parse(config["clustering:base"] ?? "10");
-    private readonly TimeSpan MinRebalanceInterval = TimeSpan.FromMinutes(0.5);
+    private readonly TimeSpan MinRebalanceInterval = TimeSpan.FromMinutes(
+        double.Parse(config["clustering:minRebalanceIntervalMinutes"] ?? "0.5"));
+    private readonly double SmoothingFactor = double.Parse(config["clustering:smoothingFactor"] ?? "0.1");
     private DateTime lastRebalanceTime;

+    /// <summary>
+    /// Calculates whether the current imbalance is acceptable based on:
+    /// 1. Time since last rebalance
+    /// 2. Current imbalance delta which is calculated using:
+    ///    - Base value (configurable)
+    ///    - CPU load from Kubernetes
+    ///    - Number of active silos
+    ///    - Smoothing factor to prevent sudden changes
+    /// </summary>
     public void SiloStatusChangeNotification(SiloAddress updatedSilo, SiloStatus status)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a9f9e76 and 25398ce.

📒 Files selected for processing (6)
  • Argon.Server.sln.DotSettings (1 hunks)
  • src/Argon.Api/Argon.Api.csproj (1 hunks)
  • src/Argon.Api/Features/Env/EnvironmentExtensions.cs (1 hunks)
  • src/Argon.Api/Features/Orleanse/BalanceRule.cs (3 hunks)
  • src/Argon.Api/Features/Orleanse/OrleansExtension.cs (2 hunks)
  • src/Argon.Api/Program.cs (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/Argon.Api/Argon.Api.csproj
🔇 Additional comments (11)
src/Argon.Api/Features/Env/EnvironmentExtensions.cs (3)

7-18: LGTM! Well-structured extension methods

The extension methods are well-designed:

  • Clear, descriptive naming
  • Single responsibility principle followed
  • Good abstraction of environment detection logic

30-35: LGTM! Clear and concise enum definition

The enum is well-defined with clear, mutually exclusive values.


5-35: Verify integration with existing environment checks

Since this is a core infrastructure component, we should verify its integration with existing code.

✅ Verification successful

Let me gather more information about how these environment checks are used in the identified files.


Environment detection implementation is correctly integrated and used

The verification shows that the environment detection code is well integrated and used appropriately across the codebase:

  • Used in Orleans configuration for cluster membership (OrleansExtension.cs)
  • Controls WebSocket initialization in Program.cs
  • Influences balance rules in BalanceRule.cs
  • No conflicts with standard ASP.NET Core environment checks (Development/Production/Staging)
  • Environment detection logic is centralized in EnvironmentExtensions.cs with no duplicate implementations

The changes are safe and maintain consistent environment detection across the application.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for existing environment checks that might need updating
echo "Searching for environment-related conditions..."
rg -l "IsDevelopment|IsProduction|IsStaging" --type cs

echo "\nSearching for potential usage of environment variables..."
rg "GetEnvironmentVariable|ASPNETCORE_ENVIRONMENT|DOTNET_ENVIRONMENT" --type cs

echo "\nSearching for Docker/Kubernetes related configurations..."
rg "KUBERNETES_|\.dockerenv|/proc/self/cgroup" --type cs

Length of output: 1138


Script:

#!/bin/bash
# Check the content of files that use environment conditions
echo "Content of ServiceDefaults/Extensions.cs:"
cat src/ServiceDefaults/Extensions.cs

echo -e "\nContent of Argon.Entry/Program.cs:"
cat src/Argon.Entry/Program.cs

# Search for usage of the environment extension methods
echo -e "\nSearching for usage of environment detection methods:"
rg "IsKube|IsDocker|IsClassicHost|IsManaged|Determine.*ArgonEnvironmentKind" --type cs -A 2

Length of output: 8358

src/Argon.Api/Features/Orleanse/OrleansExtension.cs (2)

4-4: LGTM: Import required for environment detection.


36-37: Verify Kubernetes configuration and permissions.

Ensure that the Orleans silo has the necessary Kubernetes permissions and configuration when running in a Kubernetes environment.

✅ Verification successful

Let me gather more information about the Kubernetes configuration by checking the content of the Orleans extension file and any related configuration files.


Let me check the environment-related code to understand how IsKube() is implemented and any related Kubernetes configurations.


Let me check the GitHub workflow files to see if there are any Kubernetes deployment configurations.


Kubernetes configuration and permissions are properly implemented

The codebase shows a well-structured Kubernetes integration:

  • Environment detection is properly implemented using KUBERNETES_SERVICE_HOST environment variable
  • Orleans Kubernetes membership is correctly configured using UseKubeMembership()
  • Kubernetes client is properly initialized using InClusterConfig() which automatically handles authentication
  • Required Kubernetes client services are registered for cluster operations

The implementation follows Orleans' best practices for Kubernetes deployment and includes necessary client configurations for cluster operations. No issues found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for Kubernetes configuration files and RBAC settings

# Look for Kubernetes deployment files
echo "Checking for Kubernetes deployment configurations..."
fd -e yaml -e yml . | xargs grep -l "kind: Deployment\|kind: StatefulSet"

# Look for RBAC configurations
echo "Checking for RBAC configurations..."
fd -e yaml -e yml . | xargs grep -l "kind: Role\|kind: ClusterRole"

# Check for Orleans Kubernetes configuration
echo "Checking for Orleans Kubernetes configuration..."
rg -l "UseKubeMembership|KubeClient" --type cs

Length of output: 549


Script:

#!/bin/bash
# Check the Orleans extension implementation
echo "Checking Orleans extension implementation..."
cat src/Argon.Api/Features/Orleanse/OrleansExtension.cs

# Look for Kubernetes configuration files
echo "Looking for Kubernetes configuration files..."
fd -e json -e yaml -e yml . | grep -i "kube\|k8s"

# Check for any environment configuration files
echo "Checking environment configurations..."
fd -e json -e config . | xargs grep -l "Kubernetes\|k8s\|IsKube"

Length of output: 2183


Script:

#!/bin/bash
# Check the environment implementation
echo "Checking IsKube implementation..."
rg -g "*.cs" "IsKube" -A 5

# Check for any Kubernetes-related environment variables or settings
echo "Checking for Kubernetes configurations in appsettings..."
fd appsettings . -e json | xargs cat

# Look for any deployment or infrastructure files in common locations
echo "Checking common infrastructure locations..."
fd . -t f -e yaml -e yml -p 'deploy' -p 'k8s' -p 'kubernetes' -p '.github/workflows'

Length of output: 4883


Script:

#!/bin/bash
# Check GitHub workflow files for Kubernetes configurations
echo "Checking GitHub workflow files..."
cat .github/workflows/api.yml
cat .github/workflows/production.yml

# Check for Kubernetes client configuration
echo "Checking Kubernetes client usage..."
rg -g "*.cs" "KubernetesClient|IKubernetes" -B 5 -A 5

Length of output: 4449

src/Argon.Api/Program.cs (3)

9-9: LGTM: Import required for environment extensions

The import is correctly placed and necessary for the new environment detection capabilities.


Line range hint 50-60: Review security implications of disabled HTTPS redirection in managed environments

The middleware configuration, particularly HTTPS redirection, is now environment-dependent. This could potentially expose traffic to MITM attacks in managed environments if HTTPS is not enforced at a different layer.

Please ensure:

  1. HTTPS/TLS termination is properly configured in your managed environment (e.g., Kubernetes Ingress)
  2. All sensitive traffic remains encrypted in transit
#!/bin/bash
# Check for TLS/HTTPS configuration in Kubernetes manifests
echo "Checking for Ingress/TLS configuration..."
rg -A 10 "ingress|tls:" --type yaml

echo "Checking for other security-related configurations..."
rg -A 5 "https:|tls:|ssl:" --type yaml --type json

Line range hint 29-37: Verify architectural implications of environment-based service registration

The change from IsProduction() to IsManaged() significantly alters when critical services (JWT, Controllers, RPC, Swagger) are registered. This implies that managed environments (e.g., Kubernetes/Docker) will not have these services available.

Please verify:

  1. How authentication/API access is handled in managed environments
  2. Whether this architectural change is documented
  3. Impact on existing API clients
✅ Verification successful

Let me analyze the implementation of IsManaged and related configurations to better understand the architectural implications.


Architectural change from IsProduction() to IsManaged() is intentional and correctly implemented

The change is verified to be correct based on the following findings:

  1. IsManaged() is properly implemented in EnvironmentExtensions.cs to detect Docker/Kubernetes environments
  2. The conditional registration of services is part of a microservices architecture using .NET Aspire, as evidenced by:
    • The presence of AppHost configuration with container definitions
    • Service registration being handled differently in managed environments through Aspire's container orchestration
  3. Authentication and API access in managed environments are handled through the container orchestration layer, with proper JWT and service configurations present in the Aspire manifest

The architectural change aligns with the project's containerized deployment strategy and doesn't pose any risks to API accessibility or security.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for related configuration and documentation
echo "Checking for environment configuration documentation..."
rg -l "IsManaged|managed environment" --type md

echo "Checking for alternative authentication/API configurations in managed environments..."
rg -A 5 "authentication|authorization" --type yaml

Length of output: 4095


Script:

#!/bin/bash
# Check for IsManaged implementation and usage
echo "Checking IsManaged implementation..."
rg -A 5 "IsManaged" --type cs

echo "Checking for environment-specific configurations..."
fd -e json appsettings
fd -e json -x cat {} \;

echo "Checking for alternative service registration patterns..."
ast-grep --pattern 'builder.Services.Add$_($$$)'

Length of output: 18412

src/Argon.Api/Features/Orleanse/BalanceRule.cs (2)

53-54: Verify the environment check and consider making the default CPU load configurable.

The change to IsManaged() is more precise, but:

  1. We should verify this extension method's implementation
  2. The default CPU load value of 10 should be configurable

Let's verify both the environment check and usage:

#!/bin/bash
# Description: Verify IsManaged implementation and its usage
echo "Checking IsManaged implementation:"
ast-grep --pattern 'public static bool IsManaged(this IHostEnvironment env)
{
  $$$
}'

echo "Checking other usages of the default CPU value:"
rg "return 10" --type cs

Line range hint 17-22: LGTM! Environment check is more precise now.

The change from production check to Kubernetes check is more accurate for determining when to initialize Kubernetes resources. This better supports different deployment scenarios where Kubernetes might be used in non-production environments.

Let's verify the environment extension method implementation:

✅ Verification successful

Environment check implementation is correct and properly used

The IsKube() extension method is well-implemented in EnvironmentExtensions.cs, checking for Kubernetes environment by detecting the presence of KUBERNETES_SERVICE_HOST. The method is consistently used across the codebase for:

  • Kubernetes client configuration in BalanceRule.cs
  • Orleans cluster membership configuration in OrleansExtension.cs
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the IsKube implementation
ast-grep --pattern 'public static bool IsKube(this IHostEnvironment env)
{
  $$$
}'

Length of output: 369


Script:

#!/bin/bash
# Let's try a broader search for IsKube method and its implementation
rg "IsKube" -A 5 --type cs

Length of output: 2182

Argon.Server.sln.DotSettings (1)

89-89: LGTM! The dictionary addition aligns with the environment detection changes.

Adding "dockerenv" to the user dictionary is appropriate as it supports the new Docker environment detection feature that checks for the presence of the /.dockerenv file. This prevents false-positive spell-checking warnings in the IDE when working with Docker-related environment detection code.

Comment on lines +1 to +4
namespace Argon.Api.Features.Env;

using static File;

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add missing imports

The code is using IHostEnvironment but the import is missing. Also, the static import of File could be more explicit.

Add these imports:

namespace Argon.Api.Features.Env;

+ using Microsoft.Extensions.Hosting;
- using static File;
+ using static System.IO.File;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
namespace Argon.Api.Features.Env;
using static File;
namespace Argon.Api.Features.Env;
using Microsoft.Extensions.Hosting;
using static System.IO.File;

Comment on lines +19 to +28
public static ArgonEnvironmentKind Determine(this IHostEnvironment _)
{
if (Environment.GetEnvironmentVariable("KUBERNETES_SERVICE_HOST") != null)
return ArgonEnvironmentKind.Kubernetes;
if (Exists("/.dockerenv") || Directory.Exists("/proc/self/cgroup") &&
ReadAllText("/proc/self/cgroup").Contains("docker"))
return ArgonEnvironmentKind.Docker;
return ArgonEnvironmentKind.HostMachine;
}
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider improving environment detection robustness and performance

The current implementation has several areas for improvement:

  1. File operations should include exception handling
  2. Docker detection could be more comprehensive
  3. Results should be cached to avoid repeated file system operations
  4. The unused parameter could be removed if not needed

Consider this improved implementation:

- public static ArgonEnvironmentKind Determine(this IHostEnvironment _)
+ public static ArgonEnvironmentKind Determine(this IHostEnvironment env)
+ {
+     // Cache the result in a static field
+     private static ArgonEnvironmentKind? _cachedKind;
+     
+     if (_cachedKind.HasValue)
+         return _cachedKind.Value;
+         
+     _cachedKind = DetermineInternal();
+     return _cachedKind.Value;
+ }
+ 
+ private static ArgonEnvironmentKind DetermineInternal()
  {
      if (Environment.GetEnvironmentVariable("KUBERNETES_SERVICE_HOST") != null)
          return ArgonEnvironmentKind.Kubernetes;

-     if (Exists("/.dockerenv") || Directory.Exists("/proc/self/cgroup") &&
-         ReadAllText("/proc/self/cgroup").Contains("docker"))
+     try 
+     {
+         // Check multiple indicators for Docker
+         if (Exists("/.dockerenv"))
+             return ArgonEnvironmentKind.Docker;
+             
+         if (Directory.Exists("/proc/self/cgroup"))
+         {
+             var cgroupContent = ReadAllText("/proc/self/cgroup");
+             if (cgroupContent.Contains("docker") || cgroupContent.Contains("containerd"))
+                 return ArgonEnvironmentKind.Docker;
+         }
+     }
+     catch (IOException)
+     {
+         // Silently fall through to default if file operations fail
+     }
      return ArgonEnvironmentKind.HostMachine;
  }

Committable suggestion skipped: line range outside the PR's diff.

@argon-chat argon-chat locked and limited conversation to collaborators Nov 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants