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

Kafka integration test #922

Merged
merged 72 commits into from
Mar 30, 2021
Merged

Kafka integration test #922

merged 72 commits into from
Mar 30, 2021

Conversation

akankshakumari393
Copy link
Contributor

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:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test

Issues

  • #XXX

Test Plan

./build/integration-test.sh Kafka

  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

Copy link
Contributor

@pavannd1 pavannd1 left a comment

Choose a reason for hiding this comment

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

Cosmetic improvements

pkg/app/kafka.go Outdated Show resolved Hide resolved
pkg/app/kafka.go Outdated Show resolved Hide resolved
pkg/app/kafka.go Outdated Show resolved Hide resolved
pkg/app/kafka.go Outdated Show resolved Hide resolved
pkg/app/kafka.go Outdated Show resolved Hide resolved
pkg/app/kafka.go Outdated Show resolved Hide resolved
pkg/app/kafka.go Outdated Show resolved Hide resolved
pkg/app/kafka.go Outdated Show resolved Hide resolved
pkg/app/kafka.go Outdated Show resolved Hide resolved
pkg/app/kafka.go Outdated Show resolved Hide resolved
Copy link
Contributor

@pavannd1 pavannd1 left a 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 Show resolved Hide resolved
pkg/app/kafka.go Outdated Show resolved Hide resolved
pkg/app/kafka.go Outdated
Comment on lines 97 to 99
if err != nil {
return err
}
Copy link
Contributor

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

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

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.

Copy link
Contributor Author

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 Show resolved Hide resolved
pkg/app/kafka.go Outdated
Comment on lines 303 to 312
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
}
Copy link
Contributor

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
Comment on lines 322 to 330
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")
}
Copy link
Contributor

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)
Copy link
Contributor

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
}
Copy link
Contributor

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

akankshakumari393 and others added 2 commits March 30, 2021 10:59
Co-authored-by: Prasad Ghangal <prasad.ghangal@gmail.com>
Copy link
Contributor

@PrasadG193 PrasadG193 left a 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.

pkg/app/kafka.go Outdated Show resolved Hide resolved
akankshakumari393 and others added 2 commits March 30, 2021 15:25
Co-authored-by: Prasad Ghangal <prasad.ghangal@gmail.com>
@mergify mergify bot merged commit 921321f into master Mar 30, 2021
@mergify mergify bot deleted the kafka-integration-test branch March 30, 2021 11:28
PrasadG193 added a commit that referenced this pull request Apr 5, 2021
* 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>
chaitanya-baraskar pushed a commit to chaitanya-baraskar/kanister that referenced this pull request Apr 5, 2021
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants