25 lines
675 B
Go
25 lines
675 B
Go
package meta
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/core/v1"
|
|
v12 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
|
|
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
|
)
|
|
|
|
type NamespaceConfiguration struct {
|
|
Name string
|
|
Namespace string
|
|
}
|
|
|
|
func (namespace *NamespaceConfiguration) CreateNamespace(ctx *pulumi.Context) (*v1.Namespace, error) {
|
|
return v1.NewNamespace(ctx, fmt.Sprintf("%s-namespace", namespace.Name), &v1.NamespaceArgs{
|
|
Metadata: &v12.ObjectMetaArgs{
|
|
Name: pulumi.String(namespace.Namespace),
|
|
Labels: pulumi.StringMap{
|
|
"app.kubernetes.io/managed-by": pulumi.String("pulumi"),
|
|
},
|
|
},
|
|
})
|
|
}
|