argoproj / argo-workflows

Workflow Engine for Kubernetes
https://argo-workflows.readthedocs.io/
Apache License 2.0
14.95k stars 3.19k forks source link

Support client.authentication.k8s.io/v1 #7596

Open aschleck opened 2 years ago

aschleck commented 2 years ago

Summary

Mirroring https://github.com/argoproj/argo-rollouts/issues/1741, argo cli 3.2.6 doesn't support kubeconfig auth token plugins using version client.authentication.k8s.io/v1

What happened/what you expected to happen?

FATA[2022-01-20T00:57:14.543Z] failure to create dynamic client: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1"

when my plugin outputs

{"kind":"ExecCredential","apiVersion":"client.authentication.k8s.io/v1","spec":{},"status":{"expirationTimestamp":"2022-01-20T09:57:28Z","token":"blahblahblah"}}

I expected this to work fine.

What version of Argo Workflows are you running? 3.2.6

Diagnostics

Have a kubeconfig that uses a v1 auth plugin, then run any argo workflow command that uses a kubeconfig: argo list --completed --since 7d


Thank you for your work on this project!

Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.

terrytangyuan commented 2 years ago

Would you like to submit a PR for this?

alexec commented 2 years ago

What version of Kubernetes are you using? If you are using an older version, you may also need to use an older version of workflows.

aschleck commented 2 years ago

Happy to submit a PR but wasn't quite sure how to generate the changes. Is it mostly running go get -u ./... and praying? In the argo-rollouts PR there were a bunch of other changes so it made me nervous.

Re client version, I think my kubectl should be okay:

lient Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.1", GitCommit:"86ec240af8cbd1b60bcc4c03c20da9b98005b92e", GitTreeState:"clean", BuildDate:"2021-12-16T11:33:37Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"darwin/arm64"}
Server Version: version.Info{Major:"1", Minor:"21+", GitVersion:"v1.21.2-eks-06eac09", GitCommit:"5f6d83fe4cb7febb5f4f4e39b3b2b64ebbbe3e97", GitTreeState:"clean", BuildDate:"2021-09-13T14:20:15Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"linux/amd64"}
WARNING: version difference between client (1.23) and server (1.21) exceeds the supported minor version skew of +/-1
aschleck commented 2 years ago
$ go get -u ./...
...
# github.com/argoproj/argo-events/pkg/apis/common
../../go/pkg/mod/github.com/argoproj/argo-events@v1.15.0/pkg/apis/common/openapi_generated.go:53:3: cannot use "github.com/go-openapi/spec".Schema{...} (type "github.com/go-openapi/spec".Schema) as ty
pe "k8s.io/kube-openapi/pkg/validation/spec".Schema in field value
../../go/pkg/mod/github.com/argoproj/argo-events@v1.15.0/pkg/apis/common/openapi_generated.go:65:3: cannot use "github.com/go-openapi/spec".Schema{...} (type "github.com/go-openapi/spec".Schema) as ty
pe "k8s.io/kube-openapi/pkg/validation/spec".Schema in field value
../../go/pkg/mod/github.com/argoproj/argo-events@v1.15.0/pkg/apis/common/openapi_generated.go:73:8: cannot use ref("github.com/argoproj/argo-events/pkg/apis/common.Int64OrString") (type "k8s.io/kube-o
penapi/pkg/validation/spec".Ref) as type "github.com/go-openapi/spec".Ref in field value
../../go/pkg/mod/github.com/argoproj/argo-events@v1.15.0/pkg/apis/common/openapi_generated.go:79:8: cannot use ref("github.com/argoproj/argo-events/pkg/apis/common.Amount") (type "k8s.io/kube-openapi/
pkg/validation/spec".Ref) as type "github.com/go-openapi/spec".Ref in field value
../../go/pkg/mod/github.com/argoproj/argo-events@v1.15.0/pkg/apis/common/openapi_generated.go:85:8: cannot use ref("github.com/argoproj/argo-events/pkg/apis/common.Amount") (type "k8s.io/kube-openapi/
pkg/validation/spec".Ref) as type "github.com/go-openapi/spec".Ref in field value
../../go/pkg/mod/github.com/argoproj/argo-events@v1.15.0/pkg/apis/common/openapi_generated.go:105:3: cannot use "github.com/go-openapi/spec".Schema{...} (type "github.com/go-openapi/spec".Schema) as t
ype "k8s.io/kube-openapi/pkg/validation/spec".Schema in field value
../../go/pkg/mod/github.com/argoproj/argo-events@v1.15.0/pkg/apis/common/openapi_generated.go:113:8: cannot use ref("k8s.io/api/core/v1.SecretKeySelector") (type "k8s.io/kube-openapi/pkg/validation/sp
ec".Ref) as type "github.com/go-openapi/spec".Ref in field value
../../go/pkg/mod/github.com/argoproj/argo-events@v1.15.0/pkg/apis/common/openapi_generated.go:119:8: cannot use ref("k8s.io/api/core/v1.SecretKeySelector") (type "k8s.io/kube-openapi/pkg/validation/sp
ec".Ref) as type "github.com/go-openapi/spec".Ref in field value
../../go/pkg/mod/github.com/argoproj/argo-events@v1.15.0/pkg/apis/common/openapi_generated.go:132:3: cannot use "github.com/go-openapi/spec".Schema{...} (type "github.com/go-openapi/spec".Schema) as t
ype "k8s.io/kube-openapi/pkg/validation/spec".Schema in field value
../../go/pkg/mod/github.com/argoproj/argo-events@v1.15.0/pkg/apis/common/openapi_generated.go:157:8: cannot use ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time") (type "k8s.io/kube-openapi/pkg/validati
on/spec".Ref) as type "github.com/go-openapi/spec".Ref in field value
../../go/pkg/mod/github.com/argoproj/argo-events@v1.15.0/pkg/apis/common/openapi_generated.go:132:3: too many errors
# github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1
pkg/apis/workflow/v1alpha1/openapi_generated.go:142:3: cannot use "github.com/go-openapi/spec".Schema{...} (type "github.com/go-openapi/spec".Schema) as type "k8s.io/kube-openapi/pkg/validation/spec".
Schema in field value
pkg/apis/workflow/v1alpha1/openapi_generated.go:154:3: cannot use "github.com/go-openapi/spec".Schema{...} (type "github.com/go-openapi/spec".Schema) as type "k8s.io/kube-openapi/pkg/validation/spec".
Schema in field value
pkg/apis/workflow/v1alpha1/openapi_generated.go:161:8: cannot use ref("github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1.Tar...) (type "k8s.io/kube-openapi/pkg/validation/spec".Ref) as
type "github.com/go-openapi/spec".Ref in field value
pkg/apis/workflow/v1alpha1/openapi_generated.go:166:8: cannot use ref("github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1.Non...) (type "k8s.io/kube-openapi/pkg/validation/spec".Ref) as
type "github.com/go-openapi/spec".Ref in field value
pkg/apis/workflow/v1alpha1/openapi_generated.go:171:8: cannot use ref("github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1.Zip...) (type "k8s.io/kube-openapi/pkg/validation/spec".Ref) as
type "github.com/go-openapi/spec".Ref in field value
pkg/apis/workflow/v1alpha1/openapi_generated.go:184:3: cannot use "github.com/go-openapi/spec".Schema{...} (type "github.com/go-openapi/spec".Schema) as type "k8s.io/kube-openapi/pkg/validation/spec".
Schema in field value
pkg/apis/workflow/v1alpha1/openapi_generated.go:203:11: cannot use ref("github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1.Par...) (type "k8s.io/kube-openapi/pkg/validation/spec".Ref) as
 type "github.com/go-openapi/spec".Ref in field value
pkg/apis/workflow/v1alpha1/openapi_generated.go:223:11: cannot use ref("github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1.Art...) (type "k8s.io/kube-openapi/pkg/validation/spec".Ref) as
 type "github.com/go-openapi/spec".Ref in field value
pkg/apis/workflow/v1alpha1/openapi_generated.go:283:8: cannot use ref("github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1.S3A...) (type "k8s.io/kube-openapi/pkg/validation/spec".Ref) as
type "github.com/go-openapi/spec".Ref in field value
pkg/apis/workflow/v1alpha1/openapi_generated.go:289:8: cannot use ref("github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1.Git...) (type "k8s.io/kube-openapi/pkg/validation/spec".Ref) as
type "github.com/go-openapi/spec".Ref in field value
pkg/apis/workflow/v1alpha1/openapi_generated.go:289:8: too many errors
# github.com/argoproj-labs/argo-dataflow/api/v1alpha1
../../go/pkg/mod/github.com/argoproj-labs/argo-dataflow@v0.8.0/api/v1alpha1/step_types.go:179:6: unknown field 'Handler' in struct literal of type "k8s.io/api/core/v1".Probe
../../go/pkg/mod/github.com/argoproj-labs/argo-dataflow@v0.8.0/api/v1alpha1/step_types.go:184:16: undefined: "k8s.io/api/core/v1".Handler
../../go/pkg/mod/github.com/argoproj-labs/argo-dataflow@v0.8.0/api/v1alpha1/step_types.go:198:16: undefined: "k8s.io/api/core/v1".Handler

Trying make codegen:

...
# These files are generated on a v3/ folder by the tool. Link them to the root folder
[ -e ./v3 ] || ln -s . v3
/Users/april/go/bin/openapi-gen \
          --go-header-file ./hack/custom-boilerplate.go.txt \
          --input-dirs github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1 \
          --output-package github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1 \
          --report-filename pkg/apis/api-rules/violation_exceptions.list
# Delete the link
[ -e ./v3 ] && rm -rf v3
# protoc pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto
[ -e ./vendor ] || go mod vendor
protoc -I /usr/local/include -I /Users/april/random/argo-workflows -I /Users/april/random/argo-workflows/vendor -I /Users/april/go/src -I /Users/april/go/pkg/mod/github.com/gogo/protobuf@v1.3.1/gogopr
oto -I /Users/april/go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway@v1.16.0/third_party/googleapis --gogofast_out=plugins=grpc:/Users/april/go/src --grpc-gateway_out=logtostderr=true:/Users/april/go
/src --swagger_out=logtostderr=true,fqn_for_swagger_name=true:. pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto
/usr/local/include: warning: directory does not exist.
github.com/argoproj/argo-workflows/pkg/apis/workflow/v1alpha1/generated.proto: File not found.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:6:1: Import "github.com/argoproj/argo-workflows/pkg/apis/workflow/v1alpha1/generated.proto" was not found or had errors.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:15:5: "github.com.argoproj.argo_workflows.v3.pkg.apis.workflow.v1alpha1.ClusterWorkflowTemplate" is not defined.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:31:5: "github.com.argoproj.argo_workflows.v3.pkg.apis.workflow.v1alpha1.ClusterWorkflowTemplate" is not defined.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:41:5: "github.com.argoproj.argo_workflows.v3.pkg.apis.workflow.v1alpha1.ClusterWorkflowTemplate" is not defined.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:46:87: "github.com.argoproj.argo_workflows.v3.pkg.apis.workflow.v1alpha1.ClusterWorkflowTemplate" is not defined.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:53:81: "github.com.argoproj.argo_workflows.v3.pkg.apis.workflow.v1alpha1.ClusterWorkflowTemplate" is not defined.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:57:84: "github.com.argoproj.argo_workflows.v3.pkg.apis.workflow.v1alpha1.ClusterWorkflowTemplateList" is not defined.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:61:87: "github.com.argoproj.argo_workflows.v3.pkg.apis.workflow.v1alpha1.ClusterWorkflowTemplate" is not defined.
pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.proto:72:83: "github.com.argoproj.argo_workflows.v3.pkg.apis.workflow.v1alpha1.ClusterWorkflowTemplate" is not defined.
make: *** [pkg/apiclient/clusterworkflowtemplate/cluster-workflow-template.swagger.json] Error 1

Hm

blkperl commented 2 years ago

Hi @aschleck, I had the same issue. make codegen expects argo-workflows to be checked out in $(GOPATH)/src/github.com/argoproj/argo-workflows per this troubleshooting doc: https://github.com/argoproj/argo-workflows/blob/master/docs/running-locally.md

blkperl commented 2 years ago

We will need argo-events to update to k8s 1.22 before we can upgrade argo-workflows to 1.22. I filed https://github.com/argoproj/argo-events/issues/1607 to get that started.

tooptoop4 commented 1 week ago

is this solved @blkperl ?

blkperl commented 1 week ago

@tooptoop4 I'm not sure, if the new version of Kubernetes was all that was required then yes.