github.com/IBM-Blockchain/fabric-operator@v1.0.4/api/v1beta1/ibpconsole_types.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  	consolev1 "github.com/IBM-Blockchain/fabric-operator/pkg/apis/console/v1"
    23  	corev1 "k8s.io/api/core/v1"
    24  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    25  	"k8s.io/apimachinery/pkg/runtime"
    26  )
    27  
    28  // +k8s:openapi-gen=true
    29  // +k8s:deepcopy-gen=true
    30  // IBPConsoleSpec defines the desired state of IBPConsole
    31  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    32  type IBPConsoleSpec struct {
    33  	// License should be accepted by the user to be able to setup console
    34  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    35  	License License `json:"license"`
    36  
    37  	// Images (Optional) lists the images to be used for console's deployment
    38  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    39  	Images *ConsoleImages `json:"images,omitempty"`
    40  
    41  	// ImagePullSecrets (Optional) is the list of ImagePullSecrets to be used for console's deployment
    42  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    43  	ImagePullSecrets []string `json:"imagePullSecrets,omitempty"`
    44  
    45  	// Replicas (Optional - default 1) is the number of console replicas to be setup
    46  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    47  	Replicas *int32 `json:"replicas,omitempty"`
    48  
    49  	// Resources (Optional) is the amount of resources to be provided to console deployment
    50  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    51  	Resources *ConsoleResources `json:"resources,omitempty"`
    52  
    53  	// Service (Optional) is the override object for console's service
    54  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    55  	Service *Service `json:"service,omitempty"`
    56  
    57  	// ServiceAccountName defines serviceaccount used for console deployment
    58  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    59  	ServiceAccountName string `json:"serviceAccountName,omitempty"`
    60  
    61  	// Storage (Optional - uses default storageclass if not provided) is the override object for CA's PVC config
    62  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    63  	Storage *ConsoleStorage `json:"storage,omitempty"`
    64  
    65  	// NetworkInfo is object for network overrides
    66  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    67  	NetworkInfo *NetworkInfo `json:"networkinfo,omitempty"`
    68  
    69  	// Ingress (Optional) is ingress object for ingress overrides
    70  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    71  	Ingress Ingress `json:"ingress,omitempty"`
    72  
    73  	/* console settings */
    74  	// AuthScheme is auth scheme for console access
    75  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    76  	AuthScheme string `json:"authScheme,omitempty"`
    77  
    78  	// AllowDefaultPassword, if true, will bypass the password reset flow
    79  	// on the first connection to the console GUI.  By default (false), all
    80  	// consoles require a password reset at the first login.
    81  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    82  	AllowDefaultPassword bool `json:"allowDefaultPassword,omitempty"`
    83  
    84  	// Components is database name used for components
    85  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    86  	Components string `json:"components,omitempty"`
    87  
    88  	// ClusterData is object cluster data information
    89  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    90  	ClusterData *consolev1.IBPConsoleClusterData `json:"clusterdata,omitempty"`
    91  
    92  	// ConfigtxlatorURL is url for configtxlator server
    93  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    94  	ConfigtxlatorURL string `json:"configtxlator,omitempty"`
    95  
    96  	// ConnectionString is connection url for backend database
    97  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
    98  	ConnectionString string `json:"connectionString,omitempty"`
    99  
   100  	// DeployerTimeout is timeout value for deployer calls
   101  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   102  	DeployerTimeout int32 `json:"deployerTimeout,omitempty"`
   103  
   104  	// DeployerURL is url for deployer server
   105  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   106  	DeployerURL string `json:"deployerUrl,omitempty"`
   107  
   108  	// Email is the email used for initial access
   109  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   110  	Email string `json:"email,omitempty"`
   111  
   112  	// FeatureFlags is object for feature flag settings
   113  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   114  	FeatureFlags *consolev1.FeatureFlags `json:"featureflags,omitempty"`
   115  
   116  	IAMApiKey       string           `json:"iamApiKey,omitempty"`
   117  	SegmentWriteKey string           `json:"segmentWriteKey,omitempty"`
   118  	IBMID           *consolev1.IBMID `json:"ibmid,omitempty"`
   119  	Proxying        *bool            `json:"proxying,omitempty"`
   120  
   121  	// Password is initial password to access console
   122  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   123  	Password string `json:"password,omitempty"`
   124  
   125  	// PasswordSecretName is secretname where password is stored
   126  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   127  	PasswordSecretName string `json:"passwordSecretName,omitempty"`
   128  
   129  	// Sessions is sessions database name to use
   130  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   131  	Sessions string `json:"sessions,omitempty"`
   132  
   133  	// System is system database name to use
   134  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   135  	System string `json:"system,omitempty"`
   136  
   137  	// SystemChannel is default systemchannel name
   138  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   139  	SystemChannel string `json:"systemChannel,omitempty"`
   140  
   141  	// TLSSecretName is secret name to load custom tls certs
   142  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   143  	TLSSecretName string `json:"tlsSecretName,omitempty"`
   144  
   145  	CRN                  *CRN      `json:"crn,omitempty"`
   146  	Kubeconfig           *[]byte   `json:"kubeconfig,omitempty"`
   147  	KubeconfigSecretName string    `json:"kubeconfigsecretname,omitempty"`
   148  	Versions             *Versions `json:"versions,omitempty"`
   149  	KubeconfigNamespace  string    `json:"kubeconfignamespace,omitempty"`
   150  
   151  	// RegistryURL is registry url used to pull images
   152  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   153  	RegistryURL string `json:"registryURL,omitempty"`
   154  
   155  	// Deployer is object for deployer configs
   156  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   157  	Deployer *Deployer `json:"deployer,omitempty"`
   158  
   159  	// Arch (Optional) is the architecture of the nodes where console should be deployed
   160  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   161  	Arch []string `json:"arch,omitempty"`
   162  
   163  	// Region (Optional) is the region of the nodes where the console should be deployed
   164  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   165  	Region string `json:"region,omitempty"`
   166  
   167  	// Zone (Optional) is the zone of the nodes where the console should be deployed
   168  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   169  	Zone string `json:"zone,omitempty"`
   170  
   171  	// ConfigOverride (Optional) is the object to provide overrides
   172  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   173  	ConfigOverride *ConsoleOverrides `json:"configoverride,omitempty"`
   174  
   175  	// Action (Optional) is action object for trigerring actions
   176  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   177  	Action ConsoleAction `json:"action,omitempty"`
   178  
   179  	// Version (Optional) is version for the console
   180  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   181  	Version string `json:"version"`
   182  
   183  	// UseTags (Optional) is a flag to switch between image digests and tags
   184  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   185  	UseTags *bool `json:"usetags"`
   186  }
   187  
   188  // +k8s:deepcopy-gen=true
   189  // ConsoleOverrides is the overrides to console configuration
   190  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   191  type ConsoleOverrides struct {
   192  	// Console is the overrides to console configuration
   193  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   194  	// +kubebuilder:validation:Type=object
   195  	// +kubebuilder:validation:Schemaless
   196  	// +kubebuilder:pruning:PreserveUnknownFields
   197  	Console *runtime.RawExtension `json:"console,omitempty"`
   198  
   199  	// Deployer is the overrides to deployer configuration
   200  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   201  	// +kubebuilder:validation:Type=object
   202  	// +kubebuilder:validation:Schemaless
   203  	// +kubebuilder:pruning:PreserveUnknownFields
   204  	Deployer *runtime.RawExtension `json:"deployer,omitempty"`
   205  
   206  	// MaxNameLength (Optional) is the maximum length of the name that the console can have
   207  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   208  	MaxNameLength *int `json:"maxnamelength,omitempty"`
   209  }
   210  
   211  // +k8s:deepcopy-gen=true
   212  type ConsoleOverridesConsole struct {
   213  	HostURL                    string `json:"hostURL,omitempty"`
   214  	ActivityTrackerConsolePath string `json:"activityTrackerConsolePath,omitempty"`
   215  	ActivityTrackerHostPath    string `json:"activityTrackerHostPath,omitempty"`
   216  	HSM                        string `json:"hsm"`
   217  }
   218  
   219  // +k8s:deepcopy-gen=true
   220  type ConsoleOverridesDeployer struct {
   221  	Timeouts *DeployerTimeouts `json:"timeouts,omitempty"`
   222  }
   223  
   224  // +k8s:deepcopy-gen=true
   225  type Versions struct {
   226  	CA      map[string]VersionCA      `json:"ca"`
   227  	Peer    map[string]VersionPeer    `json:"peer"`
   228  	Orderer map[string]VersionOrderer `json:"orderer"`
   229  }
   230  
   231  type VersionCA struct {
   232  	Default bool     `json:"default"`
   233  	Version string   `json:"version"`
   234  	Image   CAImages `json:"image,omitempty"`
   235  }
   236  
   237  type VersionOrderer struct {
   238  	Default bool          `json:"default"`
   239  	Version string        `json:"version"`
   240  	Image   OrdererImages `json:"image,omitempty"`
   241  }
   242  type VersionPeer struct {
   243  	Default bool       `json:"default"`
   244  	Version string     `json:"version"`
   245  	Image   PeerImages `json:"image,omitempty"`
   246  }
   247  
   248  // +k8s:openapi-gen=true
   249  // +k8s:deepcopy-gen=true
   250  // IBPConsoleStatus defines the observed state of IBP Console
   251  // +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   252  type IBPConsoleStatus struct {
   253  	CRStatus `json:",inline"`
   254  }
   255  
   256  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   257  // +k8s:openapi-gen=true
   258  // +kubebuilder:storageversion
   259  // +kubebuilder:subresource:status
   260  // +k8s:deepcopy-gen=true
   261  // The Console is used to deploy and manage the CA, peer, ordering nodes.
   262  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   263  // +operator-sdk:gen-csv:customresourcedefinitions.displayName="IBP Console"
   264  // +operator-sdk:gen-csv:customresourcedefinitions.resources=`Deployments,v1,""`
   265  // +operator-sdk:gen-csv:customresourcedefinitions.resources=`Ingresses,v1beta1,""`
   266  // +operator-sdk:gen-csv:customresourcedefinitions.resources=`PersistentVolumeClaim,v1,""`
   267  // +operator-sdk:gen-csv:customresourcedefinitions.resources=`Role,v1,""`
   268  // +operator-sdk:gen-csv:customresourcedefinitions.resources=`RoleBinding,v1,""`
   269  // +operator-sdk:gen-csv:customresourcedefinitions.resources=`Route,v1,""`
   270  // +operator-sdk:gen-csv:customresourcedefinitions.resources=`Services,v1,""`
   271  // +operator-sdk:gen-csv:customresourcedefinitions.resources=`ServiceAccounts,v1,""`
   272  // +operator-sdk:gen-csv:customresourcedefinitions.resources=`ConfigMaps,v1,""`
   273  // +operator-sdk:gen-csv:customresourcedefinitions.resources=`Secrets,v1,""`
   274  // +operator-sdk:gen-csv:customresourcedefinitions.resources=`Pods,v1,""`
   275  // +operator-sdk:gen-csv:customresourcedefinitions.resources=`Replicasets,v1,""`
   276  // +operator-sdk:gen-csv:customresourcedefinitions.resources=`IBPCA,v1beta1,""`
   277  // +operator-sdk:gen-csv:customresourcedefinitions.resources=`IBPPeer,v1beta1,""`
   278  // +operator-sdk:gen-csv:customresourcedefinitions.resources=`IBPOrderer,v1beta1,""`
   279  // +operator-sdk:gen-csv:customresourcedefinitions.resources=`IBPConsole,v1beta1,""`
   280  type IBPConsole struct {
   281  	metav1.TypeMeta   `json:",inline"`
   282  	metav1.ObjectMeta `json:"metadata,omitempty"`
   283  
   284  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   285  	Spec IBPConsoleSpec `json:"spec,omitempty"`
   286  
   287  	// Status is the observed state of IBPConsole
   288  	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
   289  	Status IBPConsoleStatus `json:"status,omitempty"`
   290  }
   291  
   292  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   293  // +k8s:deepcopy-gen=true
   294  // IBPConsoleList contains a list of IBP Console
   295  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   296  type IBPConsoleList struct {
   297  	metav1.TypeMeta `json:",inline"`
   298  	metav1.ListMeta `json:"metadata,omitempty"`
   299  	Items           []IBPConsole `json:"items"`
   300  }
   301  
   302  // +k8s:deepcopy-gen=true
   303  // ConsoleResources is the overrides to the resources of the Console
   304  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   305  type ConsoleResources struct {
   306  	// Init is the resources provided to the init container
   307  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   308  	Init *corev1.ResourceRequirements `json:"init,omitempty"`
   309  
   310  	// CouchDB is the resources provided to the couchdb container
   311  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   312  	CouchDB *corev1.ResourceRequirements `json:"couchdb,omitempty"`
   313  
   314  	// Console is the resources provided to the console container
   315  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   316  	Console *corev1.ResourceRequirements `json:"console,omitempty"`
   317  
   318  	// Deployer is the resources provided to the deployer container
   319  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   320  	Deployer *corev1.ResourceRequirements `json:"deployer,omitempty"`
   321  
   322  	// Configtxlator is the resources provided to the configtxlator container
   323  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   324  	Configtxlator *corev1.ResourceRequirements `json:"configtxlator,omitempty"`
   325  }
   326  
   327  // +k8s:deepcopy-gen=true
   328  // ConsoleStorage is the overrides to the storage of the console
   329  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   330  type ConsoleStorage struct {
   331  	// Console is the configuration of the storage of the console
   332  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   333  	Console *StorageSpec `json:"console,omitempty"`
   334  }
   335  
   336  // +k8s:deepcopy-gen=true
   337  // ConsoleImages is the list of images to be used in console deployment
   338  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   339  type ConsoleImages struct {
   340  	// ConsoleInitImage is the name of the console init image
   341  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   342  	ConsoleInitImage string `json:"consoleInitImage,omitempty"`
   343  
   344  	// ConsoleInitTag is the tag of the console init image
   345  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   346  	ConsoleInitTag string `json:"consoleInitTag,omitempty"`
   347  
   348  	// ConsoleImage is the name of the console image
   349  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   350  	ConsoleImage string `json:"consoleImage,omitempty"`
   351  
   352  	// ConsoleTag is the tag of the console image
   353  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   354  	ConsoleTag string `json:"consoleTag,omitempty"`
   355  
   356  	// ConfigtxlatorImage is the name of the configtxlator image
   357  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   358  	ConfigtxlatorImage string `json:"configtxlatorImage,omitempty"`
   359  
   360  	// ConfigtxlatorTag is the tag of the configtxlator image
   361  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   362  	ConfigtxlatorTag string `json:"configtxlatorTag,omitempty"`
   363  
   364  	// DeployerImage is the name of the deployer image
   365  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   366  	DeployerImage string `json:"deployerImage,omitempty"`
   367  
   368  	// DeployerTag is the tag of the deployer image
   369  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   370  	DeployerTag string `json:"deployerTag,omitempty"`
   371  
   372  	// CouchDBImage is the name of the couchdb image
   373  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   374  	CouchDBImage string `json:"couchdbImage,omitempty"`
   375  
   376  	// CouchDBTag is the tag of the couchdb image
   377  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   378  	CouchDBTag string `json:"couchdbTag,omitempty"`
   379  
   380  	// MustgatherImage is the name of the mustgather image
   381  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   382  	MustgatherImage string `json:"mustgatherImage,omitempty"`
   383  
   384  	// MustgatherTag is the tag of the mustgatherTag image
   385  	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   386  	MustgatherTag string `json:"mustgatherTag,omitempty"`
   387  }
   388  
   389  type Deployer struct {
   390  	Domain           string `json:"domain,omitempty"`
   391  	ConnectionString string `json:"connectionstring,omitempty"`
   392  	ComponentsDB     string `json:"components_db,omitempty"`
   393  	CreateDB         bool   `json:"create_db,omitempty"`
   394  }
   395  
   396  type DeployerTimeouts struct {
   397  	Deployment int `json:"componentDeploy"`
   398  	APIServer  int `json:"apiServer"`
   399  }
   400  
   401  // ConsoleAction contains actions that can be performed on console
   402  // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
   403  type ConsoleAction struct {
   404  	Restart bool `json:"restart,omitempty"`
   405  }