Skip to content
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

[BUG] invalid format options #773

Closed
jianghushinian opened this issue Oct 26, 2023 · 3 comments
Closed

[BUG] invalid format options #773

jianghushinian opened this issue Oct 26, 2023 · 3 comments
Labels
kind/bug Something isn't working

Comments

@jianghushinian
Copy link

What happened:

When I use temporary access credentials for Huawei obs, I get the following error:

invalid format options: xxx

What you expected to happen:

no errors.

How to reproduce it (as minimally and precisely as possible):

Secret YAML example:

apiVersion: v1
kind: Secret
metadata:
  name: juicefs-secret
  namespace: kube-system
type: Opaque
stringData:
  name: juicefs-test
  metaurl: redisurl
  storage: obs
  bucket: obs-bucket
  access-key: ak
  secret-key: sk
  format-options: session-token=xxxxxxx=

Because the session-token of Huawei obs ends with =, so JfsSetting.ParseFormatOptions method verification will make an error, code show as below, len(pair) will be 3:

func (s *JfsSetting) ParseFormatOptions() ([][]string, error) {
options := strings.Split(s.FormatOptions, ",")
parsedFormatOptions := make([][]string, 0, len(options))
for _, option := range options {
pair := strings.Split(strings.TrimSpace(option), "=")
if len(pair) != 1 && len(pair) != 2 {
return nil, fmt.Errorf("invalid format options: %s", s.FormatOptions)
}
key := strings.TrimSpace(pair[0])
if key == "" {
// ignore empty key
continue
}
value := ""
if len(pair) == 2 {
value = strings.TrimSpace(pair[1])
}
parsedFormatOptions = append(parsedFormatOptions, []string{key, value})
}
return parsedFormatOptions, nil
}

Anything else we need to know?

Environment:

  • JuiceFS CSI Driver version (which image tag did your CSI Driver use):
  • Kubernetes version (e.g. kubectl version):
  • Object storage (cloud provider and region):
  • Metadata engine info (version, cloud provider managed or self maintained):
  • Network connectivity (JuiceFS to metadata engine, JuiceFS to object storage):
  • Others:
@jianghushinian jianghushinian added the kind/bug Something isn't working label Oct 26, 2023
@jianghushinian jianghushinian changed the title [BUG] [BUG] invalid format options Oct 26, 2023
@showjason
Copy link
Contributor

/assign

@showjason
Copy link
Contributor

Hi @jianghushinian, maybe you can try the following secret yaml(but I'm not sure whether it will be working, that's my guess):)

apiVersion: v1
kind: Secret
metadata:
  name: juicefs-secret
  namespace: kube-system
type: Opaque
stringData:
  name: juicefs-test
  metaurl: redisurl
  storage: obs
  bucket: obs-bucket
  access-key: ak
  secret-key: sk
  session-token: xxxxxxx=

@Hexilee
Copy link
Contributor

Hexilee commented Nov 6, 2023

closed by #786

@Hexilee Hexilee closed this as completed Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants