Skip to content

Use in-cluster config when kubeconfig file is not found #2996

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

Merged
merged 4 commits into from
Aug 24, 2024

Conversation

soharab-ic
Copy link
Contributor

@soharab-ic soharab-ic commented Aug 22, 2024

Description

  • The PR adds support to fission-cli to use in-cluster config if kubeconfig file is not found.
  • Now fission-cli can be used to do CRUD operations on fission's resources from inside a pod using service account.

Which issue(s) this PR fixes:

Fixes #2994

Testing

  • Created ClusterRole, ClusterRoleBinding and a service account.
  • Created a docker image of the fission-cli.
  • Created a deployment with fission-cli docker image.
  • Exec to fission-cli container and run fission commands.
/ # ./fission check -v 2
couldn't find kubeconfig file. Set the KUBECONFIG environment variable to your kubeconfig's path.
Using in-cluster config
In-cluster config default namespace "default"
fission-services
--------------------
√ executor is running fine
√ router is running fine
√ storagesvc is running fine
√ webhook is running fine

fission-version
--------------------
Setting up port forward to application=fission-router in namespace 
Waiting for local port 38849
Starting port forward from local port 38849
Connected to Kubernetes API
Connecting to port 8888 on pod fission/router-5d5555f64-t7srv
Starting port forwarder
Forwarding from 127.0.0.1:38849 -> 8888
Forwarding from [::1]:38849 -> 8888
Waiting for port forward 38849 to start...
Port forward from local port 38849 started
Handling connection for 38849
Handling connection for 38849
clientVersion: v0.0.0
serverVersion: v0.0.0
√ fission is up-to-date

Checklist:

  • I ran tests as well as code linting locally to verify my changes.
  • I have done manual verification of my changes, changes working as expected.
  • I have added new tests to cover my changes.
  • My changes follow contributing guidelines of Fission.
  • I have signed all of my commits.

Or when kubeconfig file is not found in user's home directory.

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
Copy link

codecov bot commented Aug 22, 2024

Codecov Report

Attention: Patch coverage is 3.12500% with 31 lines in your changes missing coverage. Please review.

Project coverage is 44.30%. Comparing base (26f9648) to head (d88a2a0).
Report is 1 commits behind head on main.

Files Patch % Lines
pkg/fission-cli/cmd/client.go 3.12% 30 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2996      +/-   ##
==========================================
- Coverage   44.35%   44.30%   -0.05%     
==========================================
  Files         236      236              
  Lines       24621    24641      +20     
==========================================
- Hits        10920    10918       -2     
- Misses      12293    12315      +22     
  Partials     1408     1408              
Flag Coverage Δ
unittests 44.30% <3.12%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
@sanketsudake sanketsudake merged commit bf19e2f into main Aug 24, 2024
10 checks passed
@sanketsudake sanketsudake deleted the fission-cli-incluster-config branch September 26, 2024 16:17
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.

Feature Request: Support for Fission CLI to Utilize ServiceAccount in Cluster
2 participants