Skip to content

Commit

Permalink
Refactor pkg/controller/cluster into just pkg/controller (#1495)
Browse files Browse the repository at this point in the history
* Refactor pkg/controller/cluster into just pkg/controller

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
  • Loading branch information
dvaldivia authored Mar 10, 2023
1 parent ee8c66e commit b258c07
Show file tree
Hide file tree
Showing 31 changed files with 44 additions and 51 deletions.
7 changes: 0 additions & 7 deletions pkg/apis/minio.min.io/v2/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ import (
"text/template"
"time"

"github.com/minio/operator/pkg/common"

"github.com/miekg/dns"

appsv1 "k8s.io/api/apps/v1"
Expand Down Expand Up @@ -74,11 +72,6 @@ func envGet(key, defaultValue string) string {
return defaultValue
}

// List of webhook APIs
const (
WebhookAPIUpdate = common.WebhookAPIVersion + "/update"
)

type hostsTemplateValues struct {
StatefulSet string
CIService string
Expand Down
1 change: 1 addition & 0 deletions pkg/common/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ const (
UpgradeServerPort = "4221"
WebhookDefaultPort = "4222"
WebhookAPIBucketService = WebhookAPIVersion + "/bucketsrv"
WebhookAPIUpdate = WebhookAPIVersion + "/update"
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package cluster
package controller

import (
"context"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package cluster
package controller

import (
"context"
Expand Down
12 changes: 5 additions & 7 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"syscall"
"time"

"github.com/minio/operator/pkg"

"k8s.io/client-go/tools/clientcmd"

"github.com/minio/minio-go/v7/pkg/set"
Expand All @@ -32,7 +34,6 @@ import (

clientset "github.com/minio/operator/pkg/client/clientset/versioned"
informers "github.com/minio/operator/pkg/client/informers/externalversions"
"github.com/minio/operator/pkg/controller/cluster"
promclientset "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
kubeinformers "k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes"
Expand All @@ -45,9 +46,6 @@ const (
HostnameEnv = "HOSTNAME"
)

// version provides the version of this operator
var version = "DEVELOPMENT.GOGET"

var (
masterURL string
kubeconfig string
Expand Down Expand Up @@ -76,7 +74,7 @@ func StartOperator() {
flag.Parse()

if checkVersion {
fmt.Println(version)
fmt.Println(pkg.Version)
return
}

Expand Down Expand Up @@ -128,7 +126,7 @@ func StartOperator() {
podName = "operator-pod"
}

mainController := cluster.NewController(
mainController := NewController(
podName,
namespaces,
kubeClient,
Expand All @@ -141,7 +139,7 @@ func StartOperator() {
minioInformerFactory.Sts().V1alpha1().PolicyBindings(),
kubeInformerFactory.Core().V1().Services(),
hostsTemplate,
version,
pkg.Version,
)

go kubeInformerFactory.Start(stopCh)
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/cluster/csr.go → pkg/controller/csr.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// You should have received a copy of the GNU Affero General Public License, version 3,
// along with this program. If not, see <http://www.gnu.org/licenses/>

package cluster
package controller

import (
"context"
Expand All @@ -29,7 +29,7 @@ import (
"syscall"
"time"

"github.com/minio/operator/pkg/controller/cluster/certificates"
"github.com/minio/operator/pkg/controller/certificates"

certificatesV1 "k8s.io/api/certificates/v1"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package cluster
package controller

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// You should have received a copy of the GNU Affero General Public License, version 3,
// along with this program. If not, see <http://www.gnu.org/licenses/>

package cluster
package controller

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// You should have received a copy of the GNU Affero General Public License, version 3,
// along with this program. If not, see <http://www.gnu.org/licenses/>

package cluster
package controller

import (
"context"
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/cluster/kes.go → pkg/controller/kes.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// You should have received a copy of the GNU Affero General Public License, version 3,
// along with this program. If not, see <http://www.gnu.org/licenses/>

package cluster
package controller

import (
"bytes"
Expand All @@ -26,7 +26,7 @@ import (
"errors"
"fmt"

"github.com/minio/operator/pkg/controller/cluster/certificates"
"github.com/minio/operator/pkg/controller/certificates"

corev1 "k8s.io/api/core/v1"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// You should have received a copy of the GNU Affero General Public License, version 3,
// along with this program. If not, see <http://www.gnu.org/licenses/>

package cluster
package controller

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// You should have received a copy of the GNU Affero General Public License, version 3,
// along with this program. If not, see <http://www.gnu.org/licenses/>

package cluster
package controller

import (
"context"
Expand All @@ -30,7 +30,7 @@ import (

xcerts "github.com/minio/pkg/certs"

"github.com/minio/operator/pkg/controller/cluster/certificates"
"github.com/minio/operator/pkg/controller/certificates"

"k8s.io/klog/v2"

Expand Down Expand Up @@ -1146,7 +1146,7 @@ func (c *Controller) syncHandler(key string) error {
miniov2.GetNSFromFile(),
miniov2.GetClusterDomain(),
common.UpgradeServerPort,
miniov2.WebhookAPIUpdate,
common.WebhookAPIUpdate,
))
if err != nil {
_ = c.removeArtifacts()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// You should have received a copy of the GNU Affero General Public License, version 3,
// along with this program. If not, see <http://www.gnu.org/licenses/>

package cluster
package controller

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// You should have received a copy of the GNU Affero General Public License, version 3,
// along with this program. If not, see <http://www.gnu.org/licenses/>

package cluster
package controller

import (
"testing"
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/cluster/minio.go → pkg/controller/minio.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// You should have received a copy of the GNU Affero General Public License, version 3,
// along with this program. If not, see <http://www.gnu.org/licenses/>

package cluster
package controller

import (
"bytes"
Expand All @@ -31,7 +31,7 @@ import (

"k8s.io/apimachinery/pkg/runtime/schema"

"github.com/minio/operator/pkg/controller/cluster/certificates"
"github.com/minio/operator/pkg/controller/certificates"

corev1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// You should have received a copy of the GNU Affero General Public License, version 3,
// along with this program. If not, see <http://www.gnu.org/licenses/>

package cluster
package controller

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package cluster
package controller

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/cluster/pods.go → pkg/controller/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package cluster
package controller

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package cluster
package controller

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package cluster
package controller

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// You should have received a copy of the GNU Affero General Public License, version 3,
// along with this program. If not, see <http://www.gnu.org/licenses/>

package cluster
package controller

import (
"bufio"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package cluster
package controller

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package cluster
package controller

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/cluster/sts.go → pkg/controller/sts.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cluster
package controller

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package cluster
package controller

//lint:file-ignore ST1005 Incorrectly formatted error string

Expand All @@ -28,6 +28,8 @@ import (
"strconv"
"strings"

"github.com/minio/operator/pkg/common"

"github.com/minio/operator/pkg/apis/sts.min.io/v1alpha1"
iampolicy "github.com/minio/pkg/iam/policy"

Expand All @@ -42,7 +44,7 @@ import (

// Supported remote envs
const (
updatePath = "/tmp" + miniov2.WebhookAPIUpdate + slashSeparator
updatePath = "/tmp" + common.WebhookAPIUpdate + slashSeparator
)

const contextLogKey = contextKeyType("operatorlog")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package cluster
package controller

import (
"context"
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/cluster/tls.go → pkg/controller/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package cluster
package controller

import (
"context"
Expand All @@ -29,7 +29,7 @@ import (
"time"

miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2"
"github.com/minio/operator/pkg/controller/cluster/certificates"
"github.com/minio/operator/pkg/controller/certificates"
xcerts "github.com/minio/pkg/certs"
"github.com/minio/pkg/env"
corev1 "k8s.io/api/core/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package cluster
package controller

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// You should have received a copy of the GNU Affero General Public License, version 3,
// along with this program. If not, see <http://www.gnu.org/licenses/>

package cluster
package controller

import "testing"

Expand Down
Loading

0 comments on commit b258c07

Please sign in to comment.