-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Add support for customizing additional provider deployments #538
base: main
Are you sure you want to change the base?
✨ Add support for customizing additional provider deployments #538
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
✅ Deploy Preview for kubernetes-sigs-cluster-api-operator ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
909dceb
to
15a3e6c
Compare
I'm a bit confused on how to add a conversion function for CRDPattern. @Fedosin @alexander-demicev is there an example on how to do this? I tried adding something like this to the conversion funcs which didn't seem to work: https://github.com/willie-yao/cluster-api-operator/blob/upstream-install-aso-crds/api/v1alpha1/provider_conversion.go#L48 |
@willie-yao You can find an example here https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/4228/files, this PR added a new field to API and conversion to older versions |
7888168
to
7c0f00d
Compare
Thanks @alexander-demicev! I fixed up the conversion and added a unit test! |
7c0f00d
to
3ae6a36
Compare
@willie-yao This change is too specific to capz. What do you think about making it more generic? Can we introduce a new field to customize additional deployments that come with providers? I think something like |
@alexander-demicev That is a great idea. I did notice that this may be too specific to CAPZ to be implemented like this. I'll work on adding a field like |
de8275a
to
a40a7c8
Compare
|
||
// Deployment defines the properties that can be enabled on the deployment for the provider. | ||
// +optional | ||
Deployment *DeploymentSpec `json:"deployment,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexander-demicev not sure if this is the best way to do it, but I refactored the code to include an AdditionalDeployments
field that maps the name of the deployment to the Manager and Deployment spec, where the additional deployments can be customized. Is this a good way to go about it?
9a75480
to
1306800
Compare
/retest |
1306800
to
450c0c0
Compare
{{- include "recursivePrinter" $value | indent 2 }} | ||
{{- else }} | ||
{{ $key }}: {{ $value }} | ||
{{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function allows the chart to print out additionalDeployments
correctly in yaml format as both deployments and manager has nested fields.
@@ -73,25 +73,41 @@ func customizeObjectsFn(provider operatorv1.GenericProvider) func(objs []unstruc | |||
})) | |||
} | |||
|
|||
//nolint:nestif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if a nolint is allowed here. I'll have to create a few helper functions if not. lmk which approach is better!
ad064f1
to
728860c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great, couple of minor questions
api/v1alpha2/provider_types.go
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need to keep this field? can it be replaced with the container arguments in the deployment spec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, confirmed it works via container arguments in the deployment spec!
0cec2c0
to
b6684d7
Compare
additionalDeployments: | ||
fake-controller-manager: | ||
manager: | ||
crdPattern: ".*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should crdPattern
be removed since we can achieve the same with container arguments?
PR looks good, just one small comment |
151f8ee
to
9e2c3ed
Compare
/retest |
Looks like there's a problem with the E2E test output. Will be looking into this. |
9e2c3ed
to
25328eb
Compare
The hyphen in |
Actually it looks like the error is coming from the recursivePrinter: https://github.com/willie-yao/cluster-api-operator/blob/25328eb918edd7eb4b2e79cf10ab73cf0ca4f9e1/hack/charts/cluster-api-operator/templates/infra.yaml#L1 I'm not sure how to adjust that function to allow array values to be passed inline. When specifying container customizations for additionalDeployments, using a values file works. Do we have to add support for setting this inline? |
25328eb
to
d1112d3
Compare
I went ahead and removed the test case from |
What this PR does / why we need it:
This PR adds support for customizing additional provider deployments via the
additionalDeployments
field in the provider spec.additionalDeployments
is a map of the name of the provider to both the deployment and manager spec which is used for customizing the deployment/management container.This PR also adds allows CRDPattern to be configurable in deployment customization. This is to allow for installing additional CRDs through the ASO deployment.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #