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

Generic k8s interface #70

Merged
merged 11 commits into from
Sep 29, 2022
Merged

Conversation

pablochacin
Copy link
Contributor

@pablochacin pablochacin commented Sep 27, 2022

Implement Generic interface for creating, retrieving, listing, deleting Kubernetes resources of any of a set of supported kinds such as Pod, Job, Secret, Service (among others)

Closes #68

Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
@pablochacin pablochacin requested review from javaducky and dgzlopes and removed request for javaducky and dgzlopes September 27, 2022 17:22
@pablochacin pablochacin marked this pull request as draft September 27, 2022 17:30
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Copy link
Member

@dgzlopes dgzlopes left a comment

Choose a reason for hiding this comment

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

LGTM! Love it ❤️

Left a couple of comments, but all of them are nits.

pkg/api/api.go Outdated Show resolved Hide resolved
kubernetes_test.go Show resolved Hide resolved
pkg/api/api.go Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
pkg/api/api.go Outdated Show resolved Hide resolved
pkg/api/api.go Outdated
return err
}

// Create creates a resource in a kubernetes cluster from a yaml manifest
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Create creates a resource in a kubernetes cluster from a yaml manifest
// Create creates a resource in a Kubernetes cluster from a YAML manifest

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The comment is actually wrong as this method does not receive a YAML but an object with the resource specification

Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Copy link
Contributor

@javaducky javaducky left a comment

Choose a reason for hiding this comment

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

This is AWESOME!!! Great job! 🥇 🎉


var pod = k8s.get(podSpec.kind, podSpec.metadata.name, podSpec.metadata.namespace)
if (podSpec.metadata.name != pod.metadata.name) {
throw new Error("Fetch by name did not return the Service. Expected: " + podSpec.metadata.name + " but got: " + fetched.name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Super minor. Error message for the example refers to 'Service' instead of 'Pod'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Fixed

Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
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.

Implement generic k8s interface
3 participants