mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-11 08:20:16 -04:00
introduce force flag
This commit is contained in:
parent
eff7d5e046
commit
f267f336dc
1 changed files with 13 additions and 1 deletions
|
@ -79,6 +79,7 @@ type ClusterResourceModel struct {
|
||||||
Attestation types.Object `tfsdk:"attestation"`
|
Attestation types.Object `tfsdk:"attestation"`
|
||||||
GCP types.Object `tfsdk:"gcp"`
|
GCP types.Object `tfsdk:"gcp"`
|
||||||
Azure types.Object `tfsdk:"azure"`
|
Azure types.Object `tfsdk:"azure"`
|
||||||
|
Force types.Bool `tfsdk:"force"`
|
||||||
|
|
||||||
OwnerID types.String `tfsdk:"owner_id"`
|
OwnerID types.String `tfsdk:"owner_id"`
|
||||||
ClusterID types.String `tfsdk:"cluster_id"`
|
ClusterID types.String `tfsdk:"cluster_id"`
|
||||||
|
@ -309,6 +310,12 @@ func (r *ClusterResource) Schema(_ context.Context, _ resource.SchemaRequest, re
|
||||||
Description: "The kubeconfig of the cluster.",
|
Description: "The kubeconfig of the cluster.",
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"force": schema.BoolAttribute{
|
||||||
|
MarkdownDescription: "Force the microservices to be created or updated.",
|
||||||
|
Description: "Force the microservices to be created or updated.",
|
||||||
|
Optional: true,
|
||||||
|
//Default: true, TODO(): discuss
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -707,6 +714,7 @@ func (r *ClusterResource) apply(ctx context.Context, data *ClusterResourceModel,
|
||||||
DeployCSIDriver: microserviceCfg.CSIDriver,
|
DeployCSIDriver: microserviceCfg.CSIDriver,
|
||||||
masterSecret: secrets.masterSecret,
|
masterSecret: secrets.masterSecret,
|
||||||
serviceAccURI: serviceAccURI,
|
serviceAccURI: serviceAccURI,
|
||||||
|
force: data.Force.ValueBool(),
|
||||||
}
|
}
|
||||||
helmDiags := r.applyHelmCharts(ctx, applier, payload, stateFile)
|
helmDiags := r.applyHelmCharts(ctx, applier, payload, stateFile)
|
||||||
diags.Append(helmDiags...)
|
diags.Append(helmDiags...)
|
||||||
|
@ -800,6 +808,7 @@ type applyHelmChartsPayload struct {
|
||||||
DeployCSIDriver bool // Whether to deploy the CSI driver.
|
DeployCSIDriver bool // Whether to deploy the CSI driver.
|
||||||
masterSecret uri.MasterSecret // master secret of the cluster.
|
masterSecret uri.MasterSecret // master secret of the cluster.
|
||||||
serviceAccURI string // URI of the service account used within the cluster.
|
serviceAccURI string // URI of the service account used within the cluster.
|
||||||
|
force bool // Whether to force the Helm charts to be applied.
|
||||||
}
|
}
|
||||||
|
|
||||||
// applyHelmCharts applies the Helm charts to the cluster.
|
// applyHelmCharts applies the Helm charts to the cluster.
|
||||||
|
@ -813,12 +822,15 @@ func (r *ClusterResource) applyHelmCharts(ctx context.Context, applier *constell
|
||||||
K8sVersion: payload.k8sVersion,
|
K8sVersion: payload.k8sVersion,
|
||||||
MicroserviceVersion: payload.microserviceVersion,
|
MicroserviceVersion: payload.microserviceVersion,
|
||||||
DeployCSIDriver: payload.DeployCSIDriver,
|
DeployCSIDriver: payload.DeployCSIDriver,
|
||||||
Force: false,
|
Force: payload.force,
|
||||||
Conformance: false, // Conformance mode does't need to be configurable through the TF provider for now.
|
Conformance: false, // Conformance mode does't need to be configurable through the TF provider for now.
|
||||||
HelmWaitMode: helm.WaitModeAtomic,
|
HelmWaitMode: helm.WaitModeAtomic,
|
||||||
ApplyTimeout: 10 * time.Minute,
|
ApplyTimeout: 10 * time.Minute,
|
||||||
AllowDestructive: helm.DenyDestructive,
|
AllowDestructive: helm.DenyDestructive,
|
||||||
}
|
}
|
||||||
|
if payload.force {
|
||||||
|
options.AllowDestructive = helm.AllowDestructive
|
||||||
|
}
|
||||||
|
|
||||||
executor, _, err := applier.PrepareHelmCharts(options, state,
|
executor, _, err := applier.PrepareHelmCharts(options, state,
|
||||||
payload.serviceAccURI, payload.masterSecret, nil)
|
payload.serviceAccURI, payload.masterSecret, nil)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue