diff --git a/api/event-source.html b/api/event-source.html index b85496ceb1..ef8dddeae1 100644 --- a/api/event-source.html +++ b/api/event-source.html @@ -5413,7 +5413,7 @@

SFTPEventSource -

SSHKeySecret refers to the secret that contains SSH key

+

SSHKeySecret refers to the secret that contains SSH key. Key needs to contain private key and public key.

diff --git a/api/event-source.md b/api/event-source.md index e2af9a372d..b915312a77 100644 --- a/api/event-source.md +++ b/api/event-source.md @@ -5526,7 +5526,8 @@ Kubernetes core/v1.SecretKeySelector

-SSHKeySecret refers to the secret that contains SSH key +SSHKeySecret refers to the secret that contains SSH key. Key needs to +contain private key and public key.

diff --git a/api/jsonschema/schema.json b/api/jsonschema/schema.json index da379ed97b..438ce4b86d 100644 --- a/api/jsonschema/schema.json +++ b/api/jsonschema/schema.json @@ -2711,7 +2711,7 @@ }, "sshKeySecret": { "$ref": "#/definitions/io.k8s.api.core.v1.SecretKeySelector", - "description": "SSHKeySecret refers to the secret that contains SSH key" + "description": "SSHKeySecret refers to the secret that contains SSH key. Key needs to contain private key and public key." }, "username": { "$ref": "#/definitions/io.k8s.api.core.v1.SecretKeySelector", diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index 0f76d2c554..f8bf086047 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -2698,7 +2698,7 @@ "type": "string" }, "sshKeySecret": { - "description": "SSHKeySecret refers to the secret that contains SSH key", + "description": "SSHKeySecret refers to the secret that contains SSH key. Key needs to contain private key and public key.", "$ref": "#/definitions/io.k8s.api.core.v1.SecretKeySelector" }, "username": { diff --git a/eventsources/sources/sftp/start.go b/eventsources/sources/sftp/start.go index 47feaa6fa7..d8becd3ebe 100644 --- a/eventsources/sources/sftp/start.go +++ b/eventsources/sources/sftp/start.go @@ -95,7 +95,7 @@ func (el *EventListener) StartListening(ctx context.Context, dispatch func([]byt if err != nil { return fmt.Errorf("failed to parse private ssh key. err: %+v", err) } - publicKey, err := ssh.ParsePublicKey(sshKey) + publicKey, _, _, _, err := ssh.ParseAuthorizedKey(sshKey) if err != nil { return fmt.Errorf("failed to parse public ssh key. err: %+v", err) } diff --git a/pkg/apis/eventsource/v1alpha1/generated.proto b/pkg/apis/eventsource/v1alpha1/generated.proto index f4b469b04b..1bc06dc721 100644 --- a/pkg/apis/eventsource/v1alpha1/generated.proto +++ b/pkg/apis/eventsource/v1alpha1/generated.proto @@ -1423,7 +1423,7 @@ message SFTPEventSource { // Password required for authentication if any. optional k8s.io.api.core.v1.SecretKeySelector password = 4; - // SSHKeySecret refers to the secret that contains SSH key + // SSHKeySecret refers to the secret that contains SSH key. Key needs to contain private key and public key. optional k8s.io.api.core.v1.SecretKeySelector sshKeySecret = 5; // Address sftp address. diff --git a/pkg/apis/eventsource/v1alpha1/openapi_generated.go b/pkg/apis/eventsource/v1alpha1/openapi_generated.go index 3d19b36fbd..2cfb60121b 100644 --- a/pkg/apis/eventsource/v1alpha1/openapi_generated.go +++ b/pkg/apis/eventsource/v1alpha1/openapi_generated.go @@ -3692,7 +3692,7 @@ func schema_pkg_apis_eventsource_v1alpha1_SFTPEventSource(ref common.ReferenceCa }, "sshKeySecret": { SchemaProps: spec.SchemaProps{ - Description: "SSHKeySecret refers to the secret that contains SSH key", + Description: "SSHKeySecret refers to the secret that contains SSH key. Key needs to contain private key and public key.", Ref: ref("k8s.io/api/core/v1.SecretKeySelector"), }, }, diff --git a/pkg/apis/eventsource/v1alpha1/types.go b/pkg/apis/eventsource/v1alpha1/types.go index 41da881ebd..c2db254f85 100644 --- a/pkg/apis/eventsource/v1alpha1/types.go +++ b/pkg/apis/eventsource/v1alpha1/types.go @@ -303,7 +303,7 @@ type SFTPEventSource struct { Username *corev1.SecretKeySelector `json:"username,omitempty" protobuf:"bytes,3,opt,name=username"` // Password required for authentication if any. Password *corev1.SecretKeySelector `json:"password,omitempty" protobuf:"bytes,4,opt,name=password"` - // SSHKeySecret refers to the secret that contains SSH key + // SSHKeySecret refers to the secret that contains SSH key. Key needs to contain private key and public key. SSHKeySecret *corev1.SecretKeySelector `json:"sshKeySecret,omitempty" protobuf:"bytes,5,opt,name=sshKeySecret"` // Address sftp address. Address *corev1.SecretKeySelector `json:"address,omitempty" protobuf:"bytes,6,opt,name=address"`