Skip to content
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

Federated ConfigMap controller #35635

Merged
merged 2 commits into from
Nov 4, 2016

Conversation

mwielgus
Copy link
Contributor

@mwielgus mwielgus commented Oct 26, 2016

Based on the secrets controller. E2e tests will come in the next PR.

Release note:

Federated ConfigMap controller. Supports all the API that regular ConfigMap has.

cc: @quinton-hoole @kubernetes/sig-cluster-federation


This change is Reviewable

@mwielgus mwielgus added release-note Denotes a PR that will be considered when it comes time to generate release notes. retest-not-required labels Oct 26, 2016
@mwielgus mwielgus assigned ghost Oct 26, 2016
@k8s-github-robot k8s-github-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 26, 2016
@k8s-ci-robot
Copy link
Contributor

Jenkins GCE etcd3 e2e failed for commit 8c4ba03. Full PR test history.

The magic incantation to run this job again is @k8s-bot gce etcd3 e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins GCI GCE e2e failed for commit 8c4ba03. Full PR test history.

The magic incantation to run this job again is @k8s-bot gci gce e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins GCE e2e failed for commit 8c4ba03. Full PR test history.

The magic incantation to run this job again is @k8s-bot cvm gce e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass review complete. LMK when you're ready for a second pass.

configmapcontroller.configmapDeliverer = util.NewDelayingDeliverer()
configmapcontroller.clusterDeliverer = util.NewDelayingDeliverer()

// Start informer in federated API servers on configmaps that should be federated.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: s/in/on ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

},
)

// Federated updeater along with Create/Update/Delete operations.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: updater

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

util.StartBackoffGC(configmapcontroller.configmapBackoff, stopChan)
}

func getConfigMapKey(namespace, name string) string {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per previous reviews, perhaps just use NamespacedName.String() to avoid redundancy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, need to fix in other controllers

}

// Internal structure for data in delaying deliverer.
type configmapItem struct {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use NamespacedName

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


func (configmapcontroller *ConfigMapController) deliverConfigMapObj(obj interface{}, delay time.Duration, failed bool) {
configmap := obj.(*api_v1.ConfigMap)
configmapcontroller.deliverConfigMap(configmap.Namespace, configmap.Name, delay, failed)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use NamespacedName

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

})

if err != nil {
glog.Errorf("Failed to execute updates for %s: %v", key, err)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Mention retrying in ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

return
}

// Evertyhing is in order but lets be double sure
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per previous review. No. Either retry with a good reason, or don't retry.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

assert.Equal(t, configmap1.Namespace, updatedConfigMap.Namespace)
assert.True(t, configmapsEqual(configmap1, *updatedConfigMap2))

// Test add cluster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Probably good to add a test for a cluster that exists but is offline when the update is performed. Check that it is not updated while offline (to test that the test is actually working), and that it does update once the cluster comes online again.

close(stop)
}

func configmapsEqual(a, b api_v1.ConfigMap) bool {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not right. There are other fields that can be different (e.g. UID). Why not use the Equivalent functions in the library, which do a proper job of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// the future the ConfigMap structure is expanded then any field that is not populated.
// by the api server should be included here.
func ConfigMapEquivalent(s1, s2 api_v1.ConfigMap) bool {
return ObjectMetaEquivalent(s1.ObjectMeta, s2.ObjectMeta) &&
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the specs being equal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no spec in ConfigMap :)

@k8s-ci-robot
Copy link
Contributor

Jenkins verification failed for commit f827c0fa321c7974a53597922be35b2ed813edbb. Full PR test history.

The magic incantation to run this job again is @k8s-bot verify test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins GKE smoke e2e failed for commit f827c0fa321c7974a53597922be35b2ed813edbb. Full PR test history.

The magic incantation to run this job again is @k8s-bot cvm gke e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins GCI GKE smoke e2e failed for commit f827c0fa321c7974a53597922be35b2ed813edbb. Full PR test history.

The magic incantation to run this job again is @k8s-bot gci gke e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@ghost
Copy link

ghost commented Nov 4, 2016

LGTM. Thanks @mwielgus

@ghost ghost added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 4, 2016
@ghost
Copy link

ghost commented Nov 4, 2016

@mwielgus
I1031 16:16:39.248] FAILED hack/make-rules/../../hack/verify-bazel.sh 23s

@ghost
Copy link

ghost commented Nov 4, 2016

@mwielgus
I1031 16:36:33.086] FAILED hack/make-rules/../../hack/verify-test-owners.sh 2s

@mwielgus
Copy link
Contributor Author

mwielgus commented Nov 4, 2016

@quinton-hoole that was already fixed. verification is green.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants