-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Surpport snippet for server section by the annotation of the ingess #1398
Conversation
@@ -236,6 +236,9 @@ type Server struct { | |||
// CertificateAuth indicates the this server requires mutual authentication | |||
// +optional | |||
CertificateAuth authtls.AuthSSLConfig `json:"certificateAuth"` | |||
|
|||
// ServerSnippet returns the snippet of server |
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.
+optional
@@ -1065,6 +1065,28 @@ func (ic *GenericController) createServers(data []interface{}, | |||
servers[host].Alias = "" | |||
} | |||
} | |||
|
|||
// configure server snippet | |||
for _, ingIf := range data { |
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.
This loop is already being called in line 982, why not add this logic in there to avoid looping again?
host = defServerName | ||
} | ||
|
||
srvsnippet := ic.annotations.ServerSnippet(ing) |
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.
You can add this before the loop to avoid calling each time.
|
||
if servers[host].ServerSnippet == "" && srvsnippet != "" { | ||
servers[host].ServerSnippet = srvsnippet | ||
} |
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.
Add a Warning, notifying the user that it has already been configured.
type serverSnippet struct { | ||
} | ||
|
||
// NewParser creates a new CORS annotation parser |
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.
Not CORS
/lgtm |
@decker502 thanks! |
eg: