Skip to content

Conversation

@susesgartner
Copy link
Contributor

@susesgartner susesgartner commented Mar 18, 2024

Update to remove several global constants and generally rework how we store/utilize certain constants that appear across many files in both rancher/rancher and rancher/shepherd.

Motivation: The overall goal here is to streamline how we declare and use constants, this should result in fewer global vars, less importing/declaring of generic constants in specific packages, and generally more convenient code writing since generic constants can be found and imported from one place.

@susesgartner susesgartner added the automation-enhancement To indicate this is related to enhancements in code related to automation label Mar 19, 2024
slickwarren
slickwarren previously approved these changes Mar 27, 2024
Copy link
Contributor

@slickwarren slickwarren left a comment

Choose a reason for hiding this comment

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

some small nits but this is actually awesome!

Copy link
Contributor

@markusewalker markusewalker left a comment

Choose a reason for hiding this comment

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

Overall, LGTM just a reminder for myself that there are some annotations in parallel PRs that will require updating here.

@susesgartner
Copy link
Contributor Author

I will make a final pass through shepherd and update any new consts that get merged in before this PR.

@igomez06
Copy link
Contributor

igomez06 commented Apr 2, 2024

@susesgartner can you also add the globalconstant linter as well? And see if it passes that?

@susesgartner susesgartner force-pushed the RemoveGlobals branch 3 times, most recently from 9001dba to 47ae7c8 Compare April 2, 2024 17:21
@susesgartner
Copy link
Contributor Author

The globalconstant linter was what sparked my interest in creating this PR. While I have removed most of the global constants there is 1 remaining that I am currently looking into.

@igomez06
Copy link
Contributor

igomez06 commented Apr 2, 2024

The globalconstant linter was what sparked my interest in creating this PR. While I have removed most of the global constants there is 1 remaining that I am currently looking into.

I know, what I'm saying is can you add this to our GHA linter? Since you're already doing the work it would be a great time to add it our configuration and have it pass the official verify

@susesgartner
Copy link
Contributor Author

Sure!

@susesgartner susesgartner force-pushed the RemoveGlobals branch 2 times, most recently from 5317272 to c25e288 Compare April 26, 2024 21:29
slickwarren
slickwarren previously approved these changes Apr 29, 2024
Copy link
Contributor

@slickwarren slickwarren left a comment

Choose a reason for hiding this comment

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

lgtm

markusewalker
markusewalker previously approved these changes Apr 29, 2024
@susesgartner susesgartner force-pushed the RemoveGlobals branch 2 times, most recently from b76f5e9 to 713005f Compare May 3, 2024 15:02
Copy link
Member

@caliskanugur caliskanugur left a comment

Choose a reason for hiding this comment

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

Looks good, I've got couple of questions

Comment on lines 8 to 222
func Node() schema.GroupVersionResource {
node := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "nodes",
}

return node
}

func Pod() schema.GroupVersionResource {
pod := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "pods",
}

return pod
}

func ConfigMap() schema.GroupVersionResource {
configMap := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "configmaps",
}

return configMap
}

func CustomResourceDefinition() schema.GroupVersionResource {
customResourceDefinition := schema.GroupVersionResource{
Group: "apiextensions.k8s.io",
Version: "v1",
Resource: "customresourcedefinitions",
}

return customResourceDefinition
}

func Ingress() schema.GroupVersionResource {
ingress := schema.GroupVersionResource{
Group: "networking.k8s.io",
Version: "v1",
Resource: "ingresses",
}

return ingress
}

func Project() schema.GroupVersionResource {
project := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "projects",
}

return project
}

func Role() schema.GroupVersionResource {
role := schema.GroupVersionResource{
Group: rbacv1.SchemeGroupVersion.Group,
Version: rbacv1.SchemeGroupVersion.Version,
Resource: "roles",
}

return role
}

func ClusterRole() schema.GroupVersionResource {
clusterRole := schema.GroupVersionResource{
Group: rbacv1.SchemeGroupVersion.Group,
Version: rbacv1.SchemeGroupVersion.Version,
Resource: "clusterroles",
}

return clusterRole
}

func RoleBinding() schema.GroupVersionResource {
roleBinding := schema.GroupVersionResource{
Group: rbacv1.SchemeGroupVersion.Group,
Version: rbacv1.SchemeGroupVersion.Version,
Resource: "rolebindings",
}

return roleBinding
}

func ClusterRoleBinding() schema.GroupVersionResource {
clusterRoleBinding := schema.GroupVersionResource{
Group: rbacv1.SchemeGroupVersion.Group,
Version: rbacv1.SchemeGroupVersion.Version,
Resource: "clusterrolebindings",
}

return clusterRoleBinding
}

func GlobalRole() schema.GroupVersionResource {
globalRole := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "globalroles",
}

return globalRole
}

func GlobalRoleBinding() schema.GroupVersionResource {
globalRoleBinding := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "globalrolebindings",
}

return globalRoleBinding
}

func ClusterRoleTemplateBinding() schema.GroupVersionResource {
clusterRoleTemplateBinding := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "clusterroletemplatebindings",
}

return clusterRoleTemplateBinding
}

func RoleTemplate() schema.GroupVersionResource {
roleTemplate := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "roletemplates",
}

return roleTemplate
}

func ProjectRoleTemplateBinding() schema.GroupVersionResource {
projectRoleTemplateBinding := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "projectroletemplatebindings",
}

return projectRoleTemplateBinding
}

func ResourceQuota() schema.GroupVersionResource {
resourceQuota := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "resourcequotas",
}

return resourceQuota
}

func Secret() schema.GroupVersionResource {
secret := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "secrets",
}

return secret
}

func Service() schema.GroupVersionResource {
service := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "services",
}

return service
}

func StorageClass() schema.GroupVersionResource {
storageClass := schema.GroupVersionResource{
Group: "storage.k8s.io",
Version: "v1",
Resource: "storageclasses",
}

return storageClass
}

func Token() schema.GroupVersionResource {
token := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "tokens",
}

return token
}

func PersistentVolumeClaim() schema.GroupVersionResource {
persistentVolumeClaim := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "persistentvolumeclaims",
}

return persistentVolumeClaim
}

func PersistentVolume() schema.GroupVersionResource {
persistentVolume := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "persistentvolumes",
}

return persistentVolume
}

func Namespace() schema.GroupVersionResource {
namespace := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "namespaces",
}

return namespace
}

func Daemonset() schema.GroupVersionResource {
daemonset := schema.GroupVersionResource{
Group: "apps",
Version: "v1",
Resource: "daemonsets",
}

return daemonset
}

func Deployment() schema.GroupVersionResource {
deployment := schema.GroupVersionResource{
Group: "apps",
Version: "v1",
Resource: "deployments",
}

return deployment
}

func Job() schema.GroupVersionResource {
job := schema.GroupVersionResource{
Group: "batch",
Version: "v1",
Resource: "jobs",
}

return job
}

func CronJob() schema.GroupVersionResource {
cronJob := schema.GroupVersionResource{
Group: "batch",
Version: "v1beta1",
Resource: "cronjobs",
}

return cronJob
}
Copy link
Member

Choose a reason for hiding this comment

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

Do these have to be separated? I think this file would get longer whenever a new GVR is used in the framework.

What do you think about making this a template? Something like this:

