github.com/IBM-Blockchain/fabric-operator@v1.0.4/pkg/migrator/migrator.go (about)

     1  /*
     2   * Copyright contributors to the Hyperledger Fabric Operator project
     3   *
     4   * SPDX-License-Identifier: Apache-2.0
     5   *
     6   * Licensed under the Apache License, Version 2.0 (the "License");
     7   * you may not use this file except in compliance with the License.
     8   * You may obtain a copy of the License at:
     9   *
    10   * 	  http://www.apache.org/licenses/LICENSE-2.0
    11   *
    12   * Unless required by applicable law or agreed to in writing, software
    13   * distributed under the License is distributed on an "AS IS" BASIS,
    14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15   * See the License for the specific language governing permissions and
    16   * limitations under the License.
    17   */
    18  
    19  package migrator
    20  
    21  import (
    22  	config "github.com/IBM-Blockchain/fabric-operator/operatorconfig"
    23  	"github.com/IBM-Blockchain/fabric-operator/pkg/global"
    24  	k8sclient "github.com/IBM-Blockchain/fabric-operator/pkg/k8s/controllerclient"
    25  	"sigs.k8s.io/controller-runtime/pkg/client"
    26  	logf "sigs.k8s.io/controller-runtime/pkg/log"
    27  	"sigs.k8s.io/controller-runtime/pkg/manager"
    28  )
    29  
    30  var log = logf.Log
    31  
    32  type Migrator struct {
    33  	Client    k8sclient.Client
    34  	Reader    client.Reader
    35  	Config    *config.Config
    36  	Namespace string
    37  }
    38  
    39  func New(mgr manager.Manager, cfg *config.Config, namespace string) *Migrator {
    40  	client := k8sclient.New(mgr.GetClient(), &global.ConfigSetter{})
    41  	reader := mgr.GetAPIReader()
    42  	return &Migrator{
    43  		Client:    client,
    44  		Reader:    reader,
    45  		Config:    cfg,
    46  		Namespace: namespace,
    47  	}
    48  }
    49  
    50  func (m *Migrator) Migrate() error {
    51  
    52  	// No-op
    53  
    54  	return nil
    55  }