-
Notifications
You must be signed in to change notification settings - Fork 255
Conversation
E2E test results. One of them failed and passed on rerun: Summarizing 1 Failure: [Fail] Kubernetes cluster using aad-pod-identity [It] should assign identity with init containers Ran 17 of 19 Specs in 3898.244 seconds [1] should assign identity with init containers Ran 1 of 19 Specs in 257.761 seconds |
159219c
to
ee325ac
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.
Just few small nits, otherwise lgtm
Since we don't have e2e test for SP, maybe we should validate that scenario manually too before merging the PR? Also, PR needs rebase.
54220a3
to
90e16f9
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.
Added few comments but otherwise looks great!
For the docs, should we update the docs and examples with new case after we cut the release? If we update the examples and docs with this PR, it will not work for users trying out 1.5 releases.
cmd/mic/main.go
Outdated
@@ -72,7 +75,20 @@ func main() { | |||
//Identities that should be never removed from Azure AD (used defined managed identities) | |||
flag.StringVar(&immutableUserMSIs, "immutable-user-msis", "", "prevent deletion of these IDs from the underlying VM/VMSS") | |||
|
|||
// Config map for aad-pod-identity | |||
flag.StringVar(&cmConfig.Name, "cmName", "aad-pod-identity-cm", "Configmap name") |
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.
can we change this to config-map-name
instead of cmName
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.
can we use aad-pod-identity-config
instead of aad-pod-identity-cm
?
cmd/mic/main.go
Outdated
// Config map for aad-pod-identity | ||
flag.StringVar(&cmConfig.Name, "cmName", "aad-pod-identity-cm", "Configmap name") | ||
// Config map details for the type changes in the context of client-go upgrade. | ||
flag.StringVar(&typeUpgradeConfig.CMTypeUpgradeKey, "typeUpgradeCMKey", "type-upgrade-status", "Configmap key for type upgrade status") |
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 should use hyphen separated name instead of camel case similar to the other flags we have in MIC
cmd/simple/main.go
Outdated
"k8s.io/client-go/rest" | ||
"k8s.io/client-go/tools/clientcmd" | ||
"k8s.io/klog" | ||
//"context" |
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: can we remove this?
azureIdentity: "demo-aad1" | ||
selector: "demo" |
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: new line
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 as above
pkg/mic/mic.go
Outdated
@@ -18,6 +18,7 @@ import ( | |||
"github.com/Azure/aad-pod-identity/version" | |||
"golang.org/x/sync/semaphore" | |||
corev1 "k8s.io/api/core/v1" | |||
kubeErrors "k8s.io/apimachinery/pkg/api/errors" |
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.
can we rename this to apierrors
instead of kubeErrors
?
pkg/mic/mic.go
Outdated
// Start ... | ||
func (c *Client) Start(exit <-chan struct{}) { | ||
klog.V(6).Infof("MIC client starting..") | ||
|
||
if err := c.UpgradeTypeIfRequired(); err != nil { | ||
klog.Fatalf("Upgrade failed with error: %v", err) |
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.
I think we should say type upgrade failed with error. I think we need to make this error message descriptive so the user what upgrade failed here
|
||
// There is a delay in data propogation to cache. It's possible that the creates performed in the previous sync cycle | ||
// are not propogated before this sync cycle began. In order to avoid redoing the cycle, we sync cache again. | ||
c.CRDClient.SyncCacheAll(exit, false) |
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.
Were you able to confirm that this cache sync with the go client update has no leaks?
pkg/mic/mic.go
Outdated
@@ -417,19 +522,22 @@ func (c *Client) createDesiredAssignedIdentityList( | |||
newAssignedIDs := make(map[string]aadpodid.AzureAssignedIdentity) | |||
|
|||
for _, pod := range listPods { | |||
klog.V(6).Infof("checking pod: %s", pod.Name) |
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.
can we also add the pod namespace here to the log?
pkg/mic/mic.go
Outdated
if pod.Spec.NodeName == "" { | ||
//Node is not yet allocated. In that case skip the pod | ||
klog.V(2).Infof("Pod %s/%s has no assigned node yet. it will be ignored", pod.Namespace, pod.Name) | ||
continue | ||
} | ||
crdPodLabelVal := pod.Labels[aadpodid.CRDLabelKey] | ||
klog.V(6).Infof("Label value: %v", crdPodLabelVal) |
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.
I think we should also add the podns and podname in this log
pkg/mic/mic.go
Outdated
if crdPodLabelVal == "" { | ||
//No binding mentioned in the label. Just continue to the next pod | ||
klog.V(2).Infof("Pod %s/%s has correct %s label but with no value. it will be ignored", pod.Namespace, pod.Name, aadpodid.CRDLabelKey) | ||
continue | ||
} | ||
var matchedBindings []aadpodid.AzureIdentityBinding | ||
for _, allBinding := range *listBindings { | ||
klog.V(6).Infof("Check the binding: %s", allBinding.Spec.Selector) |
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.
same as above
deploy/demo/aadpodidentity.yaml
Outdated
@@ -4,5 +4,5 @@ metadata: | |||
name: demo-aad1 | |||
spec: | |||
type: 0 | |||
ResourceID: RESOURCE_ID | |||
ClientID: CLIENT_ID | |||
resourceID: RESOURCE_ID |
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 should update these manifests right before we cut the new release as this will not work with current release.
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
@kkmsft looks like there are merge conflicts.
Reason for Change:
Update client-go to avoid thread leak.
Simple command to test listing and accept GOOS from env
Fix cache sync calls
Misc. logging changes
Issue Fixed:
Notes for Reviewers:
TODO