Suggested change
func Node() schema.GroupVersionResource {
node := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "nodes",
}
return node
}
func Pod() schema.GroupVersionResource {
pod := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "pods",
}
return pod
}
func ConfigMap() schema.GroupVersionResource {
configMap := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "configmaps",
}
return configMap
}
func CustomResourceDefinition() schema.GroupVersionResource {
customResourceDefinition := schema.GroupVersionResource{
Group: "apiextensions.k8s.io",
Version: "v1",
Resource: "customresourcedefinitions",
}
return customResourceDefinition
}
func Ingress() schema.GroupVersionResource {
ingress := schema.GroupVersionResource{
Group: "networking.k8s.io",
Version: "v1",
Resource: "ingresses",
}
return ingress
}
func Project() schema.GroupVersionResource {
project := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "projects",
}
return project
}
func Role() schema.GroupVersionResource {
role := schema.GroupVersionResource{
Group: rbacv1.SchemeGroupVersion.Group,
Version: rbacv1.SchemeGroupVersion.Version,
Resource: "roles",
}
return role
}
func ClusterRole() schema.GroupVersionResource {
clusterRole := schema.GroupVersionResource{
Group: rbacv1.SchemeGroupVersion.Group,
Version: rbacv1.SchemeGroupVersion.Version,
Resource: "clusterroles",
}
return clusterRole
}
func RoleBinding() schema.GroupVersionResource {
roleBinding := schema.GroupVersionResource{
Group: rbacv1.SchemeGroupVersion.Group,
Version: rbacv1.SchemeGroupVersion.Version,
Resource: "rolebindings",
}
return roleBinding
}
func ClusterRoleBinding() schema.GroupVersionResource {
clusterRoleBinding := schema.GroupVersionResource{
Group: rbacv1.SchemeGroupVersion.Group,
Version: rbacv1.SchemeGroupVersion.Version,
Resource: "clusterrolebindings",
}
return clusterRoleBinding
}
func GlobalRole() schema.GroupVersionResource {
globalRole := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "globalroles",
}
return globalRole
}
func GlobalRoleBinding() schema.GroupVersionResource {
globalRoleBinding := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "globalrolebindings",
}
return globalRoleBinding
}
func ClusterRoleTemplateBinding() schema.GroupVersionResource {
clusterRoleTemplateBinding := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "clusterroletemplatebindings",
}
return clusterRoleTemplateBinding
}
func RoleTemplate() schema.GroupVersionResource {
roleTemplate := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "roletemplates",
}
return roleTemplate
}
func ProjectRoleTemplateBinding() schema.GroupVersionResource {
projectRoleTemplateBinding := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "projectroletemplatebindings",
}
return projectRoleTemplateBinding
}
func ResourceQuota() schema.GroupVersionResource {
resourceQuota := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "resourcequotas",
}
return resourceQuota
}
func Secret() schema.GroupVersionResource {
secret := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "secrets",
}
return secret
}
func Service() schema.GroupVersionResource {
service := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "services",
}
return service
}
func StorageClass() schema.GroupVersionResource {
storageClass := schema.GroupVersionResource{
Group: "storage.k8s.io",
Version: "v1",
Resource: "storageclasses",
}
return storageClass
}
func Token() schema.GroupVersionResource {
token := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "tokens",
}
return token
}
func PersistentVolumeClaim() schema.GroupVersionResource {
persistentVolumeClaim := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "persistentvolumeclaims",
}
return persistentVolumeClaim
}
func PersistentVolume() schema.GroupVersionResource {
persistentVolume := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "persistentvolumes",
}
return persistentVolume
}
func Namespace() schema.GroupVersionResource {
namespace := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "namespaces",
}
return namespace
}
func Daemonset() schema.GroupVersionResource {
daemonset := schema.GroupVersionResource{
Group: "apps",
Version: "v1",
Resource: "daemonsets",
}
return daemonset
}
func Deployment() schema.GroupVersionResource {
deployment := schema.GroupVersionResource{
Group: "apps",
Version: "v1",
Resource: "deployments",
}
return deployment
}
func Job() schema.GroupVersionResource {
job := schema.GroupVersionResource{
Group: "batch",
Version: "v1",
Resource: "jobs",
}
return job
}
func CronJob() schema.GroupVersionResource {
cronJob := schema.GroupVersionResource{
Group: "batch",
Version: "v1beta1",
Resource: "cronjobs",
}
return cronJob
}
func NewSchemaGVR(g, v, r string) schema.GroupVersionResource {
return schema.GroupVersionResource{
Group: g,
Version: v,
Resource: r,
}
}

Copy link
Contributor Author

@susesgartner susesgartner May 3, 2024

Choose a reason for hiding this comment

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

I am not entirely sure if this is a good idea. For similar reasons as the comment below. This would no longer really be a constant, it would be a "create" function and all of the values would have to be stored in place in the code. This would mean that if we decided to update one of these in future we would have to do so in every place NewSchemaGVR is referenced. If we are going to have to do that anyway that begs the question, what do we gain from storing this in centralized place at all? I suppose another valid question would be if we went with this approach should we just store this under schema dir instead of defaults

Copy link
Member

