Skip to content

Commit

Permalink
Merge pull request #71 from phoracek/configurable_namespace
Browse files Browse the repository at this point in the history
allow namespace adjustment during manifests build
  • Loading branch information
phoracek committed Apr 16, 2019
2 parents 50480d4 + 34fe29e commit a62da9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions pkg/components/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (ai *AddonsImages) FillDefaults() *AddonsImages {
return ai
}

func GetDeployment(repository string, tag string, imagePullPolicy string, addonsImages *AddonsImages) *appsv1.Deployment {
func GetDeployment(namespace string, repository string, tag string, imagePullPolicy string, addonsImages *AddonsImages) *appsv1.Deployment {
image := fmt.Sprintf("%s/%s:%s", repository, Name, tag)
deployment := &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{
Expand All @@ -57,7 +57,7 @@ func GetDeployment(repository string, tag string, imagePullPolicy string, addons
},
ObjectMeta: metav1.ObjectMeta{
Name: Name,
Namespace: Name,
Namespace: namespace,
},
Spec: appsv1.DeploymentSpec{
Replicas: int32Ptr(1),
Expand Down Expand Up @@ -150,15 +150,15 @@ func GetDeployment(repository string, tag string, imagePullPolicy string, addons
return deployment
}

func GetRole() *rbacv1.Role {
func GetRole(namespace string) *rbacv1.Role {
role := &rbacv1.Role{
TypeMeta: metav1.TypeMeta{
APIVersion: "rbac.authorization.k8s.io/v1",
Kind: "Role",
},
ObjectMeta: metav1.ObjectMeta{
Name: Name,
Namespace: Name,
Namespace: namespace,
Labels: map[string]string{
"name": Name,
},
Expand Down
3 changes: 2 additions & 1 deletion tools/manifest-templator/manifest-templator.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func getCNA(data *templateData) {

// Get CNA Deployment
cnadeployment := components.GetDeployment(
data.Namespace,
data.ContainerPrefix,
data.ContainerTag,
data.ImagePullPolicy,
Expand All @@ -153,7 +154,7 @@ func getCNA(data *templateData) {

// Get CNA Role
writer = strings.Builder{}
role := components.GetRole()
role := components.GetRole(data.Namespace)
marshallObject(role, &writer)
roleString := writer.String()

Expand Down

0 comments on commit a62da9d

Please sign in to comment.