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

SWS 90 Backend for Kubernetes, Prometheus and Istio #19

Merged
merged 1 commit into from Feb 14, 2018

Conversation

lucasponce
Copy link
Contributor

This depends on #18
and it's a split of #17

@lucasponce
Copy link
Contributor Author

@xeviknal @aljesusg @jotak this is the final PR for the logic defined in #17.
Please, let me know if it is good to merge in order to not block your pending work.
Thx.

config/config.go Outdated
Server Server ",omitempty"
Identity security.Identity ",omitempty"
Server Server ",omitempty"
PrometheusService string ",omitempty"
Copy link
Collaborator

Choose a reason for hiding this comment

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

the way the Go YAML processing/parsing works, the name of the yaml property is all lowercase so this is going to be a running word "prometheusservice" in the yaml file or configmap. You should add an underscore _ between words as just having camel-case isn't enough. If this is named Prometheus_Service, the yaml processor will look for the property named "promehteus_service" which is what we would want to make it easier to read.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just like the env var, we should append _Url to this to make it clear its a url (Prometheus_Service_Url)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1

config/config.go Outdated
@@ -18,13 +18,21 @@ const (
ENV_IDENTITY_CERT_FILE = "IDENTITY_CERT_FILE"
ENV_IDENTITY_PRIVATE_KEY_FILE = "IDENTITY_PRIVATE_KEY_FILE"

ENV_PROMETHEUS_SERVICE = "PROMETHEUS_SERVICE"
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should append _URL to the name to make it clear this setting expects a URL (and not, for example, a hostname or a "host:port" formatted value).

ENV_PROMETHEUS_SERVICE_URL = "PROMETHEUS_SERVICE_URL"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1

@@ -9,6 +9,9 @@ parameters:
- description: The version of the image to use
name: IMAGE_VERSION
value: dev
- description: The namespace to use
name: NAMESPACE
value: default
Copy link
Collaborator

Choose a reason for hiding this comment

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

default should be istio-system, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1 yeah I changed in the makefile but it needs to be changed here.

server := NewServer(conf)
config.Configuration = conf

server := NewServer()
Copy link
Collaborator

Choose a reason for hiding this comment

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

you should continue to pass in the config here rather than rely on global var. I think this will make writing unit and i-tests easier (because then we can create servers with different configurations, right?)

I just hate global variables - makes writing tests harder for one reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you don't like global variables - great.
I don't think it makes sense to propagate a config through 4 or 5 layers of abstraction.
I proposed in my 1st PR a mixed approach, you commented to refactor everything - great.
If tests are executed concurrently we can pass as config but if not I see a contradiction in your comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, to summarize the discussion.
It could be good to have a config.Get() and config.Set() pair that will set the configuration global var stored in the config package.

httpServer *http.Server
}

// NewServer creates a new server configured with the given settings.
// Start and Stop it with the corresponding functions.
func NewServer(conf *config.Config) *Server {
func NewServer() *Server {
Copy link
Collaborator

Choose a reason for hiding this comment

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

consider keeping the config as a field in the Server struct and passing it into the NewServer method - see my other comments. Could make writing tests harder if this is relying on global variables.

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 guess with the config.Get() and config.Set() could be enough and we can maintain the NewServer() without config param in the signature.
Do we have an agreement ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

@lucasponce lucasponce force-pushed the SWS-90-Backend-API-Final branch 3 times, most recently from c5564cb to af3c1eb Compare February 14, 2018 17:43
- Refactor configuration as global variable to avoid propagate it through several layers
- Add configuration details for openshift deployments
- Change default namespace/project to colocate with istio-system
@lucasponce
Copy link
Contributor Author

@jmazzitelli Ok, comments addressed.
Let me know if there is anything else to merge this one.

Copy link
Collaborator

@jmazzitelli jmazzitelli left a comment

Choose a reason for hiding this comment

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

LGTM

@jmazzitelli jmazzitelli merged commit b5c18b9 into kiali:master Feb 14, 2018
@lucasponce lucasponce deleted the SWS-90-Backend-API-Final branch June 18, 2018 08:48
aljesusg added a commit that referenced this pull request Oct 17, 2022
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.

None yet

2 participants