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

containerApp evn var collections #922

Merged
merged 3 commits into from
May 7, 2022
Merged

Conversation

et1975
Copy link
Contributor

@et1975 et1975 commented May 2, 2022

The changes in this PR are as follows:

  • Adds support for passing a collection of env variables of a given type to containerApp
    Why is this useful? In the absence of broad support for _.For in this library this makes iterators possible and brings it to parity with some other CEs.

I have read the contributing guidelines and have completed the following:

  • Tested my code end-to-end against a live Azure subscription.
  • Updated the documentation in the docs folder for the affected changes.
  • Written unit tests against the modified code that I have made.
  • Updated the release notes with a new entry for this PR.
  • Checked the coding standards outlined in the contributions guide and ensured my code adheres to them.

If I haven't completed any of the tasks above, I include the reasons why here:

Below is a minimal example configuration that includes the new features, which can be used to deploy to Azure:

                containerApp {
                    name "multienv"
                    add_simple_container "mcr.microsoft.com/dotnet/samples" "aspnetapp"
                    ingress_target_port 80us
                    ingress_transport Auto
                    add_http_scale_rule "http-scaler" { ConcurrentRequests = 10 }
                    add_cpu_scale_rule "cpu-scaler" { Utilisation = 50 }
                    add_secret_parameters ["servicebusconnectionkey"]
                    add_env_variables ["ServiceBusQueueName","wishrequests"]
                    add_secret_expressions ["containerlogs", containerLogs.PrimarySharedKey]
                }

@et1975
Copy link
Contributor Author

et1975 commented May 3, 2022

Added a fix for #921

@@ -34,7 +34,12 @@ type ContainerAppConfig =
ImageRegistryCredentials : ImageRegistryAuthentication list
Containers : ContainerConfig list
Dependencies : Set<ResourceId> }

member this.ResourceId = containerApps.resourceId this.Name
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think line 51 is correct actually, wondering if I should fix that too. I'm thinking it should be managedEnvironments.resourceId.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, you are right, it's the managed environment, so this is a lurking bug.

@et1975
Copy link
Contributor Author

et1975 commented May 5, 2022

@forki what do you think?

Copy link
Collaborator

@ninjarobot ninjarobot left a comment

Choose a reason for hiding this comment

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

The new operations look good, thank you for adding those and the tests to use them.

Are the ACR changes just a temporary workaround?

@@ -34,7 +34,12 @@ type ContainerAppConfig =
ImageRegistryCredentials : ImageRegistryAuthentication list
Containers : ContainerConfig list
Dependencies : Set<ResourceId> }

member this.ResourceId = containerApps.resourceId this.Name
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, you are right, it's the managed environment, so this is a lurking bug.

username = ArmExpression.create($"listCredentials({resourceId.ArmExpression.Value}, '2019-05-01').username").Eval()
passwordSecretRef = ArmExpression.create($"listCredentials({resourceId.ArmExpression.Value}, '2019-05-01').username").Eval() |}
passwordSecretRef = usernameSecretName resourceId |}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I take it we just need this for now until this bug is fixed, right?

Copy link
Member

Choose a reason for hiding this comment

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

I think so, yes. Although the string concatenation approach should just work, once the underlying ARM provider is fixed I would prefer to revert to the original expression-based approach.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds good, and given we do t have to change the DSL, this will just keep working when they fix the bug. LGTM.

@ninjarobot ninjarobot added this to the 1.7.1 milestone May 6, 2022
@ninjarobot ninjarobot merged commit a8af34e into CompositionalIT:master May 7, 2022
github-actions bot pushed a commit that referenced this pull request May 7, 2022
@ninjarobot
Copy link
Collaborator

Thanks for the contribution, this is released in 1.7.1 and available on nuget.

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