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

Get appsettings data from Kubernetes secrets #240

Conversation

sushmithavangala
Copy link
Collaborator

Fix for #231

@sushmithavangala sushmithavangala marked this pull request as ready for review January 3, 2022 06:53
Copy link
Collaborator

@TsuyoshiUshio TsuyoshiUshio left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution. I left some comment.
I'm curious if the secret is already created by the GeoMaster with sufficient AppSettings equivalent information? (I just don't know) If you already discussed with Ahmed, you can ignore this comment.

Kudu.Core/Deployment/DeploymentManager.cs Outdated Show resolved Hide resolved
Kudu.Core/Functions/KedaFunctionTriggerProvider.cs Outdated Show resolved Hide resolved
Kudu.Core/Functions/KedaFunctionTriggerProvider.cs Outdated Show resolved Hide resolved
Kudu.Core/Infrastructure/DockerContainerRestartTrigger.cs Outdated Show resolved Hide resolved
@@ -76,17 +79,17 @@ bool IsHostJson(string fullName)
}

internal static void UpdateFunctionTriggerBindingExpression(
IEnumerable<ScaleTrigger> scaleTriggers, IDictionary<string, string> appSettings)
IEnumerable<ScaleTrigger> scaleTriggers, IDictionary<string, byte[]> appSettings)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm curious why you change it from string to byte[]. Could you share the context?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The kubernetes api gives secret data as IDictionary<string, byte[]> , so the same is passed ahead. There is also kubernetesSecret.stringData available in the output that should give secret as IDictionary<string, string> , but in testing we found kubernetesSecret.stringData is giving an empty dictionary , so we have proceeded with kubernetesSecret.Data which returns IDictionary<string, byte[]>

@@ -47,6 +47,12 @@ public class Environment : IEnvironment


// This ctor is used only in unit tests

// added for test cases
public Environment()
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can use Moq with IEnvironment for the testability.

{
var config = KubernetesClientConfiguration.InClusterConfig();
// Use the config object to create a client.
var client = new Kubernetes(config);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Generally speaking, instantiate HTTP Client every time is not good idea. https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0 Kubernetes. We might pass the Http client for the object.
In this case, we can't use HttpClientFactory so that having it as static might be a good idea.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@SushmithaVReddy Can you address this feedback? I think it's important.

@sushmithavangala
Copy link
Collaborator Author

Abandoning this PR as #242 fixes the same

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.

3 participants