github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/apis/apps/v1alpha1/config.go (about) 1 /* 2 Copyright (C) 2022-2023 ApeCloud Co., Ltd 3 4 This file is part of KubeBlocks project 5 6 This program is free software: you can redistribute it and/or modify 7 it under the terms of the GNU Affero General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU Affero General Public License for more details. 15 16 You should have received a copy of the GNU Affero General Public License 17 along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 package v1alpha1 21 22 // +--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 23 // | | 24 // | ++---------------------------------------------------------------------------------------------------+ | 25 // | |+--------------------------------------------------------------------------------------------------+| | 26 // | || CInitPhase || | 27 // | || || | 28 // | || +-------------+ +---------------+ +-----------------+ +-----+ || | 29 // | || | | | | | | | | || Creating | 30 // | || | PreparePhase|----------| RenderingPhase+----------->|GeneratingSideCar|--------->| END | ||---------------- fireEvent | 31 // | || | | | | | | | | || | | 32 // | || +-------------+ +---------------+ +-----------------+ +-----+ || | | 33 // | || || | | 34 // | || || | | 35 // | ++--------------------------------------------------------------------------------------------------+| | Reconfiguring | 36 // | +----------------------------------------------------------------------------------------------------+ | | 37 // | ^ / \ | | 38 // | | / \ Succeed V | 39 // | | Creating / +-----------------------------\----------------------------------------------------------------------------+ | 40 // | | / |+-----------------------------V--------------------------------------------------------------------------+| | 41 // | | / || || | 42 // | | Failed || RunningPhase || | 43 // | | / || Reconfiguring || | 44 // | | / || +---------------------------------+ || | 45 // | | / || v | || | 46 // | | v || +---------------+ +--------------------+ +--------+---------+ || | 47 // | +----+----------------+ || | | Reconfiguring | | Failed | | || | 48 // | | | || | CFinishPhase |----------------->| MergingPhase |------------>| MergeFailedPhase | || | 49 // | | CCreateFailedPhase | || | | -> | | | | || | 50 // | | | || +-------+-------+ / +---------+----------+ +------------------+ || | 51 // | +---------------------+ || ^ / | || | 52 // | || | Reconfiguring | || | 53 // | || | / | || | 54 // | || Finish | / | Succeed || | 55 // | || | / | || | 56 // | || | +-----------------+ | || | 57 // | || | | | | || | 58 // | || +-----+ UpgradingPhase |<-----------+ || | 59 // | || | | || | 60 // | || +------------+----+ || | 61 // | || ^ | || | 62 // | || | | || | 63 // | || +-------+ || | 64 // | || || | 65 // | || || | 66 // | |+--------------------------------------------------------------------------------------------------------+| | 67 // | +----------------------------------------------------------------------------------------------------------+ | 68 // | | 69 // | | 70 // +--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 71 // 72 73 // ConfigurationPhase defines the Configuration FSM phase 74 // +enum 75 // +kubebuilder:validation:Enum={Creating,Init,Running,Pending,Merged,MergeFailed,FailedAndPause,Upgrading,Deleting,FailedAndRetry,Finished} 76 type ConfigurationPhase string 77 78 const ( 79 CCreatingPhase ConfigurationPhase = "Creating" 80 CInitPhase ConfigurationPhase = "Init" 81 CRunningPhase ConfigurationPhase = "Running" 82 CPendingPhase ConfigurationPhase = "Pending" 83 CFailedPhase ConfigurationPhase = "FailedAndRetry" 84 CFailedAndPausePhase ConfigurationPhase = "FailedAndPause" 85 CMergedPhase ConfigurationPhase = "Merged" 86 CMergeFailedPhase ConfigurationPhase = "MergeFailed" 87 CDeletingPhase ConfigurationPhase = "Deleting" 88 CUpgradingPhase ConfigurationPhase = "Upgrading" 89 CFinishedPhase ConfigurationPhase = "Finished" 90 ) 91 92 type ConfigParams struct { 93 // Data holds the configuration keys and values. 94 // This field exists to work around https://github.com/kubernetes-sigs/kubebuilder/issues/528 95 // https://github.com/kubernetes/code-generator/issues/50 96 97 // fileContent indicates the configuration file content. 98 // +optional 99 Content *string `json:"content"` 100 101 // updated parameters for a single configuration file. 102 // +optional 103 Parameters map[string]*string `json:"parameters,omitempty"` 104 }