-
Notifications
You must be signed in to change notification settings - Fork 14
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
Deployment configuration and v1alpha2 version #388
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: gazarenkov <[email protected]>
Signed-off-by: gazarenkov <[email protected]>
# Conflicts: # bundle/manifests/backstage-operator.clusterserviceversion.yaml # config/manifests/bases/backstage-operator.clusterserviceversion.yaml # integration_tests/db_test.go # integration_tests/default-config_test.go # pkg/model/secretfiles_test.go
Signed-off-by: gazarenkov <[email protected]>
Signed-off-by: gazarenkov <[email protected]>
Signed-off-by: gazarenkov <[email protected]>
[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 |
Co-authored-by: gazarenkov <[email protected]>
|
// Defaults to 1. | ||
// +optional | ||
//+kubebuilder:default=1 | ||
Replicas *int32 `json:"replicas,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.
I guess we need to remove Replicas
, Image
, and ImagePullSecrets
fields from this version, since they are marked as deprecated in v1alpha1
(and the goal is to stop using them)? And the controller would need to manage both versions.
Otherwise, I don't see the point of having a new API Version if we are just adding a new spec.deployment
field to the CR (in a backward-compatible manner). We could just add this new field without changing the API version, IMO.
Reference: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api_changes.md#changing-the-api
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.
Also, what would be the behavior if for example both spec.application.replicas
and spec.deployment.spec.replicas
are set in the CR?
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.
I'd agree with you in case if do not have GA obligations (indeed "alpha" API allows to do pretty much "whatever you want"). It is definitely simpler way for development. But, it is what it is, and we have to support older API for some time (6 mo).
Anyway, even if we have kind of choice now, I'd consider it as a good exercise for the case when we declare the API as more stable but need to change it, so, I see no reason why not to change the API version if the API is changed :).
Also, what would be the behavior if for example both spec.application.replicas and spec.deployment.spec.replicas are set in the CR?
It is a good point, I think it should be fixed, so new API always wins.
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.
I'd agree with you in case if do not have GA obligations (indeed "alpha" API allows to do pretty much "whatever you want"). It is definitely simpler way for development. But, it is what it is, and we have to support older API for some time (6 mo).
Well, I meant, to remove the deprecated fields from the new v1alpha2
version (not v1alpha1
, which I agree still needs to be supported). Otherwise, my point was to say that if we want to keep these deprecated fields in v1alpha2
, then maybe v1alpha2
is not needed at all, and the new fields could simply be added to v1alpha1
.
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 I understand how to support those fields if we remove them. Thoughts?
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.
As documented in https://sdk.operatorframework.io/docs/best-practices/best-practices/, I guess one approach could be to implement CRD conversion here, to automatically convert older v1alpha1
CRs to this new v1alpha2
.
But, even if it may be an interesting exercise, we should still be somewhat thoughtful about how we approach this. I still think that we could add the new fields you are suggesting here to the existing v1alpha1
; IMO adding new fields to the CRD is a compatible change that should not require a new API version.
We could just document the deprecated ones accordingly.
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.
As you could read in the NOTE above: "v1alpha2 is backward compatible with v1alpha1 w/o data conversion"
Not sure what exactly you mean by "been thoughtful", my point is to make it supportable which mean the API version should unequivocally identify the state. So if "v1alpha1" may mean several different (even compatible) combinations of config is not appropriate for supportable (GA) application.
// Custom image to use in all containers (including Init Containers). | ||
// It is your responsibility to make sure the image is from trusted sources and has been validated for security compliance | ||
// +optional | ||
Image *string `json:"image,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.
See previous comment..
|
||
// Image Pull Secrets to use in all containers (including Init Containers) | ||
// +optional | ||
ImagePullSecrets []string `json:"imagePullSecrets,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.
See previous comment..
api/v1alpha2/backstage_types.go
Outdated
// Set the Deployment's metadata and|or spec fields you want to override or add. | ||
// Optional. | ||
// +kubebuilder:pruning:PreserveUnknownFields | ||
Deployment *apiextensionsv1.JSON `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.
It looks like this new field won't show up in the "Form view" when creating a CR from the OCP Web Console. I guess because of the field type.
Could you investigate how we could display it there? Maybe as a descriptor in the CSV?
Note that it correctly shows up in the "YAML view" with the help of completion..
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.
I think it is due to field type, it is unstructured per se.
I think we can create an issue for ODC about it, meantime it should be solved by downstream documentation.
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.
added documentation note to PR
# Conflicts: # bundle/manifests/backstage-operator.clusterserviceversion.yaml
Signed-off-by: gazarenkov <[email protected]>
…t_patch # Conflicts: # bundle/manifests/backstage-operator.clusterserviceversion.yaml
Co-authored-by: gazarenkov <[email protected]>
|
Signed-off-by: gazarenkov <[email protected]>
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Description
This PR includes new way to configure Backstage deployment, now (in contrary to raw config) it is possible to add the changes as a and valid "fragment" of appsv1.deployment object inside Backstage CR and those fields will be merged with default (+raw) configuration, like:
Also, since this addition causes changes in the API, new API version
v1alpha2
was added. So, as for Operator versions 0.3.x and 0.4.x (if we consider 3 months release cadency and 6 months API maintain) it will support as minimum both v1alpha1 and v1alpha2 (which become a storage version). After upgrading Operator to 0.3.x the following behaviour expected:NOTE: v1alpha2 is backward compatible with v1alpha1 w/o data conversion
Openshift NOTE: deployment.patch field won't show up in the "Form view" when creating a CR from the OCP Web. To be able to edit it with ODC use "YAML view".
Which issue(s) does this PR fix or relate to
#352
PR acceptance criteria
rhdh-operator.csv.yaml
file accordinglyHow to test changes / Special notes to the reviewer