Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jwalantmodi05
Copy link
Contributor

No description provided.

Comment on lines +58 to +59
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Pod Configuration"
ServicePodSpec ServicePodSpec `json:"servicePodSpec,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Add comments for all new fields.
Suggested change
// +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"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above

Comment on lines +42 to +43
//+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

Copy link
Collaborator

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

Comment on lines +76 to 84
warn, err := r.validateServicePodSpec()

if err != nil {
return nil, err
} else if warn != nil {
return warn, nil
}

return nil, nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
warn, err := r.validateServicePodSpec()
if err != nil {
return nil, err
} else if warn != nil {
return warn, nil
}
return nil, nil
return r.validateServicePodSpec()

Comment on lines +101 to 109
warn, err := r.validateServicePodSpec()

if err != nil {
return nil, err
} else if warn != nil {
return warn, nil
}

return nil, nil
Copy link
Collaborator

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",
)
Copy link
Collaborator

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

Comment on lines +316 to +335
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},
},
},
},
},
}
Copy link
Collaborator

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.

@@ -298,3 +298,41 @@ func DeleteBackupService(

return nil
}

func getBackupServiceDeployment(k8sClient client.Client,
backupService *asdbv1beta1.AerospikeBackupService) (*app.Deployment, error) {
Copy link
Collaborator

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

Comment on lines +404 to +408
backupService, err := getBackupServiceObj(k8sClient, name, namespace)
if err != nil {
return err
}

Copy link
Collaborator

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

for key, val := range expected {
if v, ok := actual[key]; ok {
if v == val {
return true
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants