cmd: policy trace src/dst eID, secid, k8s-pod options#1124
Conversation
There was a problem hiding this comment.
var dstSecurityIdLabels should be dstSecurityIDLabels
There was a problem hiding this comment.
var srcSecurityIdLabels should be srcSecurityIDLabels
There was a problem hiding this comment.
const defaultSecurityId should be defaultSecurityID
8496945 to
6ece0a0
Compare
There was a problem hiding this comment.
func parameter epId should be epID
6e807bb to
d61a609
Compare
There was a problem hiding this comment.
exported method BoolOptions.GetModel should have comment or be unexported
There was a problem hiding this comment.
exported method BoolOptions.GetMutableModel should have comment or be unexported
There was a problem hiding this comment.
exported method BoolOptions.GetImmutableModel should have comment or be unexported
ea7dd3c to
61f3b51
Compare
| } | ||
|
|
||
| return inLabels, nil | ||
| secId := p.GetAnnotations()["cilium-identity"] |
| if resp == nil { | ||
| return nil, fmt.Errorf("ID %s not found", id) | ||
| } | ||
| func getSecIdFromK8s(podName string) (string, error) { |
There was a problem hiding this comment.
func getSecIdFromK8s should be getSecIDFromK8s
| func parseAllowedSlice(slice []string) ([]string, error) { | ||
| inLabels := []string{} | ||
| id := "" | ||
| func appendEpLabelsToSlice(epId string, labelSlice []string) []string { |
There was a problem hiding this comment.
func parameter epId should be epID
0607376 to
e5a3e38
Compare
| return d.conf.Opts.IsEnabled(endpoint.OptionDebug) | ||
| } | ||
|
|
||
| func (d *Daemon) AnnotateEndpoint(e *endpoint.Endpoint, annotationKey, annotationValue string) { |
There was a problem hiding this comment.
exported method Daemon.AnnotateEndpoint should have comment or be unexported
| return "", fmt.Errorf("unable to get pod %s in namespace %s", namespace, pod) | ||
| } | ||
|
|
||
| secId := p.GetAnnotations()["cilium-identity"] |
| if err != nil { | ||
| Fatalf("Cannot get security id from k8s pod name: %s", err) | ||
| } | ||
| convertedId, err := strconv.ParseInt(id, 0, 64) |
There was a problem hiding this comment.
var convertedId should be convertedID
| if err != nil { | ||
| Fatalf("Cannot get security id from k8s pod name: %s", err) | ||
| } | ||
| convertedId, err := strconv.ParseInt(id, 0, 64) |
There was a problem hiding this comment.
var convertedId should be convertedID
e5a3e38 to
d30c11a
Compare
ede56b3 to
8775e5b
Compare
|
Between commit 5dfd8b1 and commit 364d72ec43ecb0bd6546bc9a3d25dc402ac80b4f, the adding of the annotation failed in the K8s case: The only change was to add nodes to the list of objects that allow for updates in the RBAC YAML file. I'm not sure why this would happen? Will investigate... |
72c8e87 to
fa9e1fb
Compare
There was a problem hiding this comment.
exported const CiliumIdentityAnnotation should have comment (or a comment on this block) or be unexported
fa9e1fb to
9f992ff
Compare
Add capability to pass in a source / destination endpoint, k8s pod, and security identities to `cilium policy trace`. Signed-off by: Ian Vernon <ian@covalent.io>
abca452 to
0285330
Compare
| inLabels := []string{} | ||
| id := "" | ||
| // Returns the labels for security identity ID and an error if the labels cannot be retrieved. | ||
| func getLabelsFromIdentity(ID int64) ([]string, error) { |
There was a problem hiding this comment.
I am going to refactor this function into pkg/client/identity.go
Add capability to pass in a source / destination endpoint, k8s pod, and security identities to
cilium policy trace.Signed-off by: Ian Vernon ian@covalent.io
Partially addresses #1005