-
Notifications
You must be signed in to change notification settings - Fork 276
Use the AzureResource Informer; Refactor for clarity #20
Conversation
dfe86e4
to
62f54fc
Compare
@@ -2,6 +2,5 @@ | |||
|
|||
export K8S_NAMESPACE=smc | |||
export AZURE_SUBSCRIPTION=abc | |||
export AZURE_RESOURCE_GROUP=rg |
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.
We no longer need AZURE_RESOURCE_GROUP
- the subscription UUID is now available in the AzureResource
CRD
@@ -1,58 +0,0 @@ | |||
package main |
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.
The cmd/eds/clients.go
had the setupClients
function, which is now simplified and part of cmd/eds/eds.go
@@ -34,10 +35,16 @@ func main() { | |||
ctx, cancel := context.WithCancel(context.Background()) | |||
defer cancel() | |||
|
|||
grpcServer, lis := cmd.NewGrpc(serverType, port) | |||
grpcServer, lis := utils.NewGrpc(serverType, *port) |
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.
as @vramakrishnan requested - we moved the gRPC tools in pkg/utils
sigChan := make(chan os.Signal, 1) | ||
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM) | ||
<-sigChan | ||
|
||
glog.Info("Goodbye!") |
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.
The syscall handling block here is a bit of a noop at the moment. Reasons for putting it:
a) symmetry with eds.go
b) we are going to need this once proper integrations w/ a certificate management system(s) is implemented
servicesCache map[mesh.ServiceName][]mesh.IP | ||
computeProviders map[string]mesh.ComputeProviderI | ||
meshSpecProvider mesh.SpecI | ||
computeProviders []mesh.ComputeProviderI |
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.
The list of ComputeProviders (naming is discussed elsewhere) is now just a list. No need to categorize them in a map.
glog.Info("[EDS] Create NewEDSServer...") | ||
return &EDS{ | ||
ctx: ctx, | ||
catalog: catalog, | ||
computeProviders: computeProviders, |
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.
Removing computeProviders
- this should be an implementation detail of the catalog
There is a separate design doc / PR where this is discussed.
Run(stopCh <-chan struct{}) error | ||
// Retrieve the IP addresses comprising the ServiceName. | ||
GetIPs(ServiceName) []IP | ||
GetID() string |
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.
Adding GetID()
here -- although this is officially debated in another PR / design doc and will most likely change once the design has settled.
@@ -1,14 +1,13 @@ | |||
package cmd | |||
package utils |
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.
Moving gRPC to the utils pkg
@snehachhabria thanks for the review! |
type kv struct { | ||
k string | ||
v string | ||
} |
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.
Should this be renamed as KeyValue struct, key string and values string respectively ?
@@ -31,6 +31,9 @@ const ( | |||
|
|||
maxAuthRetryCount = 10 | |||
retryPause = 10 * time.Second | |||
|
|||
azureProvidername = "Azure" |
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.
Nit : casing
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.
@draychev the changes LGTM
Sincere apologies for the large PR. I prefer small, atomic PRs; this is not it.
The goal here is to make one last PR to clean-up the move from a previous repo. Also change the demo so it uses
AzureResource
CRD.Changes in this PR
GetComputeIDForService()
-- this is a function, which when given a service name, determines where the endpoints forming this service are (what clusters, clouds, compute providers) -- this leverages the newAzureResource
CRD and completes the demo usingService
->AzureResource
as discussed in Create 'Service' CRD to register and reference k8s and non-k8s compute resources servicemeshinterface/smi-spec#67 (comment)AzureResource
and figure out what Azure URI to query ARM for from Service --> AzureResource match based on labelsAZURE_RESOURCE_GROUP
around - this is in theAzureResource
CRDcmd/eds/clients.go
, which had thesetupClients
function, was simplified and merged intocmd/eds/eds.go
eds
andsds
CLI tools getport
arg, with the appropriate default (addresses a request by @vramakrishnan in mesh: Adding mesh.provider types enum #16)syscall
handlersAzureResource
custom k8s resourcerun-eds.sh
andrun-sds.sh
into./scripts/
(demo script adjustments if necessary will follow shortly)ServiceCatalog
to prepare this for concurrent updatesInterfaces Design Doc
Proper Interfaces design will be done via the following Design Doc (in the shape of a PR to facilitate discussion): #22