Skip to content

Commit

Permalink
chore(naming): deploy into openshift-provider-certification ns
Browse files Browse the repository at this point in the history
  • Loading branch information
bostrt committed Jun 30, 2022
1 parent faaa12a commit 40ebdcb
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
6 changes: 2 additions & 4 deletions docs/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ is necessarily as some complex code is present in Sonobuoy's Run command
implementation.

This direct usage of Sonobuoy's Cobra commands should be avoided since that
creates and odd development experience and the ability to cleanly set Sonobuoy's
creates an odd development experience and the ability to cleanly set Sonobuoy's
flags is muddied by code like this:

```golang
Expand All @@ -42,9 +42,7 @@ runCmd.Flags().Set("dns-namespace", "openshift-dns")
runCmd.Flags().Set("kubeconfig", r.config.Kubeconfig)
```

Once there is more confidence or just understanding of the Sonobuoy Client code
then the OpenShift provider certification tool's commands should all be using it.
Like this:
Instead, use the Sonobuoy Client includes with the project like this:

```golang
// Great
Expand Down
2 changes: 1 addition & 1 deletion pkg/destroy/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func NewCmdDestroy(config *pkg.Config) *cobra.Command {
// DeleteSonobuoyEnv initiates deletion of Sonobuoy environment and waits until completion.
func (d *DestroyOptions) DeleteSonobuoyEnv() error {
deleteConfig := &client.DeleteConfig{
Namespace: "sonobuoy",
Namespace: pkg.CertificationNamespace,
Wait: DeleteSonobuoyEnvWaitTime,
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/retrieve/retrieve.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func retrieveResultsRetry(config *pkg.Config) error {
func retrieveResults(config *pkg.Config) error {
// Get a reader that contains the tar output of the results directory.
reader, ec, err := config.SonobuoyClient.RetrieveResults(&client.RetrieveConfig{
Namespace: "sonobuoy",
Namespace: pkg.CertificationNamespace,
Path: config2.AggregatorResultsPath,
})
if err != nil {
Expand Down
7 changes: 5 additions & 2 deletions pkg/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (r *RunOptions) PreRunCheck() error {
}

// Check if sonobuoy namespace already exists
p, err := nsClient.Namespaces().Get(context.TODO(), "sonobuoy", metav1.GetOptions{})
p, err := nsClient.Namespaces().Get(context.TODO(), pkg.CertificationNamespace, metav1.GetOptions{})
if err != nil {
// If error is due to namespace not being found, we continue.
if !kerrors.IsNotFound(err) {
Expand Down Expand Up @@ -194,7 +194,7 @@ func (r *RunOptions) Run() error {

// Let Sonobuoy do some preflight checks before we run
errs := r.config.SonobuoyClient.PreflightChecks(&client.PreflightConfig{
Namespace: "sonobuoy",
Namespace: pkg.CertificationNamespace,
DNSNamespace: "openshift-dns",
DNSPodLabels: []string{"dns.operator.openshift.io/daemonset-dns=default"},
})
Expand Down Expand Up @@ -241,6 +241,9 @@ func (r *RunOptions) Run() error {
aggConfig.WorkerImage = r.config.SonobuoyImage
}

// Set aggregator deployment namespace
aggConfig.Namespace = pkg.CertificationNamespace

// Fill out the Run configuration
runConfig := &client.RunConfig{
GenConfig: client.GenConfig{
Expand Down
4 changes: 2 additions & 2 deletions pkg/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (s *StatusOptions) PreRunCheck() error {
}

// Check if sonobuoy namespac already exists
_, err = nsClient.Namespaces().Get(context.TODO(), "sonobuoy", metav1.GetOptions{})
_, err = nsClient.Namespaces().Get(context.TODO(), pkg.CertificationNamespace, metav1.GetOptions{})
if err != nil {
// If error is due to namespace not being found, return guidance.
if kerrors.IsNotFound(err) {
Expand All @@ -100,7 +100,7 @@ func (s *StatusOptions) PreRunCheck() error {
// Update the Sonobuoy state saved in StatusOptions
func (s *StatusOptions) Update() error {
// TODO Is a retry in here needed?
sstatus, err := s.config.SonobuoyClient.GetStatus(&client.StatusConfig{Namespace: "sonobuoy"})
sstatus, err := s.config.SonobuoyClient.GetStatus(&client.StatusConfig{Namespace: pkg.CertificationNamespace})
if err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions pkg/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
const (
AnyUIDClusterRoleBinding = "opct-anyuid"
PrivilegedClusterRoleBinding = "opct-privileged"
CertificationNamespace = "openshift-provider-certification"
ResultsFileName = "results-latest.txt"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/wait/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func WaitForRequiredResources(config *pkg.Config) error {
return err
}

lw := cache.NewFilteredListWatchFromClient(client.CoreV1().RESTClient(), "pods", "sonobuoy", func(options *metav1.ListOptions) {
lw := cache.NewFilteredListWatchFromClient(client.CoreV1().RESTClient(), "pods", pkg.CertificationNamespace, func(options *metav1.ListOptions) {
options.LabelSelector = "component=sonobuoy,sonobuoy-component=aggregator"
})

Expand Down

0 comments on commit 40ebdcb

Please sign in to comment.