-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tenant): add label with tenant name for each tenant
Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
- Loading branch information
1 parent
52aa837
commit 1a6d7f8
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2020-2023 Project Capsule Authors. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package tenant | ||
|
||
import ( | ||
"context" | ||
|
||
capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2" | ||
) | ||
|
||
const ( | ||
TenantNameLabel = "kubernetes.io/metadata.name" | ||
) | ||
|
||
// Sets a label on the Tenant object with it's name | ||
func (r *Manager) ensureMetadata(ctx context.Context, tnt *capsulev1beta2.Tenant) (err error) { | ||
tnt.SetLabels(map[string]string{ | ||
TenantNameLabel: tnt.Name, | ||
}) | ||
|
||
return r.Client.Update(ctx, tnt) | ||
} |