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

Create k8s controllers based on kube-apiserver version detected #2735

Merged
merged 2 commits into from
Feb 7, 2018

Conversation

aanm
Copy link
Member

@aanm aanm commented Feb 6, 2018

Summary of changes:

  • k8s: set up informers / controllers based on api-server version

    Since kubernetes automatically adds a v1 network policy to both v1 and
    v1beta1 resources and a v1beta1 network policy also to both v1 and
    v1beta1 resources, it will be useless to watch for both resource types
    at the same time. For that reason it was added a kube-apiserver version
    detection to set up the necessary informers / controllers based on the
    kube-apiserver version detected.

    For example, if kube-apiserver is running with version 1.6. only the
    Cilium TPR (v1) and the kubernetes network policy v1beta1 controllers
    will be started. If kube-apiserver is running with version 1.8 only the
    Cilium CRD (v2) and the kubernetes network policy v1 controllers will be
    started

  • pkg/k8s: mirror parseNetworkPolicy for kubernetes NP v1beta1
    Fixes: Deleting then adding a policy in quick succession causes invocation of wrong Kubernetes NetworkPolicy watcher #2731

Set up the k8s watchers based on the kube-apiserver version #2731

Since kubernetes automatically adds a v1 network policy to both v1 and
v1beta1 resources and a v1beta1 network policy also to both v1 and
v1beta1 resources, it will be useless to watch for both resource types
at the same time. For that reason it was added a kube-apiserver version
detection to set up the necessary informers / controllers based on the
kube-apiserver version detected.

For example, if kube-apiserver is running with version 1.6. only the
Cilium TPR (v1) and the kubernetes network policy v1beta1 controllers
will be started. If kube-apiserver is running with version 1.8 only the
Cilium CRD (v2) and the kubernetes network policy v1 controllers will be
started.

Signed-off-by: André Martins <andre@cilium.io>
@aanm aanm added kind/bug This is a bug in the Cilium logic. pending-review priority/medium This is considered important, but not urgent. sig/k8s Impacts the kubernetes API, or kubernetes -> cilium internals translation layers. release-note/bug This PR fixes an issue in a previous release of Cilium. labels Feb 6, 2018
@aanm aanm requested a review from a team February 6, 2018 23:35
return &selector
}

// ParseNetworkPolicy parses a k8s NetworkPolicy. Returns a list of

Choose a reason for hiding this comment

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

comment on exported function ParseNetworkPolicyV1beta1 should be of the form "ParseNetworkPolicyV1beta1 ..."

Signed-off-by: André Martins <andre@cilium.io>
@aanm aanm force-pushed the 2731-k8sv1beta1networkpolicy branch from 425d0c3 to 37363b5 Compare February 6, 2018 23:37
@aanm
Copy link
Member Author

aanm commented Feb 6, 2018

test-me-please

@aanm
Copy link
Member Author

aanm commented Feb 6, 2018

test-nightly

@aanm
Copy link
Member Author

aanm commented Feb 7, 2018

test-me-please

@ianvernon ianvernon merged commit 24f254a into master Feb 7, 2018
@ianvernon ianvernon deleted the 2731-k8sv1beta1networkpolicy branch February 7, 2018 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is a bug in the Cilium logic. priority/medium This is considered important, but not urgent. release-note/bug This PR fixes an issue in a previous release of Cilium. sig/k8s Impacts the kubernetes API, or kubernetes -> cilium internals translation layers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants