File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -1521,12 +1521,17 @@ func LoadAirgapFromBytes(data []byte) (*kotsv1beta1.Airgap, error) {
15211521
15221522func GetKOTSBinPath () string {
15231523 if util .PodNamespace != "" {
1524- // we're inside the kotsadm pod, the kots binary exists at /kots
1525- return "/kots"
1526- } else {
1527- // we're not inside the kotsadm pod, return the command used to run kots
1528- return os .Args [0 ]
1524+ // check that we are inside a kubernetes pod
1525+ //nolint:gosec // G101: This is a standard Kubernetes service account token path, not a hardcoded credential
1526+ tokenFile := "/var/run/secrets/kubernetes.io/serviceaccount/token"
1527+ if _ , err := os .Stat (tokenFile ); err == nil {
1528+ // we're inside the kotsadm pod, the kots binary exists at /kots
1529+ return "/kots"
1530+ }
15291531 }
1532+
1533+ // we're not inside the kotsadm pod, return the command used to run kots
1534+ return os .Args [0 ]
15301535}
15311536
15321537func LoadBrandingArchiveFromPath (archivePath string ) (* bytes.Buffer , error ) {
You can’t perform that action at this time.
0 commit comments