Skip to content

Commit

Permalink
Add NODE_SELECTOR parameter on TSB template
Browse files Browse the repository at this point in the history
Set empty openshift.io/node-selector annotation on namespace during TSB tests
  • Loading branch information
Jim Minter committed Sep 25, 2017
1 parent 3618de2 commit a5ce46c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion install/templateservicebroker/apiserver-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
kind: TemplateServiceBrokerConfig
apiVersion: config.templateservicebroker.openshift.io/v1
templateNamespaces:
- openshift
- openshift
5 changes: 4 additions & 1 deletion install/templateservicebroker/apiserver-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ parameters:
apiVersion: config.templateservicebroker.openshift.io/v1
templateNamespaces:
- openshift
- name: NODE_SELECTOR
value: "{}"
objects:

# to create the tsb server
Expand Down Expand Up @@ -59,6 +61,7 @@ objects:
path: /healthz
port: 8443
scheme: HTTPS
nodeSelector: "${{NODE_SELECTOR}}"
volumes:
- name: serving-cert
secret:
Expand Down Expand Up @@ -101,7 +104,7 @@ objects:
targetPort: 8443

# This service account will be granted permission to call the TSB.
# The token for this SA will be provided to the service catalog for
# The token for this SA will be provided to the service catalog for
# use when calling the TSB.
- apiVersion: v1
kind: ServiceAccount
Expand Down
17 changes: 17 additions & 0 deletions test/extended/templates/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ func setUser(cli *exutil.CLI, user *userapi.User) {
}
}

func setEmptyNodeSelector(tsbOC *exutil.CLI) {
namespace, err := tsbOC.AdminKubeClient().CoreV1().Namespaces().Get(tsbOC.Namespace(), metav1.GetOptions{})
o.Expect(err).NotTo(o.HaveOccurred())

namespace.Annotations["openshift.io/node-selector"] = ""

_, err = tsbOC.AdminKubeClient().CoreV1().Namespaces().Update(namespace)
o.Expect(err).NotTo(o.HaveOccurred())
}

// EnsureTSB makes sure a TSB is present where expected and returns a client to
// speak to it and a close method which provides the proxy. The caller must
// call the close method, usually done in AfterEach
Expand All @@ -137,6 +147,13 @@ func EnsureTSB(tsbOC *exutil.CLI) (osbclient.Client, func() error) {
}
}

// Set an empty node selector on our namespace. For now this ensures we
// don't trigger a spinning state (see bz1494709) with the DaemonSet if
// projectConfig.defaultNodeSelector is set in the master config and some
// nodes don't match the nodeSelector. The spinning state wastes CPU and
// fills the node logs, but otherwise isn't particularly harmful.
setEmptyNodeSelector(tsbOC)

configPath := exutil.FixturePath("..", "..", "install", "templateservicebroker", "apiserver-template.yaml")

err := tsbOC.AsAdmin().Run("new-app").Args(configPath, "-p", "LOGLEVEL=4", "-p", "NAMESPACE="+tsbOC.Namespace()).Execute()
Expand Down

0 comments on commit a5ce46c

Please sign in to comment.