Choose a reason for hiding this comment

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

These would be constructor functions. They all seem like functions that return fixed values. So one way or another they are functions right now, right? So what I am trying to say is, is it expected to add a new function for every new GVR instead of having a constructor function?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this makes sense Sam, essentially have a constructor that the default funcs call. That's what you're saying right Ugur?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, they are returning fixed values, they are the equivalent of a "const" @caliskanugur. The 2 concerns I have for axing them and putting a nice generic constructor are:

  1. They would no longer be equivalent in function to a "const". This is the case since it would be the equivalent of declaring each GVR in place wherever it is called. i.e NewSchemaGVR("x", "y", "z") is dynamic, not const and therefore there is no way to update/reuse a given GVR across the framework.
  2. If we go with the above approach then I would vote on moving the constructor into the Schema directory since it would no longer be a "const".

@@ -0,0 +1,38 @@
etcdControlPlaneWorker:
Copy link
Member

@caliskanugur caliskanugur May 3, 2024

Choose a reason for hiding this comment

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

Where are these YAML files used? Are these going to be used on r/r side?

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 ymls aren't going to be used on the rancher side but the functions that pull the data from the ymls will be used.

Copy link
Member

Choose a reason for hiding this comment

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

Could you elaborate on this one for me, I don't think I understand this move yet, is there a code reference to these files that I am potentially missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you look in pools.go the 2 files are referenced by their respective functions. The main design goal here is to provide a way to store parts of our configs that are widely used and not sensitive without using global vars.

Copy link
Member

@caliskanugur caliskanugur May 3, 2024

Choose a reason for hiding this comment

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

Oh, I missed it, thanks for the reference. Could you give more details about the design selection, what's the net positive implementation of having a YAML file, reading that file, and making it a Golang object, instead of using it as a Golang object?

Copy link
Contributor

Choose a reason for hiding this comment

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

I do think the LoadDefault function should not be here then, and more in the pkg. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

The consistency thing I was referring to, is why is this in a yaml where as the GroupVersions in functions. That is what I am talking about. I want to reiterate, my overall concern is that some thing is added to the yaml and we're not testing what we say we're testing. Does that make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm fine with moving the loadDefault function into pkg.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going to reiterate: If I could put the GroupVersions in a yaml I would however, I cannot because they are upstream k8s objects that do not have struct tags and as such I cannot simply unmarshal or change them.

Copy link
Contributor Author

@susesgartner susesgartner May 7, 2024

Choose a reason for hiding this comment

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

I am not sure I understand your final comment. Can you give me an example of "some thing is added to the yaml and we're not testing what we say we're testing"

Update to remove several global constants and generally rework how we store/utilize certain constants that appear across many files in both rancher/rancher and rancher/shepherd.

Removed duplicate const file apiobjects

comment update

Updated deflabels to default labels as per Calebs comment

PR update to address comments

Updated the stevetypes.Setting const to ManagementSetting for clarity

Update node_status.go

Update constants PR with more constants

change defaults back

Removed more global vars

Removed a global vars for Rbac and provisioning and added them to defaults directory. Also replacing them in the rancher PR

Removed the machine pools/node roles globals  now that they have been replaced

Update to add a few more constants

Moved the pools to provisioning input

Update rancheralerting.go

update the states

A few small fixes for errors

fixed namespaces

Update .golangci.yaml

Update .golangci.yaml

Update machinepools.go

Update for comments

fix
@@ -0,0 +1,11 @@
package defaults
Copy link
Contributor

Choose a reason for hiding this comment

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

This is going away correct?

Comment on lines 8 to 222
func Node() schema.GroupVersionResource {
node := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "nodes",
}

return node
}

func Pod() schema.GroupVersionResource {
pod := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "pods",
}

return pod
}

func ConfigMap() schema.GroupVersionResource {
configMap := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "configmaps",
}

return configMap
}

func CustomResourceDefinition() schema.GroupVersionResource {
customResourceDefinition := schema.GroupVersionResource{
Group: "apiextensions.k8s.io",
Version: "v1",
Resource: "customresourcedefinitions",
}

return customResourceDefinition
}

func Ingress() schema.GroupVersionResource {
ingress := schema.GroupVersionResource{
Group: "networking.k8s.io",
Version: "v1",
Resource: "ingresses",
}

return ingress
}

