Skip to content

Commit

Permalink
Added comments to new fields and added review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
wahabmk committed Jan 27, 2025
1 parent 0e7b7cf commit 683cadc
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 11 deletions.
9 changes: 6 additions & 3 deletions api/v1alpha1/multiclusterservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,12 @@ type ServiceSpec struct {
// +kubebuilder:default:=Continuous
// +kubebuilder:validation:Enum:=OneTime;Continuous;ContinuousWithDriftDetection;DryRun

SyncMode string `json:"syncMode,omitempty"`
IgnoreDrift []libsveltosv1beta1.PatchSelector `json:"ignoreDrift,omitempty"`
DriftExclusions []sveltosv1beta1.DriftExclusion `json:"driftExclusions,omitempty"`
// SyncMode speficies how services are synced in the target cluster
SyncMode string `json:"syncMode,omitempty"`
// DriftIgnore specifies resources to ignore for drift detection.
DriftIgnore []libsveltosv1beta1.PatchSelector `json:"driftIgnore,omitempty"`
// DriftExclusions specifies specific configurations of resources to ignore for drift detection.
DriftExclusions []sveltosv1beta1.DriftExclusion `json:"driftExclusions,omitempty"`
}

// MultiClusterServiceSpec defines the desired state of MultiClusterService
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/controller/clusterdeployment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ func (r *ClusterDeploymentReconciler) updateServices(ctx context.Context, mc *kc
),
PolicyRefs: getProjectPolicyRefs(mc, cred),
SyncMode: mc.Spec.ServiceSpec.SyncMode,
IgnoreDrift: mc.Spec.ServiceSpec.IgnoreDrift,
IgnoreDrift: mc.Spec.ServiceSpec.DriftIgnore,
DriftExclusions: mc.Spec.ServiceSpec.DriftExclusions,
}); err != nil {
return ctrl.Result{}, fmt.Errorf("failed to reconcile Profile: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/multiclusterservice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (r *MultiClusterServiceReconciler) reconcileUpdate(ctx context.Context, mcs
Reload: mcs.Spec.ServiceSpec.Reload,
TemplateResourceRefs: mcs.Spec.ServiceSpec.TemplateResourceRefs,
SyncMode: mcs.Spec.ServiceSpec.SyncMode,
IgnoreDrift: mcs.Spec.ServiceSpec.IgnoreDrift,
IgnoreDrift: mcs.Spec.ServiceSpec.DriftIgnore,
DriftExclusions: mcs.Spec.ServiceSpec.DriftExclusions,
}); err != nil {
return ctrl.Result{}, fmt.Errorf("failed to reconcile ClusterProfile: %w", err)
Expand Down
4 changes: 2 additions & 2 deletions internal/sveltos/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"github.com/K0rdent/kcm/internal/utils"
)

const DrifIgnorePatch = `- op: add
const drifIgnorePatch = `- op: add
path: /metadata/annotations/projectsveltos.io~1driftDetectionIgnore
value: ok`

Expand Down Expand Up @@ -255,7 +255,7 @@ func GetSpec(opts *ReconcileProfileOpts) (*sveltosv1beta1.Spec, error) {
for _, target := range opts.IgnoreDrift {
spec.Patches = append(spec.Patches, libsveltosv1beta1.Patch{
Target: &target,
Patch: DrifIgnorePatch,
Patch: drifIgnorePatch,
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ spec:
description: ServiceSpec is spec related to deployment of services.
properties:
driftExclusions:
description: DriftExclusions specifies specific configurations
of resources to ignore for drift detection.
items:
properties:
paths:
Expand Down Expand Up @@ -133,7 +135,9 @@ spec:
- paths
type: object
type: array
ignoreDrift:
driftIgnore:
description: DriftIgnore specifies resources to ignore for drift
detection.
items:
properties:
annotationSelector:
Expand Down Expand Up @@ -271,6 +275,8 @@ spec:
type: boolean
syncMode:
default: Continuous
description: SyncMode speficies how services are synced in the
target cluster
enum:
- OneTime
- Continuous
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ spec:
description: ServiceSpec is spec related to deployment of services.
properties:
driftExclusions:
description: DriftExclusions specifies specific configurations
of resources to ignore for drift detection.
items:
properties:
paths:
Expand Down Expand Up @@ -145,7 +147,9 @@ spec:
- paths
type: object
type: array
ignoreDrift:
driftIgnore:
description: DriftIgnore specifies resources to ignore for drift
detection.
items:
properties:
annotationSelector:
Expand Down Expand Up @@ -283,6 +287,8 @@ spec:
type: boolean
syncMode:
default: Continuous
description: SyncMode speficies how services are synced in the
target cluster
enum:
- OneTime
- Continuous
Expand Down

0 comments on commit 683cadc

Please sign in to comment.