Skip to content

Commit

Permalink
Use ignoreDifferences in AWSMachineTemplate.Spec to avoid out-of-sync…
Browse files Browse the repository at this point in the history
… baseclusters (#251)

* ignore diffs AWSMachineTemplate.spec
* add doc changes to mention immutability
  • Loading branch information
Rohitrajak1807 authored Oct 1, 2022
1 parent cada7dd commit efd6843
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions docs/baseclusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,7 @@ yet have an exhaustive list).
- Changing the Kubernetes version of the control plane or data plane *is* supported, so long as the new version
is supported by the relevant providers. If accepted, such a change will result in a rolling update
of the corresponding plane.
- Specific to AWS: the `AWSMachineTemplate.spec` is immutable and a CAPI webhook disallows such updates. The user is advised to not make such modifications to a basecluster manifest.
In the event that such an event does happen, the user is advised to not manually sync in those changes via `argocd`. If a new cluster with a different `AWSMachineTemplate.spec` is desired,
the recommended approach is to make a copy of the manifests in the workspace repository and then issue an `arlon cluster create` command which would then consume this manifest.

6 changes: 3 additions & 3 deletions docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ definition of *tool types*. Consequently, the list of supported bundle
types mirrors ArgoCD's supported set of manifest-producing tools.
Each bundle is defined using a Kubernetes ConfigMap resource in the arlo namespace.
Additionally, a bundle can embed the data itself ("static bundle"), or contain a reference
to the data ("dynamic bundle"). A reference can be a URL, github location, or Helm repo location.
to the data ("dynamic bundle"). A reference can be a URL, GitHub location, or Helm repo location.
The current list of supported bundle types is:

* manifest_inline: a single manifest yaml file embedded in the resource
Expand All @@ -31,7 +31,7 @@ The current list of supported bundle types is:
Bundles can specify an optional *purpose* to help classify and organize them.
In the future, Arlo may order bundle installation by purpose order (for e.g.
install bundles with purpose=*networking* before others) but that is not the
case today. The currenty *suggested* purpose values are:
case today. The currently *suggested* purpose values are:
- networking
- add-on
- data-service
Expand Down Expand Up @@ -75,7 +75,7 @@ management cluster.

Here is a summary of the kinds of resources generated and deployed by the chart:
- A unique namespace with a name based on the cluster's name. All subsequent
resources below are created inside of that namespace.
resources below are created inside that namespace.
- The stack-specific resources to create the cluster (for e.g. Cluster API resources)
- A ClusterRegistration to automatically register the cluster with ArgoCD
- A GitRepoDir to automatically create a git repo and/or directory to host a copy
Expand Down
12 changes: 12 additions & 0 deletions pkg/cluster/cluster_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,22 @@ func constructClusterApp(
Kind: "AWSManagedControlPlane",
JSONPointers: []string{"/spec/version"},
})

ignoreDiffs = append(ignoreDiffs, argoappv1.ResourceIgnoreDifferences{
Group: "infrastructure.cluster.x-k8s.io",
Kind: "AWSMachineTemplate",
JSONPointers: []string{"/spec"},
})
app.Spec.IgnoreDifferences = ignoreDiffs
app.Spec.Source.Kustomize = &argoappv1.ApplicationSourceKustomize{
NamePrefix: clusterName + "-",
}
app.Spec.SyncPolicy = &argoappv1.SyncPolicy{
Automated: &argoappv1.SyncPolicyAutomated{
Prune: true,
},
SyncOptions: []string{"Prune=true", "RespectIgnoreDifferences=true"},
}
app.Spec.Source.RepoURL = repoUrl
app.Spec.Source.TargetRevision = repoRevision
app.Spec.Source.Path = repoPath
Expand Down

0 comments on commit efd6843

Please sign in to comment.