Skip to content

Commit

Permalink
Merge pull request #157 from tomdee/k8s-no-policy
Browse files Browse the repository at this point in the history
Fix the case when running under K8s without policy
  • Loading branch information
tomdee authored Aug 23, 2016
2 parents 041de03 + 2fb1d9f commit 40fbee9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion k8s/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ func CmdAddK8s(args *skel.CmdArgs, conf utils.NetConf, hostname string, calicoCl

utils.ConfigureLogging(conf.LogLevel)

profileID := fmt.Sprintf("k8s_ns.%s", k8sArgs.K8S_POD_NAMESPACE)
// Set the profileID according to whether Kubernetes policy is required. If it's not, then just use the network
// name (which is the normal behavior) otherwise use one based on the Kubernetes pod namespace.
var profileID string
if conf.Policy.PolicyType == "" {
profileID = conf.Name
} else {
profileID = fmt.Sprintf("k8s_ns.%s", k8sArgs.K8S_POD_NAMESPACE)
}

workloadID, orchestratorID, err := utils.GetIdentifiers(args)
if err != nil {
Expand Down

0 comments on commit 40fbee9

Please sign in to comment.