github.com/IBM-Blockchain/fabric-operator@v1.0.4/api/v1beta1/common_struct.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 v1beta1
    20  
    21  import (
    22  	corev1 "k8s.io/api/core/v1"
    23  )
    24  
    25  // Service is the overrides to be used for Service of the component
    26  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    27  type Service struct {
    28  	// The "type" of the service to be used
    29  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    30  	Type corev1.ServiceType `json:"type,omitempty"`
    31  }
    32  
    33  // StorageSpec is the overrides to be used for storage of the component
    34  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    35  type StorageSpec struct {
    36  	// Size of storage
    37  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    38  	Size string `json:"size,omitempty"`
    39  
    40  	// Class is the storage class
    41  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    42  	Class string `json:"class,omitempty"`
    43  }
    44  
    45  // NetworkInfo is the overrides for the network of the component
    46  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    47  type NetworkInfo struct {
    48  	// Domain for the components
    49  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    50  	Domain string `json:"domain,omitempty"`
    51  
    52  	// ConsolePort is the port to access the console
    53  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    54  	ConsolePort int32 `json:"consolePort,omitempty"`
    55  
    56  	// ConfigtxlatorPort is the port to access configtxlator
    57  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    58  	ConfigtxlatorPort int32 `json:"configtxlatorPort,omitempty"`
    59  
    60  	// ProxyPort is the port to access console proxy
    61  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    62  	ProxyPort int32 `json:"proxyPort,omitempty"`
    63  }
    64  
    65  // Ingress (Optional) is the list of overrides for ingress of the components
    66  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    67  type Ingress struct {
    68  	// TlsSecretName (Optional) is the secret name to be used for tls certificates
    69  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    70  	TlsSecretName string `json:"tlsSecretName,omitempty"`
    71  
    72  	// Class (Optional) is the class to set for ingress
    73  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    74  	Class string `json:"class,omitempty"`
    75  }
    76  
    77  // IBPCRStatus is the string that defines if status is set by the controller
    78  // +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
    79  type IBPCRStatus string
    80  
    81  const (
    82  	// True means that the status is set by the controller successfully
    83  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
    84  	True IBPCRStatus = "True"
    85  
    86  	// False stands for the status which is not correctly set and should be ignored
    87  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
    88  	False IBPCRStatus = "False"
    89  
    90  	// Unknown stands for unknown status
    91  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
    92  	Unknown IBPCRStatus = "Unknown"
    93  )
    94  
    95  // IBPCRStatusType is the string that stores teh status
    96  // +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
    97  type IBPCRStatusType string
    98  
    99  const (
   100  	// Deploying is the status when component is being deployed
   101  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   102  	Deploying IBPCRStatusType = "Deploying"
   103  
   104  	// Deployed is the status when the component's deployment is done successfully
   105  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   106  	Deployed IBPCRStatusType = "Deployed"
   107  
   108  	// Precreated is the status of the orderers when they are waiting for config block
   109  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   110  	Precreated IBPCRStatusType = "Precreated"
   111  
   112  	// Error is the status when a component's deployment has failed due to an error
   113  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   114  	Error IBPCRStatusType = "Error"
   115  
   116  	// Warning is the status when a component is running, but will fail in future
   117  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   118  	Warning IBPCRStatusType = "Warning"
   119  
   120  	// Initializing is the status when a component is initializing
   121  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   122  	Initializing IBPCRStatusType = "Initializing"
   123  )
   124  
   125  // +k8s:deepcopy-gen=true
   126  // CRStatus is the object that defines the status of a CR
   127  // +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   128  type CRStatus struct {
   129  	// Type is true or false based on if status is valid
   130  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   131  	Type IBPCRStatusType `json:"type,omitempty"`
   132  
   133  	// Status is defined based on the current status of the component
   134  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   135  	Status IBPCRStatus `json:"status,omitempty"`
   136  
   137  	// Reason provides a reason for an error
   138  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   139  	Reason string `json:"reason,omitempty"`
   140  
   141  	// Message provides a message for the status to be shown to customer
   142  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   143  	Message string `json:"message,omitempty"`
   144  
   145  	// LastHeartbeatTime is when the controller reconciled this component
   146  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   147  	LastHeartbeatTime string `json:"lastHeartbeatTime,omitempty"`
   148  
   149  	// Version is the product (IBP) version of the component
   150  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   151  	Version string `json:"version,omitempty"`
   152  
   153  	// ErrorCode is the code of classification of errors
   154  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   155  	ErrorCode int `json:"errorcode,omitempty"`
   156  
   157  	// Versions is the operand version of the component
   158  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   159  	Versions CRStatusVersion `json:"versions,omitempty"`
   160  }
   161  
   162  // CRStatusVersion provides the current reconciled version of the operand
   163  // +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   164  type CRStatusVersion struct {
   165  	// Reconciled provides the reconciled version of the operand
   166  	Reconciled string `json:"reconciled"`
   167  }
   168  
   169  // HSM struct is DEPRECATED
   170  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   171  type HSM struct {
   172  	// PKCS11Endpoint is DEPRECATED
   173  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   174  	PKCS11Endpoint string `json:"pkcs11endpoint,omitempty"`
   175  }
   176  
   177  type CRN struct {
   178  	Version      string `json:"version,omitempty"`
   179  	CName        string `json:"c_name,omitempty"`
   180  	CType        string `json:"c_type,omitempty"`
   181  	Servicename  string `json:"service_name,omitempty"`
   182  	Location     string `json:"location,omitempty"`
   183  	AccountID    string `json:"account_id,omitempty"`
   184  	InstanceID   string `json:"instance_id,omitempty"`
   185  	ResourceType string `json:"resource_type,omitempty"`
   186  	ResourceID   string `json:"resource_id,omitempty"`
   187  }
   188  
   189  // License should be accepted to install custom resources
   190  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   191  type License struct {
   192  	// Accept should be set to true to accept the license.
   193  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   194  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:checkbox"
   195  	// +kubebuilder:validation:Enum=true
   196  	Accept bool `json:"accept,omitempty"`
   197  }
   198  
   199  // +k8s:deepcopy-gen=true
   200  // SecretSpec defines the crypto spec to pass to components
   201  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   202  type SecretSpec struct {
   203  	// Enrollment defines enrollment part of secret spec
   204  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   205  	Enrollment *EnrollmentSpec `json:"enrollment,omitempty"`
   206  
   207  	// MSP defines msp part of secret spec
   208  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   209  	MSP *MSPSpec `json:"msp,omitempty"`
   210  }
   211  
   212  // CATLS contains the TLS CA certificate of the CA
   213  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   214  type CATLS struct {
   215  	// CACert is the base64 encoded certificate
   216  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   217  	CACert string `json:"cacert,omitempty"`
   218  }
   219  
   220  // +k8s:deepcopy-gen=true
   221  // Enrollment is the enrollment section of secret spec
   222  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   223  type Enrollment struct {
   224  	// CAHost is host part of the CA to use
   225  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   226  	CAHost string `json:"cahost,omitempty"`
   227  
   228  	// CAPort is port of the CA to use
   229  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   230  	CAPort string `json:"caport,omitempty"`
   231  
   232  	// CAName is name of CA
   233  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   234  	CAName string `json:"caname,omitempty"`
   235  
   236  	// CATLS is tls details to talk to CA endpoint
   237  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   238  	CATLS *CATLS `json:"catls,omitempty"`
   239  
   240  	// EnrollID is the enrollment username
   241  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   242  	EnrollID string `json:"enrollid,omitempty"`
   243  
   244  	// EnrollSecret is enrollment secret ( password )
   245  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   246  	EnrollSecret string `json:"enrollsecret,omitempty"`
   247  
   248  	// AdminCerts is the base64 encoded admincerts
   249  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   250  	AdminCerts []string `json:"admincerts,omitempty"`
   251  
   252  	// CSR is the CSR override object
   253  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   254  	CSR *CSR `json:"csr,omitempty"`
   255  }
   256  
   257  // +k8s:deepcopy-gen=true
   258  // EnrollmentSpec contains all the configurations that a component needs to enroll with
   259  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   260  type EnrollmentSpec struct {
   261  	// Component contains ecert enrollment details
   262  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   263  	Component *Enrollment `json:"component,omitempty"`
   264  
   265  	// TLS contains tls enrollment details
   266  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   267  	TLS *Enrollment `json:"tls,omitempty"`
   268  
   269  	// ClientAuth contains client uath enrollment details
   270  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   271  	ClientAuth *Enrollment `json:"clientauth,omitempty"`
   272  }
   273  
   274  // +k8s:deepcopy-gen=true
   275  // CSR has the Hosts for the CSR to be sent in the enrollment
   276  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   277  type CSR struct {
   278  	// Hosts override for CSR
   279  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   280  	Hosts []string `json:"hosts,omitempty"`
   281  }
   282  
   283  // +k8s:deepcopy-gen=true
   284  // MSPSpec contains the configuration for the component to start with all the certificates
   285  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   286  type MSPSpec struct {
   287  	// Component contains crypto for ecerts
   288  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   289  	Component *MSP `json:"component,omitempty"`
   290  
   291  	// TLS contains crypto for tls certs
   292  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   293  	TLS *MSP `json:"tls,omitempty"`
   294  
   295  	// ClientAuth contains crypto for client auth certs
   296  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   297  	ClientAuth *MSP `json:"clientauth,omitempty"`
   298  }
   299  
   300  // +k8s:deepcopy-gen=true
   301  // MSP contains the common definitions crypto material for the component
   302  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   303  type MSP struct {
   304  	// KeyStore is base64 encoded private key
   305  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   306  	KeyStore string `json:"keystore,omitempty"`
   307  
   308  	// SignCerts is base64 encoded sign cert
   309  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   310  	SignCerts string `json:"signcerts,omitempty"`
   311  
   312  	// CACerts is base64 encoded cacerts array
   313  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   314  	CACerts []string `json:"cacerts,omitempty"`
   315  
   316  	// IntermediateCerts is base64 encoded intermediate certs array
   317  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   318  	IntermediateCerts []string `json:"intermediatecerts,omitempty"`
   319  
   320  	// AdminCerts is base64 encoded admincerts array
   321  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   322  	AdminCerts []string `json:"admincerts,omitempty"`
   323  }