func Project() schema.GroupVersionResource {
project := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "projects",
}

return project
}

func Role() schema.GroupVersionResource {
role := schema.GroupVersionResource{
Group: rbacv1.SchemeGroupVersion.Group,
Version: rbacv1.SchemeGroupVersion.Version,
Resource: "roles",
}

return role
}

func ClusterRole() schema.GroupVersionResource {
clusterRole := schema.GroupVersionResource{
Group: rbacv1.SchemeGroupVersion.Group,
Version: rbacv1.SchemeGroupVersion.Version,
Resource: "clusterroles",
}

return clusterRole
}

func RoleBinding() schema.GroupVersionResource {
roleBinding := schema.GroupVersionResource{
Group: rbacv1.SchemeGroupVersion.Group,
Version: rbacv1.SchemeGroupVersion.Version,
Resource: "rolebindings",
}

return roleBinding
}

func ClusterRoleBinding() schema.GroupVersionResource {
clusterRoleBinding := schema.GroupVersionResource{
Group: rbacv1.SchemeGroupVersion.Group,
Version: rbacv1.SchemeGroupVersion.Version,
Resource: "clusterrolebindings",
}

return clusterRoleBinding
}

func GlobalRole() schema.GroupVersionResource {
globalRole := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "globalroles",
}

return globalRole
}

func GlobalRoleBinding() schema.GroupVersionResource {
globalRoleBinding := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "globalrolebindings",
}

return globalRoleBinding
}

func ClusterRoleTemplateBinding() schema.GroupVersionResource {
clusterRoleTemplateBinding := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "clusterroletemplatebindings",
}

return clusterRoleTemplateBinding
}

func RoleTemplate() schema.GroupVersionResource {
roleTemplate := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "roletemplates",
}

return roleTemplate
}

func ProjectRoleTemplateBinding() schema.GroupVersionResource {
projectRoleTemplateBinding := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "projectroletemplatebindings",
}

return projectRoleTemplateBinding
}

func ResourceQuota() schema.GroupVersionResource {
resourceQuota := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "resourcequotas",
}

return resourceQuota
}

func Secret() schema.GroupVersionResource {
secret := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "secrets",
}

return secret
}

func Service() schema.GroupVersionResource {
service := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "services",
}

return service
}

func StorageClass() schema.GroupVersionResource {
storageClass := schema.GroupVersionResource{
Group: "storage.k8s.io",
Version: "v1",
Resource: "storageclasses",
}

return storageClass
}

func Token() schema.GroupVersionResource {
token := schema.GroupVersionResource{
Group: "management.cattle.io",
Version: "v3",
Resource: "tokens",
}

return token
}

func PersistentVolumeClaim() schema.GroupVersionResource {
persistentVolumeClaim := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "persistentvolumeclaims",
}

return persistentVolumeClaim
}

func PersistentVolume() schema.GroupVersionResource {
persistentVolume := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "persistentvolumes",
}

return persistentVolume
}

func Namespace() schema.GroupVersionResource {
namespace := schema.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "namespaces",
}

return namespace
}

func Daemonset() schema.GroupVersionResource {
daemonset := schema.GroupVersionResource{
Group: "apps",
Version: "v1",
Resource: "daemonsets",
}

return daemonset
}

func Deployment() schema.GroupVersionResource {
deployment := schema.GroupVersionResource{
Group: "apps",
Version: "v1",
Resource: "deployments",
}

return deployment
}

func Job() schema.GroupVersionResource {
job := schema.GroupVersionResource{
Group: "batch",
Version: "v1",
Resource: "jobs",
}

return job
}

func CronJob() schema.GroupVersionResource {
cronJob := schema.GroupVersionResource{
Group: "batch",
Version: "v1beta1",
Resource: "cronjobs",
}

return cronJob
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this makes sense Sam, essentially have a constructor that the default funcs call. That's what you're saying right Ugur?

module github.com/rancher/shepherd

go 1.22
go 1.22.0
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this change necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is only necessary on macs due to a golang issue. I will remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation-enhancement To indicate this is related to enhancements in code related to automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants