-
Notifications
You must be signed in to change notification settings - Fork 159
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
Add option to set DAPR protocol for Container Apps #1100
Open
fatim
wants to merge
9
commits into
CompositionalIT:master
Choose a base branch
from
fatim:feature/containerApp-dapr
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5d08105
add dapr protocol property to container apps
472672a
update documentation
7db1beb
change dapr protocol config to optional
4fd8b47
Merge branch 'CompositionalIT:master' into feature/containerApp-dapr
fatim 5bb69bd
Merge branch 'master' into feature/containerApp-dapr
3449dde
update release notes
8da3b93
Merge remote-tracking branch 'origin/feature/containerApp-dapr' into …
c13aa18
cleanup
f9ebec2
fix formatting in ContainerApps.fs
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,8 @@ type ContainerAppConfig = | |
Identity: ManagedIdentity | ||
Replicas: {| Min: int; Max: int |} option | ||
DaprConfig: {| AppId: string option | ||
Port: uint16 option |} option | ||
Port: uint16 option | ||
Protocol: string option |} option | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would make a type for the protocol e.g. [<RequireQualifiedAccess>]
type DaprProtocol = Grpc | Http Doing this will make it easier for individuals to know what the available valid options are, rather than a raw string. |
||
Secrets: Map<ContainerAppSettingKey, SecretValue> | ||
EnvironmentVariables: Map<string, EnvVar> | ||
Volumes: Map<string, Volume> | ||
|
@@ -127,7 +128,12 @@ type ContainerEnvironmentConfig = | |
containerApp.DaprConfig | ||
|> Option.map (fun x -> | ||
match x.AppId with | ||
| Some appId -> {| AppId = appId; Port = x.Port |} | ||
| Some appId -> | ||
{| | ||
AppId = appId | ||
Port = x.Port | ||
Protocol = x.Protocol | ||
|} | ||
| None -> | ||
raiseFarmer | ||
$"The container app '{containerApp.Name.Value}' requires a Dapr App ID when Dapr is enabled.") | ||
|
@@ -448,7 +454,12 @@ type ContainerAppBuilder() = | |
DaprConfig = | ||
state.DaprConfig | ||
|> Option.map (fun x -> {| x with AppId = Some appId |}) | ||
|> Option.defaultWith (fun () -> {| AppId = Some appId; Port = None |}) | ||
|> Option.defaultWith (fun () -> | ||
{| | ||
AppId = Some appId | ||
Port = None | ||
Protocol = None | ||
|}) | ||
|> Some | ||
} | ||
|
||
|
@@ -459,7 +470,28 @@ type ContainerAppBuilder() = | |
DaprConfig = | ||
state.DaprConfig | ||
|> Option.map (fun x -> {| x with Port = Some port |}) | ||
|> Option.defaultWith (fun () -> {| AppId = None; Port = Some port |}) | ||
|> Option.defaultWith (fun () -> | ||
{| | ||
AppId = None | ||
Port = Some port | ||
Protocol = None | ||
|}) | ||
|> Some | ||
} | ||
|
||
/// Configures Dapr protocol in the Azure Container App. | ||
[<CustomOperation "dapr_app_protocol">] | ||
member _.SetDaprProtocol(state: ContainerAppConfig, protocol) = | ||
{ state with | ||
DaprConfig = | ||
state.DaprConfig | ||
|> Option.map (fun x -> {| x with Protocol = Some protocol |}) | ||
|> Option.defaultWith (fun () -> | ||
{| | ||
AppId = None | ||
Port = None | ||
Protocol = Some protocol | ||
|}) | ||
|> Some | ||
} | ||
|
||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With
Protocol
now a union rather than a string, this code will need a pattern match to emit the correct string e.g.etc.