Skip to content

Commit

Permalink
remove cluster spec generate patch; no longer needed (#6821)
Browse files Browse the repository at this point in the history
  • Loading branch information
cxbrowne1207 authored Oct 17, 2023
1 parent 9168dc4 commit e53af28
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 42 deletions.
2 changes: 1 addition & 1 deletion pkg/api/v1alpha1/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func NewClusterGenerate(clusterName string, opts ...ClusterGenerateOpt) *Cluster
ObjectMeta: ObjectMeta{
Name: clusterName,
},
Spec: ClusterSpecGenerate{
Spec: ClusterSpec{
KubernetesVersion: GetClusterDefaultKubernetesVersion(),
ClusterNetwork: ClusterNetwork{
Pods: Pods{
Expand Down
34 changes: 2 additions & 32 deletions pkg/api/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,36 +74,6 @@ type ClusterSpec struct {
EtcdEncryption *[]EtcdEncryption `json:"etcdEncryption,omitempty"`
}

// ClusterSpecGenerate is the same as ClusterSpec except for removing the omitempty tag from BundlesRef.
// TODO: We needed this specifically such that we could generate a yaml with bundlesRef null so that it would
// not be omitted from the kubeapi-server. There was an issue where the apply ekas yaml resources step when
// upgrading from the latest minor release with gitps v0.16.2 to v0.17, where the newly added eksaVersion field
// and the bundlesRef should were both populated in submission to the kubeapi server, though bundlesRef was nil
// in the initially applied Cluster spec. After addressing that issue, we should clean this up
// https://github.com/aws/eks-anywhere-internal/issues/1611
// +kubebuilder:object:generate=false
type ClusterSpecGenerate struct {
KubernetesVersion KubernetesVersion `json:"kubernetesVersion,omitempty"`
ControlPlaneConfiguration ControlPlaneConfiguration `json:"controlPlaneConfiguration,omitempty"`
WorkerNodeGroupConfigurations []WorkerNodeGroupConfiguration `json:"workerNodeGroupConfigurations,omitempty"`
DatacenterRef Ref `json:"datacenterRef,omitempty"`
IdentityProviderRefs []Ref `json:"identityProviderRefs,omitempty"`
GitOpsRef *Ref `json:"gitOpsRef,omitempty"`
ClusterNetwork ClusterNetwork `json:"clusterNetwork,omitempty"`
// +kubebuilder:validation:Optional
ExternalEtcdConfiguration *ExternalEtcdConfiguration `json:"externalEtcdConfiguration,omitempty"`
ProxyConfiguration *ProxyConfiguration `json:"proxyConfiguration,omitempty"`
RegistryMirrorConfiguration *RegistryMirrorConfiguration `json:"registryMirrorConfiguration,omitempty"`
ManagementCluster ManagementCluster `json:"managementCluster,omitempty"`
PodIAMConfig *PodIAMConfig `json:"podIamConfig,omitempty"`
Packages *PackageConfiguration `json:"packages,omitempty"`
// BundlesRef contains a reference to the Bundles containing the desired dependencies for the cluster.
// DEPRECATED: Use EksaVersion instead.
BundlesRef *BundlesRef `json:"bundlesRef"`
EksaVersion *EksaVersion `json:"eksaVersion,omitempty"`
MachineHealthCheck *MachineHealthCheck `json:"machineHealthCheck,omitempty"`
}

// EksaVersion is the semver identifying the release of eks-a used to populate the cluster components.
type EksaVersion string

Expand Down Expand Up @@ -1258,7 +1228,7 @@ type ClusterGenerate struct {
metav1.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`

Spec ClusterSpecGenerate `json:"spec,omitempty"`
Spec ClusterSpec `json:"spec,omitempty"`
}

func (c *Cluster) Kind() string {
Expand Down Expand Up @@ -1419,7 +1389,7 @@ func (c *Cluster) ConvertConfigToConfigGenerateStruct() *ClusterGenerate {
Annotations: c.Annotations,
Namespace: namespace,
},
Spec: ClusterSpecGenerate{
Spec: ClusterSpec{
KubernetesVersion: c.Spec.KubernetesVersion,
ControlPlaneConfiguration: c.Spec.ControlPlaneConfiguration,
WorkerNodeGroupConfigurations: c.Spec.WorkerNodeGroupConfigurations,
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/v1alpha1/cluster_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3104,7 +3104,7 @@ func TestCluster_ConvertConfigToConfigGenerateStruct(t *testing.T) {
Annotations: testCluster.Annotations,
Namespace: testCluster.Namespace,
},
Spec: v1alpha1.ClusterSpecGenerate{
Spec: v1alpha1.ClusterSpec{
KubernetesVersion: testCluster.Spec.KubernetesVersion,
ControlPlaneConfiguration: testCluster.Spec.ControlPlaneConfiguration,
WorkerNodeGroupConfigurations: testCluster.Spec.WorkerNodeGroupConfigurations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: mycluster
namespace: default
spec:
bundlesRef: null
clusterNetwork:
pods: {}
services: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: mycluster
namespace: default
spec:
bundlesRef: null
clusterNetwork:
pods: {}
services: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: mycluster
namespace: default
spec:
bundlesRef: null
clusterNetwork:
pods: {}
services: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: testcluster
namespace: default
spec:
bundlesRef: null
clusterNetwork:
pods: {}
services: {}
Expand Down
1 change: 0 additions & 1 deletion pkg/gitops/flux/files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ metadata:
name: test-cluster
namespace: default
spec:
bundlesRef: null
clusterNetwork:
cniConfig: {}
pods: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: management-cluster
namespace: default
spec:
bundlesRef: null
clusterNetwork:
cniConfig: {}
pods: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ metadata:
name: workload-cluster
namespace: default
spec:
bundlesRef: null
clusterNetwork:
cniConfig: {}
pods: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: management-cluster
namespace: default
spec:
bundlesRef: null
clusterNetwork:
cniConfig: {}
pods: {}
Expand Down

0 comments on commit e53af28

Please sign in to comment.