-
Notifications
You must be signed in to change notification settings - Fork 148
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
Kafka integration test #922
Conversation
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.
Cosmetic improvements
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.
@PrasadG193 Please +2 when you are back online.
pkg/app/kafka.go
Outdated
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.
Don't need this condition, we are anyways returning err on line no 100
pkg/app/kafka.go
Outdated
"kafka-ping", | ||
"-ti", | ||
"--rm=true", | ||
"--image=strimzi/kafka:0.20.0-kafka-2.6.0", |
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.
let's declare the image name as const
pkg/app/kafka.go
Outdated
"--", | ||
"bin/kafka-topics.sh", | ||
"--list", | ||
"--bootstrap-server=my-cluster-kafka-external-bootstrap:9094", |
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.
is the bootstrap server name depends on the release name we provide to install chart? If that is the case, we should make it variable and build the address from release name.
Please also declare port as const.
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.
here bootstrap server doesn't depend on the release name. I will add the hostname and port as constant.
pkg/app/kafka.go
Outdated
config, err := rest.InClusterConfig() | ||
if err == nil { | ||
return config, nil | ||
} | ||
|
||
homeConfig := filepath.Join(os.Getenv("HOME"), ".kube/config") | ||
config, err = clientcmd.BuildConfigFromFlags("", homeConfig) | ||
if err == nil { | ||
return config, 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.
Please use kube.NewClient()
method in pkg/kube
to init K8s client
https://github.com/kanisterio/kanister/blob/master/pkg/kube/client.go#L54
pkg/app/kafka.go
Outdated
cfg, err := LoadConfig() | ||
if err != nil { | ||
return nil, errors.Wrapf(err, "Failed to Load config") | ||
} | ||
|
||
clientset, err := kubernetes.NewForConfig(cfg) | ||
if err != nil { | ||
return nil, errors.Wrapf(err, "Failed to create Clienset for k8s config") | ||
} |
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.
pkg/app/kafka.go
Outdated
return nil, errors.Wrapf(err, "Failed to get service for component") | ||
} | ||
for k, v := range svc.Spec.Selector { | ||
selector = fmt.Sprintf("%s%s=%s,", selector, k, v) |
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.
conn, err := kafka.DialLeader(ctx, "tcp", uri, topic, partition) | ||
if err != nil { | ||
return 0, 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.
Add defer conn.Close()
and remove the call on Line no. 440
Co-authored-by: Prasad Ghangal <prasad.ghangal@gmail.com>
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.
Minor suggestion. Looks good otherwise.
Co-authored-by: Prasad Ghangal <prasad.ghangal@gmail.com>
* Kafka Backup Blueprint * added newline * echo on single line * fixed typo * moved to examples folder * Adding kafka Restore blueprint using confluent source connector * properties file for s3Source * changes to restore blueprint * addition to restore blueprint * resolved issues * add error exit command * files renamed * added prehook * restore all topics, added a python script * merged blueprints * added phase to restore action * successcode * pod success * backup Process completed with successful exit code * fixed bugs * restore with input artifact * fixed bug * customized connector * backup and restore done * adobe s3 connector * fixed newline at the end * changes to README, multiple Run commands in Dockerfile * required changes in goreleaser * bug fixes * removed latest tags * adding comments * source connector name as pod name * removed jar file, added delete action, removed cleanup process, change kafka cluster setup * added sink docker image to delete action * removed clusterRole dependency, changed kafdrop broker address * typo correction * changes to add delete action * latest changes * Added Install functionality for kafka * completed install, ready and Ping test * WIP to delete blueprint * added delete action * lint fixed * lint checked * resolved dependencies * updated the test to use helm * typo fix * added var for yaml path * minor changes * review comments * removed kubernetes var * removing errors.Wrapf * delete CRD and configmap * blueprint images * corrected file path * removed cluster and role bindings in CRD deletion * delete kafka cluster * wait on deployment ready * deleted crd delete functionality * removed uninstalling CRD * conflict resolved * blueprint image changed * image to ghcr * Apply suggestions from code review * Fix typo * Apply suggestions from code review Co-authored-by: Prasad Ghangal <prasad.ghangal@gmail.com> * Applied suggestions from review comments * Update pkg/app/kafka.go Co-authored-by: Prasad Ghangal <prasad.ghangal@gmail.com> * minor change Co-authored-by: Pavan Navarathna <pavan@kasten.io> Co-authored-by: Prasad Ghangal <prasad.ghangal@gmail.com>
* Kafka Backup Blueprint * added newline * echo on single line * fixed typo * moved to examples folder * Adding kafka Restore blueprint using confluent source connector * properties file for s3Source * changes to restore blueprint * addition to restore blueprint * resolved issues * add error exit command * files renamed * added prehook * restore all topics, added a python script * merged blueprints * added phase to restore action * successcode * pod success * backup Process completed with successful exit code * fixed bugs * restore with input artifact * fixed bug * customized connector * backup and restore done * adobe s3 connector * fixed newline at the end * changes to README, multiple Run commands in Dockerfile * required changes in goreleaser * bug fixes * removed latest tags * adding comments * source connector name as pod name * removed jar file, added delete action, removed cleanup process, change kafka cluster setup * added sink docker image to delete action * removed clusterRole dependency, changed kafdrop broker address * typo correction * changes to add delete action * latest changes * Added Install functionality for kafka * completed install, ready and Ping test * WIP to delete blueprint * added delete action * lint fixed * lint checked * resolved dependencies * updated the test to use helm * typo fix * added var for yaml path * minor changes * review comments * removed kubernetes var * removing errors.Wrapf * delete CRD and configmap * blueprint images * corrected file path * removed cluster and role bindings in CRD deletion * delete kafka cluster * wait on deployment ready * deleted crd delete functionality * removed uninstalling CRD * conflict resolved * blueprint image changed * image to ghcr * Apply suggestions from code review * Fix typo * Apply suggestions from code review Co-authored-by: Prasad Ghangal <prasad.ghangal@gmail.com> * Applied suggestions from review comments * Update pkg/app/kafka.go Co-authored-by: Prasad Ghangal <prasad.ghangal@gmail.com> * minor change Co-authored-by: Pavan Navarathna <pavan@kasten.io> Co-authored-by: Prasad Ghangal <prasad.ghangal@gmail.com>
Change Overview
Adding integration test for Kafka Blueprint. This will not be tested in kanister CI, but we will be using it in k10 pipeline.
Link to Log statement : https://gist.github.com/A-kanksh-a/a84f0d7df5b3c2f4e953b1728267d93c#file-kafka-integration-test-log
Pull request type
Please check the type of change your PR introduces:
Issues
Test Plan
./build/integration-test.sh Kafka