-
Notifications
You must be signed in to change notification settings - Fork 38
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
KO-358: Enhance AerospikeBackupService CR with all the possible deployment configuration params #328
base: master
Are you sure you want to change the base?
Conversation
- admissionReviewVersions: | ||
- v1 | ||
clientConfig: | ||
service: | ||
name: webhook-service | ||
namespace: system | ||
path: /mutate-asdb-aerospike-com-v1beta1-aerospikebackupservice | ||
failurePolicy: Fail | ||
name: maerospikebackupservice.kb.io | ||
rules: | ||
- apiGroups: | ||
- asdb.aerospike.com | ||
apiVersions: | ||
- v1beta1 | ||
operations: | ||
- CREATE | ||
- UPDATE | ||
resources: | ||
- aerospikebackupservices | ||
sideEffects: None |
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.
Add this in helm-chart as well
} | ||
|
||
func validateObjectMeta(objectMeta *AerospikeObjectMeta) error { |
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.
func validateObjectMeta(objectMeta *AerospikeObjectMeta) error { | |
func validatePodObjectMeta(objectMeta *AerospikeObjectMeta) error { |
} | ||
func (r *AerospikeBackupService) validateResourcesField() (admission.Warnings, error) { |
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.
Add a new line
if r.Spec.Resources != nil && r.Spec.PodSpec.ServiceContainerSpec.Resources != nil { | ||
if !reflect.DeepEqual(r.Spec.Resources, r.Spec.PodSpec.ServiceContainerSpec.Resources) { | ||
return nil, fmt.Errorf("resources mismatch, different resources requirements found in " + | ||
"spec.resources and spec.podSpec.serviceContainer.resources") | ||
} else { |
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.
No need of else
statement if you are returning from if
.
You can simply have warn section below if statement
actual := deploy.Spec.Template.ObjectMeta.Annotations | ||
valid := validateLabelsOrAnnotations(actual, annotations) | ||
Expect(valid).To( | ||
BeTrue(), "Unable to find annotations", |
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.
BeTrue(), "Unable to find annotations", | |
BeTrue(), "Annotations mismatch", |
You can also add expected vs found in the error msg if possible
actual = deploy.Spec.Template.ObjectMeta.Labels | ||
valid = validateLabelsOrAnnotations(actual, labels) | ||
Expect(valid).To( | ||
BeTrue(), "Unable to find labels", |
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.
same here
@@ -281,62 +281,88 @@ var _ = Describe( | |||
|
|||
}) | |||
|
|||
It("Should validate annotations and labels addition", func() { | |||
It("Should add custom annotations and labels in the backup service deployement pods", func() { |
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("Should add custom annotations and labels in the backup service deployement pods", func() { | |
It("Should add/update custom annotations and labels in the backup service deployement pods", func() { |
deploy, dErr := getBackupServiceDeployment(k8sClient, name, namespace) | ||
Expect(dErr).ToNot(HaveOccurred()) | ||
|
||
By("Validating Annotations") | ||
actual := deploy.Spec.Template.ObjectMeta.Annotations | ||
valid := validateLabelsOrAnnotations(actual, annotations) | ||
Expect(valid).To( | ||
BeTrue(), "Unable to find annotations", | ||
) | ||
|
||
By("Validating Labels") | ||
actual = deploy.Spec.Template.ObjectMeta.Labels | ||
valid = validateLabelsOrAnnotations(actual, labels) | ||
Expect(valid).To( | ||
BeTrue(), "Unable to find labels", | ||
) |
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 if you can move this in a func (eg. validatePodObjectMeta
) for reusing in both create and update flow
requestMem := resource.MustParse("1Gi") | ||
requestCPU := resource.MustParse("200m") | ||
limitMem := resource.MustParse("2Gi") |
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.
Reduce the memory request and cpu.
It might cause issue while running tests on local dev clusters
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.
Okay, I will reduce it.
No description provided.