-
Notifications
You must be signed in to change notification settings - Fork 45
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
✨ LFX: Extend use-case of detecting deprecated Kubernetes API usage #441
Conversation
@JonahSussman @eemcmullan still need to add the test for those new function. Will try to complete that in few days. |
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.
Looks great, thanks for submitting a contribution! Just a few changes
@@ -27,9 +30,12 @@ RUN python3 -m pip install python-lsp-server | |||
|
|||
COPY --from=jaeger-builder /go/bin/all-in-one-linux /usr/bin/ | |||
|
|||
COPY --from=yq-builder /usr/bin/yq /usr/bin/yq |
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.
Thinking out loud here, but I think there was talk of doing some dependency management for external providers a while back. It's fine for now, but this method could bloat the Dockerfile when adding more providers.
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 will for sure, I think we should ask @dymurray to prioritize this work for the next version.
cmd/analyzer/main.go
Outdated
@@ -217,7 +217,7 @@ func main() { | |||
if err != nil { | |||
log.Error(err, "error writing output file", "file", outputViolations) | |||
os.Exit(1) // Treat the error as a fatal 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.
This extra space has been bugging me for a while now, thanks! 😂
external-providers/yq-external-provider/pkg/generic/dependency.go
Outdated
Show resolved
Hide resolved
external-providers/yq-external-provider/pkg/generic/dependency.go
Outdated
Show resolved
Hide resolved
external-providers/yq-external-provider/pkg/generic/dependency.go
Outdated
Show resolved
Hide resolved
external-providers/yq-external-provider/pkg/generic/provider.go
Outdated
Show resolved
Hide resolved
external-providers/yq-external-provider/pkg/generic/service_client.go
Outdated
Show resolved
Hide resolved
external-providers/yq-external-provider/pkg/generic/service_client.go
Outdated
Show resolved
Hide resolved
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.
Unsure if this is where we want to put these k8s rules. Perhaps we should add it to the https://github.com/konveyor/rulesets/ repo instead? WDYT @shawn-hurley
|
||
lspServerPath, ok := c.ProviderSpecificConfig[provider.LspServerPathConfigKey].(string) | ||
if !ok || lspServerPath == "" { | ||
return nil, fmt.Errorf("invalid lspServerPath provided, unable to init go provider") |
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 log mentions a go provider
const KIND = "kind" | ||
const GITHUB_K8S_API_URL = "https://api.github.com/repos/kubernetes/kubernetes/releases" | ||
|
||
var default_k8s_version = "v1.28.4" |
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.
may want to think of a way to make this more dynamic
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.
Should I add a config struct and then assign those values form a json file or yaml file?
@@ -0,0 +1,1034 @@ | |||
- message: Deprecated/removed Kubernetes API version 'extensions/v1beta1' is used for 'Deployment'. Consider using 'apps/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.
Could we maybe get these rules separated into rulesets by the api group? i.e. rules for apps, rules for networking, etc..
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.
will look after it. need some time
removedIn: "v1.16.0" | ||
replacementAPI: "apps/v1" | ||
- message: Deprecated/removed Kubernetes API version 'apps/v1beta2' is used for 'Deployment'. Consider using 'apps/v1'. | ||
ruleID: k8s-deprecated-api-002 |
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.
If the above is done, we could then have more descriptive ruleIDs
|
||
RUN make build | ||
|
||
# Add yq to the build stage | ||
FROM docker.io/mikefarah/yq as yq-builder |
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.
note to us, we probably need to fork this and build it out of konveyor in the future
@@ -0,0 +1,1034 @@ | |||
- message: Deprecated/removed Kubernetes API version 'extensions/v1beta1' is used for 'Deployment'. Consider using 'apps/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.
Can these rules be generated or did you do this by hand?
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.
nah it's not generated
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.
I think we can find a way to get this automated.
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.
Wow, that must have taken a long time, thank you. This is going to be a nice feature!
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.
trust me, that didn't take much time 😅
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.
I think this makes a lot of sense; I wonder if we could make it an external provider in its own repo, though maybe in the konveyor-externsions and make a flag to build an image with it built in or something?
Just wondering, if it is too much work right now I am cool with adding it and doing the messy work after :)
@Parthiba-Hazra This is awesome work! Thank you so much for taking the time to work on this and contributing! |
@Parthiba-Hazra can you rebase then I think we can merge |
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.
LGTM!
Signed-off-by: Parthiba-Hazra <parthibahazra02@gmail.com>
Signed-off-by: Parthiba-Hazra <parthibahazra02@gmail.com>
Signed-off-by: Parthiba-Hazra <parthibahazra02@gmail.com>
Signed-off-by: Parthiba-Hazra <parthibahazra02@gmail.com>
Signed-off-by: Parthiba-Hazra <parthibahazra02@gmail.com>
Signed-off-by: Parthiba-Hazra <parthibahazra02@gmail.com>
Signed-off-by: Parthiba-Hazra <parthibahazra02@gmail.com>
Signed-off-by: Parthiba-Hazra <parthibahazra02@gmail.com>
Signed-off-by: Parthiba-Hazra <parthibahazra02@gmail.com>
Signed-off-by: Parthiba-Hazra <parthibahazra02@gmail.com>
a58211b
to
eae64fa
Compare
Signed-off-by: Shawn Hurley <shawn@hurley.page>
@Parthiba-Hazra Do you mind updating the demo testing output? |
yes sure, |
Signed-off-by: Parthiba-Hazra <parthibahazra@gmail.com>
Added 'yq' provider.
Added rules to detect use of deprecated APIs in k8s yaml files.