Documentation ¶
Index ¶
- Constants
- func ApplyChaincodeSecrets(ctx context.Context, logger *log.CmdLogger, secretsClient v1.SecretInterface, ...) error
- func CopyImageJSON(logger *log.CmdLogger, src, dest string) error
- func CopyIndexFiles(logger *log.CmdLogger, src, dest string) error
- func CopyMetadataDir(logger *log.CmdLogger, src, dest string) error
- func CreateChaincodeJob(ctx context.Context, logger *log.CmdLogger, ...) (*batchv1.Job, error)
- func GetKubeClientset(logger *log.CmdLogger, kubeconfigPath string) (*kubernetes.Clientset, error)
- func GetKubeNamespace() (string, error)
- func GetOptionalEnv(key, defaultValue string) string
- func GetRequiredEnv(key string) (string, error)
- func GetValidRfc1035LabelName(prefix, peerID string, chaincodeData *ChaincodeJSON, suffixLen int) string
- func WaitForChaincodeJob(ctx context.Context, logger *log.CmdLogger, client cache.Getter, ...) error
- type ChaincodeJSON
- type ChaincodePackageID
- type ImageJSON
- type MetadataJSON
Constants ¶
const ( ChaincodeNamespaceVariable = builderVariablePrefix + "NAMESPACE" ObjectNamePrefixVariable = builderVariablePrefix + "OBJECT_NAME_PREFIX" ChaincodeServiceAccountVariable = builderVariablePrefix + "SERVICE_ACCOUNT" DebugVariable = builderVariablePrefix + "DEBUG" KubeconfigPathVariable = "KUBECONFIG_PATH" PeerIDVariable = "CORE_PEER_ID" )
const ( ChaincodeFile = "chaincode.json" ImageFile = "image.json" MetadataFile = "metadata.json" MetadataDir = "META-INF" )
const ( ObjectNameSuffixLength int = 5 // Defaults. DefaultNamespace string = "default" DefaultObjectNamePrefix string = "hlfcc" DefaultServiceAccountName string = "default" // Mutual TLS auth client key and cert paths in the chaincode container. TLSClientKeyPath string = "/etc/hyperledger/fabric/client.key" TLSClientCertPath string = "/etc/hyperledger/fabric/client.crt" TLSClientKeyFile string = "/etc/hyperledger/fabric/client_pem.key" TLSClientCertFile string = "/etc/hyperledger/fabric/client_pem.crt" TLSClientRootCertFile string = "/etc/hyperledger/fabric/peer.crt" )
Variables ¶
This section is empty.
Functions ¶
func ApplyChaincodeSecrets ¶
func ApplyChaincodeSecrets( ctx context.Context, logger *log.CmdLogger, secretsClient v1.SecretInterface, secretName, namespace, peerID string, chaincodeData *ChaincodeJSON, ) error
func CopyImageJSON ¶
CopyImageJSON validates and copies the chaincode image file.
func CopyIndexFiles ¶
CopyIndexFiles copies CouchDB index definitions from source to destination directories.
func CopyMetadataDir ¶
CopyMetadataDir copies all chaincode metadata from source to destination directories.
func CreateChaincodeJob ¶ added in v0.14.0
func CreateChaincodeJob( ctx context.Context, logger *log.CmdLogger, jobsClient typedBatchv1.JobInterface, objectName, namespace, serviceAccount, peerID string, chaincodeData *ChaincodeJSON, imageData *ImageJSON, ) (*batchv1.Job, error)
func GetKubeClientset ¶
GetKubeClientset returns a client object for a provided kubeconfig filepath if one is provided, or which uses the service account kubernetes gives to pods otherwise.
func GetKubeNamespace ¶
func GetOptionalEnv ¶
func GetRequiredEnv ¶
func GetValidRfc1035LabelName ¶ added in v0.13.0
func GetValidRfc1035LabelName(prefix, peerID string, chaincodeData *ChaincodeJSON, suffixLen int) string
GetValidRfc1035LabelName returns a valid RFC 1035 label name with the format <prefix>-<truncated_chaincode_label>-<chaincode_run_hash> and space for a suffix if required.
Types ¶
type ChaincodeJSON ¶
type ChaincodeJSON struct { ChaincodeID string `json:"chaincode_id"` PeerAddress string `json:"peer_address"` ClientCert string `json:"client_cert"` ClientKey string `json:"client_key"` RootCert string `json:"root_cert"` MspID string `json:"mspid"` }
ChaincodeJSON represents the chaincode.json file that is supplied by Fabric in the RUN_METADATA_DIR.
func ReadChaincodeJSON ¶
func ReadChaincodeJSON(logger *log.CmdLogger, dir string) (*ChaincodeJSON, error)
ReadChaincodeJSON reads and parses the chaincode.json file in the provided directory.
type ChaincodePackageID ¶ added in v0.13.0
func NewChaincodePackageID ¶ added in v0.13.0
func NewChaincodePackageID(chaincodeID string) *ChaincodePackageID
NewChaincodePackageID returns a ChaincodePackageID created from the provided string.
type MetadataJSON ¶ added in v0.14.0
MetadataJSON represents the metadata.json file in the k8s chaincode package.
func ReadMetadataJSON ¶ added in v0.14.0
func ReadMetadataJSON(logger *log.CmdLogger, dir string) (*MetadataJSON, error)
ReadMetadataJSON reads and parses the metadata.json file in the provided directory.