Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (32 sloc) 1.03 KB
package namespace
import (
apiv1 ""
apismetav1 ""
func (r *Resource) GetDesiredState(ctx context.Context, obj interface{}) (interface{}, error) {
customObject, err := key.ToCustomObject(obj)
if err != nil {
return nil, microerror.Mask(err)
r.logger.LogCtx(ctx, "level", "debug", "message", "computing the desired namespace")
// Compute the desired state of the namespace to have a reference of data how
// it should be.
namespace := &apiv1.Namespace{
TypeMeta: apismetav1.TypeMeta{
Kind: "Namespace",
APIVersion: "v1",
ObjectMeta: apismetav1.ObjectMeta{
Name: key.ClusterNamespace(customObject),
Labels: map[string]string{
"cluster": key.ClusterID(customObject),
"customer": key.ClusterCustomer(customObject),
r.logger.LogCtx(ctx, "level", "debug", "message", "computed the desired namespace")
return namespace, nil
You can’t perform that action at this time.