-
Notifications
You must be signed in to change notification settings - Fork 39.6k
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
Automatically create the kube-system namespace #25196
Automatically create the kube-system namespace #25196
Conversation
Yes, I was waiting for this. LGTM. |
I'm adding |
Thanks |
// EnsureSystemNamespacesExist will make sure both the default and the system namespace always will exist | ||
func (c *Controller) EnsureSystemNamespacesExist() error { | ||
// Try to create the default namespace | ||
if err := c.CreateNamespaceIfNeeded(api.NamespaceDefault); err != nil { |
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 move the list of namespaces to babysit to a field in Controller, and just iterate over the list here, rather than hard-coding two defaults?
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 was thinking about something like this also:
c.SystemNamespacesInterval = 1 * time.Minute
c.SystemNamespaces = []string {api.NamespaceSystem}
// RunKubernetesNamespaces periodically makes sure that all internal namespaces exist
func (c *Controller) RunKubernetesNamespaces(ch chan struct{}) {
wait.Until(func() {
// Loop the system namespace list, and create them if they do not exist
for _, ns := range c.SystemNamespaces {
if err := c.CreateNamespaceIfNeeded(ns); err != nil {
runtime.HandleError(fmt.Errorf("unable to create required kubernetes system namespace %s: %v", ns, err))
}
}
}, c.SystemNamespacesInterval, ch)
}
Do you think we should go with that approach instead?
It's more dynamic when it's only a list to modify.
The default
ns will be created at the service creation anyway, so there's no need to add it to the list
@liggitt where is the similar code in Openshift, for comparison? |
we don't have controller loops for namespaces, they are just provisioned on startup. |
Of course it's possible to only create the namespaces at |
I think the babysitting is fine |
So you're okay with changing to #25196 (comment)? I think that's the best long-term solution |
614b8fe
to
c2454f3
Compare
// RunKubernetesNamespaces periodically makes sure that all internal namespaces exist | ||
func (c *Controller) RunKubernetesNamespaces(ch chan struct{}) { | ||
wait.Until(func() { | ||
|
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.
omit blank 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.
Thanks, I'm still learning these code formatting conventions :)
I'm OK with this change but I think it'd be pretty bad if someone deletes the system or default namespace--this will actually wait for the namespace deleter to finish up before recreating them! Might consider actually rejecting deletes of kube-system in the namespace registry code. |
we have a place for that already: |
ah, great! On Thu, May 5, 2016 at 11:24 AM, Jordan Liggitt notifications@github.com
|
OK, didn't know about the |
c2454f3
to
8ea3a93
Compare
LGTM |
We should cleanup the addon updater in a follow up. |
@k8s-bot unit test this please github issue: #IGNORE |
GCE e2e build/test passed for commit 8ea3a93. |
@k8s-bot unit test this please github issue: #IGNORE |
1 similar comment
@k8s-bot unit test this please github issue: #IGNORE |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test passed for commit 8ea3a93. |
Automatic merge from submit-queue |
@mikedanese @luxas Does this PR require action by the user when upgrading from 1.2.x to 1.3.0? (Think about non-developer users.) If so, please edit your first comment to have a release-note block, like in #28132. If it is just an optional feature, please change the label to just release-note. If it is not a complete feature by itself, then apply "release-note-none" label instead. |
I believe no. @luxas please confirm. |
@erictune I don't think it'll cause any trouble/require manual action when upgrading specifically. If the release-note-action-required labels are for PRs that break upgrade compability, this PR shouldn't have that label. It's more "you should remove all |
@luxas you were the one who added release-note-action-required which is why we were asking 😃 |
Yes, I know 😊 |
SGTM |
At the same time we ensure that the
default
namespace is present, it also createskube-system
if it doesn't exist.kube-system
will now exist from the beginning, and will be recreated every 10s if deleted, in the same manner as thedefault
nsThis makes UX much better, no need for
kubectl
ing akube-system.yaml
file anymore for a function that is essential to Kubernetes (addons). For instance, this makes dashboard deployment much easier when there's no need to check for thekube-system
ns first.A follow up in the future may remove places where logic to manually create the kube-system namespace is present.
Also fixed a small bug where
CreateNamespaceIfNeeded
ignored thens
parameter and was hardcoded toapi.NamespaceDefault
.@davidopp @lavalamp @thockin @mikedanese @bryk @cheld @fgrzadkowski @smarterclayton @wojtek-t @dlorenc @vishh @dchen1107 @bgrant0607 @roberthbailey
This change is