github.com/IBM-Blockchain/fabric-operator@v1.0.4/pkg/apis/orderer/v1/orderer.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 v1
    20  
    21  import (
    22  	commonapi "github.com/IBM-Blockchain/fabric-operator/pkg/apis/common"
    23  )
    24  
    25  type Orderer struct {
    26  	General    General     `json:"general,omitempty"`
    27  	FileLedger FileLedger  `json:"fileLedger,omitempty"`
    28  	Debug      Debug       `json:"debug,omitempty"`
    29  	Consensus  interface{} `json:"consensus,omitempty"`
    30  	Operations Operations  `json:"operations,omitempty"`
    31  	Metrics    Metrics     `json:"metrics,omitempty"`
    32  }
    33  
    34  // General contains config which should be common among all orderer types.
    35  type General struct {
    36  	LedgerType        string             `json:"ledgerType,omitempty"`
    37  	ListenAddress     string             `json:"listenAddress,omitempty"`
    38  	ListenPort        uint16             `json:"listenPort,omitempty"`
    39  	TLS               TLS                `json:"tls,omitempty"`
    40  	Cluster           Cluster            `json:"cluster,omitempty"`
    41  	Keepalive         Keepalive          `json:"keepalive,omitempty"`
    42  	ConnectionTimeout commonapi.Duration `json:"connectionTimeout,omitempty"`
    43  	GenesisMethod     string             `json:"genesisMethod,omitempty"`
    44  	GenesisFile       string             `json:"genesisFile,omitempty"` // For compatibility only, will be replaced by BootstrapFile
    45  	BootstrapFile     string             `json:"bootstrapFile,omitempty"`
    46  	Profile           Profile            `json:"profile,omitempty"`
    47  	LocalMSPDir       string             `json:"localMspDir,omitempty"`
    48  	LocalMSPID        string             `json:"localMspId,omitempty"`
    49  	BCCSP             *commonapi.BCCSP   `json:"BCCSP,omitempty"`
    50  	Authentication    Authentication     `json:"authentication,omitempty"`
    51  }
    52  
    53  type Cluster struct {
    54  	ListenAddress                        string             `json:"listenAddress,omitempty"`
    55  	ListenPort                           uint16             `json:"listenPort,omitempty"`
    56  	ServerCertificate                    string             `json:"serverCertificate,omitempty"`
    57  	ServerPrivateKey                     string             `json:"serverPrivateKey,omitempty"`
    58  	ClientCertificate                    string             `json:"clientCertificate,omitempty"`
    59  	ClientPrivateKey                     string             `json:"clientPrivateKey,omitempty"`
    60  	RootCAs                              []string           `json:"rootCas,omitempty"`
    61  	DialTimeout                          commonapi.Duration `json:"dialTimeout,omitempty"`
    62  	RPCTimeout                           commonapi.Duration `json:"rpcTimeout,omitempty"`
    63  	ReplicationBufferSize                int                `json:"replicationBufferSize,omitempty"`
    64  	ReplicationPullTimeout               commonapi.Duration `json:"replicationPullTimeout,omitempty"`
    65  	ReplicationRetryTimeout              commonapi.Duration `json:"replicationRetryTimeout,omitempty"`
    66  	ReplicationBackgroundRefreshInterval commonapi.Duration `json:"replicationBackgroundRefreshInterval,omitempty"`
    67  	ReplicationMaxRetries                int                `json:"replicationMaxRetries,omitempty"`
    68  	SendBufferSize                       int                `json:"sendBufferSize,omitempty"`
    69  	CertExpirationWarningThreshold       commonapi.Duration `json:"certExpirationWarningThreshold,omitempty"`
    70  	TLSHandshakeTimeShift                commonapi.Duration `json:"tlsHandshakeTimeShift,omitempty"`
    71  }
    72  
    73  // Keepalive contains configuration for gRPC servers.
    74  type Keepalive struct {
    75  	ServerMinInterval commonapi.Duration `json:"serverMinInterval,omitempty"`
    76  	ServerInterval    commonapi.Duration `json:"serverInterval,omitempty"`
    77  	ServerTimeout     commonapi.Duration `json:"serverTimeout,omitempty"`
    78  }
    79  
    80  // TLS contains configuration for TLS connections.
    81  type TLS struct {
    82  	Enabled            *bool    `json:"enabled,omitempty"`
    83  	PrivateKey         string   `json:"privateKey,omitempty"`
    84  	Certificate        string   `json:"certificate,omitempty"`
    85  	RootCAs            []string `json:"rootCas,omitempty"`
    86  	ClientAuthRequired *bool    `json:"clientAuthRequired,omitempty"`
    87  	ClientRootCAs      []string `json:"clientRootCas,omitempty"`
    88  }
    89  
    90  // SASLPlain contains configuration for SASL/PLAIN authentication
    91  type SASLPlain struct {
    92  	Enabled  *bool  `json:"enabled,omitempty"`
    93  	User     string `json:"user,omitempty"`
    94  	Password string `json:"password,omitempty"`
    95  }
    96  
    97  // Authentication contains configuration parameters related to authenticating
    98  // client messages.
    99  type Authentication struct {
   100  	TimeWindow         commonapi.Duration `json:"timeWindow,omitempty"`
   101  	NoExpirationChecks *bool              `json:"noExpirationChecks,omitempty"`
   102  }
   103  
   104  // Profile contains configuration for Go pprof profiling.
   105  type Profile struct {
   106  	Enabled *bool  `json:"enabled,omitempty"`
   107  	Address string `json:"address,omitempty"`
   108  }
   109  
   110  // FileLedger contains configuration for the file-based ledger.
   111  type FileLedger struct {
   112  	Location string `json:"location,omitempty"`
   113  	Prefix   string `json:"prefix,omitempty"`
   114  }
   115  
   116  // Retry contains configuration related to retries and timeouts when the
   117  // connection to the Kafka cluster cannot be established, or when Metadata
   118  // requests needs to be repeated (because the cluster is in the middle of a
   119  // leader election).
   120  type Retry struct {
   121  	ShortInterval   commonapi.Duration `json:"shortInterval,omitempty"`
   122  	ShortTotal      commonapi.Duration `json:"shortTotal,omitempty"`
   123  	LongInterval    commonapi.Duration `json:"longInterval,omitempty"`
   124  	LongTotal       commonapi.Duration `json:"longTotal,omitempty"`
   125  	NetworkTimeouts NetworkTimeouts    `json:"networkTimeouts,omitempty"`
   126  	Metadata        Metadata           `json:"metadata,omitempty"`
   127  	Producer        Producer           `json:"producer,omitempty"`
   128  	Consumer        Consumer           `json:"consumer,omitempty"`
   129  }
   130  
   131  // NetworkTimeouts contains the socket timeouts for network requests to the
   132  // Kafka cluster.
   133  type NetworkTimeouts struct {
   134  	DialTimeout  commonapi.Duration `json:"dialTimeout,omitempty"`
   135  	ReadTimeout  commonapi.Duration `json:"readTimeout,omitempty"`
   136  	WriteTimeout commonapi.Duration `json:"writeTimeout,omitempty"`
   137  }
   138  
   139  // Metadata contains configuration for the metadata requests to the Kafka
   140  // cluster.
   141  type Metadata struct {
   142  	RetryMax     int                `json:"retryMax,omitempty"`
   143  	RetryBackoff commonapi.Duration `json:"retryBackoff,omitempty"`
   144  }
   145  
   146  // Producer contains configuration for the producer's retries when failing to
   147  // post a message to a Kafka partition.
   148  type Producer struct {
   149  	RetryMax     int                `json:"retryMax,omitempty"`
   150  	RetryBackoff commonapi.Duration `json:"retryBackoff,omitempty"`
   151  }
   152  
   153  // Consumer contains configuration for the consumer's retries when failing to
   154  // read from a Kafa partition.
   155  type Consumer struct {
   156  	RetryBackoff commonapi.Duration `json:"retryBackoff,omitempty"`
   157  }
   158  
   159  // Topic contains the settings to use when creating Kafka topics
   160  type Topic struct {
   161  	ReplicationFactor int16 `json:"replicationFactor,omitempty"`
   162  }
   163  
   164  // Debug contains configuration for the orderer's debug parameters.
   165  type Debug struct {
   166  	BroadcastTraceDir string `json:"broadcastTraceDir,omitempty"`
   167  	DeliverTraceDir   string `json:"deliverTraceDir,omitempty"`
   168  }
   169  
   170  // Operations configures the operations endpont for the orderer.
   171  type Operations struct {
   172  	ListenAddress string `json:"listenAddress,omitempty"`
   173  	TLS           TLS    `json:"tls,omitempty"`
   174  }
   175  
   176  // Operations confiures the metrics provider for the orderer.
   177  type Metrics struct {
   178  	Provider string `json:"provider,omitempty"`
   179  	Statsd   Statsd `json:"statsd,omitempty"`
   180  }
   181  
   182  // Statsd provides the configuration required to emit statsd metrics from the orderer.
   183  type Statsd struct {
   184  	Network       string             `json:"network,omitempty"`
   185  	Address       string             `json:"address,omitempty"`
   186  	WriteInterval commonapi.Duration `json:"writeInterval,omitempty"`
   187  	Prefix        string             `json:"prefix,omitempty"`
   188  }