-
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
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Pod Configuration" | ||
ServicePodSpec ServicePodSpec `json:"servicePodSpec,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.
- Add comments for all new fields.
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Pod Configuration" | |
ServicePodSpec ServicePodSpec `json:"servicePodSpec,omitempty"` | |
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Pod Configuration" | |
PodSpec ServicePodSpec `json:"podSpec,omitempty"` |
// Resources defines the requests and limits for the backup service container. | ||
// Resources.Limits should be more than Resources.Requests. | ||
Resources *corev1.ResourceRequirements `json:"resources,omitempty"` | ||
ServicePodSpec ServicePodSpec `json:"servicePodSpec,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.
Same comment as above
//+kubebuilder:webhook:path=/mutate-asdb-aerospike-com-v1beta1-aerospikebackupservice,mutating=true,failurePolicy=fail,sideEffects=None,groups=asdb.aerospike.com,resources=aerospikebackupservices,verbs=create;update,versions=v1beta1,name=maerospikebackupservice.kb.io,admissionReviewVersions=v1 | ||
|
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.
- Run
make generate
- to generate deepcopy code - Run
make manifests
- to generate manifests - Add new manifests new in the helm-chart
warn, err := r.validateServicePodSpec() | ||
|
||
if err != nil { | ||
return nil, err | ||
} else if warn != nil { | ||
return warn, nil | ||
} | ||
|
||
return nil, nil |
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.
warn, err := r.validateServicePodSpec() | |
if err != nil { | |
return nil, err | |
} else if warn != nil { | |
return warn, nil | |
} | |
return nil, nil | |
return r.validateServicePodSpec() |
warn, err := r.validateServicePodSpec() | ||
|
||
if err != nil { | ||
return nil, err | ||
} else if warn != nil { | ||
return warn, nil | ||
} | ||
|
||
return nil, nil |
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
valid = validateLabelsOrAnnotations(actual, map[string]string{"label-test-1": "test-1"}) | ||
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.
Add custom label and annotation update test flow as well in this test-case
nodeList, nErr := getNodeList(context.TODO(), k8sClient) | ||
Expect(nErr).ToNot(HaveOccurred()) | ||
Expect(len(nodeList.Items)).ToNot(BeZero()) | ||
|
||
By("Validating Affinity") | ||
nodeName := nodeList.Items[0].Name | ||
affinity := &corev1.Affinity{} | ||
ns := &corev1.NodeSelector{ | ||
NodeSelectorTerms: []corev1.NodeSelectorTerm{ | ||
{ | ||
MatchExpressions: []corev1.NodeSelectorRequirement{ | ||
{ | ||
Key: "kubernetes.io/hostname", | ||
Operator: corev1.NodeSelectorOpIn, | ||
Values: []string{nodeName}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} |
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.
Instead of this, it's easier to set a PreferredDuringSchedulingIgnoredDuringExecution
node affinity in the CR and validate the same from the pod object affinity.
test/backup_service/test_utils.go
Outdated
@@ -298,3 +298,41 @@ func DeleteBackupService( | |||
|
|||
return nil | |||
} | |||
|
|||
func getBackupServiceDeployment(k8sClient client.Client, | |||
backupService *asdbv1beta1.AerospikeBackupService) (*app.Deployment, 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.
It just needs the name and namespace of backup service not the whole object
backupService, err := getBackupServiceObj(k8sClient, name, namespace) | ||
if err != nil { | ||
return err | ||
} | ||
|
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 won't be required if you switch to name and namespace params in getBackupServiceDeployment
test/backup_service/test_utils.go
Outdated
for key, val := range expected { | ||
if v, ok := actual[key]; ok { | ||
if v == val { | ||
return true |
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 won't work with multiple key: values in expected map as it is returning after the first value itself
No description provided.