diff --git a/api/orderer/v1/orderer.go b/api/orderer/v1/orderer.go deleted file mode 100644 index be1e5383..00000000 --- a/api/orderer/v1/orderer.go +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright contributors to the Hyperledger Fabric Operator project - * - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package v1 - -import ( - "github.com/IBM-Blockchain/fabric-operator/api/common" -) - -type Orderer struct { - General General `json:"general,omitempty"` - FileLedger FileLedger `json:"fileLedger,omitempty"` - Debug Debug `json:"debug,omitempty"` - Consensus interface{} `json:"consensus,omitempty"` - Operations Operations `json:"operations,omitempty"` - Metrics Metrics `json:"metrics,omitempty"` -} - -// General contains config which should be common among all orderer types. -type General struct { - LedgerType string `json:"ledgerType,omitempty"` - ListenAddress string `json:"listenAddress,omitempty"` - ListenPort uint16 `json:"listenPort,omitempty"` - TLS TLS `json:"tls,omitempty"` - Cluster Cluster `json:"cluster,omitempty"` - Keepalive Keepalive `json:"keepalive,omitempty"` - ConnectionTimeout common.Duration `json:"connectionTimeout,omitempty"` - GenesisMethod string `json:"genesisMethod,omitempty"` - GenesisFile string `json:"genesisFile,omitempty"` // For compatibility only, will be replaced by BootstrapFile - BootstrapFile string `json:"bootstrapFile,omitempty"` - Profile Profile `json:"profile,omitempty"` - LocalMSPDir string `json:"localMspDir,omitempty"` - LocalMSPID string `json:"localMspId,omitempty"` - BCCSP *common.BCCSP `json:"BCCSP,omitempty"` - Authentication Authentication `json:"authentication,omitempty"` -} - -type Cluster struct { - ListenAddress string `json:"listenAddress,omitempty"` - ListenPort uint16 `json:"listenPort,omitempty"` - ServerCertificate string `json:"serverCertificate,omitempty"` - ServerPrivateKey string `json:"serverPrivateKey,omitempty"` - ClientCertificate string `json:"clientCertificate,omitempty"` - ClientPrivateKey string `json:"clientPrivateKey,omitempty"` - RootCAs []string `json:"rootCas,omitempty"` - DialTimeout common.Duration `json:"dialTimeout,omitempty"` - RPCTimeout common.Duration `json:"rpcTimeout,omitempty"` - ReplicationBufferSize int `json:"replicationBufferSize,omitempty"` - ReplicationPullTimeout common.Duration `json:"replicationPullTimeout,omitempty"` - ReplicationRetryTimeout common.Duration `json:"replicationRetryTimeout,omitempty"` - ReplicationBackgroundRefreshInterval common.Duration `json:"replicationBackgroundRefreshInterval,omitempty"` - ReplicationMaxRetries int `json:"replicationMaxRetries,omitempty"` - SendBufferSize int `json:"sendBufferSize,omitempty"` - CertExpirationWarningThreshold common.Duration `json:"certExpirationWarningThreshold,omitempty"` - TLSHandshakeTimeShift common.Duration `json:"tlsHandshakeTimeShift,omitempty"` -} - -// Keepalive contains configuration for gRPC servers. -type Keepalive struct { - ServerMinInterval common.Duration `json:"serverMinInterval,omitempty"` - ServerInterval common.Duration `json:"serverInterval,omitempty"` - ServerTimeout common.Duration `json:"serverTimeout,omitempty"` -} - -// TLS contains configuration for TLS connections. -type TLS struct { - Enabled *bool `json:"enabled,omitempty"` - PrivateKey string `json:"privateKey,omitempty"` - Certificate string `json:"certificate,omitempty"` - RootCAs []string `json:"rootCas,omitempty"` - ClientAuthRequired *bool `json:"clientAuthRequired,omitempty"` - ClientRootCAs []string `json:"clientRootCas,omitempty"` -} - -// SASLPlain contains configuration for SASL/PLAIN authentication -type SASLPlain struct { - Enabled *bool `json:"enabled,omitempty"` - User string `json:"user,omitempty"` - Password string `json:"password,omitempty"` -} - -// Authentication contains configuration parameters related to authenticating -// client messages. -type Authentication struct { - TimeWindow common.Duration `json:"timeWindow,omitempty"` - NoExpirationChecks *bool `json:"noExpirationChecks,omitempty"` -} - -// Profile contains configuration for Go pprof profiling. -type Profile struct { - Enabled *bool `json:"enabled,omitempty"` - Address string `json:"address,omitempty"` -} - -// FileLedger contains configuration for the file-based ledger. -type FileLedger struct { - Location string `json:"location,omitempty"` - Prefix string `json:"prefix,omitempty"` -} - -// Retry contains configuration related to retries and timeouts when the -// connection to the Kafka cluster cannot be established, or when Metadata -// requests needs to be repeated (because the cluster is in the middle of a -// leader election). -type Retry struct { - ShortInterval common.Duration `json:"shortInterval,omitempty"` - ShortTotal common.Duration `json:"shortTotal,omitempty"` - LongInterval common.Duration `json:"longInterval,omitempty"` - LongTotal common.Duration `json:"longTotal,omitempty"` - NetworkTimeouts NetworkTimeouts `json:"networkTimeouts,omitempty"` - Metadata Metadata `json:"metadata,omitempty"` - Producer Producer `json:"producer,omitempty"` - Consumer Consumer `json:"consumer,omitempty"` -} - -// NetworkTimeouts contains the socket timeouts for network requests to the -// Kafka cluster. -type NetworkTimeouts struct { - DialTimeout common.Duration `json:"dialTimeout,omitempty"` - ReadTimeout common.Duration `json:"readTimeout,omitempty"` - WriteTimeout common.Duration `json:"writeTimeout,omitempty"` -} - -// Metadata contains configuration for the metadata requests to the Kafka -// cluster. -type Metadata struct { - RetryMax int `json:"retryMax,omitempty"` - RetryBackoff common.Duration `json:"retryBackoff,omitempty"` -} - -// Producer contains configuration for the producer's retries when failing to -// post a message to a Kafka partition. -type Producer struct { - RetryMax int `json:"retryMax,omitempty"` - RetryBackoff common.Duration `json:"retryBackoff,omitempty"` -} - -// Consumer contains configuration for the consumer's retries when failing to -// read from a Kafa partition. -type Consumer struct { - RetryBackoff common.Duration `json:"retryBackoff,omitempty"` -} - -// Topic contains the settings to use when creating Kafka topics -type Topic struct { - ReplicationFactor int16 `json:"replicationFactor,omitempty"` -} - -// Debug contains configuration for the orderer's debug parameters. -type Debug struct { - BroadcastTraceDir string `json:"broadcastTraceDir,omitempty"` - DeliverTraceDir string `json:"deliverTraceDir,omitempty"` -} - -// Operations configures the operations endpont for the orderer. -type Operations struct { - ListenAddress string `json:"listenAddress,omitempty"` - TLS TLS `json:"tls,omitempty"` -} - -// Operations confiures the metrics provider for the orderer. -type Metrics struct { - Provider string `json:"provider,omitempty"` - Statsd Statsd `json:"statsd,omitempty"` -} - -// Statsd provides the configuration required to emit statsd metrics from the orderer. -type Statsd struct { - Network string `json:"network,omitempty"` - Address string `json:"address,omitempty"` - WriteInterval common.Duration `json:"writeInterval,omitempty"` - Prefix string `json:"prefix,omitempty"` -} diff --git a/api/orderer/v2/orderer.go b/api/orderer/v2/orderer.go deleted file mode 100644 index 3e3e7918..00000000 --- a/api/orderer/v2/orderer.go +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright contributors to the Hyperledger Fabric Operator project - * - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package v2 - -import ( - "github.com/IBM-Blockchain/fabric-operator/api/common" - v1 "github.com/IBM-Blockchain/fabric-operator/api/orderer/v1" -) - -type Orderer struct { - General General `json:"general,omitempty"` - FileLedger v1.FileLedger `json:"fileLedger,omitempty"` - Debug v1.Debug `json:"debug,omitempty"` - Consensus interface{} `json:"consensus,omitempty"` - Operations v1.Operations `json:"operations,omitempty"` - Metrics v1.Metrics `json:"metrics,omitempty"` -} - -type General struct { - ListenAddress string `json:"listenAddress,omitempty"` - ListenPort uint16 `json:"listenPort,omitempty"` - TLS v1.TLS `json:"tls,omitempty"` - Cluster v1.Cluster `json:"cluster,omitempty"` - Keepalive v1.Keepalive `json:"keepalive,omitempty"` - ConnectionTimeout common.Duration `json:"connectionTimeout,omitempty"` - GenesisFile string `json:"genesisFile,omitempty"` // For compatibility only, will be replaced by BootstrapFile - BootstrapFile string `json:"bootstrapFile,omitempty"` - BootstrapMethod string `json:"bootstrapMethod,omitempty"` - Profile v1.Profile `json:"profile,omitempty"` - LocalMSPDir string `json:"localMspDir,omitempty"` - LocalMSPID string `json:"localMspId,omitempty"` - BCCSP *common.BCCSP `json:"BCCSP,omitempty"` - Authentication v1.Authentication `json:"authentication,omitempty"` -} diff --git a/api/v1beta1/common_struct.go b/api/v1beta1/common_struct.go index adb6bf27..b13114e1 100644 --- a/api/v1beta1/common_struct.go +++ b/api/v1beta1/common_struct.go @@ -22,9 +22,6 @@ import ( corev1 "k8s.io/api/core/v1" ) -var BoolTrue = true -var BoolFalse = false - // Service is the overrides to be used for Service of the component // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true type Service struct { diff --git a/api/v1beta1/ibpconsole_types.go b/api/v1beta1/ibpconsole_types.go index 2c9e17a0..d6d3b9d0 100644 --- a/api/v1beta1/ibpconsole_types.go +++ b/api/v1beta1/ibpconsole_types.go @@ -19,7 +19,7 @@ package v1beta1 import ( - consolev1 "github.com/IBM-Blockchain/fabric-operator/api/console/v1" + consolev1 "github.com/IBM-Blockchain/fabric-operator/pkg/apis/console/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 40305010..7a28711a 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -1,12 +1,30 @@ //go:build !ignore_autogenerated // +build !ignore_autogenerated -// Code generated by operator-sdk. DO NOT EDIT. +/* + * Copyright contributors to the Hyperledger Fabric Operator project + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Code generated by controller-gen. DO NOT EDIT. package v1beta1 import ( - consolev1 "github.com/IBM-Blockchain/fabric-operator/api/console/v1" + consolev1 "github.com/IBM-Blockchain/fabric-operator/pkg/apis/console/v1" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" ) diff --git a/api/ca/v1/ca.go b/pkg/apis/ca/v1/ca.go similarity index 86% rename from api/ca/v1/ca.go rename to pkg/apis/ca/v1/ca.go index 21e0d311..7c5ff128 100644 --- a/api/ca/v1/ca.go +++ b/pkg/apis/ca/v1/ca.go @@ -19,7 +19,7 @@ package v1 import ( - "github.com/IBM-Blockchain/fabric-operator/api/common" + commonapi "github.com/IBM-Blockchain/fabric-operator/pkg/apis/common" ) // ServerConfig is the fabric-ca server's config @@ -88,6 +88,7 @@ type CAConfig struct { CSP *BCCSP `json:"bccsp,omitempty"` Intermediate IntermediateCA `json:"intermediate,omitempty"` CRL CRLConfig `json:"crl,omitempty"` + Idemix IdemixConfig `json:"idemix,omitempty"` // Optional client config for an intermediate server which acts as a client // of the root (or parent) server @@ -170,21 +171,21 @@ type Signing struct { // A SigningProfile stores information that the CA needs to store // signature policy. type SigningProfile struct { - Usage []string `json:"usage,omitempty"` - IssuerURL []string `json:"issuerurl,omitempty"` - OCSP string `json:"ocsp,omitempty"` - CRL string `json:"crl,omitempty"` - CAConstraint CAConstraint `json:"caconstraint,omitempty"` - OCSPNoCheck *bool `json:"ocspnocheck,omitempty"` - ExpiryString string `json:"expirystring,omitempty"` - BackdateString string `json:"backdatestring,omitempty"` - AuthKeyName string `json:"authkeyname,omitempty"` - RemoteName string `json:"remotename,omitempty"` - NameWhitelistString string `json:"namewhiteliststring,omitempty"` - AuthRemote AuthRemote `json:"authremote,omitempty"` - CTLogServers []string `json:"ctlogservers,omitempty"` - CertStore string `json:"certstore,omitempty"` - Expiry common.Duration `json:"expiry,omitempty"` + Usage []string `json:"usage,omitempty"` + IssuerURL []string `json:"issuerurl,omitempty"` + OCSP string `json:"ocsp,omitempty"` + CRL string `json:"crl,omitempty"` + CAConstraint CAConstraint `json:"caconstraint,omitempty"` + OCSPNoCheck *bool `json:"ocspnocheck,omitempty"` + ExpiryString string `json:"expirystring,omitempty"` + BackdateString string `json:"backdatestring,omitempty"` + AuthKeyName string `json:"authkeyname,omitempty"` + RemoteName string `json:"remotename,omitempty"` + NameWhitelistString string `json:"namewhiteliststring,omitempty"` + AuthRemote AuthRemote `json:"authremote,omitempty"` + CTLogServers []string `json:"ctlogservers,omitempty"` + CertStore string `json:"certstore,omitempty"` + Expiry commonapi.Duration `json:"expiry,omitempty"` // TODO: Do these need to be overridable? // AllowedExtensions []cfconfig.OID `json:"allowedextensions,omitempty"` @@ -340,7 +341,19 @@ type CRLConfig struct { // Specifies expiration for the CRL generated by the gencrl request // The number of hours specified by this property is added to the UTC time, resulting time // is used to set the 'Next Update' date of the CRL - Expiry common.Duration `json:"expiry,omitempty"` + Expiry commonapi.Duration `json:"expiry,omitempty"` +} + +// IdemixConfig encapsulates Idemix related the configuration options +type IdemixConfig struct { + Curve string `json:"curve,omitempty"` + IssuerPublicKeyfile string `json:"issuerpublickeyfile,omitempty"` + IssuerSecretKeyfile string `json:"issuersecretkeyfile,omitempty"` + RevocationPublicKeyfile string `json:"revocationpublickeyfile,omitempty"` + RevocationPrivateKeyfile string `json:"revocationprivatekeyfile,omitempty"` + RHPoolSize int `json:"rhpoolsize,omitempty"` + NonceExpiration string `json:"nonceexpiration,omitempty"` + NonceSweepInterval string `json:"noncesweepinterval,omitempty"` } // Options contains configuration for the operations system @@ -367,8 +380,8 @@ type TLS struct { // Statsd contains configuration of statsd type Statsd struct { - Network string `json:"network,omitempty"` - Address string `json:"address,omitempty"` - WriteInterval common.Duration `json:"writeinterval,omitempty"` - Prefix string `json:"prefix,omitempty"` + Network string `json:"network,omitempty"` + Address string `json:"address,omitempty"` + WriteInterval commonapi.Duration `json:"writeinterval,omitempty"` + Prefix string `json:"prefix,omitempty"` } diff --git a/api/common/common.go b/pkg/apis/common/common.go similarity index 100% rename from api/common/common.go rename to pkg/apis/common/common.go diff --git a/api/console/v1/console.go b/pkg/apis/console/v1/console.go similarity index 63% rename from api/console/v1/console.go rename to pkg/apis/console/v1/console.go index 5bbedade..d160f2c0 100644 --- a/api/console/v1/console.go +++ b/pkg/apis/console/v1/console.go @@ -59,6 +59,8 @@ type InfraImportOptions struct { // +k8s:deepcopy-gen=true type FeatureFlags struct { + ImportOnlyEnabled *bool `json:"import_only_enabled,omitempty"` + ReadOnlyEnabled *bool `json:"read_only_enabled,omitempty"` CreateChannelEnabled bool `json:"create_channel_enabled,omitempty"` RemotePeerConfigEnabled bool `json:"remote_peer_config_enabled,omitempty"` SaasEnabled bool `json:"saas_enabled,omitempty"` @@ -73,7 +75,6 @@ type FeatureFlags struct { Patch14to20Enabled bool `json:"patch_1_4to2_x_enabled,omitempty"` DevMode bool `json:"dev_mode,omitempty"` MustgatherEnabled bool `json:"mustgather_enabled,omitempty"` - OsnAdminEnabled bool `json:"osnadmin_feats_enabled,omitempty"` } // Added here to avoid the Circular dependency @@ -90,30 +91,31 @@ type CRN struct { } type ConsoleSettingsConfig struct { - Version string `json:"version"` - Email string `json:"initial_admin"` - AuthScheme string `json:"auth_scheme"` - Configtxlator string `json:"configtxlator"` - DeployerURL string `json:"deployer_url"` - DeployerTimeout int32 `json:"deployer_timeout"` - HSM string `json:"hsm"` - SegmentWriteKey string `json:"segment_write_key"` - DBCustomNames DBCustomNames `json:"db_custom_names"` - EnforceBackendSSL bool `json:"enforce_backend_ssl"` - SystemChannelID string `json:"system_channel_id"` - DynamicTLS bool `json:"dynamic_tls"` - DynamicConfig bool `json:"dynamic_config"` - Zone string `json:"zone"` - Infrastructure string `json:"infrastructure"` - FabricCapabilites FabricCapabilites `json:"fabric_capabilities"` - ClusterData *IBPConsoleClusterData `json:"cluster_data"` - ProxyTLSReqs string `json:"proxy_tls_fabric_reqs"` - ProxyTLSUrl string `json:"proxy_tls_ws_url"` - Featureflags *FeatureFlags `json:"feature_flags"` - IBMID *IBMID `json:"ibmid,omitempty"` - IAMApiKey string `json:"iam_api_key,omitempty"` - CRN *CRN `json:"crn,omitempty"` - CRNString string `json:"crn_string,omitempty"` - ActivityTrackerPath string `json:"activity_tracker_path,omitempty"` - TrustProxy string `json:"trust_proxy,omitempty"` + Version string `json:"version"` + Email string `json:"initial_admin"` + AuthScheme string `json:"auth_scheme,omitempty"` + AllowDefaultPassword bool `json:"allow_default_password"` + Configtxlator string `json:"configtxlator"` + DeployerURL string `json:"deployer_url"` + DeployerTimeout int32 `json:"deployer_timeout"` + HSM string `json:"hsm"` + SegmentWriteKey string `json:"segment_write_key"` + DBCustomNames DBCustomNames `json:"db_custom_names"` + EnforceBackendSSL bool `json:"enforce_backend_ssl"` + SystemChannelID string `json:"system_channel_id"` + DynamicTLS bool `json:"dynamic_tls"` + DynamicConfig bool `json:"dynamic_config"` + Zone string `json:"zone"` + Infrastructure string `json:"infrastructure"` + FabricCapabilites FabricCapabilites `json:"fabric_capabilities"` + ClusterData *IBPConsoleClusterData `json:"cluster_data"` + ProxyTLSReqs string `json:"proxy_tls_fabric_reqs"` + ProxyTLSUrl string `json:"proxy_tls_ws_url"` + Featureflags *FeatureFlags `json:"feature_flags"` + IBMID *IBMID `json:"ibmid,omitempty"` + IAMApiKey string `json:"iam_api_key,omitempty"` + CRN *CRN `json:"crn,omitempty"` + CRNString string `json:"crn_string,omitempty"` + ActivityTrackerPath string `json:"activity_tracker_path,omitempty"` + TrustProxy string `json:"trust_proxy,omitempty"` } diff --git a/api/console/v1/zz_generated.deepcopy.go b/pkg/apis/console/v1/zz_generated.deepcopy.go similarity index 68% rename from api/console/v1/zz_generated.deepcopy.go rename to pkg/apis/console/v1/zz_generated.deepcopy.go index 5dd13a6d..0a4d7a89 100644 --- a/api/console/v1/zz_generated.deepcopy.go +++ b/pkg/apis/console/v1/zz_generated.deepcopy.go @@ -1,19 +1,48 @@ //go:build !ignore_autogenerated // +build !ignore_autogenerated -// Code generated by operator-sdk. DO NOT EDIT. +/* + * Copyright contributors to the Hyperledger Fabric Operator project + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Code generated by controller-gen. DO NOT EDIT. package v1 +import () + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FeatureFlags) DeepCopyInto(out *FeatureFlags) { *out = *in + if in.ImportOnlyEnabled != nil { + in, out := &in.ImportOnlyEnabled, &out.ImportOnlyEnabled + *out = new(bool) + **out = **in + } + if in.ReadOnlyEnabled != nil { + in, out := &in.ReadOnlyEnabled, &out.ReadOnlyEnabled + *out = new(bool) + **out = **in + } if in.InfraImportOptions != nil { in, out := &in.InfraImportOptions, &out.InfraImportOptions *out = new(InfraImportOptions) (*in).DeepCopyInto(*out) } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FeatureFlags. @@ -34,7 +63,6 @@ func (in *IBPConsoleClusterData) DeepCopyInto(out *IBPConsoleClusterData) { *out = make([]string, len(*in)) copy(*out, *in) } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IBPConsoleClusterData. @@ -65,7 +93,6 @@ func (in *InfraImportOptions) DeepCopyInto(out *InfraImportOptions) { *out = make([]string, len(*in)) copy(*out, *in) } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InfraImportOptions. diff --git a/api/deployer/deployer.go b/pkg/apis/deployer/deployer.go similarity index 64% rename from api/deployer/deployer.go rename to pkg/apis/deployer/deployer.go index 78747229..1b4eb7e1 100644 --- a/api/deployer/deployer.go +++ b/pkg/apis/deployer/deployer.go @@ -20,6 +20,7 @@ package deployer import ( current "github.com/IBM-Blockchain/fabric-operator/api/v1beta1" + "github.com/IBM-Blockchain/fabric-operator/pkg/util/image" corev1 "k8s.io/api/core/v1" ) @@ -392,3 +393,157 @@ type ConsoleImages struct { // MustgatherDigest is the digest of the mustgather image MustgatherDigest string `json:"mustgatherDigest,omitempty"` } + +func (v *Versions) Override(requestedVersions *Versions, registryURL string, arch string) { + if requestedVersions == nil { + return + } + + if len(requestedVersions.CA) != 0 { + CAVersions := map[string]VersionCA{} + for key, _ := range requestedVersions.CA { + var caConfig VersionCA + requestedCAVersion := requestedVersions.CA[key] + caConfig.Image.Override(&requestedCAVersion.Image, registryURL, arch) + caConfig.Default = requestedCAVersion.Default + caConfig.Version = requestedCAVersion.Version + CAVersions[key] = caConfig + } + v.CA = CAVersions + } + + if len(requestedVersions.Peer) != 0 { + PeerVersions := map[string]VersionPeer{} + for key, _ := range requestedVersions.Peer { + var peerConfig VersionPeer + requestedPeerVersion := requestedVersions.Peer[key] + peerConfig.Image.Override(&requestedPeerVersion.Image, registryURL, arch) + peerConfig.Default = requestedPeerVersion.Default + peerConfig.Version = requestedPeerVersion.Version + PeerVersions[key] = peerConfig + } + v.Peer = PeerVersions + } + + if len(requestedVersions.Orderer) != 0 { + OrdererVersions := map[string]VersionOrderer{} + for key, _ := range requestedVersions.Orderer { + var ordererConfig VersionOrderer + requestedOrdererVersion := requestedVersions.Orderer[key] + ordererConfig.Image.Override(&requestedOrdererVersion.Image, registryURL, arch) + ordererConfig.Default = requestedOrdererVersion.Default + ordererConfig.Version = requestedOrdererVersion.Version + OrdererVersions[key] = ordererConfig + } + v.Orderer = OrdererVersions + } +} + +// Override will look at requested images and use those to override default image +// values. Override also format the image tag to include arch for non-sha based +// tags. +func (i *CAImages) Override(requested *CAImages, registryURL string, arch string) { + // If requested is nil, we are only interested in properly prepending registry + // URL to the image and with overriding default values so a empty struct is initialized. + if requested == nil { + requested = &CAImages{} + } + + // Images + i.CAInitImage = image.GetImage(registryURL, i.CAInitImage, requested.CAInitImage) + i.CAImage = image.GetImage(registryURL, i.CAImage, requested.CAImage) + i.HSMImage = image.GetImage(registryURL, i.HSMImage, requested.HSMImage) + i.EnrollerImage = image.GetImage(registryURL, i.EnrollerImage, requested.EnrollerImage) + + // Tags + i.CAInitTag = image.GetTag(arch, i.CAInitTag, requested.CAInitTag) + i.CATag = image.GetTag(arch, i.CATag, requested.CATag) + i.HSMTag = image.GetTag(arch, i.HSMTag, requested.HSMTag) + i.EnrollerTag = image.GetTag(arch, i.EnrollerTag, requested.EnrollerTag) + + // Digests + i.CAInitDigest = image.GetTag(arch, i.CAInitDigest, requested.CAInitDigest) + i.CADigest = image.GetTag(arch, i.CADigest, requested.CADigest) + i.HSMDigest = image.GetTag(arch, i.HSMDigest, requested.HSMDigest) + i.EnrollerDigest = image.GetTag(arch, i.EnrollerDigest, requested.EnrollerDigest) +} + +func (i *PeerImages) Override(requested *PeerImages, registryURL string, arch string) { + if requested == nil { + requested = &PeerImages{} + } + + // Images + i.PeerInitImage = image.GetImage(registryURL, i.PeerInitImage, requested.PeerInitImage) + i.PeerImage = image.GetImage(registryURL, i.PeerImage, requested.PeerImage) + i.CouchDBImage = image.GetImage(registryURL, i.CouchDBImage, requested.CouchDBImage) + i.DindImage = image.GetImage(registryURL, i.DindImage, requested.DindImage) + i.GRPCWebImage = image.GetImage(registryURL, i.GRPCWebImage, requested.GRPCWebImage) + i.FluentdImage = image.GetImage(registryURL, i.FluentdImage, requested.FluentdImage) + i.CCLauncherImage = image.GetImage(registryURL, i.CCLauncherImage, requested.CCLauncherImage) + i.FileTransferImage = image.GetImage(registryURL, i.FileTransferImage, requested.FileTransferImage) + i.BuilderImage = image.GetImage(registryURL, i.BuilderImage, requested.BuilderImage) + i.GoEnvImage = image.GetImage(registryURL, i.GoEnvImage, requested.GoEnvImage) + i.JavaEnvImage = image.GetImage(registryURL, i.JavaEnvImage, requested.JavaEnvImage) + i.NodeEnvImage = image.GetImage(registryURL, i.NodeEnvImage, requested.NodeEnvImage) + i.HSMImage = image.GetImage(registryURL, i.HSMImage, requested.HSMImage) + i.EnrollerImage = image.GetImage(registryURL, i.EnrollerImage, requested.EnrollerImage) + + // Tags + i.PeerInitTag = image.GetTag(arch, i.PeerInitTag, requested.PeerInitTag) + i.PeerTag = image.GetTag(arch, i.PeerTag, requested.PeerTag) + i.CouchDBTag = image.GetTag(arch, i.CouchDBTag, requested.CouchDBTag) + i.DindTag = image.GetTag(arch, i.DindTag, requested.DindTag) + i.GRPCWebTag = image.GetTag(arch, i.GRPCWebTag, requested.GRPCWebTag) + i.FluentdTag = image.GetTag(arch, i.FluentdTag, requested.FluentdTag) + i.CCLauncherTag = image.GetTag(arch, i.CCLauncherTag, requested.CCLauncherTag) + i.FileTransferTag = image.GetTag(arch, i.FileTransferTag, requested.FileTransferTag) + i.BuilderTag = image.GetTag(arch, i.BuilderTag, requested.BuilderTag) + i.GoEnvTag = image.GetTag(arch, i.GoEnvTag, requested.GoEnvTag) + i.JavaEnvTag = image.GetTag(arch, i.JavaEnvTag, requested.JavaEnvTag) + i.NodeEnvTag = image.GetTag(arch, i.NodeEnvTag, requested.NodeEnvTag) + i.HSMTag = image.GetTag(arch, i.HSMTag, requested.HSMTag) + i.EnrollerTag = image.GetTag(arch, i.EnrollerTag, requested.EnrollerTag) + + // Digests + i.PeerInitDigest = image.GetTag(arch, i.PeerInitDigest, requested.PeerInitDigest) + i.PeerDigest = image.GetTag(arch, i.PeerDigest, requested.PeerDigest) + i.CouchDBDigest = image.GetTag(arch, i.CouchDBDigest, requested.CouchDBDigest) + i.DindDigest = image.GetTag(arch, i.DindDigest, requested.DindDigest) + i.GRPCWebDigest = image.GetTag(arch, i.GRPCWebDigest, requested.GRPCWebDigest) + i.FluentdDigest = image.GetTag(arch, i.FluentdDigest, requested.FluentdDigest) + i.CCLauncherDigest = image.GetTag(arch, i.CCLauncherDigest, requested.CCLauncherDigest) + i.FileTransferDigest = image.GetTag(arch, i.FileTransferDigest, requested.FileTransferDigest) + i.BuilderDigest = image.GetTag(arch, i.BuilderDigest, requested.BuilderDigest) + i.GoEnvDigest = image.GetTag(arch, i.GoEnvDigest, requested.GoEnvDigest) + i.JavaEnvDigest = image.GetTag(arch, i.JavaEnvDigest, requested.JavaEnvDigest) + i.NodeEnvDigest = image.GetTag(arch, i.NodeEnvDigest, requested.NodeEnvDigest) + i.HSMDigest = image.GetTag(arch, i.HSMDigest, requested.HSMDigest) + i.EnrollerDigest = image.GetTag(arch, i.EnrollerDigest, requested.EnrollerDigest) +} + +func (i *OrdererImages) Override(requested *OrdererImages, registryURL string, arch string) { + if requested == nil { + requested = &OrdererImages{} + } + // Images + i.GRPCWebImage = image.GetImage(registryURL, i.GRPCWebImage, requested.GRPCWebImage) + i.OrdererInitImage = image.GetImage(registryURL, i.OrdererInitImage, requested.OrdererInitImage) + i.OrdererImage = image.GetImage(registryURL, i.OrdererImage, requested.OrdererImage) + i.HSMImage = image.GetImage(registryURL, i.HSMImage, requested.HSMImage) + i.EnrollerImage = image.GetImage(registryURL, i.EnrollerImage, requested.EnrollerImage) + + // Tags + i.GRPCWebTag = image.GetTag(arch, i.GRPCWebTag, requested.GRPCWebTag) + i.OrdererInitTag = image.GetTag(arch, i.OrdererInitTag, requested.OrdererInitTag) + i.OrdererTag = image.GetTag(arch, i.OrdererTag, requested.OrdererTag) + i.HSMTag = image.GetTag(arch, i.HSMTag, requested.HSMTag) + i.EnrollerTag = image.GetTag(arch, i.EnrollerTag, requested.EnrollerTag) + + // Digests + i.GRPCWebDigest = image.GetTag(arch, i.GRPCWebDigest, requested.GRPCWebDigest) + i.OrdererInitDigest = image.GetTag(arch, i.OrdererInitDigest, requested.OrdererInitDigest) + i.OrdererDigest = image.GetTag(arch, i.OrdererDigest, requested.OrdererDigest) + i.HSMDigest = image.GetTag(arch, i.HSMDigest, requested.HSMDigest) + i.EnrollerDigest = image.GetTag(arch, i.EnrollerDigest, requested.EnrollerDigest) +} diff --git a/pkg/apis/orderer/v1/orderer.go b/pkg/apis/orderer/v1/orderer.go new file mode 100644 index 00000000..e01c0e1b --- /dev/null +++ b/pkg/apis/orderer/v1/orderer.go @@ -0,0 +1,188 @@ +/* + * Copyright contributors to the Hyperledger Fabric Operator project + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + commonapi "github.com/IBM-Blockchain/fabric-operator/pkg/apis/common" +) + +type Orderer struct { + General General `json:"general,omitempty"` + FileLedger FileLedger `json:"fileLedger,omitempty"` + Debug Debug `json:"debug,omitempty"` + Consensus interface{} `json:"consensus,omitempty"` + Operations Operations `json:"operations,omitempty"` + Metrics Metrics `json:"metrics,omitempty"` +} + +// General contains config which should be common among all orderer types. +type General struct { + LedgerType string `json:"ledgerType,omitempty"` + ListenAddress string `json:"listenAddress,omitempty"` + ListenPort uint16 `json:"listenPort,omitempty"` + TLS TLS `json:"tls,omitempty"` + Cluster Cluster `json:"cluster,omitempty"` + Keepalive Keepalive `json:"keepalive,omitempty"` + ConnectionTimeout commonapi.Duration `json:"connectionTimeout,omitempty"` + GenesisMethod string `json:"genesisMethod,omitempty"` + GenesisFile string `json:"genesisFile,omitempty"` // For compatibility only, will be replaced by BootstrapFile + BootstrapFile string `json:"bootstrapFile,omitempty"` + Profile Profile `json:"profile,omitempty"` + LocalMSPDir string `json:"localMspDir,omitempty"` + LocalMSPID string `json:"localMspId,omitempty"` + BCCSP *commonapi.BCCSP `json:"BCCSP,omitempty"` + Authentication Authentication `json:"authentication,omitempty"` +} + +type Cluster struct { + ListenAddress string `json:"listenAddress,omitempty"` + ListenPort uint16 `json:"listenPort,omitempty"` + ServerCertificate string `json:"serverCertificate,omitempty"` + ServerPrivateKey string `json:"serverPrivateKey,omitempty"` + ClientCertificate string `json:"clientCertificate,omitempty"` + ClientPrivateKey string `json:"clientPrivateKey,omitempty"` + RootCAs []string `json:"rootCas,omitempty"` + DialTimeout commonapi.Duration `json:"dialTimeout,omitempty"` + RPCTimeout commonapi.Duration `json:"rpcTimeout,omitempty"` + ReplicationBufferSize int `json:"replicationBufferSize,omitempty"` + ReplicationPullTimeout commonapi.Duration `json:"replicationPullTimeout,omitempty"` + ReplicationRetryTimeout commonapi.Duration `json:"replicationRetryTimeout,omitempty"` + ReplicationBackgroundRefreshInterval commonapi.Duration `json:"replicationBackgroundRefreshInterval,omitempty"` + ReplicationMaxRetries int `json:"replicationMaxRetries,omitempty"` + SendBufferSize int `json:"sendBufferSize,omitempty"` + CertExpirationWarningThreshold commonapi.Duration `json:"certExpirationWarningThreshold,omitempty"` + TLSHandshakeTimeShift commonapi.Duration `json:"tlsHandshakeTimeShift,omitempty"` +} + +// Keepalive contains configuration for gRPC servers. +type Keepalive struct { + ServerMinInterval commonapi.Duration `json:"serverMinInterval,omitempty"` + ServerInterval commonapi.Duration `json:"serverInterval,omitempty"` + ServerTimeout commonapi.Duration `json:"serverTimeout,omitempty"` +} + +// TLS contains configuration for TLS connections. +type TLS struct { + Enabled *bool `json:"enabled,omitempty"` + PrivateKey string `json:"privateKey,omitempty"` + Certificate string `json:"certificate,omitempty"` + RootCAs []string `json:"rootCas,omitempty"` + ClientAuthRequired *bool `json:"clientAuthRequired,omitempty"` + ClientRootCAs []string `json:"clientRootCas,omitempty"` +} + +// SASLPlain contains configuration for SASL/PLAIN authentication +type SASLPlain struct { + Enabled *bool `json:"enabled,omitempty"` + User string `json:"user,omitempty"` + Password string `json:"password,omitempty"` +} + +// Authentication contains configuration parameters related to authenticating +// client messages. +type Authentication struct { + TimeWindow commonapi.Duration `json:"timeWindow,omitempty"` + NoExpirationChecks *bool `json:"noExpirationChecks,omitempty"` +} + +// Profile contains configuration for Go pprof profiling. +type Profile struct { + Enabled *bool `json:"enabled,omitempty"` + Address string `json:"address,omitempty"` +} + +// FileLedger contains configuration for the file-based ledger. +type FileLedger struct { + Location string `json:"location,omitempty"` + Prefix string `json:"prefix,omitempty"` +} + +// Retry contains configuration related to retries and timeouts when the +// connection to the Kafka cluster cannot be established, or when Metadata +// requests needs to be repeated (because the cluster is in the middle of a +// leader election). +type Retry struct { + ShortInterval commonapi.Duration `json:"shortInterval,omitempty"` + ShortTotal commonapi.Duration `json:"shortTotal,omitempty"` + LongInterval commonapi.Duration `json:"longInterval,omitempty"` + LongTotal commonapi.Duration `json:"longTotal,omitempty"` + NetworkTimeouts NetworkTimeouts `json:"networkTimeouts,omitempty"` + Metadata Metadata `json:"metadata,omitempty"` + Producer Producer `json:"producer,omitempty"` + Consumer Consumer `json:"consumer,omitempty"` +} + +// NetworkTimeouts contains the socket timeouts for network requests to the +// Kafka cluster. +type NetworkTimeouts struct { + DialTimeout commonapi.Duration `json:"dialTimeout,omitempty"` + ReadTimeout commonapi.Duration `json:"readTimeout,omitempty"` + WriteTimeout commonapi.Duration `json:"writeTimeout,omitempty"` +} + +// Metadata contains configuration for the metadata requests to the Kafka +// cluster. +type Metadata struct { + RetryMax int `json:"retryMax,omitempty"` + RetryBackoff commonapi.Duration `json:"retryBackoff,omitempty"` +} + +// Producer contains configuration for the producer's retries when failing to +// post a message to a Kafka partition. +type Producer struct { + RetryMax int `json:"retryMax,omitempty"` + RetryBackoff commonapi.Duration `json:"retryBackoff,omitempty"` +} + +// Consumer contains configuration for the consumer's retries when failing to +// read from a Kafa partition. +type Consumer struct { + RetryBackoff commonapi.Duration `json:"retryBackoff,omitempty"` +} + +// Topic contains the settings to use when creating Kafka topics +type Topic struct { + ReplicationFactor int16 `json:"replicationFactor,omitempty"` +} + +// Debug contains configuration for the orderer's debug parameters. +type Debug struct { + BroadcastTraceDir string `json:"broadcastTraceDir,omitempty"` + DeliverTraceDir string `json:"deliverTraceDir,omitempty"` +} + +// Operations configures the operations endpont for the orderer. +type Operations struct { + ListenAddress string `json:"listenAddress,omitempty"` + TLS TLS `json:"tls,omitempty"` +} + +// Operations confiures the metrics provider for the orderer. +type Metrics struct { + Provider string `json:"provider,omitempty"` + Statsd Statsd `json:"statsd,omitempty"` +} + +// Statsd provides the configuration required to emit statsd metrics from the orderer. +type Statsd struct { + Network string `json:"network,omitempty"` + Address string `json:"address,omitempty"` + WriteInterval commonapi.Duration `json:"writeInterval,omitempty"` + Prefix string `json:"prefix,omitempty"` +} diff --git a/pkg/apis/orderer/v2/orderer.go b/pkg/apis/orderer/v2/orderer.go new file mode 100644 index 00000000..59ebe244 --- /dev/null +++ b/pkg/apis/orderer/v2/orderer.go @@ -0,0 +1,50 @@ +/* + * Copyright contributors to the Hyperledger Fabric Operator project + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v2 + +import ( + commonapi "github.com/IBM-Blockchain/fabric-operator/pkg/apis/common" + v1 "github.com/IBM-Blockchain/fabric-operator/pkg/apis/orderer/v1" +) + +type Orderer struct { + General General `json:"general,omitempty"` + FileLedger v1.FileLedger `json:"fileLedger,omitempty"` + Debug v1.Debug `json:"debug,omitempty"` + Consensus interface{} `json:"consensus,omitempty"` + Operations v1.Operations `json:"operations,omitempty"` + Metrics v1.Metrics `json:"metrics,omitempty"` +} + +type General struct { + ListenAddress string `json:"listenAddress,omitempty"` + ListenPort uint16 `json:"listenPort,omitempty"` + TLS v1.TLS `json:"tls,omitempty"` + Cluster v1.Cluster `json:"cluster,omitempty"` + Keepalive v1.Keepalive `json:"keepalive,omitempty"` + ConnectionTimeout commonapi.Duration `json:"connectionTimeout,omitempty"` + GenesisFile string `json:"genesisFile,omitempty"` // For compatibility only, will be replaced by BootstrapFile + BootstrapFile string `json:"bootstrapFile,omitempty"` + BootstrapMethod string `json:"bootstrapMethod,omitempty"` + Profile v1.Profile `json:"profile,omitempty"` + LocalMSPDir string `json:"localMspDir,omitempty"` + LocalMSPID string `json:"localMspId,omitempty"` + BCCSP *commonapi.BCCSP `json:"BCCSP,omitempty"` + Authentication v1.Authentication `json:"authentication,omitempty"` +} diff --git a/api/orderer/v24/orderer.go b/pkg/apis/orderer/v24/orderer.go similarity index 58% rename from api/orderer/v24/orderer.go rename to pkg/apis/orderer/v24/orderer.go index 42ce69af..f7181bb4 100644 --- a/api/orderer/v24/orderer.go +++ b/pkg/apis/orderer/v24/orderer.go @@ -19,8 +19,8 @@ package v24 import ( - "github.com/IBM-Blockchain/fabric-operator/api/common" - v1 "github.com/IBM-Blockchain/fabric-operator/api/orderer/v1" + commonapi "github.com/IBM-Blockchain/fabric-operator/pkg/apis/common" + v1 "github.com/IBM-Blockchain/fabric-operator/pkg/apis/orderer/v1" ) type Orderer struct { @@ -35,20 +35,22 @@ type Orderer struct { } type General struct { - ListenAddress string `json:"listenAddress,omitempty"` - ListenPort uint16 `json:"listenPort,omitempty"` - TLS v1.TLS `json:"tls,omitempty"` - Cluster v1.Cluster `json:"cluster,omitempty"` - Keepalive v1.Keepalive `json:"keepalive,omitempty"` - ConnectionTimeout common.Duration `json:"connectionTimeout,omitempty"` - GenesisFile string `json:"genesisFile,omitempty"` // For compatibility only, will be replaced by BootstrapFile - BootstrapFile string `json:"bootstrapFile,omitempty"` - BootstrapMethod string `json:"bootstrapMethod,omitempty"` - Profile v1.Profile `json:"profile,omitempty"` - LocalMSPDir string `json:"localMspDir,omitempty"` - LocalMSPID string `json:"localMspId,omitempty"` - BCCSP *common.BCCSP `json:"BCCSP,omitempty"` - Authentication v1.Authentication `json:"authentication,omitempty"` + ListenAddress string `json:"listenAddress,omitempty"` + ListenPort uint16 `json:"listenPort,omitempty"` + TLS v1.TLS `json:"tls,omitempty"` + Cluster v1.Cluster `json:"cluster,omitempty"` + Keepalive v1.Keepalive `json:"keepalive,omitempty"` + ConnectionTimeout commonapi.Duration `json:"connectionTimeout,omitempty"` + GenesisFile string `json:"genesisFile,omitempty"` // For compatibility only, will be replaced by BootstrapFile + BootstrapFile string `json:"bootstrapFile,omitempty"` + BootstrapMethod string `json:"bootstrapMethod,omitempty"` + Profile v1.Profile `json:"profile,omitempty"` + LocalMSPDir string `json:"localMspDir,omitempty"` + LocalMSPID string `json:"localMspId,omitempty"` + BCCSP *commonapi.BCCSP `json:"BCCSP,omitempty"` + Authentication v1.Authentication `json:"authentication,omitempty"` + MaxRecvMsgSize int `json:"maxRecvMsgSize,omitempty"` + MaxSendMsgSize int `json:"maxSendMsgSize,omitempty"` } // FileLedger contains configuration for the file-based ledger. diff --git a/pkg/apis/orderer/v25/orderer.go b/pkg/apis/orderer/v25/orderer.go new file mode 100644 index 00000000..c837fa08 --- /dev/null +++ b/pkg/apis/orderer/v25/orderer.go @@ -0,0 +1,35 @@ +/* + * Copyright contributors to the Hyperledger Fabric Operator project + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v25 + +import ( + v1 "github.com/IBM-Blockchain/fabric-operator/pkg/apis/orderer/v1" + v2 "github.com/IBM-Blockchain/fabric-operator/pkg/apis/orderer/v24" +) + +type Orderer struct { + General v2.General `json:"general,omitempty"` + FileLedger v2.FileLedger `json:"fileLedger,omitempty"` + Debug v1.Debug `json:"debug,omitempty"` + Consensus interface{} `json:"consensus,omitempty"` + Operations v1.Operations `json:"operations,omitempty"` + Metrics v1.Metrics `json:"metrics,omitempty"` + Admin v2.Admin `json:"admin,omitempty"` + ChannelParticipation v2.ChannelParticipation `json:"channelParticipation,omitempty"` +} diff --git a/api/peer/v1/peer.go b/pkg/apis/peer/v1/peer.go similarity index 99% rename from api/peer/v1/peer.go rename to pkg/apis/peer/v1/peer.go index 81823019..3cacdf43 100644 --- a/api/peer/v1/peer.go +++ b/pkg/apis/peer/v1/peer.go @@ -19,7 +19,7 @@ package v1 import ( - "github.com/IBM-Blockchain/fabric-operator/api/common" + "github.com/IBM-Blockchain/fabric-operator/pkg/apis/common" "github.com/docker/docker/api/types/container" ) diff --git a/api/peer/v2/peer.go b/pkg/apis/peer/v2/peer.go similarity index 94% rename from api/peer/v2/peer.go rename to pkg/apis/peer/v2/peer.go index 50d38d96..72df20a2 100644 --- a/api/peer/v2/peer.go +++ b/pkg/apis/peer/v2/peer.go @@ -19,8 +19,9 @@ package v2 import ( - "github.com/IBM-Blockchain/fabric-operator/api/common" - v1 "github.com/IBM-Blockchain/fabric-operator/api/peer/v1" + "github.com/IBM-Blockchain/fabric-operator/pkg/apis/common" + v1 "github.com/IBM-Blockchain/fabric-operator/pkg/apis/peer/v1" + "github.com/IBM-Blockchain/fabric-operator/pkg/util" ) type Core struct { @@ -60,6 +61,8 @@ type Peer struct { ValidatorPoolSize int `json:"validatorPoolSize,omitempty"` Discovery v1.Discovery `json:"discovery,omitempty"` Limits Limits `json:"limits,omitempty"` + MaxRecvMsgSize int `json:"maxRecvMsgSize,omitempty"` + MaxSendMsgSize int `json:"maxSendMsgSize,omitempty"` } type Gossip struct { @@ -206,3 +209,16 @@ type KeepAlive struct { Client v1.KeepAliveClient `json:"client,omitempty"` DeliveryClient v1.KeepAliveClient `json:"deliveryClient,omitempty"` } + +func (a *AddressOverride) CACertsFileToBytes() ([]byte, error) { + data, err := util.Base64ToBytes(a.CACertsFile) + if err != nil { + return nil, err + } + + return data, nil +} + +func (a *AddressOverride) GetCertBytes() []byte { + return a.certBytes +} diff --git a/api/peer/v25/peer.go b/pkg/apis/peer/v25/peer.go similarity index 92% rename from api/peer/v25/peer.go rename to pkg/apis/peer/v25/peer.go index 0f2ba2d7..a26fd990 100644 --- a/api/peer/v25/peer.go +++ b/pkg/apis/peer/v25/peer.go @@ -19,9 +19,9 @@ package v25 import ( - "github.com/IBM-Blockchain/fabric-operator/api/common" - v1 "github.com/IBM-Blockchain/fabric-operator/api/peer/v1" - v2 "github.com/IBM-Blockchain/fabric-operator/api/peer/v2" + "github.com/IBM-Blockchain/fabric-operator/pkg/apis/common" + v1 "github.com/IBM-Blockchain/fabric-operator/pkg/apis/peer/v1" + v2 "github.com/IBM-Blockchain/fabric-operator/pkg/apis/peer/v2" ) type Core struct { @@ -61,6 +61,8 @@ type Peer struct { ValidatorPoolSize int `json:"validatorPoolSize,omitempty"` Discovery v1.Discovery `json:"discovery,omitempty"` Limits v2.Limits `json:"limits,omitempty"` + MaxRecvMsgSize int `json:"maxRecvMsgSize,omitempty"` + MaxSendMsgSize int `json:"maxSendMsgSize,omitempty"` } type Ledger struct { @@ -69,13 +71,6 @@ type Ledger struct { PvtDataStore PvtDataStore `json:"pvtdataStore,omitempty"` } -type Gateway struct { - Enabled *bool `json:"enabled,omitempty"` - EndorsementTimeout common.Duration `json:"endorsementTimeout,omitempty"` - DialTimeout common.Duration `json:"dialTimeout,omitempty"` - BroadcastTimeout common.Duration `json:"broadcastTimeout,omitempty"` -} - type PvtDataStore struct { CollElgProcMaxDbBatchSize int `json:"collElgProcMaxDbBatchSize,omitempty"` CollElgProcDbBatchesInterval int `json:"collElgProcDbBatchesInterval,omitempty"` @@ -83,3 +78,10 @@ type PvtDataStore struct { PurgeInterval int `json:"purgeInterval,omitempty"` PurgedKeyAuditLogging *bool `json:"purgedKeyAuditLogging,omitempty"` } + +type Gateway struct { + Enabled *bool `json:"enabled,omitempty"` + EndorsementTimeout common.Duration `json:"endorsementTimeout,omitempty"` + DialTimeout common.Duration `json:"dialTimeout,omitempty"` + BroadcastTimeout common.Duration `json:"broadcastTimeout,omitempty"` +} diff --git a/scripts/copy_apis.sh b/scripts/copy_apis.sh new file mode 100755 index 00000000..cfe316a5 --- /dev/null +++ b/scripts/copy_apis.sh @@ -0,0 +1,50 @@ + +#!/bin/bash +# +# Copyright contributors to the Hyperledger Fabric Operations Console project +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#!/bin/bash -e + +## delete the folder if already exists +rm -rf /tmp/fabric-operator + +## clone the main repo to temp directory and copy the files +git clone https://github.com/hyperledger-labs/fabric-operator.git /tmp/fabric-operator >/dev/null 2>&1 + +# copy CA config +cp -r /tmp/fabric-operator/pkg/apis/ca/v1/ca.go ../pkg/apis/ca/v1/ca.go + +# copy peer config +cp -r /tmp/fabric-operator/pkg/apis/peer/* ../pkg/apis/peer/. + +# copy orderer config +cp -r /tmp/fabric-operator/pkg/apis/orderer/* ../pkg/apis/orderer/. + +# copy console config +cp -r /tmp/fabric-operator/pkg/apis/console/* ../pkg/apis/console/. + +# copy common config +cp -r /tmp/fabric-operator/pkg/apis/common/* ../pkg/apis/common/ + +# copy deployer config +cp -r /tmp/fabric-operator/pkg/apis/deployer/* ../pkg/apis/deployer/ + +# copy v1beta1 specs +cp /tmp/fabric-operator/api/v1beta1/common_struct.go ../api/v1beta1/ +cp -r /tmp/fabric-operator/api/v1beta1/*_types.go ../api/v1beta1/. +cp /tmp/fabric-operator/api/v1beta1/zz_generated.deepcopy.go ../api/v1beta1/zz_generated.deepcopy.go \ No newline at end of file