-
Notifications
You must be signed in to change notification settings - Fork 26
feat: Add custom DNS and pod annotations support #548
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
0030ff6
973546e
3d3fb11
8d287ab
35b0867
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,6 +113,25 @@ func getChaincodeStartTimeout(logger *log.CmdLogger) (chaincodeStartTimeoutDurat | |
| return chaincodeStartTimeoutDuration, true | ||
| } | ||
|
|
||
| func getNameServers(logger *log.CmdLogger) string { | ||
| nameServers := util.GetOptionalEnv(util.NameServersVariable, "") | ||
| logger.Debugf("%s=%s", util.NameServersVariable, nameServers) | ||
|
|
||
| return nameServers | ||
| } | ||
|
|
||
| func getCustomAnnotations(logger *log.CmdLogger) map[string]string { | ||
| annotationsStr := util.GetOptionalEnv(util.CustomAnnotationsVariable, "") | ||
| logger.Debugf("%s=%s", util.CustomAnnotationsVariable, annotationsStr) | ||
|
|
||
| annotations := util.ParseAnnotations(annotationsStr) | ||
|
Member
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. There should be some validation for the annotations somewhere. The builder does label validation for example.
Author
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. what type of validation we can add for this annotation ? |
||
| if len(annotations) > 0 { | ||
| logger.Debugf("Parsed custom annotations: %v", annotations) | ||
| } | ||
|
|
||
| return annotations | ||
| } | ||
|
|
||
| func Run() { | ||
| const ( | ||
| expectedArgsLength = 3 | ||
|
|
@@ -164,6 +183,9 @@ func Run() { | |
| os.Exit(1) | ||
| } | ||
|
|
||
| nameServers := getNameServers(logger) | ||
| customAnnotations := getCustomAnnotations(logger) | ||
|
|
||
| run := &builder.Run{ | ||
| BuildOutputDirectory: buildOutputDirectory, | ||
| RunMetadataDirectory: runMetadataDirectory, | ||
|
|
@@ -174,6 +196,8 @@ func Run() { | |
| KubeServiceAccount: kubeServiceAccount, | ||
| KubeNamePrefix: kubeNamePrefix, | ||
| ChaincodeStartTimeout: chaincodeStartTimeout, | ||
| NameServers: nameServers, | ||
| CustomAnnotations: customAnnotations, | ||
| } | ||
|
|
||
| if err := run.Run(ctx); err != nil { | ||
|
|
||
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.
There should be some validation for the nameserver variable. I think it's something like up to 3 IP addresses but I don't know for sure/the details.
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.
yes it can be 3 servers
nameservers: a list of IP addresses that will be used as DNS servers for the Pod. There can be at most 3 IP addresses specified.
but it's admin responsibility to identify the servers , we can add validation / Warning about length
do you agree ?