-
Notifications
You must be signed in to change notification settings - Fork 25
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 Thiea Manager with basic functionality #97
Conversation
cbc4a8b
to
e3cf6a4
Compare
7e42527
to
ba3ae5f
Compare
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.
Thanks Shawn for working on this!
Namespace: npReco.Namespace, | ||
Name: npReco.Name, | ||
} | ||
c.queue.Add(namespacedName) |
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 it be c.queue.forget(namespacedName)?
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.
c.queue
is the actual worker queue to reconcile the resources. here we're just adding the key to the workqueue to indicate that some resource is removed and reconciliation is needed (i.e. deletion of child res related to this job CR). the key is forgotten only when reconciliation is done for it.
c03db5d
to
829a288
Compare
cmd/theia-manager/theia-manager.go
Outdated
const informerDefaultResync = 12 * time.Hour | ||
|
||
func run(o *Options) error { | ||
klog.Infof("Theia manager starting...") |
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.
better to use structured logging: klog.InfoS(). Same for other logs.
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.
fixed 4 occurrences
pkg/apiserver/apiserver.go
Outdated
} | ||
p := s.GenericAPIServer | ||
if p == nil { | ||
return fmt.Errorf("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.
ditto
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.
removed both. was leftover when doing local debugging. neither should be the case when actually running the code.
7e737bd
to
9fde85d
Compare
This change adds the following: 1. API server setup and config 2. sample REST endpoint apis/intelligence.theia.antrea.io/v1alpha1/networkpolicyrecommendations 3. codegen scripts for API server 4. helm charts for theia Manager and API server config values Signed-off-by: Shawn Wang <wshaoquan@vmware.com>
This change adds an example controller to Theia manager, which watches NetworkPolicyRecommendation and exposes querier interface for APIServer to consume. When NetworkPolicyRecommendation is deployed in flow-visibility NS, the k8s resources and be properly returned via REST endpoint /apis/intelligence.theia.antrea.io/v1alpha1/networkpolicyrecommendations/{name} Signed-off-by: Shawn Wang <wshaoquan@vmware.com>
Signed-off-by: Shawn Wang <wshaoquan@vmware.com>
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.
LGTM
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.
LGTM
This change adds the skeleton of Theia manager, including APIServer and a simple
NetworkPolicyRecommendation
CR controller.The code is structured following Antrea controller, and summarized below:
pkg/apis/crd
structured CRD definitions for k8s client generation (consumed by controllers)pkg/apis/intelligence
structured REST payload definitions by API group and endpointspkg/apiserver/registry
REST handlers grouped by API group and endpointspkg/apiserver/apiserver.go
APIServer definitions and configurationspkg/client
k8s client-gen'ed codespkg/controller
collection of k8s resource controllersThis change also adds Helm chart generation and code generation scripts.
To get the manager up and running in an existing testbed:
build/charts/theia/crds/network-policy-recommendation-crd.yaml
make theia-manager
and scp imageprojects.registry.vmware.com/antrea/theia-manager:latest
to worker nodeshack/generate-manifest.sh --mode dev --theia-manager > build/yamls/flow-visibility.yml
and apply the diffsWith the following CR deployed:
$ curl -k https://<theia-manager-svc>/apis/intelligence.theia.antrea.io/v1alpha1/networkpolicyrecommendations/pr-test
curl -k https://<theia-manager-svc>apis/intelligence.theia.antrea.io/v1alpha1/networkpolicyrecommendations/pr-test-1