Skip to content

Commit

Permalink
Add support for customizing additional provider deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
willie-yao committed Jun 6, 2024
1 parent ea4f195 commit 450c0c0
Show file tree
Hide file tree
Showing 15 changed files with 24,560 additions and 4,772 deletions.
20 changes: 20 additions & 0 deletions api/v1alpha1/provider_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ func (src *BootstrapProvider) ConvertTo(dstRaw conversion.Hub) error {
}

dst.Spec.ManifestPatches = restored.Spec.ManifestPatches
dst.Spec.AdditionalDeployments = restored.Spec.AdditionalDeployments

if restored.Spec.Manager != nil {
dst.Spec.Manager.CRDPattern = restored.Spec.Manager.CRDPattern
}

return nil
}
Expand Down Expand Up @@ -107,6 +112,11 @@ func (src *ControlPlaneProvider) ConvertTo(dstRaw conversion.Hub) error {
}

dst.Spec.ManifestPatches = restored.Spec.ManifestPatches
dst.Spec.AdditionalDeployments = restored.Spec.AdditionalDeployments

if restored.Spec.Manager != nil {
dst.Spec.Manager.CRDPattern = restored.Spec.Manager.CRDPattern
}

return nil
}
Expand Down Expand Up @@ -168,6 +178,11 @@ func (src *CoreProvider) ConvertTo(dstRaw conversion.Hub) error {
}

dst.Spec.ManifestPatches = restored.Spec.ManifestPatches
dst.Spec.AdditionalDeployments = restored.Spec.AdditionalDeployments

if restored.Spec.Manager != nil {
dst.Spec.Manager.CRDPattern = restored.Spec.Manager.CRDPattern
}

return nil
}
Expand Down Expand Up @@ -229,6 +244,11 @@ func (src *InfrastructureProvider) ConvertTo(dstRaw conversion.Hub) error {
}

dst.Spec.ManifestPatches = restored.Spec.ManifestPatches
dst.Spec.AdditionalDeployments = restored.Spec.AdditionalDeployments

if restored.Spec.Manager != nil {
dst.Spec.Manager.CRDPattern = restored.Spec.Manager.CRDPattern
}

return nil
}
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/zz_generated.conversion.go

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

23 changes: 23 additions & 0 deletions api/v1alpha2/provider_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,24 @@ type ProviderSpec struct {
// This should be an inline yaml blob-string https://datatracker.ietf.org/doc/html/rfc7396
// +optional
ManifestPatches []string `json:"manifestPatches,omitempty"`

// AdditionalDeployments is a map of additional deployments that the provider
// should manage. The key is the name of the deployment and the value is the
// DeploymentSpec.
// +optional
AdditionalDeployments map[string]AdditionalProviderCustomization `json:"additionalDeployments,omitempty"`
}

// AdditionalProviderCustomization defines the properties that can be enabled on the controller
// manager and deployment for the provider if the provider is managing additional deployments.
type AdditionalProviderCustomization struct {
// Manager defines the properties that can be enabled on the controller manager for the additional provider deployment.
// +optional
Manager *ManagerSpec `json:"manager,omitempty"`

// Deployment defines the properties that can be enabled on the deployment for the additional provider deployment.
// +optional
Deployment *DeploymentSpec `json:"deployment,omitempty"`
}

// ConfigmapReference contains enough information to locate the configmap.
Expand Down Expand Up @@ -123,6 +141,11 @@ type ManagerSpec struct {
// in as container args to the provider's controller manager.
// Controller Manager flag is --feature-gates.
FeatureGates map[string]bool `json:"featureGates,omitempty"`

// CRDPattern is a regular expression that matches the CRDs that the provider
// is expected to manage.
// +optional
CRDPattern *string `json:"crdPattern,omitempty"`
}

// DeploymentSpec defines the properties that can be enabled on the Deployment for the provider.
Expand Down
37 changes: 37 additions & 0 deletions api/v1alpha2/zz_generated.deepcopy.go

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

Loading

0 comments on commit 450c0c0

Please sign in to comment.