Open ffjlabo opened 1 month ago
The purpose of the component
Modification idea
deployTarget
The purpose of the component
Modification idea
GetLivestate(app)
Concern
livestateFlushInterval
to change them by users.The purpose of the component
Modification idea
Detect(app)
Concern
detectInterval
to change them by users.The purpose of the component
Modification idea
commandCheckInterval
BuildPlanPreviewResult(app)
Concern
The metrics deployment_status
is affected because it has the label platform_provider
.
https://github.com/pipe-cd/pipecd/blob/548a804d344d7c5faa70bcb6bd0889aa2a9269af/pkg/app/piped/controller/controllermetrics/metrics.go#L23C1-L40C2
deployment_status{application_id="xxxxxxxx",application_kind="KUBERNETES",application_name="simple",deployment="xxxxxxx",instance="127.0.0.1:9085",job="pipecd-ops",launcher_version="v0.49.2",pipecd_component="piped",piped="xxxxx",piped_version="v0.49.2",platform_provider="kubernetes",project="test",status="DEPLOYMENT_CANCELLED"}
Modification idea There are two ideas.
plugin_deployment_status
deployTarget
to the deployment_status
Concern
For idea 1.
For idea 2.
deployment_status{platform_provider="kubernetes"} or deployment_status{deployTarget="kubernetes"}
The purpose of the component
model.ApplicationInfo
and corresponding in the model.Application
(e.g. Kind, Name...)Modification idea
model.Application.Labels["kind"]
instead of model.Application.Kind
Concern
The purpose of the component
config.LoadAplication(repoPath, configRelPath string, appKind model.ApplicationKind)
https://github.com/pipe-cd/pipecd/blob/4a2334a3c96d31c9bcfcbfae02eb6873dd923cdc/pkg/app/piped/planpreview/builder.go#L307Modification Idea
config.LoadApplication(repoPath, configRelPath string, appKind model.ApplicationKind)
to LoadApplication(repoPath, configRelPath string, appKind string)
model.Application.Labels["kind"]
instead of model.Application.Kind
The purpose of the component
Modification Idea
plugin_kind
to the model.ApplicationLiveStateSnapshot
model.Application.Labels["kind"]
instead of model.Application.Kind
message ApplicationLiveStateSnapshot {
reserved 2;
...
ApplicationKind kind = 5 [(validate.rules).enum.defined_only = true];
...
string plugin_kind = 16;
}
The purpose of the component
Modification idea
model.Application.Labels["kind"]
instead of model.Application.Kind
The purpose of the component
kind
to show deployment info on the slack message https://github.com/pipe-cd/pipecd/blob/44cfc932b2061f4cfbdbd134c912543919b1119d/pkg/app/piped/notifier/slack.go#L235Modification idea
model.Application.Labels["kind"]
instead of model.Application.Kind
The purpose of the component
kind
Modification idea
Modification idea
Deployment.Kind
.The purpose of the component
Modification idea
Application
as kind.The purpose of the component
The metrics deployment_status
is affected because it has the label application_kind
.
https://github.com/pipe-cd/pipecd/blob/548a804d344d7c5faa70bcb6bd0889aa2a9269af/pkg/app/piped/controller/controllermetrics/metrics.go#L23C1-L40C2
deployment_status{application_id="xxxxxxxx",application_kind="KUBERNETES",application_name="simple",deployment="xxxxxxx",instance="127.0.0.1:9085",job="pipecd-ops",launcher_version="v0.49.2",pipecd_component="piped",piped="xxxxx",piped_version="v0.49.2",platform_provider="kubernetes",project="test",status="DEPLOYMENT_CANCELLED"}
Modification idea
model.Application.Labels["kind"]
instead of model.Application.Kind
The purpose of the component
Modification idea
model.Application.Labels["kind"]
instead of model.Application.Kind
The purpose of the component
HasPlatformProvider
https://github.com/pipe-cd/pipecd/blob/44cfc932b2061f4cfbdbd134c912543919b1119d/pkg/app/piped/controller/scheduler.go#L524Modification idea
model.Application.Labels["kind"]
instead of model.Application.Kind
HasDeployTargets
instead of the HasPlatformprvoders
Mostly related to 2 model applications and deployment
Used in
The source fetched to used in the drawer is come from the piped configuration
https://github.com/pipe-cd/pipecd/blob/master/web/src/components/application-form/index.tsx#L58-L80
What would you like to be added:
This issue tracks the progress for deprecating Platform Provider and Kind toward piped plugin architecture in pipedv1.
The purpose is to manage application kind and platform providers on the PipeCD plugin side in the future.
Considering the impact on users, pay attention to the following points:
current update process
kind
based on the current Application Kind to the Application.deployTarget
based on the current Application Platform Provider to the Application.Details (under planning)
For Platform Provider
Instead of Platform Provider, we plan to introduce the config for the plugin and define deployTargets.
piped config
We also plan to deploy the app to multiple targets at once in a multicluster feature for k8s. So, we define
DeployTargets
as an array in Application and Deployment.Application
Deployment
For the backward compatibility
Before updating the piped, users should migrate the current data on DB.
Former idea
During the migration, there might be both platform providers and deploy targets in the piped config. So we need to convert the platform providers to deploy targets internally. **Refer the Platform Provider or Deploy Target** - If the ApplicationKind is `Application`, just use `DeployTarget` - If the ApplicationKind is old one, convert `PlatformProvider` to `DeployTarget` ```golang func (s *PipedSpec) FindDeployTarget(name string, t model.ApplicationKind) (*PipedDeployTarget, bool) { // First, check the application is supported by the plugin architecture. It means that the kind is set to "Application". // If not, the deploy target is the platform provider. // For backward compatibility, the deploy target is the platform provider. if t != model.ApplicationKind_APPLICATION { p, found := s.FindPlatformProvider(name, t) if !found { return &PipedDeployTarget{}, false } return &PipedDeployTarget{ Name: p.Name, Labels: p.Labels, Config: p.Config, }, true } // If the application is supported by the plugin architecture, the deploy target is the deploy target. for _, dt := range s.DeployTargets { if dt.Name == name { return dt, true } } return &PipedDeployTarget{}, false } ```For Kind
Instead of Kind, we plan to introduce the label to represent the application kind.
For the builtin plugins, we define 5 labels as string.
For the backward compatibility
Before updating the piped, users should migrate the current data on DB.
Former idea
We need to support both before and after creating plugin architecture for now. So, I propose the way to decide the application kind like this. - Define `APPLICATION` as `ApplicationKind` - Add new method to decide the actual kind for Application and Deployment. ```proto enum ApplicationKind { KUBERNETES = 0; TERRAFORM = 1; LAMBDA = 3; CLOUDRUN = 4; ECS = 5; APPLICATION = 6; <- new! } ``` ```golang func (a * Application) GetKind() string { // First, check the application is supported by the plugin architecture. It means that the kind is set to "Application". // If so, return the kind from the labels. if a.Kind == ApplicationKind_Application { return a.Labels["kind"] } // For backward compatibility, return the kind as string return a.Kind.String() } ``` ```golang func (d *Deployment) GetKind() string { // First, check the application is supported by the plugin architecture. It means that the kind is set to "Application". // If so, return the kind from the labels. if d.Kind == ApplicationKind_Application { return d.Labels["kind"] } // For backward compatibility, return the kind as string return d.Kind.String() } ```TODO
Firstly, I listed the target features to require some modifications. We need to further investigation to decide the way to fix.
investigation
implementation
Why is this needed: