-
Notifications
You must be signed in to change notification settings - Fork 49
Add labels to kube-system and components namespaces #646
Conversation
81da759
to
cd3166c
Compare
|
373ab03
to
c110753
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.
Nit
5df427d
to
8085908
Compare
8085908
to
e1be658
Compare
e1be658
to
666ca3e
Compare
@iaguis @invidian @knrt10 @surajssd Updated the PR old: allow a generic label To go along with network policies we also need customized namespace labels such as metrics labels for prometheus operator, this was not possible in the current incarnation. To mitigate that:
|
Some questions about the spec of that:
Maybe we could just re-use |
8cbd52a
to
b5c3176
Compare
@iaguis @invidian @knrt10 @surajssd Completely reworked the PR to accommodate reviews and bugs found during testing.
A common task for post installation is to update the components release namespace with labels. Even if we allow helm to take care of components release namespace creation, it only does on the fly creation of the namespace and not from the chart manifest(if namespace manifest is present)
Before updating the release namespace, I retrieve the existing metadata of namespace and remove the labels specific to Lokomotive i.e labels with prefix I believe this same trick can be applied to all manifests in the chart that have Lokmotive specific labels that may/may not be removed in the updated version of the component (out of scope for this PR)
|
27cc2b7
to
f63f5cb
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.
Thanks for the PR @ipochi. I left some comments with suggestions of what I think we should improve before we merge, as in my opinion there is way too much duplicated code in this PR, which can be handled in a better way.
Yes, I am testing a new single method. for purposes of not messing it up. I have tests per component as part of the PR for now. Once the CI passes for the new test. I will update the |
a8bf9f4
to
6332379
Compare
6332379
to
3ed0efc
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 some last nits, otherwise LGTM 🎉
b7ae4d2
to
d447aa3
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.
LGTM, except one nit.
This commit adds a new Namespace struct that holds metadata regarding the Name, Labels and Annotatations specific to the Lokomotive installation or components installation. Signed-off-by: Imran Pochi <imran@kinvolk.io>
Signed-off-by: Imran Pochi <imran@kinvolk.io>
To allow components specify metadata(labels, annotations) for release namespace. Adds the labels that are required to be present on the components release namespace. Updates references where needed due to this change. Signed-off-by: Imran Pochi <imran@kinvolk.io>
Move function `ensureNamespaceExists` to k8sutil package with new name CreateOrUpdateNamespace. This function creates/updates the namespace. Components use this function to create/update the release namespace. This function is also used to update the `kube-system` namespace after cluster installation. Includes another helper function in the `internal` package that merges two given maps. This is done to ensure that existing labels and annotations are retained and the new set of Labels/annotations overrides any existing ones. Signed-off-by: Imran Pochi <imran@kinvolk.io>
This commit adds the namespace label `lokomotive.kinvolk.io/name : <namespace_name>` to the release namespace. Signed-off-by: Imran Pochi <imran@kinvolk.io>
This commit updates the pre-installed namespaces in the cluster to include the labels provided. Signed-off-by: Imran Pochi <imran@kinvolk.io>
ced9a7a
to
8e4a55f
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.
LGTM 🎉
Signed-off-by: knrt10 <tripathi.kautilya@gmail.com>
Signed-off-by: Imran Pochi <imran@kinvolk.io>
Signed-off-by: Imran Pochi <imran@kinvolk.io>
8e4a55f
to
a51b143
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.
LGTM
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.
ok
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.
LGMT and great work @ipochi 🎉
This PR adds label
lokomotive.kinvolk.io/name: <namespace_name>
toNamespace
object forkube-system
and all components.This is done so allow NetworkPolicies be written using the
namespaceSelector
.UPDATE:
To go along with network policies we also need customized namespace labels such as metrics labels for prometheus operator, this was not possible in the current incarnation.
To mitigate that:
GetNamespacelabels()
helm
doesn't not deal with namespace creation or update.component.GetNamespaceLabels()
is called and passed toUpdateNamespaceWithLabels
function.Fixes : #153 #647