Compare commits

...
Author SHA1 Message Date
Payton Ward 77f82e18b5 Add --ldap-username and --ldap-password flags to mc idp ldap accesskey create-with-login (#5258)
Add ldap-username and ldap-password flags to "idp ldap accesskey create-with-login"
2025-11-06 08:25:29 -08:00
Klaus Post ed0b962588 Modernize + Go version bump + Pin linter (#5256)
* Upgrade go version in CI.
* Add toolchain to pin version.
* Add linter/fumpt as pinned version in tools.
* Run `go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./...`
2025-11-05 04:20:36 -08:00
dorman 7394ce0dd2 feat: beautify output for the ping command (#5237) 2025-08-13 01:35:41 -07:00
Daryl White b01f0c7371 Update links to new docs site (#5242) 2025-08-13 01:35:23 -07:00
dorman 5bb5df85e2 Fix the abnormal exit of the ping command (#5233)
The ping command abnormally exits after being executed more than 1000 times.
2025-07-23 13:36:38 -07:00
M Alvee ae1eab7d52 chore: clear error message with unauthorized credentials (#5236) 2025-07-23 13:36:17 -07:00
Yashwanth Krishnan ee72571936 update dependencies to fix dependent library CVEs: CVE-2025-22874, CVE-2025-4673 (#5235) 2025-07-20 22:28:08 -07:00
Shreyas Mali e5d2270535 fix: mirror active-active and race condition (#5234) 2025-07-19 07:45:24 -07:00
M Alvee 2676e50bc1 fix: redact sse key in debug logs (#5231) 2025-07-16 08:35:03 -07:00
dorman f72d75db5a mv:support set tag and checksum (#5133) 2025-07-13 11:52:53 -07:00
dorman c305d62fd5 ping: support ping a specified node and remove duplicate port printing (#5132) 2025-07-13 11:48:37 -07:00
Matthieu OLIVIER 4e38f39e25 feat: add --storage-class option to mc put subcommand (#5228)
feat: add --storage-class option to mc put
2025-07-13 11:46:49 -07:00
dorman 8576e735b1 mirror and cp support set the maximum number of threads (#5220) 2025-07-02 09:49:52 -07:00
Klaus Post 9a180cece7 Some paths like url2Stat will send resource with backslashes on windows (#5226)
This will cause key paths to mismatch and not be sent.

Example:

```
λ go build&&mc stat -enc-c="play/testbucket/=MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDA" play/testbucket/mc
Name      : mc
Date      : 2025-07-02 17:52:42 CEST
Size      : 43 MiB
ETag      : 398345f23dc2ad4dd277e437e6ca7a1d-3
Type      : file
Encryption: SSE-C
Metadata  :
  Content-Type: application/x-msdownload
```
2025-07-02 09:49:02 -07:00
Menno Finlay-Smits 039be57dd2 Include ARN in "replicate list" output (#5215)
The "replicate resync start" command requires the remote bucket ARN.
This is currently difficult to obtain and requires picking through the
output of "replicate list --json". Worse still, the JSON output doesn't
contain the human-readable host for the bucket, making it difficult to
know that you've got the correct one.

This change solves the issue by including the ARN in the default list
output.
2025-06-25 08:26:44 -07:00
Klaus Post 3c9df3f2ea Update build version (#5218)
Fixes #5217
2025-06-24 02:41:42 -07:00
Burkov Egor 00fb114bce fix: add checks for nil HTTP in admin-trace matches func (#5216) 2025-06-23 08:14:30 -07:00
Harshavardhana 68f1d43f05 remove fips 'mc' container Dockerfile 2025-05-24 22:02:12 -07:00
Krutika Dhananjay f71ad84bcf Fix deletion of previously sync'd buckets and objects during mc-mirror (#5205) 2025-05-20 18:59:54 -07:00
angry-garden-salad 99c1b4365a Add STATUS column to batch job list table output (#5202) 2025-05-19 14:17:46 -07:00
jiuker 18c1c94d85 fix: remove check if lock config exists before set (#5203) 2025-05-19 01:05:02 -07:00
Shreyas Mali b9f30231ca removing config cmd (#5201) 2025-05-19 00:46:25 -07:00
Shreyas Mali 19d87ba475 fix: support chained mirror properly for delete propagation #4558 (#5197) 2025-05-06 09:41:33 -07:00
Klaus Post bbfe579fef Change support profile defaults (#5198)
* Remove block and mutex as they are rather intensive and provide little information.
* Add 'runtime'. Small, not intensive and possibly useful. Ignored by non-AIStor.
* Do 15 seconds for better data.
2025-05-06 08:10:18 -07:00
angry-garden-salad 2c1e058767 Explicitly set file permissions for admin-cluster-{bucket,iam}-export… (#5194)
Explicitly set file permissions for admin-cluster-{bucket,iam}-export.go to 600 regardless of umask
2025-05-02 09:34:41 -07:00
Aditya Manthramurthy 0a686cf874 Add support for catalog batch job type (#5150)
- During batch yaml generation, we check if the server supports the kind
of batch job requested.
- Shows catalog job status
2025-05-02 09:33:45 -07:00
Taran Pelkey 719f121225 Add idp openid accesskey commands (#5182) 2025-05-02 09:33:10 -07:00
jiuker b00526b153 feat: add deletemarker info for batch status (#5191) 2025-04-16 11:13:26 -07:00
Olli Janatuinen 391616f9cf mirror: skip status message from excluded buckets (#5190) 2025-04-10 08:51:27 -07:00
Burkov Egor ddda0fce2c typo: fix typo in tracing error for path (#5189) 2025-04-10 08:51:05 -07:00
Burkov Egor 0b4d69bc57 fix: update better error handling (#5188) 2025-04-10 08:50:18 -07:00
Mark Theunissen e929f89cee ConsoleMsg is not set by open source or AIStor, we should remove this an… (#5186)
ConsoleMsg is not set by open source or eos, we should remove this and correctly show Message only
2025-04-08 08:39:49 -07:00
dorman 56f94fd375 fix the terminal is damaged when parameters are missing (#5175) 2025-04-03 10:07:56 -07:00
jiuker 2d305ce990 fix: error out when the source and destination might be subdirectories of each other (#5173) 2025-04-01 22:51:22 -07:00
Harshavardhana 3296636c25 fix: replace tag and point to relevant release 2025-03-31 15:31:04 -07:00
Taran Pelkey 5349af0082 Add admin accesskey sts-revoke and idp ldap accesskey sts-revoke (#5160) 2025-03-31 13:55:31 -07:00
dorman ceb07bee89 fix return EOF failure on lines with trailing empty lines (#5176) 2025-03-28 02:05:40 -07:00
jiuker 5ce725ba7d fix: no data transition will show error for when mc ilm info not found (#5177) 2025-03-28 01:26:11 -07:00
Harshavardhana c652022dab upgrade golang-lint to v2 (#5178) 2025-03-28 01:05:40 -07:00
Harshavardhana d249b65941 pre-emptively disable sha256 payload if checksum is set (#5167) 2025-03-27 12:54:23 -07:00
dependabot[bot] b2d265dcc6 build(deps): bump github.com/golang-jwt/jwt/v4 from 4.5.1 to 4.5.2 (#5169)
Bumps [github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt) from 4.5.1 to 4.5.2.
- [Release notes](https://github.com/golang-jwt/jwt/releases)
- [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md)
- [Commits](https://github.com/golang-jwt/jwt/compare/v4.5.1...v4.5.2)

---
updated-dependencies:
- dependency-name: github.com/golang-jwt/jwt/v4
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-24 08:40:50 -07:00
Aditya Manthramurthy 0f061900ee batch: use server's generate API when available (#5166)
Uses the new GenerateBatchJobV2 API to request server to list supported
batch jobs and to request job templates in `mc batch generate`
2025-03-14 10:29:01 -07:00
Klaus Post cf909e1063 Add ping sort to mc support top rpc (#5158)
Use key 'p' to sort by ping.
2025-03-13 01:02:18 -07:00
Aditya Manthramurthy c1d5d4cbb4 Update all deps (#5165) 2025-03-12 10:29:24 -07:00
Shireesh Anjal b3a00e0f8c Update madmin-go to latest version (#5161)
and clear reference to the removed variable madmin.HealthDataTypeSysLoad
2025-03-11 10:47:28 -07:00
Aditya Manthramurthy 06520070bb Update ssh and jws libs for fixed CVEs (#5164)
-   https://pkg.go.dev/vuln/GO-2025-3488
-   https://pkg.go.dev/vuln/GO-2025-3487
2025-03-11 09:36:39 -07:00
Harshavardhana ce874fdc6a rename rcp -> rpc 2025-03-07 15:46:22 -08:00
Shireesh Anjal 1e412f58a5 Remove logs feature from 'mc support callhome' (#5157)
Both the flags --logs and --diag are removed, and the command supports
only diagnostics callhome.
2025-03-06 08:30:58 -08:00
jinapurapu b0f40b4db7 Reject add ILM rule with both day and date parameters (#5155) 2025-03-06 05:05:05 -08:00
jinapurapu 10035268c4 Fix transition days calculation (#5154) 2025-03-05 13:23:17 -08:00
Klaus Post 9eb205cb62 Mirror should delete on delete marker creation + ILM (#5148)
Fixes #5147
2025-02-21 08:00:46 -08:00
jiuker 0ba848a99e fix: use tags package instead of s3utils (#5146) 2025-02-20 00:54:15 -08:00
Grahit 28909abaa4 fix empty ilm tier list output (#5145) 2025-02-19 20:27:26 -08:00
Harshavardhana 383560b1c3 update all dependencies (#5143) 2025-02-15 02:36:16 -08:00
Anis Eleuch 8585339d12 More fixes to custom arch hotfix building (#5135)
Set TARGET_GOOS and TARGET_GOARCH to specify the target architecture of
the built binary.
2025-02-14 08:49:56 -08:00
jiuker 468ab39f41 test: add tags copy test for mirror (#5141) 2025-02-14 08:49:41 -08:00
Klaus Post 217d92358b Add CRC64NVME checksum type. (#5142)
Also adds `CRC32-FO` and `CRC32C-FO` for complete object checksums.

```
λ mc cp -checksum=crc64nvme mc.exe myminio/testbucket
...com\minio\mc\mc.exe: 41.95 MiB / 41.95 MiB

λ mc stat myminio/testbucket/mc.exe
Name      : mc.exe
Date      : 2025-02-14 13:59:05 CET
Size      : 42 MiB
ETag      : 7f130846cec6e6ece750565b1f3d9518-3
VersionID : f4daeb78-9eaf-4da9-b9ca-d8b65fbc69e3
Type      : file
Checksum  : CRC64NVME:TOfg0RHhpZk=
Metadata  :
  Content-Type: application/x-msdownload

λ mc cp -checksum=crc32-fo mc.exe myminio/testbucket
...com\minio\mc\mc.exe: 41.95 MiB / 41.95 MiB

λ mc stat myminio/testbucket/mc.exe
Name      : mc.exe
Date      : 2025-02-14 13:58:52 CET
Size      : 42 MiB
ETag      : 7f130846cec6e6ece750565b1f3d9518-3
VersionID : 1ec587dd-9127-42ee-ad82-58b48f9676d5
Type      : file
Checksum  : CRC32:3Dt3fQ==
Metadata  :
  Content-Type: application/x-msdownload

λ _
```
2025-02-14 08:13:46 -08:00
Mark Theunissen c32317ef80 Improve docs to hint to the user that MD5 is not stored (#5138)
Improve docs to hint to the user that MD5 is the odd one out in this list
2025-02-13 10:19:41 -08:00
jiuker 089f833ce0 feat: support --custom-header flags (#5127) 2025-02-13 10:18:53 -08:00
Burkov Egor 42b78ded3a fix: explicit fd close fix (#5129) 2025-02-13 02:41:18 -08:00
jiuker 147e8f5b3b feat: add tags copy for mirror (#5137) 2025-02-13 02:39:59 -08:00
Klaus Post e97f4324d5 Fix vet check (#5134)
... and pin toolchain.
2025-02-12 08:36:32 -08:00
Harshavardhana 859c5989a1 make custom ARCH based hotfixes 2025-02-11 15:37:45 -08:00
Harshavardhana 10c50368c5 remove fips build 2025-02-08 13:06:32 -08:00
dorman bd925c01a1 mirror: add the duration time and beautify the output (#5125)
add the duration time and beautify the output
2025-02-08 11:14:21 -08:00
Burkov Egor 030c8125eb fix: urls equals nil deref (#5126)
Now in checks we can get nil dereference while both struct has Content
field of nil. But in code we cheching for nil, and I believe that
testcase can be real:
```go
urls1 := URLs{};
urls2 := URLs{};
urls1.Equal(urls2);
```
2025-02-07 02:46:26 -08:00
Harshavardhana 6376279f15 add support for pre-2023 minio deployments (#5122) 2025-02-04 14:18:02 -08:00
Taran Pelkey 5aee0b1c9e Change enable to "enable=" (#5104) 2025-02-04 12:34:19 -08:00
Sveinn ( keyb1nd ) 8d713ff927 Giving mirror the option to exit early when --remove is not set (#5116)
* Giving mirror the option to exit early when --remove is not set
* Making sure always to cancel the context on exit
* Adding an internal flag to enable local listing only based on active/active and remove flags
* Renaming localListingOnly to sourceListingOnly
2025-02-04 12:32:54 -08:00
Klaus Post 318e707071 Add "mc support upload" encryption (#5113)
* Add `--enc` parameter to `mc support upload` to encrypt the file content.
* Add file size as zstd frame content size.
* Test opening the file before doing more.
* Uses same key as "mc support inspect".
2025-02-03 20:57:50 -08:00
Harshavardhana 423ef1ba2a update go deps 2025-01-22 23:47:51 -08:00
Shubhendu a4f20fe74c Use latest madmin-go for policy content check (#5109)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2025-01-22 23:41:01 -08:00
Mark Theunissen 5cfac09600 Improve the error message when trying to add multiple expiry options (#5117) 2025-01-22 22:51:38 -08:00
Klaus Post b436cd2436 mc find - allow absolute times (#5118)
For `--newer-than` and `--older-than`, allow using absolute times.

Example:

```
λ mc ls play/testbucket
[2025-01-22 09:57:12 CET] 676KiB STANDARD Daily checks Procedure for Portainer.docx
[2025-01-22 16:40:07 CET]  22KiB STANDARD dovrennost_mobilizaciya_0-2.docx

λ mc find -newer-than="2025-01-22 09:57:00 CET" play/testbucket
play/testbucket/Daily checks Procedure for Portainer.docx
play/testbucket/dovrennost_mobilizaciya_0-2.docx

λ mc find -newer-than="2025-01-22 09:57:13 CET" play/testbucket
play/testbucket/dovrennost_mobilizaciya_0-2.docx
```

We allow the same timestamp types as `--rewind` and add the printed type for easy copy+paste.
2025-01-22 22:51:15 -08:00
dorman 0019b7b83c fix: cp and mirror commands fail to be executed when the file length is 255 characters (#5114) 2025-01-21 02:19:00 -08:00
Harshavardhana cc8758c88d chore: update deps 2025-01-17 15:25:50 -08:00
qinyuren 95e1f70eb5 The version-id in the get command does not work (#5110) 2025-01-16 01:52:17 -08:00
Harshavardhana b1a3941f22 chore: update deps (#5102) 2025-01-02 05:11:34 -08:00
Klaus Post 147852cb37 Add go runtime profile type (#5098)
Available on AIStor.

Requires https://github.com/minio/madmin-go/pull/322

Lower minimum duration to 1 second. Useful (pretty much required) for traces.
2025-01-02 04:55:34 -08:00
Poorna bf7b5f620e fix ilm rule edit for --expire-all-object-versions (#5101)
Editing a rule with --expire-all-object-versions should be applied
to existing rule properly
2025-01-02 04:10:56 -08:00
Harshavardhana f4dd5e4a07 update all deps and update CREDITS (#5097) 2024-12-16 04:20:40 +05:30
Klaus Post 19017536cc Add support top rpc ui nicities (#5087)
* Split to/from. t/f keys to go directly. <tab> to switch.
* Sort by queue size (q)
* Filter/Sort by reconnects (r)
* Add PgUp+PgDn
* Pause with <space>
2024-12-15 01:26:01 -08:00
Klaus Post 86907df91d Improve trace stats (#5095)
Allows traces to be replayed in stats mode from `mc admin trace -json ALIAS >trace.json`, using `mc admin trace -in=trace.json`. `.zst` are automatically decompressed.

This is replayed at full speed, since I don't really see any value in keeping original speed.

Add scrolling to stats. Up+Down+Home+End

Add 'r' to reset min/max stats.
2024-12-15 01:25:34 -08:00
Anis Eleuch 1681e4497c heal: Do not print a cryptic msg when scanning a dangling object (#5084)
Healing in server side will list with quorum 1, so it will pick stale
objects as well. This is currently not rendered well in mc that shows
this cryptic message:
	Invalid parity shard count/surplus shard count given

Print the text sent by the server instead.
2024-11-21 09:21:54 -08:00
Allan Roger Reid 35cb4b8177 Return delete markers in mc find (#5083)
* Default to list delete flags if they are part of the result set, so that they are not hidden from the find function

* Add --with-delete-marker flag to toggle the listing of delete markers. Defaults to false

* List delete markers as well when using the --versions flag
2024-11-20 10:10:21 -08:00
Harshavardhana bb4ff4951a when --no-list is specified avoid every List() call (#5082) 2024-11-17 11:35:25 -08:00
Anis Eleuch 308a8ea9d0 heal: Simplify bucket healing status (#5079)
Avoid using the drive count concept to pick a color for a bucket healing
result. This was straightforward when we were healing a bucket per erasure 
set, but now it becomes more complex to show a result.

Pick green if everything is okay, yellow if a bucket is missing in a
drive, red for any other drive state (unformatted, offline, ..), and
grey for any weird situation.
2024-11-13 08:33:49 -08:00
Anis Eleuch 63eb4a4609 lint: Fix new detected lint complaints (#5080) 2024-11-13 05:46:18 -08:00
Klaus Post 6ac18619cf Only warn if less than 28 days to cert expires (#5077)
Fixes #5076 as much as reasonable.
2024-11-05 03:29:45 -08:00
dependabot[bot] 95a03f54da Bump github.com/golang-jwt/jwt/v4 from 4.5.0 to 4.5.1 (#5074)
Bumps [github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/golang-jwt/jwt/releases)
- [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md)
- [Commits](https://github.com/golang-jwt/jwt/compare/v4.5.0...v4.5.1)

---
updated-dependencies:
- dependency-name: github.com/golang-jwt/jwt/v4
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-05 02:22:23 -08:00
dorman 9f4659884d Make the profiler easier to use (#5068) 2024-10-29 08:34:59 -07:00
Shubhendu a814b5deaf Mark batch job status properly (#5066)
Client side overall status was always shown as `in-progress` even if
job was successful or failed.

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2024-10-21 01:51:15 -07:00
Michael Fenn 65aa514dfa Add string/json output string mc pipe (#5065)
This commit adds a string message and json output to mc pipe.  The
implementation is heavily inspired by the one in mc cp, just adapted to
the different semantics of pipe.
2024-10-20 06:55:58 -07:00
Klaus Post d9b81b2956 Add support rpc JSON replay. (#5064)
Add realtime replay of captured JSON data.

Example:
```
λ mc support top rpc --json myminio >rpc.json

λ mc support top rpc -in=rpc.json
```
2024-10-18 14:18:41 -07:00
Klaus Post 2c4e3ad46b Report errors and better file names for mc support inspect (#5062)
Check the returned stream for errors and show them. Don't upload/keep pointless data

Use the request alias to create a better file name...

Example:

```
λ mc support inspect play/testbucket/testdat/**
mc: <ERROR> Unable to download file data. GetRawData: No files matched the given pattern.
```

Previously the error would just be ignored.

```
λ mc support inspect --airgap play/testbucket/testdata/**
File data successfully downloaded as inspect-play_testbucket_testdata.enc
```

Previously all files would be called `inspect-data.enc`, which would just be difficult to distinguish.
2024-10-15 08:15:39 -07:00
Klaus Post bad9b2c737 Add basic RPC metrics via mc support top rpc (#5060)
Example:
```
λ mc support top rpc myminio
      SERVER            CONCTD  PING    OUT Q   RECONNS STR IN  STR OUT MSG IN  MSG OUT
 To  127.0.0.1:9001       5     0.5ms     0        0    -> 20    0 ->   60007    60089
From 127.0.0.1:9001       5     0.5ms     0        0     -> 0    20 ->  60089    60002
 To  127.0.0.1:9002       5     0.0ms     0        0     -> 0    4 ->   34209    33937
From 127.0.0.1:9002       5     0.5ms     0        0     -> 4    0 ->   33938    34209
 To  127.0.0.1:9003       5     0.0ms     0        0     -> 0    4 ->   99379   101165
From 127.0.0.1:9003       5     0.0ms     0        0     -> 4    0 ->   101166   99379
 To  127.0.0.1:9004       5     0.5ms     0        0     -> 0    4 ->   33784    33029
From 127.0.0.1:9004       5     0.0ms     0        0     -> 4    0 ->   33030    33784
 To  127.0.0.1:9005       5     0.0ms     0        0     -> 0    4 ->   33515    33135
From 127.0.0.1:9005       5     0.5ms     0        0     -> 4    0 ->   33136    33515
 To  127.0.0.1:9006       5     0.0ms     0        0     -> 0    4 ->   33627    33161
From 127.0.0.1:9006       5     0.0ms     0        0     -> 4    0 ->   33162    33627
```

There is already server support for metrics.
2024-10-14 13:50:20 -07:00
Harshavardhana e20dea646f remove s390x support 2024-10-13 06:54:36 -07:00
Krutika Dhananjay cf128de2cf Do not fail mc-admin-policy-attach if policy already attached/detached (#5058)
Currently, attempts to attach a policy to a user who already has
the policy attached to them results in a 400.

This change handles cases where policy attach/detach operations
are automated using scripts/jobs. A re-run of the attach/detach
step should not fail the entire job.
2024-10-08 02:37:26 -07:00
Taran Pelkey 07eeb10c06 Add mc admin accesskey commands (#5038) 2024-10-04 04:29:36 -07:00
Harshavardhana ce0b434152 upgrade dependencies (#5053) 2024-10-02 01:27:28 -07:00
Anis Eleuch 4616d11c20 heal: More UX changes (#5052)
- Do not show healing ETA anymore; there are some scenarios where the
  ETA can be wrong. Show when healing is started and the progress of the
  healing drive usage compared to nonhealing drives in the same erasure set.
- `--verbose` prints only offline/faulty and healing drives
- `--all-drives` to show information about all drives
- Add yes/no prompt when a user wants to heal the whole namespace
2024-10-01 15:14:33 -07:00
Harshavardhana 609f32a4ff cleanup use of os.Environ() re-use env.List(prefix) (#5048) 2024-09-27 05:08:56 -07:00
Harshavardhana 97fe232a9a add alias name to 'mc ready' (#5044) 2024-09-25 02:56:38 -07:00
llchry a5a54b4429 put: Add --disable-multipart to make it easier to use. (#5041) 2024-09-24 10:47:33 -07:00
Klaus Post be874766a7 Add --checksum param to pipe, put, cp, mirror (#5043)
Add checksums to pipe, cp, mirror commands.

> Add checksum to uploaded object. Values: MD5, CRC32, CRC32C, SHA1 or SHA256. Requires server trailing headers support like AWS, MinIO and possibly others.

`--md5` is hidden, but still applied.

Uploads to buckets with object locking will still use MD5.

Bonus: `mc stat` shows checksum information.
2024-09-24 08:25:16 -07:00
Poorna 3dac3d392f fix quota info (#5040) 2024-09-20 05:49:53 -07:00
11ebe952ea iam export:designate zip file name (#4995)
Co-authored-by: Harshavardhana <harsha@minio.io>


---------

Co-authored-by: Harshavardhana <harsha@minio.io>
Co-authored-by: Klaus Post <klauspost@gmail.com>
Co-authored-by: Aditya Manthramurthy <donatello@users.noreply.github.com>
2024-09-16 10:43:14 -07:00
dormanandKlaus Post 37095dadcc mirror:Add the printing of event time (#4953)
* Add the printing of event time

* Update mirror-main.go

---------

Co-authored-by: Klaus Post <klauspost@gmail.com>
2024-09-16 10:30:02 -07:00
dorman 41aca25f6c alias: mc alias list command outputs the alias information specified by MC_CONFIG_ENV_FILE (#5028)
* Update alias-list.go
2024-09-16 10:23:10 -07:00
Anis EleuchandAnis Eleuch bbfe577d2e idp-ldap: Fix create-with-login command (#5036)
Currently, LDAP create-with-login command is not working properly when
the LDAP user does not have admin:CreateServiceAccount permission.

The permission is normally not needed since a user is allowed
to create a service account for itself. In that case, a temporary
account should be created and a new service account should be issued to
the temporary account access key, and not to the LDAP username as what
the code currently does.

This commit will send the correct target user in that case to make
create-with-login always successful.

Co-authored-by: Anis Eleuch <anis@min.io>
2024-09-14 20:56:26 -07:00
Shubhendu 04c5116c9b Fix regression (#5034)
A regression was introduced by https://github.com/minio/mc/pull/5032
where new `mc` with old MinIO wont import the IAM configs properly.

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2024-09-09 00:53:10 -07:00
Anis Eleuch f2d65b6c18 scanner-status: Support both old & new scanner metrics (#4683)
When the scanner uses parallel erasure sets scanning, the cycle concept
for the whole scan is no longer relevant. This PR will show the number
of ongoing bucket scans. 

```
mc admin scanner status --bucket <bucket-name> ALIAS
```

Will print a detailed report of a particular bucket scan.

Like, when the last scan progress was saved for that bucket for all
erasure sets. Also it will print when a full scan of a bucket finished.

(A full bucket scan means the last time frame that was needed for each
of erasure sets to do sixteen cycles)
2024-09-08 01:15:30 -07:00
Anis Eleuch 3092b6bf14 tier: Add hidden --force to remove tiering command (#5031)
To ensure that the server can remove an internal tier configuration
when the tiering is unreachable or other corner cases where it is not
possible for the server to determine if the tier contains some data
or fully empty.
2024-09-06 11:28:18 -07:00
Shubhendu 25ea06308f Update to print skipped entities during IAM import (#5032)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2024-09-05 08:31:14 -07:00
Taran Pelkey 54268c4808 Add edit, enable, and disable to mc idp ldap accesskey (#5033) 2024-09-05 04:03:52 -07:00
Anis Eleuch ba97441b5e mirror: Print errors in --json format when --skip-errs is provided (#5030) 2024-08-29 19:25:07 -07:00
Harshavardhana efc60a8a90 fix: docker buildx warnings 2024-08-26 09:48:09 -07:00
Harshavardhana a55d9a8d17 upgrade pkg/v3, minio-go/v7 deps (#5027) 2024-08-26 03:49:58 -07:00
Anis Eleuch 6801d70e55 heal: Do not show heal ETA when there is a retry attempt (#5025)
There is no suitable mechanism to estimate the ETA of healing when it is
retrying, although in most cases, it is just a listing that should be
quick enough. Hide the ETA anyway for now.
2024-08-26 01:50:57 -07:00
Harshavardhana 2e10255b6d allow cat to take part by part numbers (#5026) 2024-08-26 01:48:58 -07:00
Mark Theunissen efa1b396f2 Add commands for managing Bucket CORS (#5019) 2024-08-22 08:46:05 -07:00
Anis Eleuch aca5c185fe heal: Adapt the status based on a new Finished flag (#5017)
In a new MinIO version, Healing can be set to false while HealInfo is
not nil. This indicates that the drive was healed and the healing is
finished. This commit adapts the code with the new concept. This will
not break with older MinIO versions since those versions will already
remove .healing.bin, in that case Healing will be false, HealInfo will
be nil.
2024-08-21 05:20:43 -07:00
jiuker 690f3f8bb3 fix: Use TLS for STS endpoint when STS endpoint uses https scheme. (#5022) 2024-08-17 15:15:59 -07:00
Taran Pelkey 2c94b8d039 policy entities now print group memberships per user (#4961) 2024-08-17 04:33:50 -07:00
Harshavardhana 456709a2a4 combine STS, SVC accounts into access keys with or without expiration (#5004) 2024-08-17 04:11:58 -07:00
Ramon de Klein 479171e7be Fix warnings (#5023) 2024-08-15 08:50:11 -07:00
Harshavardhana b34cd742cb chore: update all deps (#5018) 2024-08-12 22:33:17 -07:00
Mark Theunissen 21ab58a03f Import bucket metadata must show CORS and general errors if any are found (#5001) 2024-08-12 20:08:58 -07:00
Harshavardhana 32b7b72193 conditionally disallow list() when object does not exist (#5016)
allow users to avoid list() call when an object does not
exist when following flags are used with `mc stat`

```
--no-list (HEAD the latest version)
--version-id <vid>
```

Also avoid superflous url2Stat() calls while processing
the args, there is no real reason to do that.
2024-08-12 01:52:27 -07:00
dorman e7d1e97852 stat: print information about all buckets when only alias are set (#5002) 2024-08-08 19:04:42 -07:00
Ravind Kumar d6886b33d2 Update admin-service.go (#5010)
`mc admin service stop` is hidden as it is a dangerous/one-way command.

No need to reference it in the description
2024-08-08 17:46:32 -07:00
Sveinn 487b874a2e Fixing invalid help menu for s3 type encryption (#5008)
* Fixing invalid help menu for s3 type encryption

* removing random comment
2024-08-08 17:46:22 -07:00
Andreas Auernhammer 58f15fca83 add global --resolve HOST[:PORT]=IP flag (#5013)
add global `--resolve HOST[:PORT]:IP` flag

This commit adds support for custom DNS overwrites via one or multiple
`--resolve` flags. It allows `mc` users to define custom DNS mappings
from a HOST (and optional port) to an IP address.

For example:
```
mc --resolve foo.com:9000=10.1.2.3 ls myminio/mybucket
```
The `--resolve` syntax is taken from cURL. Ref. `curl --help dns`

Use cases:

  1. DNS overwrites. If there are no DNS resolvers available, e.g.
     due to a temp. outage, this allows `mc` to connect to a defined
     alias as long as the IP of the one or multiple cluster nodes are
     known. It also allows `mc` to overwrite the current DNS responses.
     This is useful for various tests in dev and staging environments.
  2. TLS certificate verification. Often TLS certificates are issued
     for some DNS names (via SAN) but not for IP addresses. IP addresses
     are usually not static and might change anytime. Accessing a MinIO
     cluster that serves a certificate containing only DNS SANs via an
     IP address results in a TLS certificate verification error - even
     if the certificate is issued by a trusted CA. The current workaround
     is the `--insecure` flag which disables TLS certification completely.

Example for TLS verification:

```
$ mc alias set 'myminio' 'https://192.168.188.118:9000' 'minioadmin' 'minioadmin'
mc: <ERROR> Unable to initialize new alias from the provided credentials.
Get "https://192.168.188.118:9000": tls: failed to verify certificate:
x509: cannot validate certificate for 192.168.188.118 because it doesn't contain any IP SANs.
```

```
mc alias set --resolve foo.com:9000=192.168.188.118 'myminio' 'https://foo.com:9000' 'minioadmin' 'minioadmin'
Added `myminio` successfully.
```

Signed-off-by: Andreas Auernhammer <github@aead.dev>
2024-08-08 17:46:03 -07:00
Andrea Longo a56899e13c docs: explain scanner bucket quota check process (#5011) 2024-08-07 03:27:15 -07:00
Klaus Post 3cb570ff56 Normalize metadata values for compare (#5006)
Possible fix for https://github.com/minio/mc/issues/4997
2024-08-05 18:45:27 -07:00
Shireesh Anjal 28d64f224a Fix wrong message shown when upload to SUBNET fails (#5005)
When upload of the inspect file to SUBNET fails, following wrong message
was getting printed:

`Object inspection data for '' uploaded to SUBNET successfully`

Fixed the if condition to ensure that following correct message is
printed:

`File data successfully downloaded as <filename>`
2024-08-05 01:06:03 -07:00
Taran Pelkey f0d2ad4708 Rework mc idp ldap accesskey list to use new API endpoint (#4946) 2024-07-31 08:58:33 -07:00
Roman Chechyotkin 6a06daa1de #4988 fixed prometheus metrics usage message (#5000) 2024-07-31 08:47:42 -07:00
Harshavardhana 8ad22bb694 trace: avoid aggregate statistics TX/RX with --all (#4998) 2024-07-26 06:08:44 -07:00
Klaus Post 73e614aee9 Make trace stats more compact (#4999)
Make `mc admin trace -stats` more compact, and hopefully more readable.

* Truncates durations more reasonably
* Use `-` for 0 TTFB.
* Use `↑151B ↓12K` instead of `↑ 151 B ↓ 12 KiB/m`
* Reduce FPS from 7 to 3 for less flickering.
2024-07-26 05:50:54 -07:00
Anis Eleuch 58c42bc91b Allow STANDARD_IA as a AWS tier storage class (#4994) 2024-07-22 13:02:49 -07:00
Klaus Post f6df01d750 Fix incorrect bool parsing (#4991)
For example `--json=false` would still print JSON.

Went through all usage, and I think I covered them all.
2024-07-18 09:08:30 -07:00
Anis Eleuch ded36374e8 Show a warning when the server certificate duration is expiring soon (#4989)
When 90% of the validity time of a server is elapsed, print a warning
reminding the user to change the certificate.
2024-07-18 09:08:07 -07:00
mchtech 11034f9de1 mirror: let user decide whether to skip errors if client runs in watch / active-active mode (#4986)
Signed-off-by: mchtech <michu_an@126.com>
2024-07-15 10:46:06 -07:00
Klaus Post 4d498deb35 Fix non-recursive compares against alias+key on Windows (#4983)
Many listings would stop after the first version had been processed on Windows, since

For example, `mytls/testbucket/trace.json` != `mytls\testbucket\trace.json` would cause `mc undo` to only see one version since this would fail.

Use `getStandardizedURL` for both sides of these compares.
2024-07-11 11:01:28 -07:00
Shireesh Anjal ddfd44cb35 Support metrics-v3 api in admin prometheus generate (#4985)
Add a flag --api-version with possible values of v2 and v3, with default
being v2.

So when this flag is not passed, the command will work exactly as it did
before.

When using v3, there is a different set of metric types supported. It
also supports a new flag:

bucket: the bucket for which the metrics are to be fetched. it is
applicable only for the metric types that are available at bucket level,
which currently are 'api' and 'replication'
2024-07-11 11:00:59 -07:00
Shireesh Anjal ea33d018ca Support metrics-v3 api in admin prometheus metrics (#4982)
Add a flag --api-version with possible values of v2 and v3, with the default
being v2. So when this flag is not passed, the command will work exactly
as before.

When using v3, a different set of metric types is supported. It
also supports two additional flags:

Bucket: the bucket for which the metrics are to be fetched. it is
applicable only for the metric types that are available at the bucket level,
which currently are 'api' and 'replication'
2024-07-11 01:33:12 -07:00
Harshavardhana 21d3ec0089 improve 'admin service restart' UI (#4979)
```
mc admin service restart local -w
Service status: ▰▱▱ [DONE]
Summary:
    ┌───────────────────────┬─────────────────────────────┐
    │ Servers:              │ 4 online, 0 offline, 0 hung │
    │ Restart Time:         │ 3.949842ms                  │
    │ Background Init Time: │ 1.503707801s                │
    └───────────────────────┴─────────────────────────────┘
```

Existing UI didn't scale well for 100+ nodes, this
UI change is also made to provide clear guidance on
how soon the service is available v/s background
initialization time.
2024-07-08 13:59:24 -07:00
Harshavardhana 661e19b3b2 update deps (#4978) 2024-07-04 07:29:35 -07:00
Harshavardhana d6ff970125 honor bucket-key S3 feature (#4976)
fixes #4973
2024-07-03 13:17:25 -07:00
Mark Theunissen 26680ab77c Add ability to update tier credentials for Azure svc principal accounts (#4975) 2024-07-03 12:14:48 -07:00
Klaus Post 7e4b64d12a Simplify go.mod (#4977)
Combine into direct and indirect sections. See https://github.com/golang/go/issues/67948 for why this is a mess.

Enables running `go mod tidy` without blowing up things.
2024-07-03 11:49:12 -07:00
Harshavardhana 74032bc16a update govulncheck 1.22.5 2024-07-02 14:39:05 -07:00
Shubhendu bbdd9638f2 Use new batch status api /status-job (#4930)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2024-07-02 08:29:37 -07:00
Anis Eleuch e0d2e95984 heal: Add hidden --pool and --set to heal a particular ES (#4971)
--pool and --set are hidden flags. They could be used to heal a
particular erasure set. --pool and --set start with 1 (not indexes)
2024-07-02 02:28:07 -07:00
Harshavardhana f5b325d9d3 remove unused code 2024-06-29 12:08:46 -07:00
Harshavardhana 6811427b8b provide a overall summary along with call-wise (#4970)
```
Duration: 1m3s ▱▱▱
RPM    :  1168103.3
RX Rate:↑ 2.5 TiB/m
TX Rate:↓ 2.4 TiB/m
-------------
...
```
2024-06-28 16:17:44 -07:00
Harshavardhana 3548007d5b fix: make sure to set the right sse-kms key (#4967) 2024-06-24 12:40:33 -07:00
Harshavardhana dda9e96887 make 'mc admin service restart' more descriptive of what it does (#4965) 2024-06-20 07:50:54 -07:00
Harshavardhana 8876275c07 list versions including DEL marker when figuring out Stat() (#4951)
this is needed to avoid an inconsistent behavior when an
object exists v/s DEL marker or FreeVersion exists.
2024-06-19 22:57:53 -07:00
Prakash Senthil Vel b72bd7992c enable batch expiry option in trace (#4964)
add batch expiry option in trace
2024-06-19 22:17:42 -07:00
Harshavardhana a289dae750 fix: support 'mc put --if-not-exists' (#4963)
Also allow 'mc get --version-id'
2024-06-18 14:15:26 -07:00
Sveinn adaf70c7eb Adding support for Hex keys (#4962) 2024-06-18 07:51:58 -07:00
Poorna e7c9a733c6 fix replicate status display for older replication config (#4957)
that specified ARN in the Role field. This has since moved to
Destination.Bucket
2024-06-12 07:34:03 -07:00
Harshavardhana a472e3d9ed switch RX and TX arrow marks correctly
the arrow marks must be from server perpective
not `mc` perspective.
2024-06-11 12:50:18 -07:00
Anis Eleuch 7a0a8f54d9 info: Add --offline flag to show only offline nodes (#4955) 2024-06-10 09:44:15 -07:00
jiuker e44a1c612d fix: mc mirror got zero exit code when access denied (#4952) 2024-06-07 08:48:20 -07:00
Harshavardhana 17adf0abbb add vulncheck with go upgrade 2024-06-05 11:13:30 -07:00
Harshavardhana 0bd92d778e add space between upload/download indicators 2024-06-05 11:12:13 -07:00
Klaus Post 3997483ce7 Add sizes to mc admin trace (#4949)
```
Regular trace:

2024-06-03T14:18:37.303 [STORAGE] storage.ReadXL 127.0.0.1:9001 e:\data\distxl\s1\d3 warp-benchmark-bucket pz9WSPPj/4.TnpU8KEot9t4zl66.rnd 538.3µs 1003 B

With -v:

127.0.0.1:9001  [STORAGE storage.ReadXL] [2024-06-03T14:14:51.680] e:\data\distxl\s1\d3 warp-benchmark-bucket yvhiOPYp/117.hjDOOH6KmAhtC0Ty.rnd total-errs-availability=0 total-errs-timeout=0 0s 1003 B

With -stats

Duration: 21s ∙∙●
Call                            Count           RPM     Avg Time        Min Time        Max Time        Avg TTFB        Max TTFB        Avg Size        Errors
storage.ReadXL                  15808 (67.2%)   44344.8 429µs           0s              69.9984ms       0s              0s              1.2 KiB         0
storage.Delete                  3088 (13.1%)    8662.5  2.056ms         9.7075ms        305.0662ms      0s              0s              -               3

http stats:

Duration: 14s ∙∙●
Call                            Count           RPM     Avg Time        Min Time        Max Time        Avg TTFB        Max TTFB        Avg Size        Errors
s3.GetObject                    4532 (44.1%)    19502.8 1.121ms         267.5µs         67.9369ms       1.098ms         67.9369ms       ↓77 B ↑1000 B   0
s3.HeadObject                   3028 (29.4%)    13030.6 1.031ms         506.8µs         62.9893ms       0s              0s              ↓77 B           0
s3.PutObject                    1711 (16.6%)    7363.1  21.109ms        2.5496ms        181.8214ms      9µs             10.6771ms       ↓1.3 KiB ↑0 B   0
s3.DeleteObject                 1008 (9.8%)     4337.8  56.204ms        1.5859ms        411.1034ms      1.185ms         175.1619ms      ↓77 B ↑4 B      0
s3.DeleteMultipleObjects        1 (0.0%)        4.3     316.358ms       316.3584ms      316.3584ms      315.306ms       315.3055ms      ↓23 KiB ↑24 KiB 0

```

Backwards compatible, but will start displaying non-zero after: https://github.com/minio/minio/pull/19851 and  https://github.com/minio/minio/pull/19864
2024-06-05 00:50:20 -07:00
voldikss 3cfa8642fd fix: rm command with --newer-than not working (#4944) 2024-06-01 08:03:35 -07:00
Klaus Post 5040e61400 Fix support top net JSON (#4948)
JSON output was completely mangled.
Add switch to limit the number of responses.
2024-05-31 07:59:52 -07:00
jiuker 3774027cea fix: avoid HeadObject call for mc get (#4947) 2024-05-31 07:53:51 -07:00
Harshavardhana ac55cd1023 remote flaky bucket_replication test for now 2024-05-30 10:00:02 -07:00
Harshavardhana a8fdcbe7cb restructure credential creation with simplified expectations (#4939)
avoid weird coding style, simplify by using relatively
less number of variables and move things around to make
code more readable.

Improve HELP output readability.
2024-05-24 02:08:49 -07:00
Aditya Manthramurthy d4b7b00d73 Bump up minio/pkg to v3 (#4940) 2024-05-23 00:59:47 -07:00
Harshavardhana b46cf3c417 simplify histograms, make it based on the server return (#4935) 2024-05-13 09:31:11 -07:00
Harshavardhana 900235c14b keep pool display order and also pretty it (#4931)
```
mc admin info play/
●  play.min.io
   Uptime: 4 minutes
   Version: 2024-05-10T08:24:14Z
   Network: 1/1 OK
   Drives: 4/4 OK
   Pool: 1

┌──────┬───────────────────────┬─────────────────────┬──────────────┐
│ Pool │ Raw Usage             │ Erasure stripe size │ Erasure sets │
│ 1st  │ 8.5% (total: 120 GiB) │ 4                   │ 1            │
└──────┴───────────────────────┴─────────────────────┴──────────────┘

8.4 GiB Used, 479 Buckets, 3,585 Objects, 210 Versions, 27 Delete Markers
4 drives online, 0 drives offline, EC:1
```
2024-05-10 11:56:40 -07:00
jiuker 1b890948e8 fix: mirror --summary should work like -q (#4923) 2024-05-10 11:47:20 -07:00
Harshavardhana fdb36acbb1 fix: test regression since #4920 (#4928)
use mc_cmd always inside `functional-tests.sh`

Bonus: run shell formatting
2024-05-09 10:04:24 -07:00
jiuker 0d8c4f8aa8 fix: mc find --metadata work without prefix (#4926) 2024-05-09 07:13:21 -07:00
Sveinn a96123be2e showing disable-pager flag as an option (#4929) 2024-05-09 07:13:07 -07:00
jiuker 5378c957f5 fix: mc rb --force return ok with bucketNotExists (#4927) 2024-05-09 03:32:30 -07:00
Kanagaraj M 45ae31533d fix replication bandwidth unit conversion (#4922) 2024-05-09 03:04:18 -07:00
Shubhendu 62b110408f Correct spelling in message (#4924)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2024-05-09 01:41:56 -07:00
Shubhendu 2fb9e21122 Added test for bucket replication (#4920)
Make sure proxying of DEL markers doesnt happen to remote site
while stat calls.

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2024-05-09 01:40:35 -07:00
Shubhendu 646712d5e5 Fix panic in mc admin health command (#4921)
The globalFlags were getting added twice and so causing duplicate
error andso a panic.

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2024-05-07 08:20:21 -07:00
Klaus Post b471de8d18 Add standard EC setting to admin info (#4918)
Discretely adds the standard EC setting to regular `mc admin info`.

```
λ mc admin info play
●  play.min.io
   Uptime: 1 hour
   Version: 2024-04-15T10:03:01Z
   Network: 1/1 OK
   Drives: 4/4 OK
   Pool: 1

Pools:
   1st, Erasure sets: 1, Drives per erasure set: 4

945 MiB Used, 409 Buckets, 5,498 Objects, 52 Versions, 4 Delete Markers
4 drives online, 0 drives offline, EC:2
```

Will save many deep dives into JSON.
2024-05-03 04:21:07 -07:00
Harshavardhana b317d0d63d fix: honor S3v2 if configured (#4917)
fixes #4915

A regression was introduced in #4755, we hardly test
with v2 anymore so this has never been covered.
2024-05-03 04:17:42 -07:00
Harshavardhana dcb911bed9 make s3Config Transport a roundTripper (#4914) 2024-04-30 10:44:48 -07:00
Sveinn 9fad66d824 updating prefix validation and adding some tests (#4907) 2024-04-30 10:29:33 -07:00
jiuker 5b7b222371 fix: divde by zero for decom status (#4908) 2024-04-29 02:56:05 -07:00
Sveinn 4a3f5899c6 enabling MC_DISABLE_PAGER and --dp (#4909) 2024-04-29 02:55:40 -07:00
Ziyi Fan 770097b64f Fix the percent of pool used (#4910)
Fix a the percent of pool used in rebalance status
2024-04-29 02:55:22 -07:00
Harshavardhana afd408284e scanner token buffer can overflow use bufio.NewReader() (#4912)
To avoid the following error on binary objects

```
bufio.Scanner: token too long.
```
2024-04-29 02:48:39 -07:00
Harshavardhana 5dfaa31d67 move to crypto/sha256 instead of sha256-simd (#4911) 2024-04-25 15:35:12 -07:00
Harshavardhana 2ed4cd91a7 fix: docker hotfix binaries 2024-04-19 09:41:02 -07:00
Harshavardhana e59e453a14 fix: docker hotfix container builds 2024-04-19 09:33:18 -07:00
Shubhendu bc47cebd91 Show ILM Expiry Replication status only if enabled (#4900)
In case Replication of ILM Expiry rules is disabled, mention the same
in `mc admin replicate status ALIAS` output.

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2024-04-19 01:52:20 -07:00
Anis Eleuch 3ec030eb26 cosmetic: Hide mc admin bucket and its subcommands visible (#4905)
Current mc admin bucket is visible under 'mc admin' however, mc admin
bucket will not show sub-commands, which is confusing.

Hide mc admin bucket and make mc admin bucket subcommands visible for
now, until removed later.
2024-04-18 09:45:29 -07:00
Harshavardhana 58a9cb37ec upgrade deps to latest releases (#4904) 2024-04-18 07:46:46 -07:00
Sveinn fe58afcd39 Large MC Update (new encryption flags, functional test suite, removal of session code, minor cleanup, vuln. updates ) (#4882) 2024-04-15 08:10:25 -07:00
Taran Pelkey e701bce12c Move mc idp ldap accesskey create --login to mc idp ldap accesskey create-with-login (#4894) 2024-04-12 00:00:53 -07:00
Aditya Manthramurthy 76c3674200 fix: build on linux/mips64 (#4899)
Also, add cross-compilation to CI. This includes all the archs we intend
to publish production binaries for.

`linux/mips64` was broken previously, and this is fixed by updating
github.com/shirou/gopsutil/v3 to the latest version.
2024-04-11 17:36:42 -07:00
Aditya Manthramurthy 6bac84d281 Update version for govulncheck (#4898) 2024-04-11 16:47:52 -07:00
Krishnan Parthasarathi 0b13328b3a Move ilm-tier-info to use lipgloss/table (#4892) 2024-04-02 15:58:53 -07:00
Krishnan Parthasarathi 0e3d1d50bf Use lipgloss's table package for ilm-tier-ls (#4890) 2024-04-02 02:14:13 -07:00
dorman 9f8147bf0e doc update (#4867) 2024-03-30 08:29:52 -07:00
David Legrand f740a6d40b Functional tests: add a parameter for the full site cleaning test (#4877)
fixes #4876 

The latest `mc rb` test cleans all the site data, and on the demo site, 
there are sometimes WORM files put in by some users, which leads to 
a failure. This test should only be run on sites where the user knows he can
clean everything without errors.
2024-03-30 08:29:28 -07:00
Shireesh Anjal 206d017878 Expose health diagnostics related functions (#4885)
So that dependent projects (e.g. console) can make use of them instead
of duplicating the logic.
2024-03-30 08:28:09 -07:00
Klaus Post 89d742a76d Update madmin to existing master (#4888)
Proposed branch no longer exists.
2024-03-28 08:12:19 -07:00
Praveen raj Mani 7bac47fe04 fix resync to find peers by deployment ID instead of site names (#4884)
The site names may vary if configured on UI. The Deployment ID
is immutable and can be used instead in replicate resync commands.
2024-03-25 09:41:14 -07:00
Shireesh Anjal 9043bbf545 Expose getClusterRegInfo (#4881)
so that it can be used by other projects (e.g. console) instead of
duplicating the logic.
2024-03-20 14:07:29 -07:00
David Legrand 795ed1eb49 Fix functional-tests.sh file generation under macOS (#4875)
Fixes #4874 

`head -c 0` leads to an `head: illegal byte count -- 0` error under macOS. We should also provide the input with `-i` parameter (it's ok under GNU/Linux too)
2024-03-16 03:01:31 -07:00
dependabot[bot] 2508db9c56 Bump google.golang.org/protobuf from 1.31.0 to 1.33.0 (#4872)
Bumps google.golang.org/protobuf from 1.31.0 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-13 16:51:57 -07:00
Harshavardhana 53f59667f6 support node being part of multiple pools pick the actual number (#4870) 2024-03-13 12:22:53 -07:00
Harshavardhana 1ec55a5178 avoid stat and listing with --purge (#4869) 2024-03-08 22:43:06 -08:00
dependabot[bot] 6302f888a5 Bump github.com/lestrrat-go/jwx from 1.2.28 to 1.2.29 (#4868)
Bumps [github.com/lestrrat-go/jwx](https://github.com/lestrrat-go/jwx) from 1.2.28 to 1.2.29.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/v1.2.29/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v1.2.28...v1.2.29)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-08 14:29:25 -08:00
Harshavardhana 33a43e9c6e update go to v1.21.8 for vulncheck 2024-03-06 16:31:49 -08:00
Shireesh Anjal daf5b18e18 Add command for uploading file to SUBNET issue (#4854)
mc support upload --issue <issueNum> --comment <msg> <alias> </path/to/file>

Will upload the given file to the given SUBNET issue
2024-03-06 16:29:26 -08:00
Harshavardhana 98af07b69c bring back the original progress bar (#4866)
also cleanup 'mc put/get' behavior
2024-03-02 16:13:08 -08:00
Shireesh Anjal 66daa906eb mc support commands: allow --json in online mode (#4859)
There was a validation that said `--json` is supported only when
`--airgap` is also passed for SUBNET related `mc support` commands.

Remove this validation to allow `--json` to be passed even in online
mode. In this scenario, print a status JSON after upload to SUBNET.
2024-03-02 11:55:14 -08:00
dorman c2bf38f647 mirror: add bucket exclusions (#4861) 2024-03-02 11:54:51 -08:00
dorman 94cf5edf7a replicate: support alias (#4864) 2024-03-02 01:24:46 -08:00
jiuker f17313e7ab fix: emtpy progrese_bar and add change the color style white into green after upload success. (#4857) 2024-02-23 17:33:20 -08:00
Shireesh Anjal 744dc910d8 Do not validate deployment id from license if nil uuid (#4856)
In some very rare cases the license can contain a nil uuid
(00000000-0000-0000-0000-000000000000). Do not validate it against the
cluster's deployment id during registration.
2024-02-23 16:44:28 -08:00
jiuker 403bf6bc3a fix: add showLastProgressBar (#4855) 2024-02-22 04:23:55 -08:00
Sveinn e6288fa5f3 add help menu to put command when no parameters are present (#4852) 2024-02-21 18:35:53 -08:00
jiuker 5ff2208a2d add mc get (#4847) 2024-02-21 18:34:48 -08:00
jiuker e7ef65e655 fix: add error message to mc put (#4849) 2024-02-21 10:10:34 -08:00
Shubhendu 8156961333 Enable --expire-all-object-versions (#4840) 2024-02-20 06:47:42 -08:00
jiuker 1e69c2aadd feat: add put action (#4839) 2024-02-19 22:36:31 -08:00
Poorna 7d5e4ed56d fix example in admin replicate update (#4846) 2024-02-16 03:05:48 -08:00
dorman 6bb045a5e6 mirror: copy events also can mirror (#4842) 2024-02-14 13:19:52 -08:00
Harshavardhana 1466ae7b50 fix missing space while printing profile success message (#4845) 2024-02-14 13:18:56 -08:00
Sveinn 669cb0a9a4 Removing terminal whitelist for pager mechanism (#4843) 2024-02-09 14:18:24 -08:00
jiuker 62b12a2770 fix: mirror with local path (#4825) 2024-01-31 00:59:40 -08:00
Fexiven e21762b5a7 Fix syntax in examples (#4834) 2024-01-31 00:58:34 -08:00
Poorna 1274167567 fix validation in replicate rm to allow stale target cleanup (#4838)
when --all --force is specified, send request to server even if
replication config is not found to allow stale target cleanup
2024-01-31 00:58:18 -08:00
Poorna 12f446e1de fix prometheus metrics response on success (#4835) 2024-01-29 11:40:12 -08:00
Harshavardhana ba9fc6a307 fix: remove prometheus metrics arbitrary body limit (#4832) 2024-01-28 08:23:14 -08:00
Harshavardhana 9a5ef7c56d feat: service restart/update provides now per node status (#4827) 2024-01-26 12:32:20 -08:00
dependabot[bot] 1d42ad0df6 Bump github.com/lestrrat-go/jwx from 1.2.27 to 1.2.28 (#4830)
Bumps [github.com/lestrrat-go/jwx](https://github.com/lestrrat-go/jwx) from 1.2.27 to 1.2.28.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/v1.2.28/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v1.2.27...v1.2.28)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-25 15:59:36 -08:00
jiuker ffade16689 feat: add skip-errors to mc mirror (#4831) 2024-01-25 15:10:12 -08:00
jiuker ffa7a67bcf fix: allow -q by turning of pipe progress bar (#4828) 2024-01-22 21:02:19 -08:00
Sveinn 1ff6818938 Adding screen-256color to pager enabled terms (#4829) 2024-01-22 21:01:39 -08:00
jiuker bb25267eaa feat: add action for mc undo recursive (#4822) 2024-01-17 23:03:39 -08:00
Klaus Post 1edb08e74f Add ability to replay JSON file in scanner info (#4824)
Add (for now hidden) `-in` switch that opens a file that was output from `-json` and replays it.

```
λ go build&&mc admin scanner info -in=scanner-status.json
Scanner Activity: ∙∙●

Overall Statistics
------------------
Est. full scan time:   148d18h50m; Estimated 0.20/month
Current cycle:         5618; Started: 2024-01-06 14:14:39.745238158 +0000 UTC
Active drives:         2

Last Minute Statistics
----------------------
Objects Scanned:       402 objects; Avg: 91.974ms; Rate: 578880/day
Versions Scanned:      402 versions; Avg: 66.892µs; Rate: 578880/day
Versions Heal Checked: 0 versions; Avg: 0ms
Read Metadata:         402 objects; Avg: 91.74ms, Size: 649 bytes/obj
ILM checks:            402 versions; Avg: 1.909µs
Check Replication:     402 versions; Avg: 63.641µs
Verify Deleted:        0 folders; Avg: 0ms
Yield:                 1m13.7s total; Avg: 183.311ms/obj
------------------------------------------- Errors --------------------------------------------------
peer is not reachable
peer is not reachable
------------------------------------- Currently Scanning Paths --------------------------------------
...
```
2024-01-17 09:02:52 -08:00
Sveinn 7484802005 Making cli pager optional + better visual indicators for scrolling (#4819) 2024-01-16 08:06:34 -08:00
Anis Eleuch 799ded568d mirror: --preserve should not activate --overwrite (#4821)
Users would expect the mirror will not override anything unless --overwrite
flag is specified. However, currently --preserve will activate
--overwrite, which is not needed. This commit will fix this behavior.
2024-01-13 00:44:48 -08:00
Sveinn 2552dbf55e Fixing PR template format (#4820) 2024-01-12 11:02:16 -08:00
Sveinn bf2d21809a Arranging command help menu alphabetically (#4817)
arranging commands alphabetically
2024-01-11 22:49:15 -08:00
Shubhendu d4305a5bf9 Added option --exclude-folders (#4566)
This flag works in conjunction with `--recursive` and sets tags for all
the bucket objects minus the subdirs.

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2024-01-10 21:49:32 -08:00
Daniel Valdivia 74e889f95b Workflow to add issues to tracking project (#4815)
Signed-off-by: Daniel Valdivia <hola@danielvaldivia.com>
2024-01-10 15:21:17 -08:00
Shubhendu 7f1da50991 allow aliases with single character strings (#4812)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2024-01-08 11:17:23 -08:00
Krishnan Parthasarathi 59eca9fea8 ILM rule type filter flags should work with --json (#4814) 2024-01-04 21:04:32 -08:00
Shireesh Anjal bad0ad9dfb Add missing space between 'at' and filename (#4813)
When the report is generated in airgap mode, mc shows a message

MinIO diagnostics report saved at<filename>

Here a space is missing between 'at' and the filename. Add the same.
2024-01-03 08:51:10 -08:00
jiuker 0ffee47910 honor correct content-type for any files when passed via SQL query (#4809)
fixes #4518
2024-01-03 01:02:08 -08:00
jiuker 370b7483b1 feat: support summary for mc mirror (#4811) 2024-01-02 10:12:43 -08:00
Shubhendu 5386533bb9 Use correct target path during mirroring objects (#4807)
Currently if we don't use absolute paths in mirror command, absolute path of
source gets appended to the target path and so in destination object gets
mirrored to wrong prefix / path.

For example say source object path is `/tmp/source/prefix/a.txt` and mirror
command executed from `/tmp` dir as `mc mirror --json --watch source xyz`,
the object in target gets mirrored to location `xyz/tmp/source/prefix/a.txt`.
Also any new file created gets copied properly though.

```
mc mirror --json --watch source/ xyz/
{
 "status": "success",
 "source": "/tmp/source/prefix/a.txt",
 "target": "xyz/tmp/source/prefix/a.txt",
 "size": 0,
 "totalCount": 1,
 "totalSize": 0
}
{
 "status": "success",
 "source": "/tmp/source/b.txt",
 "target": "xyz/b.txt",
 "size": 0,
 "totalCount": 2,
 "totalSize": 0
}

```

With the fix now after running the command `mc mirror --json --watch source xyz`
the object would correctly get copied to location `/tmp/xyz/prefix/a.txt` as below

```
{
 "status": "success",
 "source": "/tmp/source/prefix/a.txt",
 "target": "xyz/prefix/a.txt",
 "size": 0,
 "totalCount": 2,
 "totalSize": 0
}
{
 "status": "success",
 "source": "/tmp/source/b.txt",
 "target": "xyz/b.txt",
 "size": 0,
 "totalCount": 1,
 "totalSize": 0
}
{
 "status": "success",
 "source": "/tmp/source/c.txt",
 "target": "xyz/c.txt",
 "size": 0,
 "totalCount": 3,
 "totalSize": 0
}
```

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-12-29 12:15:29 -08:00
jiuker f88eb55911 fix: tree traversal issue with empty folders (#4810)
fixes #4794
2023-12-29 09:16:55 -08:00
Harshavardhana 176f657e53 properly ignore permission denied error with mirror (#4803) 2023-12-26 10:07:28 -08:00
Taran Pelkey c27ddd4adf Add ldap accesskey create, update accesskey list with new endpoint (#4760) 2023-12-23 00:47:21 -08:00
Shireesh Anjal fb5dd2588c Accept --license flag in mc license register (#4795)
If passed,

- validate and save it immediately in the subnet config
- extract API key from it and use it for online registration with SUBNET
  (if `--airgap` is not passed)
- in case online registration with SUBNET fails for any reason, fallback
  to airgap mode (show URL to be visited on SUBNET)
2023-12-20 00:45:13 -08:00
Klaus Post 8e1573ec1b Set exitcode on copy/mirror source failure (#4798)
Also fixes errors potentially being swallowed by filtering.

Fixes #4773

```
λ go build&&mc cp s3/default/1.mp4 1.mp4
mc: <ERROR> Unable to prepare URL for copying. Unable to guess the type of copy operation.

λ echo %errorlevel%
1

λ _
```
2023-12-19 23:14:22 -08:00
Harshavardhana 60286667cc update dependencies to address new CVE (#4799) 2023-12-19 23:13:54 -08:00
Anis Eleuch 9ad4ee9d08 tier: Support AWS web identity token file for MinIO EKS pods (#4789)
Add --aws-role-arn and --aws-web-identity-file to allow MinIO EKS pods
to use web identity token auth style to tier data to a AWS S3 bucket.
2023-12-15 13:36:29 -08:00
asce c0462e64b2 use explicit operation handling for anonymous operations to prevent undesirable checks (#4791) 2023-12-15 13:36:12 -08:00
Anis Eleuch 34be0ed96a decom: status clearly shows that the it is about raw disk usage (#4792)
Some users are confused about the 'Capacity' wording and think this is
about the objects usage, not disk usage; Change the wording to make this
is more clear.
2023-12-14 19:00:20 -08:00
Shireesh Anjal 28f44cb9a0 Read new key license_v2 from SUBNET response (#4788)
SUBNET now has a v2 license that is returned in the new key
`license_v2`. mc will start reading and storing the same.
2023-12-13 20:46:56 -08:00
Anis Eleuch 8da737f8fd tier: Add support of service principal auth for Azure (#4787)
Add new flags to `mc ilm tier add` command to support Azure storage
authentication using a service principal account:
 
 --az-sp-tenant-id
 --az-sp-client-id
 --az-sp-client-secret
2023-12-13 16:37:41 -08:00
Anis Eleuch 1facc1eef5 support: --debug flag will print http requests for easier debugging (#4776) 2023-12-13 15:31:01 -08:00
Harshavardhana f78f391f8b fix: broken 'anonymous get-json' 2023-12-13 15:29:52 -08:00
Shireesh Anjal bb65ba8874 Use subnet package in pkg for license validation (#4784)
Most of the code related to license validation is now available in
`minio/pkg`. So remove it from mc and use the function(s) from `pkg`.
2023-12-11 09:06:09 -08:00
Shubhendu 1ba9435365 Fix a panic for bucket heal (#4781)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-12-07 14:13:17 -08:00
Anis Eleuch 1e2c5cec0a ready: Do not quit when the target server is offline or any other error (#4783)
Ready makes sense to not quit in any case, until the target server is
fully initialized
2023-12-07 14:13:04 -08:00
Krishnan Parthasarathi d920e2b34b Add support to batch-expire jobs (#4677) 2023-12-02 03:24:10 -08:00
Harshavardhana f5f7147b9e do not auto-decompress objects with content-encoding (#4777)
fixes #4769
2023-12-01 18:03:28 -08:00
Krishnan Parthasarathi b7a7b05395 Update minio-go to incl ilm fix (#4779) 2023-11-30 10:39:50 -08:00
Harshavardhana 59e0e56b21 chore update minio/pkg and madmin-go (#4774) 2023-11-28 09:29:57 -08:00
r-sc 5e6ae2172e set-json to fail on custom policies without .json (#4745) 2023-11-27 03:26:13 -08:00
Harshavardhana 2178568417 make STS support for 'mc' alias specific (#4771)
currently STS specific behavior is global,
`mc` however supports multiple aliases - we
need to make sure that `mc` treats this ENV
specific to an alias.
2023-11-26 01:35:13 -08:00
Krishnan Parthasarathi 16709e4bbc ilm: Add support for size based filters (#4770) 2023-11-22 23:59:19 -08:00
Shubhendu 56d84e64b1 Option to enable disable ILM expiry for site replication (#4698)
Added options `replicate-ilm-expiry` and `disable-ilm-expiry-replication`
for `mc admin replicate add` and `mc admin replicate update` commands
respectively.

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-11-21 22:17:38 -08:00
Shireesh Anjal 937b34616f Do not fail if deployment id not found in license (#4767)
SUBNET is being enhanced to generate account-level licenses instead of
deployment-level. So newer licenses may not contain the deployment id.

So validate the deployment id against the cluster only if present in the
license.
2023-11-20 08:30:59 -08:00
Harshavardhana d8342b68a0 fix: docker container builds with proper container name 2023-11-16 19:34:18 -08:00
Harshavardhana fe05b5bb42 fix: avoid crash with --stats -a (#4765) 2023-11-16 16:43:30 -08:00
Harshavardhana 4724c024c6 support missing role-arn and role-session-name (#4763) 2023-11-15 14:45:58 -08:00
Pedro Juarez 6c9cdc27bc Refactor methods that initialize client to reuse code blocks (#4755) 2023-11-15 13:20:52 -08:00
jiuker c3ebf165ee fix: Incorrect batch status Throughput entry (#4758)
fixes https://github.com/minio/mc/issues/4756
2023-11-13 10:10:39 -08:00
Harshavardhana 5124a01ae7 add 'alias export' command (#4759) 2023-11-13 03:20:16 -08:00
Harshavardhana 8c8e625217 trace statistics add MaxTTFB column (#4757) 2023-11-13 02:26:37 -08:00
Pedro Juarez b1d4341fcb add STS support for mc admin command (#4754) 2023-11-11 23:08:33 -08:00
Krishnan Parthasarathi d3773744a6 Transition doesn't support NewerNoncurrentVersions (#4750)
hiding --noncurrent-transition-newer flag to avoid confusion to MinIO
users.
2023-11-11 12:58:33 -08:00
Daryl White 56803d2167 Updating example with correct flag (#4751) 2023-11-10 13:37:17 -08:00
Shubhendu 6829c3fabc Change go version to 1.21.4 to fix vulncheck failures (#4749)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-11-09 14:43:59 -08:00
Harshavardhana 7db80b6ad9 fix: broken docker builds for microdnf command (#4746) 2023-11-08 13:00:21 -08:00
Shireesh Anjal a5adf14769 Add anonymize flag to support-diag (#4742) 2023-11-08 01:36:09 -08:00
Daniel Valdivia 011c61b254 Add support for STS credentials (#4744) 2023-11-05 20:19:23 -08:00
Shireesh Anjal b7dc9cc724 Show net info spinner in health diagnostics (#4741) 2023-11-02 09:52:34 -07:00
Harshavardhana 9f2fb2b6a9 upgrade madmin-go/v3 (#4738) 2023-10-30 11:43:32 -07:00
Sveinn b82f6c60b2 Removing un-used variables and fixing an error condition (#4737) 2023-10-30 08:43:44 -07:00
Harshavardhana 01df0ff497 upgrade madmin-go/v3 (#4735) 2023-10-28 14:24:39 -07:00
Taran Pelkey c1f61a1e06 Add idp ldap accesskey (#4686) 2023-10-26 14:23:45 -07:00
dependabot[bot] dae819544b Bump google.golang.org/grpc from 1.58.0 to 1.58.3 (#4731)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.58.0 to 1.58.3.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.58.0...v1.58.3)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-26 10:53:29 -07:00
Harshavardhana 1bcbe9019d add top locks owner as well (#4733)
```
Since                 Type    Owner                 Resource
13 hours ago          WRITE   10.68.100.18:9000     .minio.sys/leader.lock
13 hours ago          WRITE   10.68.100.18:9000     .minio.sys/callhome/runCallhome.lock
13 hours ago          WRITE   10.68.100.23:9000     .minio.sys/new-drive-healing/0/0
...
...
```
2023-10-26 07:52:18 -07:00
Andreas Auernhammer b798764785 update container base image to ubi9 (#4730)
This commit updates the container base image
to ubi9/ubi-9.2. It is ~4 MB smaller than ubi-8.

Signed-off-by: Andreas Auernhammer <github@aead.dev>
2023-10-25 08:31:38 -07:00
r-sc 75e722216a fix: print updates/merge multiple policy for a user (#4691) 2023-10-24 14:42:22 -07:00
Shireesh Anjal 39a57a14b8 revamp spinner in mc support diag (#4727)
The current spinner mechanism looks for the data categories (CPU,
drives, memory, etc) sequentially. If any of the category's data is not
received, it gets stuck there.

If a new data category is introduced without changing the version of the
HealthInfo struct, then `mc support diag` can get stuck for the new
category when talking to an older version of minio.

So instead of looking for the categories one by one, start a spinner for
each category at the beginning, and mark it as done as soon as the
corresponding data is received. When the last category (admin info) is
received, mark any pending category as done so that the command
continues with the rest of the processing.
2023-10-24 00:17:17 -07:00
Harshavardhana 2678c2c8e5 use Dockerfile ADD feature deprecate curl (#4728) 2023-10-23 23:32:21 -07:00
Harshavardhana 97cc12fdc5 Add average TTFB for statistics (#4726) 2023-10-23 22:18:28 -07:00
Andreas Auernhammer 0440badc41 use ubi-micro instead of ubi-minimal (#4725)
This commit replaces the UBI minimal with the
small and less bloated UBI micro image.

This reduces noise from security scanners flagging
components not used by mc and reduces the overall
size of the container.

Signed-off-by: Andreas Auernhammer <github@aead.dev>
2023-10-23 21:51:09 -07:00
Poorna 2c6ae7d1f7 Add --bucket-bandwidth flag to mc admin replicate update (#4687)
to allow default bucket bandwidth to be set in site replication
2023-10-23 15:46:02 -07:00
Sveinn eb6f304e2e Created a retry mechanism and added a --retry flag to mc mirror (#4715) 2023-10-20 02:03:26 -07:00
Klaus Post d2a2bdb07b Fix missing colours on windows (#4721) 2023-10-19 11:31:34 -07:00
Harshavardhana 903a1f202c add support for min/max time in 'trace --stats' (#4723)
also change the UI to match a k8s'isk style
output.

```
mc admin trace play/ --stats
Duration: 12s ●∙∙
Call                    Count           RPM     Avg Time        Min Time        Max Time        Errors  RX Avg  TX Avg
s3.GetBucketLocation    22 (48.9%)      107.8   431µs           205.196µs       1.360389ms      0       135 B   137 B
s3.ListObjectsV2        22 (48.9%)      107.8   1.615ms         520.96µs        6.821432ms      0       135 B   2.3 KiB
s3.ListBuckets          1 (2.2%)        4.9     2.302ms         2.301694ms      2.301694ms      0       135 B   29 KiB
```
2023-10-18 11:09:29 -07:00
Harshavardhana 062f28c9cc allow 'mc' flags to have ENV equivalent (#4720)
it simplifies the codebase a bit and also
allows for `mc` to easily be configured in
containerized environments.
2023-10-16 22:51:25 -07:00
Sveinn 377b71641b Preventing duplicate transfers during cp and mv when prefixes overlap (#4719) 2023-10-16 09:56:30 -07:00
Shubham Vernekar fb8a20a780 chore: update docs to indicate where is present (#4718) 2023-10-16 08:44:12 -07:00
Anis Eleuch d158b9a478 prom: Allow insecure TLS connections if --insecure is provided (#4716) 2023-10-13 18:57:03 -07:00
dependabot[bot]andHarshavardhana 54d12e95bd Bump golang.org/x/net from 0.15.0 to 0.17.0 (#4713)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.15.0 to 0.17.0.
- [Commits](https://github.com/golang/net/compare/v0.15.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Harshavardhana <harsha@minio.io>
2023-10-12 12:06:14 -07:00
Sveinn 87d6cd2d4f Validation optimization - reduce HEAD calls during cp and mv operations (#4710) 2023-10-12 11:30:11 -07:00
Shubhendu 32311bb933 Use the new golang version 1.21.3 (#4714)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-10-12 06:14:15 -07:00
Klaus Post 0793ce767b Add --stats to traces (#4669)
Allows collecting live stats of all traced subsystems.

Examples:

```
λ mc admin trace --stats play
+----------------------------+-------------+------+-----------+--------+---------+---------+
| Call                       | Count       | RPM  | Avg Time  | Errors | RX Avg  | TX Avg  |
| s3.GetObject               | 247 (63.3%) | 82.5 | 2.391ms   | 0      | 133 B   | 179 KiB |
| s3.HeadBucket              | 102 (26.2%) | 34.1 | 1.114ms   | 0      | 147 B   | 0 B     |
| s3.GetBucketLocation       | 18 (4.6%)   | 6.0  | 1.942ms   | 0      | 147 B   | 149 B   |
| s3.PutBucket               | 6 (1.5%)    | 2.0  | 4.146ms   | 0      | 151 B   | 0 B     |
| s3.ListObjectsV1           | 4 (1.0%)    | 1.3  | 4.276ms   | 0      | 124 B   | 577 B   |
| s3.ListBuckets             | 3 (0.8%)    | 1.0  | 15.312ms  | 0      | 135 B   | 82 KiB  |
| s3.PutObject               | 3 (0.8%)    | 1.0  | 4.304ms   | 0      | 14 KiB  | 0 B     |
| s3.DeleteObject            | 2 (0.5%)    | 0.7  | 407µs     | 0      | 88 B    | 0 B     |
| s3.HeadObject              | 2 (0.5%)    | 0.7  | 1.36ms    | 0      | 108 B   | 0 B     |
| s3.CompleteMultipartUpload | 1 (0.3%)    | 0.3  | 7.943ms   | 0      | 301 B   | 449 B   |
| s3.NewMultipartUpload      | 1 (0.3%)    | 0.3  | 4.895ms   | 0      | 160 B   | 383 B   |
| s3.PutObjectPart           | 1 (0.3%)    | 0.3  | 103.782ms | 0      | 8.8 MiB | 0 B     |
+----------------------------+-------------+------+-----------+--------+---------+---------+

λ mc admin trace --stats -call=storage play
+------------------------------+---------------+----------+----------+--------+--------+--------+
| Call                         | Count         | RPM      | Avg Time | Errors | RX Avg | TX Avg |
| storage.ReadXL               | 70780 (33.3%) | 174700.3 | 43µs     | 200    | -      | -      |
| storage.RenameData           | 70633 (33.2%) | 174337.5 | 1.165ms  | 0      | -      | -      |
| storage.DiskInfo             | 70540 (33.1%) | 174107.9 | 1µs      | 0      | -      | -      |
| storage.ReadVersion          | 280 (0.1%)    | 691.1    | 70µs     | 0      | -      | -      |
| storage.StatVol              | 236 (0.1%)    | 582.5    | 13µs     | 0      | -      | -      |
| storage.DeleteAbandonedParts | 140 (0.1%)    | 345.6    | 149µs    | 0      | -      | -      |
| storage.CreateFile           | 88 (0.0%)     | 217.2    | 4.169ms  | 0      | -      | -      |
| storage.ListVols             | 88 (0.0%)     | 217.2    | 426µs    | 0      | -      | -      |
| storage.ReadFileStream       | 18 (0.0%)     | 44.4     | 28µs     | 0      | -      | -      |
| storage.VerifyFile           | 16 (0.0%)     | 39.5     | 2.166ms  | 0      | -      | -      |
+------------------------------+---------------+----------+----------+--------+--------+--------+
```
2023-10-10 10:12:06 -07:00
Shireesh Anjal eca8310ac8 Add support for resource metrics (#4689) 2023-10-03 23:52:56 -07:00
Anis Eleuch 4be483de6d scanner: Limit the active disks if no enough term space (#4705)
If the terminal height is not enough to show the number of active disks,
which is likely the case in a large deployment, print only a few entries
until the number of lines reaches the terminal height.
2023-10-03 08:31:31 -07:00
Anis Eleuch 67fa4aa7a3 Fix mirror stats with --quiet flag (#4703) 2023-10-02 08:03:54 -06:00
Harshavardhana d8ace59107 add 'mc admin trace' filtering based on request queries (#4704) 2023-10-02 00:40:19 -07:00
Armin Weißer d47a2ba53a Add min, max and total request time to top api command (#4702)
Add min and max request time to top api command
2023-09-29 09:41:22 -07:00
Shireesh Anjal 86d5b64ffa Use latest madmin-go (v3.0.21) (#4701)
This ensures that drive model is included in the partition data inside
the health diagnostics report.
2023-09-29 01:07:54 -07:00
Anis Eleuch 1a65176cee perf net: Do not show Err: tag if there is no error (#4700) 2023-09-28 15:59:55 -07:00
Harshavardhana 103272612a change 6->3 decimal resolution, to conserve terminal realestate 2023-09-28 10:48:30 -07:00
Armin Weißer c3c899c365 Add ART and ATP to 'support top api' command (#4699)
Average Request Time (ART) = Total Duration / Calls
Average Throughput (ATP) = (RX+TX) / Total Duration
2023-09-28 08:33:49 -07:00
Taran Pelkey 618512cc92 broaden reach of --no-color flag (#4697) 2023-09-25 23:10:43 -07:00
Klaus Post 21ee2bd432 Show heal checks performed on missing (#4692)
Add stats for objects missing on current disk, but healed.

Visualizes stats for https://github.com/minio/minio/pull/18076
2023-09-25 10:32:06 -07:00
Harshavardhana ae05d45173 upgrade minio/pkg v2.0.2 (#4694) 2023-09-21 22:07:46 -07:00
Anis Eleuch 38b8665e9e perf net: Show the error with the bandwidth results (#4688)
An error in the result does not mean that the whole perf net test
failed, we can still show some results, with an error as well, to be
less confusing to the user.
2023-09-20 08:22:31 -07:00
Harshavardhana 79df949087 add exclude-storageclass flag for mirror (#4684)
this option exists to skip tiered objects such as

- "GLACIER"
- "DEEP_ARCHIVE"

users can use this option when migrating awss3 -> minio

```
mc mirror --exclude-storageclass GLACIER \
   --exclude-storageclass DEEP_ARCHIVE s3/bucket minio/bucket
```
2023-09-19 22:47:55 -07:00
r-sc f551d4b14d Support multiple policies in 'mc admin user policy' command (#4685) 2023-09-19 09:27:38 -07:00
Harshavardhana 3adb6c93fd hide all old deprecate heal options (#4682) 2023-09-18 23:02:58 -07:00
Klaus Post f36429be69 Add download links (#4681)
Update README.md

Add more archs.
2023-09-18 10:00:11 -07:00
Harshavardhana e561bc770e update all dependencies (#4679) 2023-09-13 16:08:58 -07:00
Harshavardhana 9dcef8825f fix: alignment issues in help for svacct sub-commands (#4676) 2023-09-07 15:48:55 -07:00
Harshavardhana e088bd45a9 fix: alignment in 'replicate status' help (#4675) 2023-09-07 01:01:36 -07:00
Aditya Manthramurthy e2056fb057 Update to minio/pkg v2 (#4674) 2023-09-02 14:28:03 -07:00
Poorna 5a5a9973c3 Change replicate status metrics to show additional info (#4582)
in `mc replicate status` for bucket replication
and `mc admin replicate status` for site replication.
2023-08-30 01:02:26 -07:00
Harshavardhana 9da0b405db support all scanner events to be reported for excessive versions (#4672) 2023-08-29 15:55:06 -07:00
Shubhendu 38d4108458 Added mc admin kms key list ALIAS command (#4663)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-08-29 15:36:30 -07:00
Harshavardhana d973c0a9bb update contribution license PR template 2023-08-29 09:39:46 -07:00
Poorna acc25b8c50 fix: bandwidth displayed in mc replicate status (#4664) 2023-08-18 14:57:55 -07:00
Harshavardhana df68f5cf89 add new PR template license terms and go1.21.x build (#4662) 2023-08-15 16:03:09 -07:00
Harshavardhana f198b23e1a fix: batch status responsiveness (#4661) 2023-08-15 14:15:45 -07:00
Anis Eleuch 469f770fe6 kms-status: Show unknown for decryption when encryption fails (#4659)
mc admin kms key status shows success for decryption when encryption is
failed, though the server does not test the decryption processs when the
encryption is failed. In such cases, this commit will show decryption with a
question mark instead of OK mark
2023-08-14 13:04:49 -07:00
Anis Eleuch 9d99cfbb7e mv: Do not error out when a bucket has an object lock config (#4654)
It appears that this code is coming from the old days when locking was
implemented before versioning; It does not make sense now to make mv
errors out when a bucket has a locking configuration.
2023-08-14 13:04:26 -07:00
Shireesh Anjal e112429e81 fix license register error in airgap mode (#4653) 2023-08-10 10:12:21 -07:00
jiuker 44ca181a93 feat: support perf client to show TX from client to server (#4645) 2023-08-10 07:16:40 -07:00
Shubhendu 01fb7c5a96 fix: provide an option for Prometheus config for node and bucket endpoints (#4652)
Earlier the command `mc admin prometheus generate ALIAS` used to
display only the scrape configuration for cluster metrics endpoint.
This change enables optionally to display scrape configuration for
node / bucket metrics endpoints.

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-08-08 10:23:59 -07:00
Harshavardhana b8d6623a3d update go1.20.7 for vulncheck 2023-08-08 09:44:00 -07:00
Harshavardhana 0a529d5e64 update deps to latest packages and update CREDITS (#4649) 2023-08-01 16:30:57 -07:00
Harshavardhana 3cf3095253 add TTFB as part of 'mc admin trace' in pretty form (#4648) 2023-07-31 20:31:06 -07:00
Shireesh Anjal 6b8680a2f7 Do not allow registration of play cluster (#4647)
Since play is a public demo cluster, it should not be allowed to
register with subnet.
2023-07-25 20:51:50 -07:00
Shubhendu 1c17ff4c99 Enabled option to show node and bucket metrics (#4632)
Earlier the command `mc admin prometheus metrics ALIAS` used to
display only the cluster-level metrics. This change enables
optionally to list node/bucket-specific metrics.

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-07-21 13:44:27 -07:00
Krishnan Parthasarathi 057470183f admin-info: Include delete markers count (#4642) 2023-07-19 15:54:09 -07:00
Poorna c04a480dd3 fix replicate update to check for older role ARN (#4640) 2023-07-19 13:11:09 -07:00
Harshavardhana c5ea09b74d properly report bandwidth if not configured (#4641)
report bandwidth if not configured
2023-07-19 12:42:18 -07:00
jiuker 493cd196b7 fix: remove count flag and show the byteRate for support top net (#4639) 2023-07-19 08:34:35 -07:00
jiuker dd6e9c7fcd fix: Enable byHost filtering by supplying server host list (#4637) 2023-07-19 00:45:16 -07:00
Harshavardhana 216aae32b9 fix: with --purge flag ignore path validation errors (#4636) 2023-07-18 14:05:38 -07:00
jiuker 48dd25742a Support mc top net (#4626) 2023-07-18 13:11:00 -07:00
Sergey c78ff23e77 Fixing misleading usage help for mc anonymous set-json (#4621) 2023-07-18 01:07:38 -07:00
Harshavardhana 1fbd97aa04 run gofumpt -extra on all source files (#4634) 2023-07-17 13:10:20 -07:00
Shireesh Anjal e8f049cbb1 Ensure --airgap is available on all support commands (#4633)
- remove deprecated and unused flags from `support diag`
- add missing registration check-in
  - call home status
  - proxy set|show|remove
2023-07-17 09:02:50 -07:00
Shubhendu 15ea1125e3 Added endpoint and version attributes to KMS details (#4591)
Added endpoint and version attributes to KMS details

Now it would list details of all KMS instances with additional attributes
endpoint and version. In case of k8s based deployment the list would consist
a single entry.

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-07-13 09:10:43 -07:00
Poorna 09a06e2a75 Rename mc replicate diff as mc replicate backlog (#4568)
Rename `mc replicate diff` as `mc replicate backlog`

By default `mc replicate backlog` shows the most recent failures with additional
--nodes flag to filter output by node and --arn flag to filter by remote target.
This is a fast operation and provides a quick snapshot of backlog currently in failed
status.

`mc replicate backlog --full` does a full listing and reports all object versions in
 pending or failed replication status.
2023-07-13 09:06:12 -07:00
Harshavardhana 355150151f allow purge to happen on quorum lost objects (#4629) 2023-07-13 00:11:43 -07:00
Harshavardhana c1193fc29d add update UBI image to 8.8 (#4625) 2023-07-11 16:30:44 -07:00
Aditya Manthramurthy 1b992864ee Enhance user info output with authentication info (#4613) 2023-07-06 22:25:51 -07:00
Poorna a2c253c43b admin replicate update: rename --sync flag to --mode (#4623) 2023-07-06 22:25:27 -07:00
jiuker 72958227ad fix: miss count for 'mc support top drive' (#4624) 2023-07-06 08:46:12 -07:00
jiuker 00b68bfa16 support site perf replication (#4608) 2023-07-06 01:07:41 -07:00
Shireesh Anjal eebdcdf365 Upgrade madmin-go/v3 to 3.0.4 (#4618)
Capture realtime metrics in health report
2023-06-28 14:54:17 -07:00
Kaan Kabalak c96b42c8f2 Fix issues related to 'mc admin svcacct list --json' cmd (#4619)
- Fix table header being printed when the '--json' flag is present for
the 'mc admin svcacct list' command
- Fix sentinel date being marshaled when the '--json' flag is present
for the 'mc admin svcacct list' command
2023-06-27 22:52:26 -07:00
Harshavardhana 0ed2956757 improve user messaging in 'support perf' and 'mc rm --dry-run' (#4617)
- terminal messaging for 'mc rm --dry-run' was completely
  wrong, it was using `fmt.Println` which shouldn't be done.

- mc support perf - printing was using a mix of color.New()
  and console.Infoln() (use one)

- mc support profile - printing was using a mix of color.New()
  and console.Info() (use one)

- mc support inspect - printing was using a mix of color.New()
  and consoleInfo() (use one)
2023-06-26 09:20:51 -07:00
r-sc f8f565c2b6 fix: allow cluster bucket export to export single bucket (#4614) 2023-06-24 01:38:52 -07:00
r-sc dea3058aa1 Improve consistency in mc cmds (#4609) 2023-06-23 11:12:07 -07:00
Aditya Manthramurthy 4b06db8e17 Update minio dependencies (#4610) 2023-06-20 14:00:40 -07:00
Aditya Manthramurthy 5f39522e69 Add response details for policy attach/detach cmd (#4602)
For internal IDP.

Also updates madmin-go to v3 as part of this change

- Temporarily disable test_admin_users until minio side fix is merged
2023-06-19 12:31:19 -07:00
Poorna bf3924b583 resync status: show current status (#4604)
Also exit tea.Program when resync is canceled.
2023-06-15 08:08:26 -07:00
dependabot[bot] 84f5724459 Bump github.com/lestrrat-go/jwx from 1.2.25 to 1.2.26 (#4601)
Bumps [github.com/lestrrat-go/jwx](https://github.com/lestrrat-go/jwx) from 1.2.25 to 1.2.26.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/v1.2.26/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v1.2.25...v1.2.26)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-14 12:40:22 -07:00
r-sc 2c67a3aaa7 Improve output readability for mc stat command (#4597) 2023-06-14 07:44:46 -07:00
Aditya Manthramurthy 916e05bc24 Fix unconfigured IDP output in idp info command (#4600) 2023-06-13 13:49:33 -07:00
Shubhendu 41926421f9 Set theme color for mc admin user svcacct set output (#4599)
Align with output theme for other commands like `enable`,
`disable` etc.

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-06-13 11:19:50 -07:00
Harshavardhana f148db7ae0 remove unnecessary newline and contextualize the success (#4598) 2023-06-13 08:44:46 -07:00
Klaus Post 2ecd33086f fix: copy progress crash (#4596)
Fix naked type assertion crash on `mc cp` with no output.

Fixes #4595
2023-06-12 13:48:33 -07:00
Harshavardhana 5e4ab1ec48 add ftp trace support (#4590) 2023-06-06 06:48:56 -07:00
Harshavardhana 04407b4199 print in tabular form for callhome status (#4588) 2023-06-03 08:09:50 -07:00
Kaan Kabalak ca1d00741b Implement '--expiry' flag for 'mc admin user svcacct add & edit' (#4570) 2023-05-30 15:41:38 -07:00
Klaus Post c6d4b63785 Make mc ping useful for startup checks (#4584) 2023-05-29 20:36:19 -07:00
Shireesh Anjal 298dbc50ca fix proxy not being used to test connectivity (#4583) 2023-05-28 11:02:33 -07:00
Shubhendu 9cb069e7af Corrected message to align with other messages (#4577)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-05-26 16:31:54 -07:00
Kaan Kabalak 0fac0e006e List expiration dates for 'mc admin user svcacct list' command (#4576) 2023-05-26 10:55:37 -07:00
Krishnan Parthasarathi 68a3d5adec Add updatedAt for ilm-rule-ls (#4579) 2023-05-26 09:37:48 -07:00
Klaus Post 96cb5cfc44 fix: limit manual GC to bigger objects (#4581) 2023-05-26 08:12:10 -07:00
Shubhendu 7415469c72 Show groups with their policy details while listing users (#4578)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-05-23 10:15:19 -07:00
Aditya Manthramurthy 8c06f54d8b Move mc admin idp to mc idp (#4574) 2023-05-19 15:10:28 -07:00
Anis Eleuch 7259e23679 Add sorting order to top drive command (#4575) 2023-05-19 08:41:17 -07:00
Aditya Manthramurthy 43745a9a59 Deprecate older idp commands (#4572) 2023-05-18 09:59:00 -07:00
Aditya Manthramurthy 052cf01a96 Add name and description for service accounts (#4569) 2023-05-17 11:46:09 -07:00
Thierry FOURNIER c767a3705f bug: panic on nil pointer dereference for "mc admin heal" when disk i… (#4571) 2023-05-17 10:03:17 -07:00
Anis Eleuch aefb1db4db Load Subnet proxy and API key from the env if found (#4557) 2023-05-09 10:11:27 -07:00
dorman ada4096d0b randomly generate AK and SK on mc client (#4565) 2023-05-09 09:14:34 -07:00
Anis Eleuch 6050568e66 info: Correctly show pool config with offline node(s) (#4567) 2023-05-09 08:13:26 -07:00
Shireesh Anjal af0e241883 Support setting subnet url via env var in dev mode (#4564) 2023-05-07 23:34:22 -07:00
Anis Eleuch 5a0d5116f4 mirror: Fix removal of FS target without a trailing slash (#4560) 2023-05-04 11:10:16 -07:00
Shubhendu b005b9a94d Remove tags for object versions (#4563)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-05-01 08:04:31 -07:00
Anis EleuchandAnis Elleuch a7e729fd38 mirror: Honor --fake for target bucket removal (#4561)
Co-authored-by: Anis Elleuch <anis@min.io>
2023-04-27 19:52:06 -07:00
Shireesh Anjal 36e26c448f Ensure perf results file has an extension (#4551) 2023-04-25 11:41:52 -07:00
Anis Eleuch 7130c92043 info: Show nodes in initializing state (#4556) 2023-04-25 11:41:24 -07:00
Harshavardhana 0da22db3af allow aliases to be / at the end and handle such cases (#4554) 2023-04-21 11:30:52 -07:00
Daniel Valdivia 6833118338 Consistent subcommand naming for list and remove with shortname (#4548)
Signed-off-by: Daniel Valdivia <hola@danielvaldivia.com>
2023-04-16 23:07:14 -07:00
Klaus Post 2ff87d64dc Fix dry run message crash (#4546) 2023-04-16 23:04:51 -07:00
dorman 4bc0aa730d doc: Update mc admin doc (#4529) 2023-04-16 23:04:33 -07:00
吴小白 b088b02adc build: support loong64 (#4549) 2023-04-13 11:09:41 -07:00
Anis Eleuch 1843717c57 Remove diskInfo structure in heal report (#4545) 2023-04-11 19:21:51 -07:00
Anis Eleuch 83336dfab3 heal: Fix summary ETA with multiple disks healing in one set (#4543) 2023-04-11 10:03:28 -07:00
Harshavardhana e668f4ad69 update minio-go/v7 -> v7.0.52 (#4544) 2023-04-11 10:03:12 -07:00
Anis Eleuch 50f11d8248 stat: fix printing bucket usage info (#4542) 2023-04-10 09:32:41 -07:00
Harshavardhana a06e46677a fix: remove replace directive merged incorrectly 2023-04-09 19:08:14 -07:00
Anis Eleuch 456c6fde8b perf: Add --noclear flag to avoid doing cleanup (#4473) 2023-04-08 23:10:28 -07:00
Poorna e94ce35608 Add trace for ilm call type (#4538) 2023-04-08 11:37:17 -07:00
Harshavardhana c6db258e7d do not crash on zero values (#4536) 2023-04-08 11:36:50 -07:00
Klaus Post 36aa65b791 Add metadata and tags to mc find (#4531) 2023-04-08 09:43:27 -07:00
Poorna 2c3f0e8ccf Add flag to admin replicate update to toggle synchronous replication (#4514) 2023-04-08 08:54:39 -07:00
jinapurapu a9fb9426f1 Improve errInvalidAlias (#4532) 2023-04-08 08:20:20 -07:00
Shubhendu 2d12a0a310 Dont send blank perf report to SUBNET (#4533)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-04-08 08:04:27 -07:00
tomaszduda23 d385122bef print RestoreInfo to check status of restored objects (#4534) 2023-04-08 08:03:46 -07:00
Taran Pelkey 1c6f4f48ab Add errors for deprecated commands (#4498) 2023-04-06 09:51:10 -07:00
Poorna b5768efc96 Add trace options for batch key rotation (#4507) 2023-04-04 14:00:02 -07:00
Shireesh Anjal a9cf9103ef Upgrade madmin-go to 2.0.18 (#4535) 2023-04-04 11:33:01 -07:00
Allan Roger Reid ada99298b2 fix: redact secretKey from printed on screen (#4526) 2023-03-28 12:50:57 -07:00
Anis Eleuch 81453d7c8f stat: Fix output when stat a prefix which has other prefixes (#4501) 2023-03-23 13:03:04 -07:00
Harshavardhana 8d6afee8fc honor context cancellation on long-running lists (#4519) 2023-03-23 12:44:45 -07:00
Shubhendu f3ff8b1556 Revert query parameter src while diag upload to SUBNET (#4516) 2023-03-23 12:36:06 -07:00
Anis Eleuch 8a67c25f53 cp: Descriptive error about why unable to locate the source (#4517) 2023-03-23 08:00:24 -07:00
Harshavardhana 381f016f61 add Expiration: info if present for sts/svc accounts (#4515) 2023-03-23 07:59:46 -07:00
Krishnan Parthasarathi 88896ae495 Incl. rules with NewerNoncurrentVersions > 0 (#4505) 2023-03-20 10:17:53 -07:00
Poorna 292f2dd960 Add batch cancel command (#4506) 2023-03-20 10:17:32 -07:00
Klaus Post 2e9b7e5ddc Fix decommission status crash (#4510) 2023-03-20 10:17:00 -07:00
Harshavardhana 252421354c update functional tests for admin_users with 'policy commands' (#4508) 2023-03-19 20:49:16 -07:00
Anis Eleuch e290a426a1 heal: Summary output based on disks utilization (#4474) 2023-03-18 16:43:18 -07:00
Taran Pelkey 9401450402 Restructure adding and removing policies from users and groups (#4428) 2023-03-18 16:41:57 -07:00
Anis Eleuch 07fb372398 rm: --dry-run with --versions to print versions modtime (#4495) 2023-03-18 16:39:26 -07:00
Aditya Manthramurthy 0e97683460 fix: ldap commands don't accept config name (#4499) 2023-03-18 16:38:27 -07:00
Klaus Post 5d334f4960 fix: windows stat command (#4503) 2023-03-18 16:37:13 -07:00
Shubhendu 045430905a Added query parameter src while diag upload to SUBNET (#4504)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-03-18 16:36:36 -07:00
Poorna d276bd7395 replicate ls: fix panic (#4497) 2023-03-13 06:07:16 -07:00
Poorna dfeadd796a replicate status - drop stale ARNs from stats (#4494) 2023-03-10 07:17:17 -08:00
Shireesh Anjal 107c6dd265 Allow support proxy set|remove without registration (#4488) 2023-03-09 00:10:42 -08:00
Shubhendu aaed62cdd8 Skip subnet config get while --airgap mode of license register (#4479)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-03-08 00:26:24 -08:00
Harshavardhana bf4a825530 upgrade dependencies and move to go1.20.x (#4490) 2023-03-04 16:34:53 -08:00
Krishnan Parthasarathi 5fbe8c26ba tier-add: --force flag to ignore in use check (#4481) 2023-02-27 16:12:59 -08:00
Anis Elleuch 1843bab500 subnet: Avoid general hard timeout for requests (#4478) 2023-02-21 09:32:38 -08:00
Anis Elleuch 40e51ee9af inspect: Avoid memory usage in subnet upload (#4477) 2023-02-21 19:57:51 +05:30
Klaus Post feccaabc78 Print custom info in trace (#4476) 2023-02-21 17:04:31 +05:30
Harshavardhana 54e2edd1be support unix-pipes with bigger buffers for performance (#4472) 2023-02-16 11:20:11 -08:00
Harshavardhana 47a2f48284 add more debugging tools to 'mc' container (#4475) 2023-02-15 05:06:51 -08:00
Anis Elleuch c02d5923fb Update madmin-go library (#4471) 2023-02-13 08:27:27 -08:00
Harshavardhana f5fec75b0a fix: do not print empty logs on screen (#4470) 2023-02-13 00:11:27 -08:00
Anis Elleuch 616f1cdb1f Implement 'mc admin user sts info' command (#4377) 2023-02-10 13:10:54 -08:00
Poorna a0c075b387 Remove mc admin bucket remote bandwidth command and introduce (#4430) 2023-02-10 12:50:11 -08:00
Shubhendu 95f4443e35 Added code to print the copy resume information (#4454)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-02-10 12:49:36 -08:00
Poorna 023e0cacc5 mc rm: disallow --purge with flags other than --force (#4467) 2023-02-07 03:42:57 -08:00
Anis Elleuch 663e082161 Fix parsing --response-duration in trace command (#4466) 2023-02-03 21:40:24 -08:00
Harshavardhana 3aebb3362b remove replace flag for go-ieproxy to allow go install 2023-02-03 19:02:13 +05:30
Harshavardhana 2679713ec4 update to newer libraries (#4464) 2023-02-02 08:57:14 -08:00
Yauhen Matsiushonak 04ba6633f3 mc admin user list --json output doesn't include user groups (#4433) (#4463) 2023-02-01 22:31:55 +05:30
Anis Elleuch 7afd7beddd locks: Use timestamp when elapsed is zero (#4462) 2023-02-01 21:46:35 +05:30
Poorna cb9de43544 Improve replicate ls output (#4460) 2023-01-31 16:25:23 +05:30
Poorna c1c7561b4e Fix replicate add/update cmds to allow prefix in rule (#4459) 2023-01-31 16:24:55 +05:30
Kanagaraj M 2e95a70c98 Use --api-key flag on register when provided (#4458) 2023-01-28 12:29:38 -08:00
Harshavardhana 58b7fc447d fix: hide duration flag its not useful for users (#4457) 2023-01-27 02:07:09 -08:00
Krishnan Parthasarathi f8d8667238 Add support for restoring SSE-C encrypted objects (#4456) 2023-01-26 01:44:04 -08:00
Harshavardhana 842a816385 use humanize.IBytes instead of humanize.Bytes (#4455) 2023-01-24 07:14:25 -08:00
Harshavardhana 34a67cb169 cleanup mc to use 'go' errs to be 'e' (#4450) 2023-01-24 02:03:57 -08:00
Shubhendu 468fc49d0f Corrected the logic for calculating the expiration no of days (#4451)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-01-23 07:11:38 -08:00
Shubhendu e9e6c2231f Corrected output for command mc admin info (#4448)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-01-19 09:13:40 -08:00
Shireesh Anjal 58f9fec703 Support --airgap in unregister command (#4441) 2023-01-18 10:03:24 +05:30
Anis Elleuch 6e97f161c8 Add support of giving a comment to service accounts (#4438) 2023-01-14 21:22:28 +05:30
Shireesh Anjal cc1606ff5c Improve message when profile upload fails (#4443) 2023-01-14 05:09:44 +05:30
Aditya Manthramurthy 73727de391 Simplify/speedup container image publishing script (#4442) 2023-01-13 20:47:05 +05:30
Daniel Valdivia 14c2e506fa Add confirm flag to mc admin update --yes (#4439)
Signed-off-by: Daniel Valdivia <hola@danielvaldivia.com>
2023-01-11 08:44:16 +05:30
Shireesh Anjal 7c6499b8a8 Renew license online if license file not passed (#4429) 2023-01-09 01:19:23 -08:00
Poorna e6e2b57022 Rename admin replicate subcommands (#4383) 2023-01-06 14:29:42 -08:00
Harshavardhana fbef5dd7f0 support concurrent uploads for 'mc pipe' (#4435) 2023-01-06 12:17:45 -08:00
Poorna 55a9d204db rb: avoid throwing error for force delete of prefix (#4436) 2023-01-06 12:09:09 -08:00
Shireesh Anjal cca1fd7c82 Upload inspect data to SUBNET (#4420) 2023-01-06 11:36:21 -08:00
Anis Elleuch a933ca5ae6 trace: Add bootstrap tracing type (#4416) 2023-01-06 11:36:11 -08:00
Taran Pelkey eedcbfe138 Allow mirror to continue syncing after an object fails to sync (#4427) 2023-01-06 11:11:42 -08:00
dorman 176072dee4 trace: Add input and output filters options (#4353) 2022-12-24 07:21:38 -08:00
Harshavardhana 0dffa062ea upgrade UBI image to 8.7 (#4425) 2022-12-23 07:52:58 -08:00
Harshavardhana a5c59c6190 avoid converting API types to local forms in 'mc' (#4424) 2022-12-22 14:23:48 -08:00
Taran Pelkey 4654d71164 Change formatting of mc stat (#4397) 2022-12-22 14:23:22 -08:00
Poorna c32ab49547 Change mc replicate add|update to integrate create remote targets (#4403) 2022-12-22 11:00:13 -08:00
Krishnan Parthasarathi 2166c63e8f admin-trace: Fix support for tracing scanner calls (#4417) 2022-12-22 10:58:17 -08:00
Anis Elleuch 8f0ae83bf8 fix: Correctly print svc accounts list (#4422) 2022-12-22 09:18:57 -08:00
Harshavardhana e8792efe0a fix: replicate remove show partial operations if any (#4418) 2022-12-22 09:13:46 -08:00
Krishnan Parthasarathi f8a489be9d reorganize ILM tier commands (#4385) 2022-12-19 16:48:28 -08:00
Anis Elleuch 7370e6bfd3 Print 'Cancel upon user request' when the global context is cancelled (#4406) 2022-12-16 23:26:04 -08:00
Harshavardhana c24e9c7847 fix: improve the information on retention config (#4411) 2022-12-16 23:25:44 -08:00
Poorna e4a840380c show endpoint in the replication status (#4412) 2022-12-16 23:25:36 -08:00
Anis Elleuch d0a496826d heal: Reword new disks healing summary (#4413) 2022-12-16 23:25:24 -08:00
Aditya Manthramurthy ce7b02a310 fix: IDP enable/disable command (#4410) 2022-12-16 23:24:56 -08:00
Klaus Post 802f2813e4 Upgrade golang.org/x/net (#4405) 2022-12-13 08:36:13 -08:00
Aditya ManthramurthyandHarshavardhana 4b4cab0441 Add LDAP policy attach/detach commands (#4390)
Co-authored-by: Harshavardhana <harsha@minio.io>
2022-12-12 16:23:28 -08:00
Anis Elleuch b8974e5aed mirror: continue operations even if source object goes missing (#4402) 2022-12-12 12:09:42 -08:00
Klaus Post c18faa5ff6 Add full list of call types. (#4401) 2022-12-12 11:13:00 -08:00
Anis Elleuch c4c0547a57 trace: Add two validations for passed arguments (#4399) 2022-12-12 08:43:09 -08:00
Anis Elleuch 97beb1108d admin update: Add a prompt for confirmation (#4400) 2022-12-12 07:10:12 -08:00
Harshavardhana daa06599e4 stat: avoid unix epoch time when printing date (#4398) 2022-12-09 11:38:22 -08:00
Anis Elleuch 62d07d5ea1 Stat: Do not append a slash when --rewind is specified (#4396) 2022-12-09 02:34:53 -08:00
Anis Elleuch 6b0f191643 find: Add support of --versions flag (#4394) 2022-12-09 02:34:30 -08:00
Poorna 84cbb788e2 Report data usage in mc stat of bucket (#4392) 2022-12-08 10:43:39 -08:00
Anis Elleuch 3aa2b3a755 Add staticheck to make lint (#4395) 2022-12-08 07:51:44 -08:00
Harshavardhana c8f319d94b add HiddenAliases to avoid printing aliases when deprecated (#4393) 2022-12-08 02:07:01 -08:00
Poorna b61ad7a959 Move mc admin bucket quota to mc quota (#4389) 2022-12-07 12:11:52 -08:00
Harshavardhana dbc1f6ada0 add support for upload/download limits (#4388) 2022-12-06 14:39:16 -08:00
Harshavardhana 76d49771d9 rename force-delete to purge hidden flag (#4387) 2022-12-06 08:45:49 -08:00
Klaus Post 52a931bfa7 Add staticcheck to CI (#4386) 2022-12-05 08:32:04 -08:00
Aditya Manthramurthy a55d40caf7 fix: IDP remove commands (#4384) 2022-12-02 15:48:47 -08:00
Aditya Manthramurthy 854b4f123f Bump up madmin-go to v2 (#4382) 2022-12-01 10:41:14 -08:00
Vladimir Garvardt 9fb024f8ec Use NewArnFromString when parsing user-provided ARN string (#4378) 2022-12-01 07:55:07 -08:00
Shireesh Anjal 024656ba05 Move support logs to admin logs (#4381) 2022-11-30 19:34:01 -08:00
Shireesh Anjal c64833c018 Add commands to set, show and remove proxy (#4375) 2022-11-22 16:07:43 -08:00
Shireesh Anjal dc9794cdb0 Restructure mc support callhome command (#4372) 2022-11-22 09:06:25 -08:00
Krishnan Parthasarathi 6406549729 top-locks: Include lock duration in --json output (#4366) 2022-11-21 10:08:32 -08:00
Harshavardhana 12f9b4e241 fix: stat --json output for single alias (#4376) 2022-11-21 10:08:06 -08:00
Poorna b38e144774 Add site resync commands (#4269) 2022-11-18 12:14:05 -08:00
Krishnan Parthasarathi 2770f13a73 ilm-ls: report ExpiredObjectDeleteMarker correctly (#4373) 2022-11-17 13:20:39 -08:00
Taran Pelkey 1192c2d468 fix cp --zip so it copies to given destination name (#4358) 2022-11-16 14:53:29 -08:00
Klaus Post 9051548c80 fix: mc stat for filesystem items (#4371) 2022-11-15 07:56:11 -08:00
Anis Elleuch 89b53a7e52 ls: Fix listing versions when the system clock is off (#4370) 2022-11-15 07:55:05 -08:00
Anis Elleuch 3ee6095c47 du: Do not count directories in FS mode (#4369) 2022-11-15 07:54:18 -08:00
Aditya Manthramurthy a20ab1b3dc fix: examples for mc admin idp commands (#4368) 2022-11-14 18:38:59 -08:00
adfost fd7142e223 update license headers to 2022 (#4360) 2022-11-14 18:38:39 -08:00
adfost bec340af65 fix: 'du' clean the input path to avoid extra counting (#4361) 2022-11-14 11:12:37 -08:00
Andreas Auernhammer 7cde242709 encrypt: remove sse-s3 example (#4357)
Signed-off-by: Andreas Auernhammer <hi@aead.dev>
2022-11-09 21:05:08 -08:00
Krishnan Parthasarathi 66e2075ebd Improve ilm-add flags and ilm-ls output (#4262) 2022-11-09 12:19:18 -08:00
Aditya Manthramurthy 791080485b Add LDAP Policy Entities command (#4318) 2022-11-08 17:01:53 -08:00
Aditya Manthramurthy bc16bde337 Bump up madmin-go for IDP API client bugfix (#4351) 2022-11-07 15:47:39 -08:00
adfost ec67a51185 Replicate-update instead of replicate-edit (#4346) 2022-11-07 15:47:23 -08:00
Poorna 631bf7822b replicate diff: change ui (#4347) 2022-11-07 13:11:32 -08:00
adfost 8b1054cbdb Handling newerNoncurrentVersions Expiry and Transition in validation (#4348) 2022-11-04 11:31:27 -07:00
Shireesh Anjal e5c92be7db More improvements in format of perf test results (#4350) 2022-11-04 08:24:54 -07:00
Aditya Manthramurthy 583d449e38 Update admin IDP commands with new design (#4310) 2022-11-02 17:02:58 -07:00
Shireesh Anjal 655258cf74 Update version of madmin-go to v1.7.3 (#4344) 2022-11-02 12:35:34 -07:00
dorman a4a9b8f406 add help menu for cmd 'mc admin user add' (#4337) 2022-11-01 16:15:12 -07:00
dorman 2f5bf0c17f modify operation type in message (#4339) 2022-11-01 14:10:26 -07:00
Anis Elleuch b5ee028536 fix: stat command with a directory marker (#4341) 2022-11-01 14:09:57 -07:00
Harshavardhana cf7e0ae050 generalize input for ctx.Command.Name (#4338) 2022-11-01 08:04:26 -07:00
Krishnan Parthasarathi 15e52fd862 Fix typo in rebalance-stop output (#4336) 2022-10-31 18:00:57 -07:00
Harshavardhana e64706d7ea fix up rebalance commands for 'mc' error conventions and usage (#4333) 2022-10-30 16:45:20 -07:00
Krishnan Parthasarathi 5b0fc3ef94 feat: admin-rebalance subcommands (#4186) 2022-10-29 22:10:17 -07:00
Anis Elleuch 1bf8a56adc Add support for inspect data v2 (#4185) 2022-10-29 11:27:05 -07:00
Klaus Post 929062c86b Add new healing summary (#4323) 2022-10-29 03:09:23 -07:00
Poorna 710fe47b9b support inspect: bump up metadata version (#4331) 2022-10-28 02:49:37 -07:00
Shireesh Anjal a2753bbaab Improve format of perf tests output (#4330) 2022-10-27 23:28:06 -07:00
adfost 1f51635bc7 Updating usage for mc replicate edit (#4328) 2022-10-27 16:53:36 -07:00
Harshavardhana 88796ea618 improve retention CLI errors and comply with 'mc' style (#4321) 2022-10-21 20:39:29 -07:00
adfost fd6846bc88 Fixing typo in MC (#4320) 2022-10-21 00:42:13 -07:00
Harshavardhana ad254a8fe2 make sure to pass jobType to GenerateBatchJob() (#4319) 2022-10-20 16:26:33 -07:00
Poorna dccbca774a replication diff: add header (#4288) 2022-10-20 14:50:16 -07:00
Shireesh Anjal 3cc795610b Add command to unregister a cluster (#4314) 2022-10-20 11:36:25 -07:00
Aditya Manthramurthy b9b729a3c9 Add LDAP support for IDP Config commands (#4296) 2022-10-19 14:57:53 -07:00
Shireesh Anjal e8afb9b135 Improve help text for support profile|perf (#4311) 2022-10-19 10:32:32 -07:00
Harshavardhana 8493f97e04 update new deps (#4303) 2022-10-18 17:42:56 -07:00
bh4t 28073441c0 change example bucket names to simple names (#4308) 2022-10-18 11:53:33 -07:00
Anis Elleuch 42c16b288c Add number of offline disks in heal info summary (#4305) 2022-10-18 09:01:01 -07:00
Harshavardhana 839e44595c avoid unnecessary tea program for 'license info' (#4306) 2022-10-18 02:06:57 -07:00
Shireesh Anjal 81c04723f9 Print license info table with solid lines (#4301) 2022-10-17 09:44:34 -07:00
Harshavardhana 3fe6778ee7 list jobTypes currently supported (#4298) 2022-10-12 11:12:50 -07:00
Harshavardhana 318569a861 use showAppAndExit() for pager help (#4292) 2022-10-12 09:39:40 -07:00
Harshavardhana 27322636ae feat: Introduce 'mc batch' command (#4225) 2022-10-09 14:10:59 -07:00
Shireesh Anjal 02da50b05e Support --dev flag in license info|update (#4281) 2022-10-09 12:48:40 -07:00
Anis Elleuch be2e66c37c Keep help output after quitting (#4289) 2022-10-09 12:09:37 -07:00
Mukta Puri ec8687d57e Replace 'policy' with 'anonymous' in readme (#4287) 2022-10-07 09:03:39 -07:00
Shireesh Anjal d673ca79ea Show airgapped registration link in different color (#4282) 2022-10-06 07:41:05 -07:00
Minio Trusted 1a832ed018 upgrade pkg and madmin-go deps 2022-10-05 18:20:06 -07:00
Anis Elleuch d86f52c4bb Upgrade minio/pkg dependency (#4280) 2022-10-05 18:08:12 -07:00
Harshavardhana a7dd2810ae fix: updateURL when customURL is not passed (#4279) 2022-10-03 15:00:41 -07:00
Minio Trusted 68ca2bf457 upgrade minio/pkg v1.4.3 2022-10-01 10:52:48 -07:00
Minio Trusted f73adff238 update minio-go/v7 master 2022-10-01 00:56:14 -07:00
Harshavardhana fa344d5cc0 remove 'mc policy' command (#4276) 2022-09-30 13:25:25 -07:00
Shireesh Anjal 99bfdfed4c Remove perf tests from support diagnostics (#4277) 2022-09-30 12:43:41 -07:00
Harshavardhana 2f1d44eee2 convert tabs to spaces in all commands (#4275) 2022-09-29 11:14:57 -07:00
Shireesh Anjal d0e71b13a8 Save API key if present in the license (#4266) 2022-09-29 00:30:40 -07:00
Harshavardhana cd0c81165b re-order the support perf UI (#4268) 2022-09-29 00:30:18 -07:00
Shireesh Anjal e917b9513d error out from support commands if not registered (#4271) 2022-09-28 14:52:11 -07:00
Anis Elleuch f85086b153 Use a pager for help output (#4245) 2022-09-28 11:28:02 -07:00
Harshavardhana 2f08ccf0d5 avoid expensive threads profile by default (#4270) 2022-09-28 00:45:26 -07:00
Shireesh Anjal ba5f9ac373 Upload results of perf tests to SUBNET (#4254) 2022-09-27 02:56:43 -07:00
Harshavardhana 698e9ad094 update minio-go to address missing userMetadata (#4263) 2022-09-26 14:27:53 -07:00
Klaus Post efdda726bd Fix mc admin scanner info --json (#4264) 2022-09-26 09:02:26 -07:00
Daryl White 37e726f100 Update documentation links with new URLs (#4261) 2022-09-22 14:05:27 -07:00
Anis Elleuch f151b8ab42 Print supported flags only if there is at least one flag defined (#4259) 2022-09-19 07:03:22 -07:00
Harshavardhana 388ebe127f rename disks -> drives almost everywhere (#4257) 2022-09-19 07:01:40 -07:00
Harshavardhana ad4441ef2b disks must be renamed to drives everywhere for display (#4255)
use helper for couple of functions
2022-09-16 02:16:47 -07:00
Shireesh Anjal cdb6b179d3 Upload profile zip to SUBNET (#4226)
When the `--airgap` flag is not passed, the generated profile zip will
be uploaded to SUBNET.
2022-09-15 22:18:14 -07:00
Shireesh Anjal 6347b436ff Export perf test result related types (#4246)
So that they can be used by `health-analyzer` when parsing the
performance test results data.
2022-09-15 01:22:42 -07:00
Krishnan Parthasarathi 1009a897d8 ilm-add: update flags related to tiering (#4250) 2022-09-14 13:53:00 -07:00
Harshavardhana b34681d662 fix: use deadlineconn properly (#4249)
PR #4164 didn't use the set deadlines properly
2022-09-14 08:15:37 -07:00
Shireesh Anjal 97715cd215 Remove duplicate key in .golangci.yml (#4247)
The .golangci.yml file contains the root level key `linters-settings`
twice, resulting in following error when we run `make lint`:

```
> make lint
Running lint check
ERRO Can't read config: can't read viper config: While parsing config: yaml: unmarshal errors:
  line 26: mapping key "linters-settings" already defined at line 1
make: *** [Makefile:36: lint] Error 3
```

Fixed by merging into a single key.
2022-09-13 09:45:58 -07:00
Klaus Post 048aab801a Do Go vulncheck directly (#4248)
Skip action, just invoke it ourself.

This allows us to specify Go version in our code.
2022-09-13 07:57:16 -07:00
Harshavardhana acd390f261 allow support for airgapped 'mc update' URL (#4244)
support airgapped environments to update `mc`
via a URL, similar to `minio server`
2022-09-12 12:51:52 -07:00
Anis Elleuch 145da32419 Add --request-header to trace cmd to filter http requests (#4238)
e.g:

`mc admin trace --request-header "User-Agent: *hadoop*" <alias>`
   to print all S3 requests sent by Hadoop

`mc admin trace --request-header "!X-Minio-Source*" <alias>`
   to avoid printing S3 requests related to replication
2022-09-12 10:12:06 -07:00
Andreas Auernhammer b6c2a7bb85 add vulncheck action to CI (#4243)
Signed-off-by: Andreas Auernhammer <hi@aead.dev>
2022-09-12 10:11:52 -07:00
Harshavardhana 6f414de058 add hotfix build support (#4240) 2022-09-09 03:48:56 -07:00
Harshavardhana ea96e2b2c8 allow terminal control back for 'top api/disk' (#4239)
similar to #4237 fix other command TUI's as well,
also no locking is needed to protect maps.

Update()/View() are serial so need to add mutexes.
2022-09-09 03:48:39 -07:00
Anis Elleuch 3142b54cc1 Avoid cutting policy name in admin policy list command (#4241)
`mc admin policy list` only shows policy names, it does not need
 to cut the policy name to 20 characters when showing it.
2022-09-09 03:47:41 -07:00
Harshavardhana 30a9bb8b05 allow terminal control back after bubbletea UI (#4237)
terminal control was not relinquished since ui.Start()
must not be run in a go-routine as it is expected
to be a blocking call, and must be serialized with when
an application exits.

refactor the 'scanner info/status' to ensure we have
correct behavior.

This PR also renames 'info-> status', keeps the older
one as alias for now.
2022-09-08 08:18:07 -07:00
Ashish Kumar Sinha f73e036b80 fix: alignment issue in mc ping. (#4218) 2022-09-07 15:27:40 -07:00
Anis Elleuch 1f7bce1ada Add a pull request github template (#4234)
It will make it easier to remember that the documentation needs to be
updated.
2022-09-07 15:25:58 -07:00
Anis Elleuch 5bb0e38f94 Add objects sizes histogram to bucket info (#4236)
mc admin bucket info shows the object size histogram
2022-09-07 15:25:35 -07:00
Krishnan Parthasarathi 248f8efb36 Update minio-go to for recent pkg/lifecycle fixes (#4235) 2022-09-07 15:25:17 -07:00
Anis Elleuch b3e1ac34c7 ls: Fix ls exit code related to some errors in FS (#4233)
The code that is being modified is from 2016. Currently, it does not set
an exit code status in the following cases, all of them are returned by
the FS layer:

    BrokenSymlink
    TooManyLevelsSymlink
    PathNotFound
    PathInsufficientPermission

There is no reason to avoid setting an exit code in this case. The only
functional change of this PR is by setting an exit code
2022-09-06 09:54:46 -07:00
Harshavardhana 5cd7ff8876 cleanup commands to use Go 'err' as 'e' (#4232)
many commands seem to have sort of had
stopped following the expected convention
in `mc` to differentiate *probe.Error.

To keep things readable this PR is the
first attempt at such a cleanup.
2022-09-06 08:03:25 -07:00
Klaus Post 2c9a733cae Add mc admin trace --call=healing (#4229)
Provide healing operation traces.

See https://github.com/minio/minio/pull/15616 for basic implementation.
2022-08-31 08:17:02 -07:00
Harshavardhana 01fbd0f5ef use go1.18 alpine image (#4228) 2022-08-30 08:18:40 -07:00
Harshavardhana 41e6cc5626 fix: use DurationFlag to response-threshold (#4227)
Also add missing flags from 'mc admin scanner trace'
2022-08-30 08:15:54 -07:00
Shireesh Anjal a64491e101 Fix support callhome status command (#4222)
Because of recent changes in the way config is parsed in `mc`, we need
to pass `madmin.Default` as the target when looking for the callhome
config.
2022-08-28 13:08:11 -07:00
Harshavardhana af1d0ee6da change progress unicode style, simplify progress bar init() (#4224) 2022-08-26 12:45:12 -07:00
Klaus Post 55c5b96323 Fix mb with-versioning (#4223)
`mc mb --with-versioning` no longer works after https://github.com/minio/mc/commit/f70b7e537c908e2c426f87218d5a44f807588074 (no PR)

Use long param name.
2022-08-26 06:40:33 -07:00
Shireesh Anjal 85a50dbf91 Fix support logs status command (#4221)
Earlier, the parsed config contained the `target` of the form
`subsystem:target` e.g. `logger_webhook:subnet`. Now it contains only
the target e.g. `subnet`.

Updating the `support logs status` command code accordingly to ensure
that it prints correct output.
2022-08-25 08:03:03 -07:00
Aditya Manthramurthy 9f24a19aa8 Fix config parsing with updated madmin helper (#4220) 2022-08-24 23:33:40 -07:00
Harshavardhana f022a57088 feat: support head with --zip (#4219) 2022-08-24 23:10:03 -07:00
Ashish Kumar Sinha 236b50d6db trim response to two-decimal places in ping command (#4214) 2022-08-24 21:09:32 -07:00
Shireesh Anjal 07fffc3bc8 Enhancements in registration and diagnostics (#4200)
- When the cluster is registered but either license or api-key
  are available in the config, and when `--airgap` is not passed 
  to the command, try to automatically fetch and store the other
  both.
- Add `--api-key` flag to `mc support diag`
- Use header-based auth with subnet
- Introduce a common function to initialize/check connectivity with subnet
- Make the health report upload function generic so that it can be used
  by other commands like profile in future
- Add a global variable for airgapped mode
- Add more examples to `mc license register`
2022-08-22 22:45:20 -07:00
Harshavardhana f70b7e537c remove 'mc mb' short flag to avoid confusion
Bonus: fix `od` build issues since removal of madmin.KVS
instead keep a `mc` version of `argKVS` for future use.
2022-08-22 22:10:41 -07:00
Taran Pelkey 68a36788aa Add od command (#4180) 2022-08-22 22:02:23 -07:00
Harshavardhana 488b277e36 feat: --with-versioning flag to create bucket as versioned (#4216) 2022-08-22 10:52:19 -07:00
Anis Elleuch c57671a0d4 Introduce disk IO statistics UI (#4201) 2022-08-22 10:52:00 -07:00
Aditya Manthramurthy 8c239d16aa Update madmin dep to fix a crash (#4215) 2022-08-18 09:53:41 -07:00
Aditya Manthramurthy 1529bb83bf Move config parsing logic to madmin (#4212) 2022-08-17 17:07:58 -07:00
Anis Elleuch 3cb806d011 Add --disable, --enable and --prefix to ilm commands (#4209)
Passing the prefix in the aliased url is problematic for ilm edit
command when the user wants to modify something in the ILM rule: no
prefix in the url means the user wants to set an empty prefix or maybe
nothing. To fix this, add --prefix flag and make it a default choice in
the document.

Also, ilm edit will try to only apply passed flags. LifecycleOptions
fields are all pointers to apply only non nil fields to the ILM rule.
2022-08-17 17:07:42 -07:00
Harshavardhana de65258a7f fix: ping must call AdminInfo only with '--distributed' (#4208) 2022-08-16 07:14:12 -07:00
Anis Elleuch 7a276b6111 Update github.com/minio/cli version (#4192) 2022-08-15 19:05:49 -07:00
Aditya Manthramurthy 088aa3f04f Update config output JSON format (#4207)
This change allows for the JSON format of config output from the server
to show both the environment variables' and config system variables'
value.
2022-08-15 19:05:19 -07:00
Taran Pelkey eb7a7206a3 Clarify error when user has no policy (#4206) 2022-08-14 15:13:33 -07:00
Aditya Manthramurthy c2c2ab4299 Make environment variables output highlighted (#4205)
For `mc admin config get|export`
2022-08-10 17:30:48 -07:00
Ashish Kumar Sinha c12f6e46c3 rename mc admin top to mc support top (#4191) 2022-08-10 13:02:42 -07:00
Harshavardhana c2f1770cec update minio-go/v7 v7.0.34 (#4203)
fixes #4202
2022-08-10 11:15:32 -07:00
Krishnan Parthasarathi d691fc4c9f Add trace support for decommissioning (#4195) 2022-08-10 10:14:21 -07:00
Harshavardhana c307963422 upgrade CI/CD go1.19 (#4204) 2022-08-10 08:46:41 -07:00
Anis Elleuch 3e990e3525 Change the JSON output of mc support perf (#4198)
Change the JSON output of mc support perf

The new change will still print multiple JSON lines for each conducted
performance test but now we have a new field called 'type' field to
difference between network, drive and object tests.

This change also adds 'final' field to indicate this is the final json of a
particular performance testing.

Also, errors when conducting those tests will have a field 'err' as well
in the JSON output.
2022-08-10 08:09:05 -07:00
Anis Elleuch 73b157e4b1 Print a better error msg when net perf is unsupported (#4194)
Netperf is not supported in a standard deployment, this PR will print a
better error message in that case.
2022-08-08 15:20:18 -07:00
Anis Elleuch d43c25ffa3 restart: Use health check instead of service info API (#4190)
`mc admin service restart` currently uses ServerInfo() API which is costly.
2022-08-08 09:32:27 -07:00
Shireesh Anjal de706ef096 Fix example description for mc support perf (#4193)
The current description seems incomplete as it doesn't mention object
storage performance.
2022-08-08 08:35:51 -07:00
Harshavardhana 7838be4a7f apply --status-code only for HTTP traces if present (#4189)
fixes #4188
2022-08-08 08:33:23 -07:00
Ashish Kumar Sinha 63d0e213c3 update ping command with new terminal UI (#4163) 2022-08-08 00:04:14 -07:00
Harshavardhana 6cee296d04 rename Remove -> Removed in 'mc rm' (#4187) 2022-08-05 21:54:56 -07:00
Taran Pelkey 1381bf2168 Update examples for admin-config-reset (#4160) 2022-08-05 20:29:15 -07:00
Poorna 351d021b92 Change ui for admin cluster bucket import (#4184)
Report on all errors encountered during import
2022-08-05 01:01:28 -07:00
Anis Elleuch 4e42a9e3eb rb: Better error message when the user passes an object name (#4183)
The new error message is:
```
$ mc rb --force play/testbucket/dir/
mc: <ERROR> Failed to remove `play/testbucket/dir/`. Bucket name `testbucket/dir/` not valid.
```
2022-08-03 08:43:41 -07:00
Anis ElleuchandAnis Elleuch 554905ac46 rm: Fix successful message for operations on the filesystem (#4182)
Names of the removed files when mc operatres on the filesystem are
not shown properly. The code is splitting the removed path into bucket
and prefix which doesn't make sense for filesystem.

The commit will just send the path of the removed object.

Co-authored-by: Anis Elleuch <anis@min.io>
2022-08-03 08:33:04 -07:00
Harshavardhana cf428f1188 support in-place rewrite of objects in heal and convert the format (#4175) 2022-08-03 05:46:31 -07:00
Harshavardhana 69c0129cc7 remove sysinfo from errorIf with globalDebug (#4178)
remove sysinfo from errorIf without globalDebug

Bonus remove unused error BucketNameTopLevel and
fixes #4177
2022-08-02 17:00:08 -07:00
Ashish Kumar Sinha 16ff57a0ef add errors to admin top api command (#4176) 2022-08-01 12:43:32 -07:00
Shireesh Anjal edd633ff2f Save api key passed as argument in config (#4157)
When the account api key is passed to `mc license register` via the
`--api-key` flag and after the registration is successful, save it to
minio config, so that it can be used automatically in subsequent calls.

Also stop extracting and storing api key from the response of SUBNET
register api.
2022-07-31 22:44:23 -07:00
dorman 37a83f23f0 change rm color on the terminal (#4171)
fixes #4165
2022-07-29 12:17:16 -07:00
dorman 11d3bace31 rm: add fake message with --fake (#4170)
fixes #4166
2022-07-29 11:03:24 -07:00
Anis Elleuch 624e3c1606 Remove isURLPrefixExists() call (#4173)
isURLPrefixExists() is used after url2Stat() function to check if the
given aliased URL corresponds to an existing prefix in the server. However,
 url2Stat() is already doing that and returns valid information for
those prefixes.

Removing isURLPrefixExists() all together.
2022-07-29 10:43:20 -07:00
Shireesh Anjal 3d2dea913f Use madmin-go version 1.4.9 (#4169) 2022-07-28 13:10:30 -07:00
Shireesh Anjal a80947bfe8 Validate license against deployment id (#4161)
The command `mc license update` should error out in case the deployment
id from the license doesn't match the cluster.
2022-07-28 08:37:47 -07:00
Harshavardhana c7570bd54a introduce net.Conn deadlines to avoid hung connections (#4164)
fixes #4133
2022-07-27 08:21:05 -07:00
Shireesh Anjal 9de421ffd4 New offline registration flow (#4156)
Instead of asking the user to

- open the subnet register page
- paste the registered token
- copy the generated license token
- paste it back on mc

Now we will simply ask the user to visit a subnet URL (which contains
the registration token as a query parameter). On visiting this page,
subnet will automatically register the cluster and generate a license
for it.

User can then optionally update the license on mc using 
the `mc license update` command
2022-07-26 23:21:06 -07:00
Anis Elleuch c32a438045 Add admin bucket info command (#4109)
Print bucket usage and configuration (encryption, policy, ILM, etc..)
2022-07-25 10:42:12 -07:00
Poorna 015134b2b7 Add mc replicate diff cmd to show unreplicated objects (#4127) 2022-07-23 19:25:13 -07:00
Anis Elleuch 657b6315fc support perf to execute all speed tests (#4158)
This commit will make `mc support perf <alias>` to execute all
performance tests, networking, drive and object speed tests.

perf will only have --duration and --verbose flags.

The user can still test with 'drive', 'object', and 'net' but they will
be hidden for now along with their flags.
2022-07-23 18:58:57 -07:00
Harshavardhana 95e6947f9c remove sysinfo from --json mode without --debug (#4159) 2022-07-23 18:57:57 -07:00
Taran Pelkey 537ad9468a Add support for NewerNoncurrentVersions (#4153) 2022-07-22 15:29:30 -07:00
Anis Elleuch 1c1ee7a5a4 info: Show pools summary of a erasure cluster (#4162)
Also fix the assumption that each node has one pool, so print all pools
indexes that belong to a particular node
2022-07-21 07:30:50 -07:00
Klaus Post cb7f9b6db2 Add mc cat --tail and --offset (#4149)
Allow range requests for cat operations, either specifying tail or an absolute offset.

If tail is longer then fail, the entire file is listed.
2022-07-18 21:22:10 -07:00
Shireesh Anjal 603857371c Add license update command (#4155) 2022-07-18 18:54:45 -07:00
Klaus Post 48e9183957 Move mc admin top scanner -> mc admin scanner info (#4151)
Also, add `mc admin scanner trace` which gives a simplified trace 
with only relevant options.
2022-07-15 02:20:55 -07:00
Harshavardhana 288e8e3678 update madmin-go to v1.4.5 (#4154) 2022-07-13 22:22:35 -07:00
Shireesh Anjal 7b20dc2958 Move support register to license register (#4150)
Also, introduce a new command `license info` to print information 
from the license (when the license is available)
2022-07-13 18:25:30 -07:00
Ashish Kumar Sinha add7b7b881 add mc ping command (#4074) 2022-07-11 09:16:12 -07:00
Minio Trusted afa79f2bd7 update minio-go to v7.0.31
for local files there is a significant
memory reduction by moving back the
multipart upload implementation to use
unbuffered implementation.
2022-07-10 22:32:40 -07:00
Krishnan Parthasarathi 11771955b3 fix: tier-add help (#4148) 2022-07-08 08:47:12 -07:00
Shireesh Anjal 81c4a5ad6e Add --api-key flag to mc support register (#4144) 2022-07-06 07:54:36 -07:00
Aditya Manthramurthy 811d7e5edb Add commands to manage external IDPs (#4131)
This adds the set, info, ls and rm commands
2022-07-05 18:19:13 -07:00
Klaus Post 01b87ecc02 Upgrade madmin (#4145)
Upgrade madmin to fix trace regression.
2022-07-05 11:08:30 -07:00
Harshavardhana 58860ccb15 reset timer after the function body is finished (#4143)
reset timer after the function body is finished

this is needed to make sure to wait "expected" amount
of time, otherwise the timer has already fired (negating
the wait of your function body)
2022-07-02 08:45:00 -07:00
Klaus Post 82a6c4f20f Add admin top scanner & trace --call=scanner (#4130)
mc: Add admin top scanner & trace --call=scanner

Examples:
```
λ mc admin top scanner myminio
Scanner Activity: ●∙∙
+-------------------------------------------------------------------------------------------------------+
| Last full scan time:   0d0h5m; Estimated 7358.44/month                                                |
| Current cycle:         129439; Started: 2022-06-22 18:01:50.5775259 +0200 CEST                        |
| Active disks:          1                                                                              |
| -------------------------------------- Last Minute Statistics --------------------------------------- |
| Objects Scanned:       101 objects; Avg: 3.775ms; Rate: 145440/day                                    |
| Versions Scanned:      10001 versions; Avg: 31.998µs; Rate: 14401440/day                              |
| Versions Heal Checked: 200 versions; Avg: 1.394ms; Rate: 288000/day                                   |
| Read Metadata:         101 objects; Avg: 0ms                                                          |
| ILM checks:            10001 versions; Avg: 408ns                                                     |
| Check Replication:     10001 versions; Avg: 3.646µs                                                   |
| Verify Deleted:        0 folders; Avg: 0ms                                                            |
| Yield:                 59.083s total; Avg: 584.978ms/obj                                              |
| ------------------------------------- Currently Scanning Paths -------------------------------------- |
| 127.0.0.1:9002/d:/data/distxl-plain/s2/d1/warp-benchmark-bucket/qwrShN3c/405.M(nsCrNI(PZhkAqA.rnd     |
+-------------------------------------------------------------------------------------------------------+
```

```
λ mc admin trace --call=scanner myminio
2022-06-22T18:04:12.705 [SCANNER] scanner.ScanFolder 127.0.0.1:9002 d:\data\distxl-plain\s2\d4 warp-benchmark-bucket/ajJkH6Ic/2425.mLeCC9gkg)7aQxfJ.rnd 15.2171467s
2022-06-22T18:04:28.022 [SCANNER] scanner.ScanObject 127.0.0.1:9002 d:\data\distxl-plain\s2\d4 ajJkH6Ic/304.SAWTkh9)WJrnZF7l.rnd/xl.meta 1.0691ms
2022-06-22T18:04:27.922 [SCANNER] scanner.ScanFolder 127.0.0.1:9002 d:\data\distxl-plain\s2\d4 warp-benchmark-bucket/ajJkH6Ic/304.SAWTkh9)WJrnZF7l.rnd 209.3969ms
2022-06-22T18:04:28.232 [SCANNER] scanner.ScanObject 127.0.0.1:9002 d:\data\distxl-plain\s2\d4 ajJkH6Ic/405.(kO1pyUPMdhsaXev.rnd/xl.meta 1.0531ms
2022-06-22T18:04:28.131 [SCANNER] scanner.ScanFolder 127.0.0.1:9002 d:\data\distxl-plain\s2\d4 warp-benchmark-bucket/ajJkH6Ic/405.(kO1pyUPMdhsaXev.rnd 207.7757ms
2022-06-22T18:04:28.440 [SCANNER] scanner.ScanObject 127.0.0.1:9002 d:\data\distxl-plain\s2\d4 ajJkH6Ic/506.E726EiB(GNLfSLro.rnd/xl.meta 1.0317ms
...
```
2022-07-01 16:04:04 -07:00
Praveen raj Mani c29c4a38a6 Implement mc ready to check if the cluster is ready or not (#4101)
Also adds option to check if the cluster has enough read quorum and if
the cluster is taken down for any maintenance.

Uses madmin.AnonymousClient for invoking the requests
2022-07-01 12:02:25 -07:00
Shireesh Anjal 5afc2bdfad Add support status command (#4140)
Will print following information:

- Is the cluster registered
- Is pushing logs to SUBNET enabled
- Is pushing callhome info to SUBNET enabled
2022-07-01 11:20:35 -07:00
Harshavardhana bf1145af1e update minio-go/v7 to v7.0.30 (#4136) 2022-06-28 05:09:02 -07:00
Eng Zer Jun 264d21c65a refactor: replace strings.Replace with strings.ReplaceAll (#4135)
strings.ReplaceAll(s, old, new) is a wrapper function for
strings.Replace(s, old, new, -1). But strings.ReplaceAll is more
readable and removes the hardcoded -1.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-06-27 03:59:09 -07:00
Minio Trusted 5212e42ded update to RedHat UBI 8.6 2022-06-26 12:44:40 -07:00
Ashish Kumar Sinha 40ee1a4ed6 change admin console to support logs show (#4132) 2022-06-26 11:51:48 -07:00
Poorna b1d8ca83f2 admin: add admin cluster iam import/export cmd (#4102) 2022-06-26 11:36:48 -07:00
Shireesh Anjal 78f844a357 Save license at the time of registration (#4123)
Currently we only extract the `api_key` from SUBNET's registration api
response and store it in the minio subnet config. The response contains
license also, and it can be useful in getting information about the
subscription. So this PR enhances the register command to extract and
store the license also.
2022-06-26 11:35:31 -07:00
Harshavardhana 17f5b7b11c add further license banners in default 'help' output (#4129) 2022-06-22 09:41:02 -07:00
Aditya Manthramurthy 2754c91048 Switch to last commit time based release (#4128) 2022-06-17 11:16:51 -07:00
Anis Elleuch 0e44ad30db Update version printing to include more information (#4125)
Show licence, copyright header and platform in addition to mc version.
2022-06-16 13:17:03 -07:00
Harshavardhana fc1d65b6e8 filter out hidden flags from error printing (#4122) 2022-06-16 09:45:16 -07:00
Anis Elleuch b0e8574969 Healing finish estimation time relies on disk usage space (#4124)
Do not rely on the disk scanner's total object numbers.

Also, remove healing MRF from the calculation for simplicity.
2022-06-16 09:43:53 -07:00
Harshavardhana a9a7b7a225 fix: help output formatting for cluster bucket export/import 2022-06-15 13:34:24 -07:00
Harshavardhana ce9e444740 add unfreeze command to 'unfreeze' S3 API calls (#4121) 2022-06-15 13:29:14 -07:00
Shireesh Anjal 80ae287b02 Add commands to enable/disable callhome and logs (#4107)
- Remove the get/set options under `callhome`
- Move logs settings to a separate command (`mc support logs`)
- Provide toggle options (`enable, disable, status`) for both the
commands

In case of logs (`mc support logs enable|disable|status`),

`enable` configures minio to push logs to SUBNET in real-time by
configuring the webhook `logger_webhook:subnet`
`disable` disables the webhook
`status` displays whether it is enabled or disabled

In the case of call home (`mc support callhome enable|disable|status`),

`enable` configures minio to automatically push callhome info to SUBNET
every 24hrs by setting the config `callhome enable=on`
`disable` disables callhome by setting `enable=off`
`status` displays whether it is enabled or disabled
2022-06-15 09:14:52 -07:00
Harshavardhana 127d84854d improve UI for driveperf inspired from object perf test (#4118) 2022-06-14 23:09:58 -07:00
Poorna a59de0d37e add import/export bucket metadata command (#4087) 2022-06-14 10:55:58 -07:00
Harshavardhana d2960d67ce extend Go's time.ParseDuration to support days, weeks and years (#4116) 2022-06-13 04:18:38 -07:00
Harshavardhana 36d5749991 improve UI for netperf inspired from object perf test (#4117)
Refer for the behavior https://asciinema.org/a/501270
2022-06-13 04:17:28 -07:00
Harshavardhana fc64e84829 fix: 'mc admin top api' IOPs, RX/TX remove them (#4115)
The current implementation didn't cater to concurrency
factor i.e X calls happening in parallel so the
resulting values for IOPs, RX, and TX were all skewed,
change this to print totals instead.

We need to bring moving average behavior to know
the overall IOPs, RX, TX per second here.

Will bring this change subsequently, keep it simple
for now.
2022-06-10 17:37:20 -07:00
Shireesh Anjal 7a6a43046c Improve success message in support register cmd (#4108)
Change the success message on cluster registration to `{alias}
registered successfully`.

When the `mc support register` command is run for an already registered
cluster, show the message `{alias} updated successfully` to indicate
that updated information about the cluster was sent to SUBNET.
2022-06-10 15:12:40 -07:00
Harshavardhana 50669cafa6 ignore remove errors for WORM protected objects (#4111)
this error is similar to insufficient permission
on local folders, we can proceed to remove whatever
objects we can.
2022-06-10 15:12:16 -07:00
Aditya Manthramurthy d42880acb1 Bump up linter version (#4114)
- Add Go 1.18 to CI
- Appears to be needed for Go 1.18
2022-06-10 15:12:05 -07:00
Harshavardhana 250c0e4e59 update help for 'mc admin top api' 2022-06-10 11:09:54 -07:00
Harshavardhana e19fcb8daf feat: Add 'mc admin top api' for realtime view (#4112)
This is just a beginning but this can be enhanced further
to have different views of S3 calls, internal calls, and
disk/storage calls.
2022-06-10 11:02:26 -07:00
Anis Elleuch abfc6709b0 heal: Fix single disk healing ETA reporting (#4113)
ETA disk during healing was not accurate especially when the number of
files is low. The reason is that the estimation is based on time.Now()
though heal info in the server side is only updated each minute.

Use heal info last update field instead of time.Now().
2022-06-10 07:17:00 -07:00
Shireesh Anjal e9d27aef5c fix: callhome get error when subnet hook not set (#4089)
When there is no SUBNET webhook configured in the cluster (which is the
default state), the `mc support callhome get` command fails as it tries
to fetch the `logger_webhook:subnet` setting which doesn't exist.

Fixed by ignoring the specific error that says the sub-system target
doesn't exist, and printing `logs=off` in such cases.
2022-06-03 10:24:25 -07:00
Poorna 591858cd1a Fix replicate status detail summary (#4104)
refactor display to report consistent status by ARN

Fixes issue: #4105
2022-06-02 20:11:09 -07:00
Harshavardhana 6e2ed46cb4 add hidden force-delete option (#4097) 2022-05-30 12:51:43 -07:00
Harshavardhana 30fd595df6 cleanup print message for 'support profile' (#4099)
use single logging style, we do not use
`go` logger in `mc` avoid it.
2022-05-30 06:24:31 -07:00
Harshavardhana 8f7accb135 update go deps for yaml.v3 and minio-go 2022-05-29 17:56:24 -07:00
Claudio B 1cff14a109 regression: update golang.org/x/crypto (#4096) 2022-05-26 20:07:32 -07:00
Shireesh Anjal 03e876aeaa Hide mc support callhome command (#4091)
As the functionality is not fully ready yet.
2022-05-23 09:58:29 -07:00
Anis Elleuch 6c0d5e4b65 alias: Enable self signed TLS prompt in darwin platforms (#4094)
Not trusted TLS error message has another string representation in
Darwin platform. Since there is no another way to test for this specific
error with Golang API, we will need to support this alternate error message.
2022-05-23 06:36:11 -07:00
Harshavardhana 83d81ea590 fix: SubKeyId may not be same AuthorityKeyId for self-signed CA (#4093)
In situations when cert is its own CA the SubKeyId is not
same as AuthorityKeyId

Refer
https://cs.opensource.google/go/go/+/refs/tags/go1.18.2:src/crypto/x509/x509.go;l=1525

This PR handles this by validating the SubKeyId with correct value
that is expected, extends the current TOFU style.
2022-05-23 05:13:20 -07:00
Shireesh Anjal 907555c849 Deprecate --name flag from support diag (#4092)
Earlier the `support diag` command used to work even when the cluster
was not registered with SUBNET. In such cases, it used to pass the value
of `--name` flag as the cluster name to be set on SUBNET.

Now it errors out if the cluster is not registered. i.e. It expects the
cluster to be already registered with SUBNET, which means it already has
a name. Hence the `--name` flag is meaningless.

Removing the code that used this flag, and marking it as hidden and
deprecated.
2022-05-19 10:35:19 -07:00
Harshavardhana 1b1a5940ab add JSON flag support for decom status (#4086) 2022-05-16 16:09:53 -07:00
Ashish Kumar Sinha aa60a8db1e modify support profile command (#4061) 2022-05-12 06:43:21 -07:00
Anis Elleuch 8ca59cdebf trace: Show milliseconds in trace output (#4083)
Trace output without --verbose was always missing milliseconds precision
due to a typo in the code. This commit fixes the issue.
2022-05-11 10:17:36 -07:00
Krishnan Parthasarathi b5a0640899 Prefix version suspension (#4064) 2022-05-08 18:15:17 -07:00
Pablo Hinojosa b5937c68bc doc: Fix broken link (#4072) 2022-05-08 17:19:27 -07:00
Harshavardhana 0d9d42166a avoid cascading deletes for active-active setups (#4079)
This PR in-turn ends up supporting cascading deletes
for `mc mirror` setups when you have

```
mc mirror --watch alias1 alias2
mc mirror --watch alias2 alias3
```

IT still avoids cyclical deletes such as

```
mc mirror --watch alias1 alias2
mc mirror --watch alias2 alias1
```
2022-05-06 16:14:21 -07:00
Poorna 844139d52d Fix example for mc admin replicate edit (#4080) 2022-05-06 11:42:07 -07:00
Ashish Kumar Sinha d62c1e2418 Add admin prometheus metrics (#4049) 2022-05-05 23:38:16 -07:00
Shireesh Anjal 4e8402e46f Use latest version of madmin-go (1.3.13) (#4075)
Contains a new structure for Kubernetes information that will be
returned in the health report (mc support diag)
2022-05-05 04:21:35 -07:00
Krishnan Parthasarathi f126341342 Add support for minio warm tier (#4009) 2022-05-04 16:45:46 -07:00
DanielMcKracken 5619a78ead update golang.org/x/crypto (#4068) 2022-04-29 07:42:08 -07:00
Harshavardhana 04161f5e19 fix: support autocompletion for command aliases (#4070) 2022-04-28 13:55:44 -07:00
ksonj c586b4c06e Document setting multiple policies (#4065)
*
2022-04-28 12:50:32 -07:00
Anis Elleuch 19952de324 Fix client-s3 Stat() for prefix with parallel lower prefixes (#4069)
client-s3.Stat() does not properly detect a prefix when there is another
lower one,

e.g: Stat() of 'dir/' fails when there is 'dir-name/' in the same parent
prefix.
2022-04-28 12:50:01 -07:00
Klooven 7c229abb05 fix: README.md rename config to alias (#4062) 2022-04-26 17:27:16 -07:00
Prakash Senthil Vel 276e1db70d Error message when update failing due to permissions (#4057) 2022-04-26 04:30:21 -07:00
Anis Elleuch 162609d6d0 info: Add the count of total versions details (#4060)
admin info command will show the total number of versions of a
deployment, if available.
2022-04-25 22:05:56 -07:00
Harshavardhana 32dfeaaf6b update minio/pkg to v1.1.22 2022-04-25 19:45:34 -07:00
Ashish Kumar Sinha cc4ff3a0cc Remove cpuio as default in profiling (#4056) 2022-04-19 08:54:41 -07:00
Nick Doornekamp 0530f5a471 Update documentation for --older/newer-than flags (#4039) 2022-04-16 08:10:14 -07:00
Harshavardhana e964a37a3f update minio/pkg deps 2022-04-15 19:51:00 -07:00
Anis Elleuch 606cdd3453 Load proxy config when probing for server TLS certificate (#4052)
mc alias set recently started to probe the TLS certificate for
the remote server, however it should load the proxy environment
configuration if any.
2022-04-15 16:49:57 -07:00
Anis Elleuch 1187be0ad2 mirror: Do not create remote bucket with --dry-run (#4054)
In a site wide mirroring, non existing buckets in the destination site
are still created if --dry-run is passed. This commit will avoid this.

This commit also prints a mirror message of the newly created buckets
in a site wide mirroring.
2022-04-15 16:49:28 -07:00
Anis Elleuch 6a61b286b1 mirror: Stop minio-go bucket listen when watch is cancelled (#4053)
When mirror in --watch mode is restarted, the previous minio-go
ListenNotification/ListenBucketNotification call is not properly
canceled. This commit creates a new context for that listen call and
cancels it when client-s3 Watch() is asked to be stopped.
2022-04-15 16:49:13 -07:00
Harshavardhana 792c6c1475 update minio-go/v7, minio/pkg deps 2022-04-15 00:38:49 -07:00
Ashish Kumar Sinha 1a504e6e64 Replace fake with dry-run (#4050) 2022-04-14 06:49:57 -07:00
Gabriel Dolberg 8e6b9c8a49 fix usage message wording (#4048) 2022-04-13 13:27:25 -07:00
Ashish Kumar Sinha 8df32e87d6 Add mutex, threads and cpuio as default in profiling (#4046) 2022-04-12 00:08:34 -07:00
jinapurapu 45c6f376c4 Error handling for remove alias request if alias not found (#4017) 2022-04-11 13:26:40 -07:00
Harshavardhana 2a5195f2d2 update to latest madmin-go v1.3.11 2022-04-08 16:20:13 -07:00
Anis Elleuch 3f0953f9f4 Do not rely on contentCh to print removal messages (#4041)
Removal is an asynchrounous operation. We should not use structures that
we send to the removal goroutine and use them in removal messages.
2022-04-07 11:52:55 -07:00
Shireesh Anjal dbc09a8bf0 Get speedtest results as part of support diag (#4034)
Also remove the `--full` flag and run the new perf tests (that run quite
fast) always (if the minio version supports it).

In case of older versions of minio that have the older versions of the
performance tests, mc will not request for those tests to be run, and
subsequently will not look for their results in the response.
2022-04-07 08:12:51 -07:00
Daniel Valdivia 42bb4df233 Simplify mc ilm ls (#4042)
Signed-off-by: Daniel Valdivia <hola@danielvaldivia.com>
2022-04-05 12:56:01 -07:00
Anis ElleuchandAnis Elleuch d9feb87286 Compute bucket/object correctly for some endpoints (#4040)
Removing an old code that calculates incorrectly the bucket and object
from the client-s3.targetURL. The old code assumed that
client-s3.targetURL can have this style
http://bucket.endpoint/prefix/object but this is not true.

client-s3.targetURL will always have this endpoint style
https://endpoint/bucket/object whenever vhost is enabled or not for a
given alias.

Co-authored-by: Anis Elleuch <anis@min.io>
2022-04-04 18:47:08 -07:00
Anis ElleuchandAnis Elleuch 661afae983 mirror: Do not exit upon errors when --watch is passed (#4032)
Currently, when mirror is not able to copy an object (e.g. corrupted)
and watch is specified, mirror will restart mirroring again to stop
again at the same problematic object.

Co-authored-by: Anis Elleuch <anis@min.io>
2022-04-02 16:16:34 -07:00
Anis ElleuchandAnis Elleuch 033969a0bf rm: Fix sending an object/version to removal with --no-current flag (#4038)
Do no miss sending object/version to contentCh when there is deletion
result available.

This commit fixes issues seen when some objects/versions are not deleted
when --no-current is passed.

Co-authored-by: Anis Elleuch <anis@min.io>
2022-04-02 16:14:23 -07:00
PoornaandPoorna Krishnamoorthy 5a3ad93ab9 `mc rm --non-current should remove top level deletemarker (#4037)
Earlier commit #8eae2e3bbfafe952ecb33904c0d9073871a32169 reverted
this behavior, bringing it back

Co-authored-by: Poorna Krishnamoorthy <poorna@minio.io>
2022-04-01 16:39:16 -07:00
PoornaandPoorna Krishnamoorthy dc2a851b54 Make sure to print mc rm dry run message (#4033)
Co-authored-by: Poorna Krishnamoorthy <poorna@minio.io>
2022-04-01 01:19:02 -07:00
PoornaandPoorna Krishnamoorthy 8eae2e3bbf Fix mc rm --non-current to use --older-than filter if specified (#4030)
This PR also changes the interpretation of --non-current flag to delete
all non current versions that qualify irrespective of whether top level
version is a delete marker.

Co-authored-by: Poorna Krishnamoorthy <poorna@minio.io>
2022-03-30 16:21:42 -07:00
Shireesh Anjal 4d7b58bac5 Fix message in admin subnet health (#4019) 2022-03-30 12:03:50 -07:00
Gabriel Dolberg 9c34f6c94b Typo: Fix error messages on service account operations (#4026) 2022-03-30 11:55:55 -07:00
Poorna d6ffdbc8fb admin trace: convert trace type to string in json fmt (#4029) 2022-03-25 01:52:53 -07:00
Harshavardhana 84a7b83eda use globalRootCAs always do not initialize new certPools
automatic prompt for certs broke system trusted tls endpoints
since it ignored the currently loaded certs as trusted.

if they are available and we can establish TLS we should
proceed instead of failing and asking users to always use
`--insecure`
2022-03-17 12:56:43 -07:00
Anis Elleuch de063f9252 Fix alias add when --insecure is passed in a non tty (#4025)
--insecure does not have an effect when running mc in a non-terminal. This
commit fixes the behavior by ignoring the prompt from trusting self
signed certificate when --insecure is passed as well.
2022-03-17 10:35:24 -07:00
Harshavardhana b01f48836a replicate add should enable all replication types by default (#4021)
fixes #4020
2022-03-16 13:06:05 -07:00
Andreas Auernhammer 3252573ed2 alias: fetch peer certificate when adding an alias (#4010)
This commit adds an extension to the `alias set`
command. When adding an alias fails due to a TLS
trust error - i.e. remote peer certificate verification
fails - `mc` fetches the remote peer certificate,
computes the public key fingerprint and asks the user
to confirm the fingerprint.

When the user confirms the fingerprint, the certificate
is added to the `CAs` directory.

This allows users to use a TOFU authentication with
self-signed certificates - similar to SSH.

Signed-off-by: Andreas Auernhammer <hi@aead.dev>
2022-03-16 10:00:25 -07:00
Anis Elleuch 0f31ce23b9 mv: Fix regression when checking lock in target bucket (#4015)
A recent commit changed the behavior of client-s3.GetObjectLockConfig()
without properly checking the behavior of the callers introducing a bug
during mv command where the target is an S3 server.

Add some tests for the mc mv command as well.
2022-03-11 15:10:02 -08:00
Anis Elleuch 869c875967 svcacct: Show successful message after deletion (#4016)
Fix some typo that prevented the command to print a success message
when a service account is deleted.
2022-03-11 15:09:46 -08:00
Poorna bd00af5a71 Allow remote target endpoint to point to different host (#4012) 2022-03-08 17:42:16 -08:00
Krishna Srinivas def1988b92 Implement "mc support perf net" for network throughput test (#3998) 2022-03-08 11:30:42 -08:00
Harshavardhana f13defa545 update some wording and docs under tier commands (#4007) 2022-03-01 17:12:26 -08:00
Shireesh Anjal a7a9b65237 Remove --schedule flag from support diag command (#4003)
Going forward, periodic upload of diagnostics is not expected to be
performed using the `support diag` command.
2022-03-01 10:53:59 -08:00
Anis Elleuch 88b984a6e2 more validation for retention commands (#4004) 2022-03-01 10:53:43 -08:00
Krishnan Parthasarathi 9aa7712c43 Add support for tier-rm/tier-verify (#3996) 2022-03-01 10:53:09 -08:00
Klaus Post 0d5acd8820 Fix arm FreeBSD build (#4006)
Fixes #4005

Tested with `GOOS=freebsd GOARCH=arm go build .`.
2022-03-01 10:23:05 -08:00
supriyo-biswas 9de0045882 Quote special characters in share curl command (#4000)
* Quote special characters in share curl command
* Add testcases and other unsafe chars
2022-02-28 12:25:19 -08:00
Anis Elleuch cce6451b63 watch: Clean up watch when restarting mirror after an error (#3993)
Add cleanup for watch code when it exits and mirroring is restarted.
2022-02-25 20:15:21 -08:00
Harshavardhana a1d6c3d4af remove trimming of top level path 2022-02-25 18:10:25 -08:00
Klaus Post 5488be0c8b Add cpuio profile type (#3988) 2022-02-25 10:46:22 -08:00
jinapurapu 9cf722a3aa Updated help text to clarify alias (#4001) 2022-02-24 16:04:29 -08:00
Anis Elleuch 096fbbf24a mirror: Proper cleanup after exit (#3994) 2022-02-24 14:24:22 -08:00
Harshavardhana af342c3780 update wording of svacct command line 2022-02-24 13:31:00 -08:00
Harshavardhana d7846dab9e update CREDITs file for new deps 2022-02-24 12:59:29 -08:00
Harshavardhana b44a7642ed update go mod tidy -compat=1.17 2022-02-24 12:58:21 -08:00
Krishnan Parthasarathi 2cae86c783 tier-info: Add bar charts for 24hr dailys tier-stats (#3928) 2022-02-24 12:51:21 -08:00
Harshavardhana 620455a22c update minio-go/v7 to v7.0.23 2022-02-22 18:50:59 -08:00
Harshavardhana dec8d91dbc fix: rename 'perf drives' to 'perf drive' (#3991) 2022-02-22 10:13:07 -08:00
Shireesh Anjal f4f5932d3f Add mc support callhome get command (#3986)
* Add `mc support callhome get` command

Will print all the callhome settings (currently just `logs=on|off`)

* Rename retrieveCallhomeSetting to printCallhomeSetting

As it doesn't need to return anything, and only prints the setting.
2022-02-21 15:47:31 -08:00
Anis Elleuch 3902b3b03f Refactor profiling and add goroutines (#3992)
Running mc like this,

`MC_PROFILER=mem,goroutine mc ...` will start profiling and save
profiling data when mc quits with Control-C.
2022-02-21 14:50:51 -08:00
Harshavardhana c7a8815414 fix: rm should reject --non-current with --recursive (#3987) 2022-02-18 02:59:34 -08:00
Shireesh Anjal 99bdf20c64 Remove cli flag subnet-proxy (#3989)
System now supports setting the subnet proxy as a config, so the command
line flag is not required anymore.
2022-02-17 11:05:53 -08:00
Harshavardhana 3b15bec803 update minio-go to v7.0.22 2022-02-16 10:40:26 -08:00
Harshavardhana c5e56141bd fix: admin info output for multiple pools (#3985)
fixes #3984
fixes #3976
2022-02-16 10:35:24 -08:00
Shireesh Anjal 220f7c217a Fix cluster registration failing when proxy not set (#3983) 2022-02-15 04:03:39 -08:00
Klaus Post 2f42260f98 Add remote zip support to mc ls/cp/cat (#3977)
--zip flag is hidden for now
2022-02-15 03:09:39 -08:00
Harshavardhana a11a264933 extend 'mc support inspect --export=json' to export JSON directly (#3981)
this is essentially the same code at
https://github.com/minio/minio/tree/master/docs/debugging/xl-meta

--export option provides exporting 'xl.meta' information as 'JSON'
or export the inlined-data 'JSON' that represents 'version-id' and
the corresponding size of the inlined data.

This essentially now provides full visibility of the inspected data
that is captured, extracts and converts into some parseable
JSON.
2022-02-15 01:52:18 -08:00
Shireesh Anjal c7537a171f Improve descriptions of support commands (#3982) 2022-02-14 02:48:56 -08:00
Shireesh Anjal 65efe40a82 Use subnet proxy from minio config if available (#3969)
minio now supports storing the proxy to be used for connecting to subnet
in the `subnet proxy` config. So mc can use it if available when
communicating with subnet during cluster registration or diagnostics
upload.
2022-02-13 22:13:27 -08:00
Shireesh Anjal f65871e305 Move admin speedtest to support perf (#3966)
related to drives and objects sub-commands
2022-02-13 22:13:06 -08:00
Shireesh Anjal ab2bce93ea Move admin profile to support profile (#3972)
As part of reorganization of support related commands
2022-02-13 16:08:52 -08:00
Shireesh Anjal 7b93343803 Move admin inspect to support inspect (#3971) 2022-02-13 15:38:06 -08:00
Poorna c579c0b403 Add subcommands to mc replicate resync (#3964)
This PR adds `start` and `status` subcommands for
managing replication resync
2022-02-13 15:36:24 -08:00
Harshavardhana c595efe440 fix: some inconsistencies in 'mc support' command 2022-02-13 15:21:46 -08:00
Harshavardhana cb1daf1567 simplify wording for mc replicate edit and default sane values (#3980) 2022-02-11 17:07:53 -08:00
Harshavardhana 2be75594d0 simplify wording for mc replicate add and default sane values (#3978) 2022-02-11 16:36:37 -08:00
Harshavardhana ed42cdc3a8 fix: alias import comment formatting (#3979) 2022-02-11 13:27:48 -08:00
jinapurapu 8e3b5ebc46 Add alias import command (#3958) 2022-02-11 10:15:02 -08:00
Shireesh Anjal 5d50c9beb9 Error out from support diag if cluster not registered (#3970)
If user tries to run `mc support diag` for a cluster that is not yet
registered, error out asking the user to register the cluster first.
2022-02-11 09:28:15 -08:00
Poorna 9b6f6cdbb4 Add admin replicate remove command to allow removal of sites (#3919) 2022-02-10 18:50:11 -08:00
Sidhartha Mani 006c48c51c add admin speedtest drive command (#3939) 2022-02-10 17:53:39 -08:00
Klaus Post e71b1c80b4 Skip Shell check on Windows (#3973)
Fixes `mc: <ERROR> Failed to enable autocompletion. Cannot 
determine shell-type and SHELL environment variable found: exit status 1.` 
on Windows.
2022-02-10 17:52:02 -08:00
jinapurapu 548dc0fd99 Added help message if no arguments passed to mc alias set command (#3963) 2022-02-09 03:14:03 -08:00
Harshavardhana 3a7a724753 error out when bucket not found with proper exitcode (#3959)
fixes #3953
2022-02-08 12:23:17 -08:00
Shireesh Anjal 5960c628f3 Move admin-subnet commands to support (#3949) 2022-02-08 10:05:36 -08:00
Harshavardhana dabc6c598e set bucketName always in RemoveResult response (#3957) 2022-02-04 12:21:02 -08:00
Harshavardhana cb7674133a make sure backendType is looked up properly 2022-02-04 12:14:06 -08:00
Harshavardhana 98bc432b53 add pool id as part of 'mc admin info' output (#3954) 2022-02-04 12:05:16 -08:00
Christian Muehlhaeuser e048c85d71 fix: don't query terminal on startup (#3956)
This change bumps the lipgloss and termenv dependencies, which prevents
the terminal from being OSC-queried on startup. Additionally, OSC
queries will never be run if the process isn't in control of the
terminal, for example when started in the background / detached.

Fixes #3955.
2022-02-03 20:46:44 -08:00
Harshavardhana f5cd21bcf0 update container images for ubi-8.5 2022-02-03 09:40:49 -08:00
Klaus Post 8ad226ca83 du: Add object counts (#3950) 2022-02-03 09:39:15 -08:00
Harshavardhana fd6d470242 update container image to ubi-8.5 (#3948) 2022-02-02 10:15:49 -08:00
Poorna a7147d221d Change mc admin replicate status ui to have additional filters (#3936) 2022-02-01 15:51:09 -08:00
Shireesh Anjal af7c550f26 Add command to configure callhome options (#3940) 2022-02-01 15:50:39 -08:00
Harshavardhana f5596de2fe ignore expiration and expires from JSON output (#3947) 2022-02-01 15:50:09 -08:00
Christian Muehlhaeuser 8a0d1134bb fix: don't block if terminal does not respond to OSC query (#3946)
This aborts OSC queries after a timeout, and prevents mc from getting
stuck when encountering unresponsive or non-compliant terminals, like
CircleCI's.

Fixes #3938.
2022-02-01 10:01:06 -08:00
apendragon 3f23cdd921 honor --bypass flag for 'mc retention' command (#3945)
Fixes #3944
2022-01-29 09:20:38 -08:00
Harshavardhana 829153f47c update go.sum - go mod tidy 2022-01-28 16:23:20 -08:00
Poorna ccbc1ff725 Add mc admin replicate edit command (#3908) 2022-01-28 16:22:14 -08:00
Harshavardhana 3e28003f82 fix: admin speedtest verbose output \n (#3943) 2022-01-28 16:21:37 -08:00
Aditya Manthramurthy 6d12396b47 Add option to mc admin policy info to save policy JSON to file (#3914) 2022-01-28 16:21:28 -08:00
Villena Guillaume 9914c8187e Allow storageclass to be specified on mc ls (#3915) 2022-01-28 14:42:21 -08:00
Harshavardhana 43524f7978 remove quota FIFO support (#3942) 2022-01-28 14:41:44 -08:00
Harshavardhana f06a4b20a3 add missing 'mc admin inspect' examples (#3934) 2022-01-28 14:41:35 -08:00
Anis Elleuch 0c58d62a1f Fix mirror with relative fs path (#3929)
mc diff <alias>/<bucket>/ ./dir/ is not calculated correctly because the
difference code relies on the format of the argument, for example,
whether it is dir/ or ./dir/ or ../my/dir/.

This commit will calculate the absolute path of the passed argument if
it is a filesystem path and uses it through the code.
2022-01-28 10:19:21 -08:00
Christian Muehlhaeuser 068e19a7e4 fix: do not query terminal when running in a CI context (#3941)
This prevents mc from querying the terminal via OSC when running in a
CI context, like CircleCI. As the CI never responds to the query we
get stuck in a read we can not cancel.

Fixes #3938.
2022-01-28 08:57:53 -08:00
Harshavardhana 16249f3587 add amount of time 'service restart' took (#3935) 2022-01-24 14:18:11 -08:00
d-tork 7656636373 docs: add example instructions for IBM cloud storage (#3932) 2022-01-24 08:37:25 -08:00
Anis Elleuch fd70dd59c6 heal: Add verbose flag to heal command (#3927)
For deployments which has many disks, it is annoying to list all disks
by default. Add --verbose flag to only show the status of all disks.
2022-01-21 08:51:18 -08:00
Anis Elleuch 2f9bcdf344 typo: Error out if the policy is already set in policy update cmd (#3931)
Fix a typo when checking if a policy is already set to a user or a
group.
2022-01-21 08:46:49 -08:00
Harshavardhana dd01c71445 use actual UTF-8 characters instead of \u for readability 2022-01-16 16:57:51 -08:00
Harshavardhana ac39184c35 make UI changes to speedtest bring a more cleaner spinner (#3921)
- Removes flickering of spinner
- Moves to a more maintained library bubbles spinner
- Adds better visual formatting for table output
2022-01-16 12:21:55 -08:00
Poorna d2b7c3c3ac update admin replicate info output format (#3920) 2022-01-14 18:53:23 -08:00
Harshavardhana 91278da28d 'decom status' progress and UI improvements 2022-01-12 21:52:33 -08:00
Harshavardhana 0ddf3e2691 implement pool decomission commands (#3769) 2022-01-10 22:35:35 -08:00
Harshavardhana 1264168162 sufficiently colorize svacct command outputs (#3917)
also print help when no args passed, instead of asking
for `--help`

fixes #3803
2022-01-10 08:55:23 -08:00
Poorna aed4d3062f Add admin replicate status command (#3887) 2022-01-06 13:50:28 -08:00
Harshavardhana 61db086b10 run gofumpt as part of golang-ci 2022-01-06 13:21:58 -08:00
Harshavardhana a59f9e4d30 add gofumpt support, automated cleanup (#3911) 2022-01-06 10:55:40 -08:00
Harshavardhana 8b3935e24d error out if --non-current is used without --versions (#3910) 2022-01-06 02:05:21 -08:00
Harshavardhana 0373840f42 turn-off auto-tuning only when --concurrent is specified (#3909) 2022-01-05 15:36:59 -08:00
Harshavardhana 8132c286e4 rm: fix printing when deleting content 2022-01-05 00:28:46 -08:00
Klaus Post eef80d47cd find: Fix --exec parsing (#3907)
Find would replace placeholders before splitting input, meaning files with spaces would be executed as separate args.

Split before replacing args, and use shell-style parsing.

Technically, this requires quotes in input to be escaped, so to specify `--exec='echo {""}'` you must escape them like this: `--exec='echo {\"\"}'`. Quoted inputs aren't documented, but it is a change.

Errors would not be displayed, like `./mc find play/test123/ --exec='unknown {}'` would just exit. Instead it now prints `exec: "unknown": executable file not found in $PATH`.

Fixes #3906
2022-01-03 23:56:55 -08:00
Harshavardhana 37e0f8ba27 update all dependencies for mc 2021-12-31 14:58:08 -08:00
Harshavardhana 05c3ae8716 fix: admin heal info output for multiple pools (#3905)
locally setup multiple pools was showing incorrect
values where secondary pool was ignored, also fix
possible estimate correction if needed.
2021-12-28 22:50:11 -08:00
Harshavardhana f06a0987a3 rm: print proper paths instead of just objectnames for S3 endpoints 2021-12-28 18:37:48 -08:00
Anis Elleuch 3391f39521 mirror: Sort bucket names with slash for site wide scenarios (#3894)
mc diff/mirror command fails to compare source & target when doing
an S3 site-wide listing.

The reason is that client-s3.List(), when doing a site-wide listing,
lists buckets first and list objects inside each bucket with the order
returned by S3 ListBuckets API.

However this can produce a non properly sorted listing output,
e.g.:

```
$ mc ls -r myminio/
[2021-12-14 15:58:27 CET] 227KiB bucketname/object1
[2021-12-14 15:58:24 CET] 227KiB bucketname-0/object2
```

Though it should be
```
$ mc ls -r myminio/
[2021-12-14 15:58:24 CET] 227KiB bucketname-0/object2
[2021-12-14 15:58:27 CET] 227KiB bucketname/object1
```

because '/' has a higher ASCII value than '-'

This commit fixes the behavior by always sorting bucket names with
a fake trailing slash when doing a site-wide recursive listing.
2021-12-28 17:49:45 -08:00
Harshavardhana e08ded6d28 display when delete markers are created (#3904) 2021-12-28 17:48:54 -08:00
Harshavardhana 3144cb97ed remove retry in difference() comparator (#3903)
it is potentially harmful when retrying
a lot of buckets where in this might
trigger a retry - continous Listing()

however this retry is not needed as the
callers restart as needed when --watch
or --active-active are used.
2021-12-27 09:16:15 -08:00
Klaus Post 12012eafad du: Fix double counting of objects (#3901)
`mc du play` would count objects twice since it was doing a recursive listing AND travering into folders.

Compare total to `mc du play --depth=2` and `mc du play --recursive`.
2021-12-22 08:21:52 -08:00
Dean Kleissas 385bc1b23a Set default value for --event flag of omitted (#3752) 2021-12-21 02:16:36 -08:00
Ravind Kumar 0b2f0c9b48 Fix mc ilm restore --help (#3897) 2021-12-20 14:23:47 -08:00
Krishnan Parthasarathi 409ccc7c07 Update go.mod to include NewerNoncurrentVersions support (#3898)
With this `mc ilm import` accepts NewerNoncurrentVersions tag.
2021-12-20 14:23:35 -08:00
Anis Elleuch 7bd5c343f7 heal: Show healed objects count even if healing start time is unknown (#3896)
mc summary should still show some information when some disks report
healing in progress but without started time.
2021-12-16 08:36:38 -08:00
Anis Elleuch 68a9e3f52e ux: Fix admin heal display with multiple zones (#3893)
mc admin heal was showing additional unnecessary entries 
of nodes with empty disks listing when that node does not 
belong to the current pool number. A node only belongs to 
one pool, so remove the extra entries.
2021-12-14 09:43:38 -08:00
Aditya Manthramurthy 7031efb55a Update admin policy/user commands with new policy info API (#3877)
will support older minio versions as well
2021-12-11 09:04:32 -08:00
Harshavardhana 2d516d350a Allow specifying many aliases in MC_CONFIG_ENV_FILE (#3885)
Allows for getting ENV secrets remotely, or from
secure vault secrets.
2021-12-11 08:29:11 -08:00
Harshavardhana 2a84f0f1f9 disable IPv6 locally for all interfaces before docker build 2021-12-09 17:51:31 -08:00
Harshavardhana 9bdd7660f6 remove support for go1.16 2021-12-09 12:16:18 -08:00
Shireesh Anjal b6c50a92a1 Use subnet api key instead of license (#3876)
The earlier approach of using a license token for communicating with
SUBNET is being replaced with a simpler mechanism of API keys. Unlike
the license which is a JWT token, these API keys will be simple UUID
tokens, and don't have any embedded information in them. SUBNET would
generate the API key on cluster registration, and return in the API
response. mc then stores it in the `subnet api_key` config of minio,
to be used for subsequent communication with SUBNET.

In case the api_key is not available in the config, but the cluster's
license is available, it will be used as auth in the subnet API call,
and api_key will be set after the call succeeds. This will help in
smooth migration from older versions of MinIO.
2021-12-09 09:40:27 -08:00
Krishnan Parthasarathi 23a05f5a17 Update ilm-add examples (#3884)
Hide date options like expiry-date and transition-date to 
avoid unintended consequences explained here -
  
https://docs.aws.amazon.com/AmazonS3/latest/userguide/intro-lifecycle-rules.html#intro-lifecycle-rules-actions
  
> If you specify an S3 Lifecycle action with a date that is in the past, 
> all qualified objects become immediately eligible for that Lifecycle action.
2021-12-07 15:06:06 -08:00
Anis Elleuch bd7a49f500 tags: Show how to assign two tags to an object (#3881)
mc cp --tags is able to assign more than one tag to an object, 
enhance the example to show that.
2021-12-06 09:39:13 -08:00
Harshavardhana 8a207df2ab avoid double formatting svacct policy (#3878) 2021-12-02 08:48:13 -08:00
Krishnan Parthasarathi cb73b76c81 Add tier-info command for tier-specific stats (#3827) 2021-11-29 09:10:00 -08:00
Anis Elleuch e84871950a speedtest: Ask the user to increase duration with empty result. (#3875)
Sometimes, with slow machines, speedtest will not able to accomplish
any PUT/GET operations though no errors is met. In that case, this
commit will show an adequate error message asking the user to increase
the --duration flag.
2021-11-29 09:05:33 -08:00
Anis Elleuch a064265d0c svcacct: Validate policy document and error out if needed (#3873) 2021-11-27 14:47:48 -08:00
Harshavardhana 4793c40bf6 remove HTML tags from README.md 2021-11-22 00:42:08 -08:00
Harshavardhana 18a579da0b Set theme jekyll-theme-minimal 2021-11-22 00:37:50 -08:00
Shireesh Anjal df75eed32e Use latest version of madmin-go (#3866)
It contains a new field `TLSInfoAvailable` which will get added under
the `tls` node in health report, helping `health-analyzer` perform the
TLS related checks more reliably.
2021-11-18 14:30:26 -08:00
Harshavardhana 26e7e49cd7 honor cgroup memory limits in parallel-manager (#3871) 2021-11-18 14:30:02 -08:00
Shireesh Anjal d0c62eb584 Fix health upload to subnet failing (#3870)
The writer needs to be closed before creating the request. Otherwise the
call to subnet api fails with error like:

HTTP/1.x transport connection broken: http: ContentLength=6235 with Body length 6303.
2021-11-16 08:37:08 -08:00
Harshavardhana 3a4e469334 feat: detect starting from windows explorer (#3869)
Windows users often click on the binary without
knowing `mc` is a command-line tool and should be
run from a terminal. Throw a message to guide them
on what to do.
2021-11-16 00:21:48 -08:00
Harshavardhana ae66e893c7 with --force flag no need for exit code (#3868)
fixes #3673
2021-11-15 10:00:12 -08:00
ebozduman 7fd441ec6c Removes Windows path adjustment for prefixes (#3614) 2021-11-14 21:21:00 -08:00
Krishnan Parthasarathi 6460d2facf Update go.mod to include support for MaxNoncurrentVersions (#3863) 2021-11-12 16:18:15 -08:00
Harshavardhana b2ff347c69 cleanup 'admin health' command (#3862)
- reach subnet, upon failure provide `--airgap` command line
  to allow them to upload report manually.

- use a proper httpClient when reaching out to subnet
  with a 10sec timeout, and also support custom proxies
  with self signed certs.

- also fix some error messages and cleanup help with correct
  wording and grammar.
2021-11-12 09:34:29 -08:00
Shireesh Anjal b882f3e484 Better message on reset of dynamic config (#3861)
When a dynamic config is reset, the minio api response has `true` as
value of the header `x-minio-config-applied`. In such cases, mc should
not show the message asking the user to restart `minio`.
2021-11-11 06:49:13 -08:00
Shireesh Anjal 1461b652d9 Introduce admin health command (#3847)
It will be a hidden command and will behave 
exactly same as `mc admin subnet health`

Also, remove the deprecated command `admin subnet obd`
2021-11-09 16:36:02 -08:00
Poorna K a776222b33 Uppercase tier name in admin tier add cmd (#3849) 2021-11-09 16:35:32 -08:00
Harshavardhana e7c79413d7 fallback to bucket retention info for only bucket names (#3860) 2021-11-08 09:49:56 -08:00
Harshavardhana 9b5d0ba1ef update Dockerfile files 2021-11-05 03:29:49 -07:00
Harshavardhana 9f6b500142 update go.sum 2021-11-04 23:51:20 -07:00
Krishna Srinivas 9e8fea96ca Show live updates for speedtest (#3855) 2021-11-04 23:50:28 -07:00
Robert LütznerandRobert Lützner 6e1d044f91 admin-trace: Add missing asterisk to --path example in usage (#3857)
Limiting tracing to a specific path requires an asterisk at the end. I
don't know if this is a regression or the example was always wrong. I
only ever figured this out by trial and error.

This fixes #3856.

Co-authored-by: Robert Lützner <robert.luetzner@iternity.com>
2021-11-03 09:34:32 -07:00
Shireesh Anjal c0cfc9c507 Fix usage validation in mc admin service restart (#3859)
The command needs exactly one argument, but was allowing two and
ignoring the second if passed. Fixed the validation.

Signed-off-by: Shireesh Anjal <shireesh@minio.io>
2021-11-03 09:33:01 -07:00
Shireesh Anjal 905502e311 Fix subnet health crash on passing invalid flag (#3858)
The custom `String()` function written for the `HealthDataTypeFlag` was
resulting in a crash as it did not contain `\t` character on which the
usage gets split when printing the error message.

Fixed by reusing the `FlagStringer` from cli package, which is used by StringFlag.String() as well.
2021-11-03 09:32:36 -07:00
Poorna KandPoorna Krishnamoorthy 14303ec6cf fix --disable-proxy flag in admin bucket remote add command (#3851)
Co-authored-by: Poorna Krishnamoorthy <poorna@minio.io>
2021-10-29 12:05:56 -07:00
Harshavardhana 7866f97ef5 Revert "Remove unused Transport option. (#3818)"
This reverts commit bc69976481.

This option is used by console
2021-10-26 19:49:40 -07:00
Harshavardhana 6339784743 update gjson to avoid CVE-2021-42836 2021-10-25 20:56:15 -07:00
Shireesh Anjal b9bfcb50a3 Fix subnet login during registration not working (#3841)
Subnet doesn't return `ContentLength` in it's api response, and hence
using it as the limit with `LimitReader` doesn't work. Fixed by using a
sufficiently large (1 MiB) limit.
2021-10-20 21:15:00 -07:00
Shireesh Anjal b493f01699 Update go.mod to use latest version of madmin-go (#3839)
So that the TLS config related data gets added in the health report.
2021-10-20 10:26:36 -07:00
Shireesh Anjal e45d648ce9 Rename --offline flag to --airgap (#3837)
Retain `--offline` as hidden for backward compatibility (won't show up
in help)
2021-10-18 09:49:52 -07:00
Aditya Manthramurthy 3177a62819 Add functional tests to test sanity of users in internal IDP (#3838) 2021-10-18 08:41:14 -07:00
Harshavardhana ae271e7645 add new linters and fix unnecessary type conversions (#3835) 2021-10-14 15:33:31 -07:00
Klaus Post 0eef0174a7 inspect: Save data unencrypted by default (#3832)
By default decrypt the data. Add `--encrypt`.
2021-10-12 11:49:49 -07:00
Daniel Jakots b880f09931 fix: build on 32-bit systems (#3732) 2021-10-12 02:08:54 -07:00
Ori Hoch 6047ef858a fixes minio/mc#3830 servers without lock returns locking disabled (#3831) 2021-10-11 14:26:23 -07:00
Shireesh Anjal e4d4bf6641 Add register sub-command to mc admin subnet (#3808)
By default, it will run in `online` mode and try to register the cluster
on subnet. If the subnet license is not available in minio/mc config, it
will

- ask the user for login credentials
- use the credentials for authentication and call the registration api
- get the license from response of the api and store it in config
- use the stored license for any subsequent calls

In case the user belongs to multiple organizations in subnet, they will
be prompted to choose the appropriate organization from the list.

If the client machine is in an airgapped environment, user can choose to
use the `--offline` flag when running the command. In this case, it will

- generate and print the registration token
- ask the user to paste it in the subnet registration screen
- accept the license generated by subnet and store it in config

As part of this work, the `health` sub-command is also enhanced to:
- run in `online` mode by default, which tries to upload the health
report to subnet. Here the user will be prompted for subnet credentials
(if license not available in config) _before_ generating the health
report as it is a long running process.
- support a new flag `--offline` which can be used when subnet is not
reachable. When used, the health report will be generated in a local
json.gz file, which can then be uploaded on subnet.

The examples in help text of both the sub-commands are enhanced to list
multiple use cases.

When saving license to config, first preference is given to minio
config. If the minio server supports the `subnet license` key, the
license will be stored here. In case it is an older version of minio
that doesn't support this key, then the license will be stored in mc
host config.
2021-10-07 11:20:28 -07:00
Aditya Manthramurthy 198bca9cdf Add new admin replicate subcommand (#3810)
This change adds support for enabling site replication
2021-10-06 16:57:01 -07:00
Krishnan Parthasarathi 054cfa0103 ilm-edit: Accept zero days for transition (#3824) 2021-10-06 13:34:41 -07:00
Anis Elleuch 6b329ce01f rb: Fix side wide removal of an alias (#3796)
* rb: Fix side wide removal of an alias

rb --force --dangerous should remove all buckets under an alias. This
PR fixes a recent regression.
2021-10-06 09:56:57 -07:00
Harshavardhana 44a597a9f9 allow removal of replica/ilm event-types (#3823) 2021-10-06 09:24:12 -07:00
Shireesh Anjal 55c6a1fccc fix: incorrect spinner for network perf test (#3813)
In case of non-distributed setup, the server doesn't return network perf
data. Because of this, the network spinner doesn't finish, and is closed
explicitly outside the loop, resulting two lines (one incomplete, one
complete) for it.

Fixed by explicitly checking the number of servers when checking for
completion of the network spinner.
2021-10-05 17:00:41 -07:00
Anis Elleuch 026cfa16c5 admin info: Show 'OK' in yellow when offline networks/disks (#3814)
In mc admin info output, it is better to show 'OK' status in yellow and
not in green when there is a failed disk or a failed network link so it
is easier for users to detect something wrong.
2021-10-05 17:00:27 -07:00
Krishnan Parthasarathi 924df70b33 Add support for immediate tiering (#3816) 2021-10-04 12:19:48 -07:00
Shireesh Anjal 6c41669342 health: perform only lightweight tests by default (#3820)
Perform only lightweight tests by default, and include the long running
tests only if specified through a `--full` flag in the `admin subnet
health` command.
2021-10-04 09:03:19 -07:00
Anis Elleuch 1aa0f47736 ilm: Correctly show tags in tabular info when this non AND tag (#3819)
Tag can be set directly under Filter tag and not always under
Filter.And in the lifecycle document. In that case, the tag won't be
properly showed in the tabular info of the ILM listing. This PR fixes
it.
2021-10-01 11:59:15 -07:00
Klaus Post bc69976481 Remove unused Transport option. (#3818) 2021-10-01 11:41:34 -07:00
Harshavardhana 88544fee85 update all dependencies in go.mod (#3812) 2021-09-29 22:05:43 -07:00
Klaus Post 7e6f46fba6 Bump CI Go versions (#3811)
* Bump CI Go versions
* Fix changed fmt.
* Only check vet on one version.
* Bump minimum go version in go.mod
* Add Darwin test.

Replaces #3807
2021-09-28 09:19:52 -07:00
Anis Elleuch 1bcd5df300 Add ilm restore command (#3790) 2021-09-24 09:32:39 -07:00
Krishnan Parthasarathi 368b4106d7 Disallow updating azure tier account-name (#3805) 2021-09-23 10:57:39 -07:00
Anis Elleuch 445414dc0c svcacct: Colorize svcacct output (#3806) 2021-09-23 10:01:37 -07:00
Harshavardhana 2d01434415 update madmin-go and minio-go dependency 2021-09-22 15:08:05 -07:00
Anis Elleuch fa0aa1e45f heal: More verbose information (#3795)
heal info now shows the list of all MinIO nodes and the status of disks,
OK, unformatted, healing with an estimation of the time of healing
completion. It also shows the tolerance of nodes/disks, meaning how many
nodes or disks we can turn off before losing read operation in the
cluster.
2021-09-22 14:39:59 -07:00
ebozduman 5a8f677304 Windows support for copying local files to object storage (#3666) 2021-09-22 14:38:56 -07:00
Anis Elleuch 4e4c912b37 Order mc admin info output by endpoint (#3804)
To make easy for users to navigate through the list of servers.
2021-09-21 09:08:28 -07:00
Ashish Kumar Sinhaandsinhaashish a8bf2a463b Add global flags to edit tier command (#3802)
Co-authored-by: sinhaashish <ashish@minio.com>
2021-09-17 07:09:00 -07:00
Krishna Srinivas e576844f0f Erase the spinner on speedtest completion (#3800) 2021-09-16 17:25:17 -07:00
Krishna Srinivas d7bc62efa6 Show spinner during speedtest (#3799) 2021-09-16 15:39:12 -07:00
Poorna Krishnamoorthy 77a4c9f9e5 update minio-go dependency (#3797) 2021-09-16 15:30:10 -07:00
Harshavardhana 1f997000a3 trace: multiple values for headers are ',' separated (#3798) 2021-09-16 08:55:08 -07:00
Ashish Kumar Sinha 1f2429c336 validation for namespace removal (#3783) 2021-09-15 11:34:41 -07:00
Poorna Krishnamoorthy 6bf64d9704 Add multisite replication support in mc replicate cmd (#3766)
Also adding a flag to `mc replicate reset` to allow 
granular replication reset by target
2021-09-15 10:32:28 -07:00
Krishna Srinivas 24456eb990 Support speedtest autotuning on the server side (#3777) 2021-09-14 23:29:49 -07:00
Shireesh Anjal 56b22c37fc fix: subnet health spinners not working properly (#3788)
The "admin info" step was moved from being the first step to the last
step in minio at some point, but the sequence of spinners in mc was not
updated with this change. Because of this, the first spinner itself used
to get stuck for the whole duration of report generation.

Fixed by correcting the sequence of spinners to make them in sync with
the processing in minio.

Signed-off-by: Shireesh Anjal <shireesh@minio.io>
2021-09-08 08:01:55 -07:00
Kaan Kabalak 4e56329bae Replace 'none' in 'mc anonymous get/set' with 'private' (#3792)
This commit replaces the 'none' policy with 'private' for the
'mc anonymous get/set' command without breaking 
backward compatibility
2021-09-07 19:10:13 -07:00
Harshavardhana e7d3f4637a update CREDITS, add quay.io/minio/mc:latest 2021-09-02 11:24:57 -07:00
Klaus Post f661334f3d doc: Update diff table (#3778) 2021-09-01 16:47:57 -07:00
Anis Elleuch 7f37854b02 parallel-manager: Reduce parallelism when there is not enough memory (#3629)
Some users with low memory and good connection uploading some big files
can see memory crash, since mc will increase upload parallelism over
time when the bandwidth and the server is able to carry the load.

This PR will check the free OS memory before starting mirror/cp and will
estimate current memory usage based on uploaded objects sizes, it will
stop parallelism until the memory gets some room.
2021-09-01 09:07:26 -07:00
Shireesh Anjal ef90b8b3dd Add sys services and config spinner in subnet health (#3772)
Signed-off-by: Shireesh Anjal <shireesh@minio.io>
2021-08-31 11:17:58 -07:00
Artem Yarmoliuk 855333e4ab Update x/sys to support go 1.17 (#3779)
See: https://github.com/golang/go/issues/45702
2021-08-25 10:56:52 -07:00
Anis Elleuch 0667914d16 rb: --force flag forces bucket removal after BucketNotEmpty err (#3780)
Some users struggle to remove a bucket when they don't use recommended
setups, such as NFS disks.

This command will force bucket removal in server side, using
x-minio-force-delete during DELETE bucket call.
2021-08-23 07:10:41 -07:00
Harshavardhana c19d58bb88 add 'mc update' progress bar support (#3782) 2021-08-21 21:01:31 -07:00
Anis ElleuchandAnis Elleuch a88acb58d4 fix: Avoid crash when asking for no existing transition/expiry info (#3771)
mc ilm ls has --expiry and --transition to show for only expiry or
transition information, but if one of them doesn't exist, mc crashes.
The PR fixes this.

Co-authored-by: Anis Elleuch <anis@min.io>
2021-08-17 14:11:09 -07:00
Harshavardhana 43b03a8532 support 'mc rm --non-current' to delete non-current objects (#3768) 2021-08-10 18:29:22 -07:00
Klaus Post b3ce21fb72 Add mc admin inspect (#3754)
Add function to download data from server with admin privileges.

For https://github.com/minio/minio/pull/12635
2021-08-06 06:42:23 -07:00
Shireesh Anjal 539a6b5654 Add sys errors spinner in subnet health output (#3760)
The subnet health report generation now includes collection of system
errors. So add a spinner for this step too in the screen output of the
command.

Signed-off-by: Shireesh Anjal <shireesh@minio.io>
2021-08-05 22:30:19 -07:00
Krishna Srinivas bc5835e680 feat: admin speedtest implementation (#3759) 2021-07-29 18:18:58 -07:00
Harshavardhana 4af8b2d20b do not prematurely default multipart to 16MiB 2021-07-27 08:42:07 -07:00
Harshavardhana addaf66de8 fix: do not prematurely error out during Heal() (#3762) 2021-07-26 08:01:59 -07:00
Harshavardhana c3ab68ed1e allow configuring multipart size for testing (#3761)
add MC_UPLOAD_MULTIPART_SIZE, MC_UPLOAD_MULTIPART_THREADS
to test in situations when default values are not enough
for showing proper bandwidth usage.
2021-07-23 09:21:59 -07:00
Harshavardhana 7dafdaf88e rename policy to anonymous command (#3755)
although keep `policy` command hidden
for backward compatibility.
2021-07-19 08:49:28 -07:00
Harshavardhana c319567430 do not print config values in base64 (#3757)
fixes #3696
2021-07-19 08:29:20 -07:00
Anis Elleuch bfafb96632 heal: Refactor info output (#3730)
mc admin heal <alias> will show simplifed output which aggregates MRF &
new disks healing.

e.g.:

```
$ mc admin heal myminio/
Objects Healed: 7/27 (25.9%), 31 MB/110 MB (0%)
Heal rate: 3 obj/s, 10 MB/s
Estimated Completion: 11 seconds

```
2021-07-16 09:51:00 -07:00
Emir İşman 05ec684549 deps: update jwt-go dependency (#3756) 2021-07-10 13:37:58 -07:00
Harshavardhana 5e95eea60c fix: openbsd/amd64 cross compilation 2021-07-04 00:46:58 -07:00
Shireesh Anjal db1b1bd811 fix: health report incompatibility with old minio (#3751)
When the subnet health command from current mc is used with the MinIO
versions before the latest health data structure changes (v2) were
introduced, the generated report doesn't contain the cluster information
(minio -> info).

This is because these old versions of minio don't return this
information in the output of the `healthinfo` api.

Fixed this by explicitly pulling the server info separately when we
detect that the health schema version is not v2.
2021-07-01 10:04:08 -07:00
Klaus Post a1ba511f16 trace: Display times in local timezone (#3750)
Make sure times are converted to local time zone.
2021-06-29 08:48:12 -07:00
Harshavardhana cebf331854 update minio/pkg to v1.0.8 2021-06-25 17:21:08 -07:00
Poorna Krishnamoorthy 2c52cdf27c Add flag to mc replicate for existing object replication (#3698)
This allows triggering a resyncing of previously
replicated objects when existing object replication is
enabled. It is useful in scenarios where replication target
is entirely lost and content needs to be replicated again.
2021-06-12 18:02:25 -07:00
Harshavardhana 776643ff2a fix: remove legacy path for prometheus (#3743)
additionally add `--public` flag for unauthenticated
prometheus config.
2021-06-12 09:47:30 -07:00
Anis Elleuch b70da9cbcb mirror: Add S3 latency metric (#3679)
Add a new metric called: `mc_mirror_replication_duration`, which shows
the histogram of replication time of different categories of object
sizes
2021-06-11 21:21:15 -07:00
Harshavardhana 9242dbdf69 add support for quay.io mirror 2021-06-11 16:51:03 -07:00
Klaus Post 7c0ab1b2d5 Add single line json output (#3739) 2021-06-11 14:40:16 -07:00
Harshavardhana 27d0ea67cb remove legacy errors from docs
fixes #12474
2021-06-09 10:24:38 -07:00
Poorna Krishnamoorthy c8d9eee2b4 Add options to enable|disable proxy,sync for remote target (#3701)
Also allow URL endpoint, bandwidth limit, healthcheck-duration
and path to be updated for an ARN.
2021-06-07 18:11:38 -07:00
Poorna Krishnamoorthy 6a2b118473 tier: support using aws role for s3 (#3736)
Signed-off-by: Poorna Krishnamoorthy <poorna@minio.io>
2021-06-07 13:44:30 -07:00
Anis ElleuchandKlaus Post a06096f8ee du: Use recursive listing when no detailed report is asked (#3737)
mc du will always count the size of all objects under a specified
path, du -r will show the disk usage in a more detailed fashion, but if
not specified, let's do a recursive LIST call instead of calling du()
multiple times.

Co-authored-by: Klaus Post <klauspost@gmail.com>
2021-06-03 08:19:04 -07:00
Harshavardhana 87092404e0 fix: 'mc admin tier' CLI fix typos (#3734) 2021-06-01 15:00:06 -07:00
Harshavardhana 4b7e85d7e9 reduce memstats information in 'admin info' 2021-06-01 11:25:23 -07:00
Bala FA fbbae711bd Add new health data structure support. (#3687)
`mc admin subnet health` command supports new health data structure
and versioning of health API.

Signed-off-by: Bala.FA <bala.gluster@gmail.com>
2021-05-30 20:02:40 -07:00
Harshavardhana 5b972bb7b0 update latest colorjson v1.0.1 2021-05-30 19:45:00 -07:00
Harshavardhana 91efd0c066 migrate mc to minio/pkg (#3731)
remove all dependency for minio/minio
2021-05-29 09:30:33 -07:00
Anis ElleuchandAnis Elleuch 9740a09584 restart: Avoid bad empty line (#3729)
Print '...' instead, for a distributed cluster, other characters will
follow to indicate the status of the restart command.

Co-authored-by: Anis Elleuch <anis@min.io>
2021-05-27 19:46:30 -07:00
Harshavardhana 8d65ee7130 fix: enhance support for special access/secretkeys in remote targets (#3725)
it latest release and master `mc admin bucket remote add` cannot
parse accesskeys/secretkeys with special characters such as `@`,
this is due to an incorrect implementation.

use the technique used in parsing MC_HOST_alias here to allow
for more complex use-cases.
2021-05-18 22:29:47 -07:00
Poorna Krishnamoorthy 6e251456d2 Add flag for replica sync to mc replicate command (#3722)
Signed-off-by: Poorna Krishnamoorthy <poorna@minio.io>
2021-05-17 14:11:51 -07:00
Shireesh Anjal 9714e1cf49 Use new URL for upload to subnet (#3720)
Old path: /api/auth/health_reports
New path: /api/health/upload

Signed-off-by: Shireesh Anjal <shireesh@minio.io>
2021-05-15 22:20:22 -07:00
Harshavardhana 60d3646baf attr is optional for mc pipe
fixes #3718
2021-05-12 09:27:36 -07:00
Harshavardhana 7d142be711 support parsing special tags after releaseTag 2021-05-11 19:51:36 -07:00
Krishnan Parthasarathi deb714784c Add mc admin tier subcommands (#3566)
Signed-off-by: Krishnan Parthasarathi <kp@minio.io>
2021-05-11 19:42:49 -07:00
Klaus Post 757b9d6872 pipe: Add custom attributes and tags (#3706)
Support adding custom attributes and tags.

Examples included.
2021-05-11 19:35:58 -07:00
Harshavardhana 954f0a5fd1 add fips build support for mc 2021-05-11 18:25:46 -07:00
Harshavardhana ac08bf41a7 fix: gofmt on some files 2021-05-11 17:46:41 -07:00
Harshavardhana 077fff35dd update CREDITS file with latest deps 2021-05-11 17:45:49 -07:00
Harshavardhana 1402987ccb change license to AGPLv3 2021-05-11 17:45:08 -07:00
Anis Elleuch 0c11cf9f28 Update minio-go for a fix in ILM (#3716)
Signed-off-by: Anis Elleuch <anis@min.io>
2021-05-11 14:11:15 -07:00
Shireesh Anjal e207f3bfa4 Fix incorrect error related to "name" flag (#3714) 2021-05-10 19:48:14 -07:00
Harshavardhana 073c9c6308 remove fetchUserKeys _contrib 2021-05-10 10:13:23 -07:00
Harshavardhana 8cf4031ef5 add some self contained functions to contrib
remove chinese doc translations, move docs to CC-BY 4.0 license
2021-05-10 09:38:59 -07:00
Harshavardhana dfbedf9f3a update madmin-go to v1.0.2 2021-05-06 16:34:09 -07:00
Harshavardhana 6c3ac00e18 update madmin to github.com/minio/madmin-go (#3710) 2021-05-06 13:33:17 -07:00
Shireesh Anjal 8c4a2698d9 Add --schedule and --name flags to subnet health (#3685)
* Add --schedule flag to subnet health command

If passed along with --license, the health diagnostics will be executed
and uploaded to Subnet at given schedule (in days).

Also, delete the generated file after succesful upload to subnet.

* Add --name flag to subnet health command

If passed along with the --license flag, this will be passed as the name
of the cluster in the subnet upload request. Subnet uses this only for
the 1st upload of the given cluster.

If not passed, the alias of the cluster will be passed as default value
for the cluster name.
2021-05-06 10:31:33 -07:00
Anis ElleuchandAnis Elleuch a62d2b4659 svcacct: Print password when generating a new service account (#3709)
Sometimes passwords are auto-generated, print them so the user can
easily copy it somewhere.

Signed-off-by: Anis Elleuch <anis@min.io>

Co-authored-by: Anis Elleuch <anis@min.io>
2021-05-05 17:22:38 -07:00
Poorna Krishnamoorthy c4890d949b trace: display time in UTC format (#3708) 2021-05-03 11:52:16 -07:00
Bala FA af1676e6ec admin.subnet.health: add-flag-to-support-subnet-proxy (#3692)
Signed-off-by: Bala.FA <bala.gluster@gmail.com>
2021-04-26 09:45:50 -07:00
Anis Elleuch 4eae7ec7ed Add support of service account commands (#3650)
Signed-off-by: Anis Elleuch <anis@min.io>
2021-04-22 10:17:34 -07:00
Harshavardhana 36c17891d6 update build to use go1.16 2021-04-22 10:07:50 -07:00
Harshavardhana 37f5eff195 fix: use madmin constants 2021-04-21 16:52:21 -07:00
Poorna Krishnamoorthy 20e5905de0 Add mc replicate status command (#3684) 2021-04-21 14:05:17 -07:00
Anis Elleuch a17153cf9e admin: Implement a better restart command UX (#3618)
mc admin restart service clearly indicates to the user that restarting
the process is started and also shows progress using:

 `.` in red to indicate the cluster is still offline
 `!` in yellow to indicate the cluster is up but still initializing
2021-04-21 14:05:06 -07:00
Anis Elleuch c00c7e3a35 admin: Add policy subcommand to user (#3648)
mc admin user policy will download all 
policies JSON linked to a user and 
merge them into one.
2021-04-19 07:35:52 -07:00
Harshavardhana d8393a365e fix: mirror monitoring cli to be --monitoring-address (#3695)
fixes #3693
fixes #3694
2021-04-18 09:11:45 -07:00
Anis Elleuch 78e3c94f5a trace: Make evaluation filters more user friendly (#3642)
Currently trace filters are like OR operations, but I think in debugging
we want AND instead.

Currently, --status-code 503 --path 'bucket/path'  will show 503 requests or
requests with 'bucket/path', this PR will require having both conditions
in the requests in order to be shown in the trace.
2021-04-16 08:56:26 -07:00
ebozduman ef59238007 Adds error exit codes for SIGINT, SIGTERM and SIGKILL (#3662) 2021-04-15 16:58:49 -07:00
Poorna Krishnamoorthy b537ee408b report bandwidth limit in --json mode (#3688)
for `mc admin bucket remote ls`

This PR also removes label for a remote target
2021-04-15 16:58:13 -07:00
Anis Elleuch 4380288249 trace: Add support of older admin tarce API (#3683) 2021-04-07 12:25:53 -07:00
Shireesh Anjal 1ac898c382 Fix net perf spinner not finishing in subnet health (#3676)
In case of single server setups, the network performance data is empty.
Because of this, the condition that indicates that the network test step
is over never evaluates to true and hence the spinner doesn't finish
(doesn't show the tickmark indicating the step has completed).

While this is a nigligible issue in normal execution of the subnet
health command, it has a weird side effect when the `--license` flag is
passed. In such cases, the network test spinner finishes _after_ the
message about succesful generation of the report is printed.

Ensuring that all the spinners are stopped explicitly after the api call
returns resolves this issue.
2021-04-07 12:14:25 -07:00
Anis Elleuch a093f822e2 Avoid automatic copy of storage class (#3681) 2021-04-06 10:24:34 -07:00
Klaus Post 9f9f7ec542 trace: Add goroutines by default (#3664)
Goroutines are very often useful. Include them by default.
2021-04-06 09:23:01 -07:00
Harshavardhana e513a4f68f improve bandwidth monitor UI (#3680)
make the reporting UI more succint as below

```
┌──────────────────┬──────────────────────────┬───────────────────┐
│ Bucket           │ Configured Max Bandwidth │ Current Bandwidth │
├──────────────────┼──────────────────────────┼───────────────────┤
│ testbucket       │ N/A                      │ 4.4 kb/sec        │
└──────────────────┴──────────────────────────┴───────────────────┘
```
2021-04-05 16:07:00 -07:00
Harshavardhana 6074aa43ff add nodeName and path properly for os/storage calls (#3670) 2021-03-28 08:07:34 -07:00
Anis Elleuch 9914d28527 trace: Add support of Storage & OS tracing (#3663) 2021-03-27 05:38:57 -07:00
Poorna Krishnamoorthy 0ee9471197 trace: fix missing client info for ipv6 (#3661)
fixes: https://github.com/minio/minio/issues/11833
2021-03-24 03:50:02 -07:00
Anis Elleuch c3cae160b3 mirror: Add total_s3uploaded_bytes metric (#3646)
The new metric will track the total bytes of copied objects in the
target during mirroring.
2021-03-22 13:27:01 -07:00
Shireesh Anjal 1f71fdc03a Add option to upload health report to Subnet (#3641)
Add an optional text flag `license` to the `subnet health`
command. If this flag is passed, upload the generated health report to
Subnet by passing the license key as auth.
2021-03-22 09:26:09 -07:00
Harshavardhana 49e85e9109 reduce default part size upto 16MiB (#3654) 2021-03-19 09:10:36 -07:00
Anis Elleuch bac257a6e0 dep: Update minio/minio dependency for disk metrics (#3649)
After updating minio/minio dependency, mc admin info --json shows the
latency and the number of calls of each API in the POSIX layer.
2021-03-17 23:28:01 -07:00
Anis Elleuch e10c82f9ad cp: Add --tags to tag uploaded objects (#3644)
Applying tagging to objects copied in an S3 object using --tags flag.
2021-03-16 08:46:28 -07:00
ebozduman 501b791408 Fixes conflicting Failure&Successful msgs in 'mc rb' output (#3616) 2021-03-10 23:13:55 -08:00
Anis Elleuch ccb35f1672 mv: Fix panic and simply the code a little bit (#3640)
Also, mv did not consider --fake flag, fix it as well.
2021-03-10 23:12:04 -08:00
Ritesh H Shukla faa895dd75 Track remote replication bandwidth consumption (#3609) 2021-03-10 17:30:36 -08:00
Harshavardhana dde89f7604 add release build-arg for multiarch builds 2021-03-10 00:10:53 -08:00
Anis ElleuchandAnis Elleuch 28d8677578 mirror: Add monitoring endpoint for mirroring operations (#3636)
* mirror: Add monitoring endpoint for mirroring operations

The following are the added metrics:

mc_mirror_failed_s3ops 3
mc_mirror_time_last_activity 9
mc_mirror_total_restarts 3
mc_mirror_total_s3ops 199920

Also, --watch automatically restarted if an error is detected

Co-authored-by: Anis Elleuch <anis@min.io>
2021-03-09 09:38:35 +05:30
Anis Elleuch 1d9873c512 admin policy: Add unset & update command (#3638)
`unset` will remove policies from a user or a group
`update` will add new policies to a user or a group
2021-03-06 13:14:49 -08:00
Harshavardhana a8c6f751a7 update to latest minio master with healing struct changes 2021-03-04 17:09:55 -08:00
Harshavardhana 13cf091af6 update to latest minio master 2021-03-02 18:00:29 -08:00
Jackson Borchardt cb577322fd fix typo (#3631) 2021-03-02 09:53:28 -08:00
Shireesh Anjal f9d36f9b52 Update minio dependency to latest master branch (#3628) 2021-03-01 08:22:50 -08:00
Harshavardhana 56ea65a78e update go CREDITS 2021-03-01 00:21:17 -08:00
Harshavardhana 8bbd07802e update 'madmin' deps to latest master 2021-03-01 00:17:22 -08:00
Anis Elleuch e3b84c39df ilm: Fix edit ILM versioning parameters (#3626)
After the introduction of versioning parameter in mc ilm document, we
didn't test mc ilm edit. This PR fixes this behavior and add more
lifecycle validation for versioning parameters
2021-02-27 09:08:28 -08:00
ebozduman cb909f5ce5 Stops 'mc cp --attr' preserve file attributes without '--preserve' (#3625) 2021-02-25 09:32:44 -08:00
Anis Elleuch 18da584d5a session: Fix resuming cp/mv session (#3580)
Session files contained a colored json which leaded a problem with
unparsing it, use jsoniter instead of the colorjson when marshal
unmarshal session data.
2021-02-19 10:51:48 -08:00
Shireesh Anjal b3c692d6eb Ignore parallel net perf data when its empty (#3607)
When parallel net perf tests are not performed, for example in FS mode,
the server response contains an empty node for the net pef data with
value of `addr` as empty string (`""`).

This data should be ignored when mapping the server response to the
health report format. Otherwise we end up with a health report with an
empty server node under `hardware` section.
2021-02-16 19:35:39 -08:00
Anis Elleuch 0053d58648 rm: Better messages when buckets are empty (#3606) 2021-02-16 13:53:04 -08:00
Harshavardhana 97482653ac update go mod for latest changes in pkg/iam 2021-02-16 12:05:04 -08:00
Harshavardhana 7672841f8c update go mod for latest changes in pkg/iam 2021-02-13 00:45:25 -08:00
Anis Elleuch d759f195f2 trace: Add source IP in verbose mode (#3612)
Add the source IP information in the REQUEST trace line when the verbose
mode is enabled.
2021-02-12 21:32:08 -08:00
Anis Elleuch 006cb0c0cf mirror: Fix behavior under Windows when source url is S3 (#3611)
Removed one block of code which seems to be useless and no comment with
it. This was causing issue doing mirroring under Windows.
2021-02-12 21:31:34 -08:00
Aditya Manthramurthy 4eb6f999a6 fix: crash on invalid input to policy set (#3610) 2021-02-12 11:22:02 -08:00
Aditya Manthramurthy 7c0fb6a99e Fix user/group argument parsing (#3602) 2021-02-09 14:25:11 -08:00
Ritesh H Shukla f782b462c6 Do not print v2 prometheus metrics for older releases (#3600) 2021-02-09 10:34:39 -08:00
Shireesh Anjal 4942cffc2c Update minio dependency to latest master branch (#3601) 2021-02-09 09:50:40 -08:00
Poorna Krishnamoorthy c44387cb32 Add --sync flag to admin bucket remote add command (#3549) 2021-02-05 15:21:31 -08:00
Anis Elleuch e93ec078dc ilm: Fix adding ExpiredObjectDeleteMarker alone (#3596)
It is not possible to add rule with only ExpiredObjectDeleteMarker
activated. This commit fixes the issue.
2021-02-04 21:13:53 -08:00
Anis Elleuch 650a4b8d66 cp: Fix crash with recursive copy with non existant resource (#3592)
Fixing a recent regression introduced when copying a non
existent bucket or prefix when --recursive flag is passed.
2021-02-02 08:37:30 -08:00
Harshavardhana ade302d969 fix: suggestion format with 'mc admin config set' 2021-01-27 18:27:58 -08:00
Ritesh H Shukla 169aa24ae0 Update the URL for metrics (#3584) 2021-01-25 17:32:58 -08:00
Harshavardhana 24ebcf13cf fix: make listing consistent with top level delete marker (#3587)
```
~ mc ls s3/tbucket13/x.txt
[2021-01-25 13:24:09 PST]   525B z.txt
```

```
~ mc ls s3/tbucket132/x.txt
[2021-01-25 13:31:41 PST]   525B x.txt/z.txt
```
2021-01-25 14:39:16 -08:00
Anis Elleuch 130f4393bb cp: Copy recursive paths having the passed prefix (#3563) 2021-01-24 00:06:40 -08:00
Anis Elleuch 7e19044d98 ilm: Import aborts when lifecycle config does not have a rule (#3576)
Currently, there is a success message misleading the user, while what is
really happened is that minio-go SetLifecycle removes any existing
lifecycle configuration in the bucket.
2021-01-23 23:05:15 -08:00
Harshavardhana 1fd739cc50 update admin docs with expected 'admin info' output 2021-01-22 12:13:46 -08:00
Stuart Thomson 93d579a936 doc: Add section to README for use in GitLab CI (#3577) 2021-01-21 20:50:17 -08:00
Frederick ZhangandErsan 8760185bc3 Remove IsInstalled() call before auto-completion installation (#3548)
At the moment posener/complete [1] doesn't allow specifying shell for
IsInstalled(), which might lead to confusing error messages, since it
just returns true if it's able to find completion definition in *any*
shell configurations even if it's not what the user currently uses.

Hence we should remove this check and call Install() directly, and user
can get more details in this case.

[1] https://github.com/posener/complete

* Improve auto-completion installation handling as per @ebozduman
* Improve messages when user's using an unsupported shell
* Refactors mc auto-complete logic

Co-authored-by: Ersan <ersan.bozduman@gmail.com>
2021-01-21 20:48:22 -08:00
Harshavardhana f73987fc34 fix: invalid user-agent release tag for mc (#3575)
fixes #3529
2021-01-20 09:51:52 -08:00
Harshavardhana 1c3e6516f0 allow trace filters on handler names (#3568)
also convert the filter options to slice flags, for example
if you wish to trace only for status code 404 and 503 then
you would specify the following command

```
mc admin trace --status-code 404 --status-code 503 myminio/
```

Refactor and make implementation more readable.
2021-01-19 02:20:34 -08:00
Maxime Bochon 419a6935db fix: extra spaces prevent italic formatting in doc (#3459) 2021-01-18 15:40:03 -08:00
Anis Elleuch f1f3003e5e Update minio-go to fix lcp bug (#3572) 2021-01-14 03:26:28 -08:00
Anis Elleuch 5fcb069e8a Add missing lifecycle versioning config parameters (#3565)
Add the following flags to mc ilm command:

  --expired-object-delete-marker
  --noncurrentversion-expiration-days
  --noncurrentversion-transition-days
  --noncurrentversion-transition-storage-class
2021-01-12 23:47:39 -08:00
Anis Elleuch c1fe60f7ad admin info: Show yellow dot when the cluster is not fully initialized (#3555) 2021-01-05 09:13:08 -08:00
Anis Elleuch e7df97d1e0 trace: Add more filters options (#3556)
Filter options are necessary if the server receives a lot of requests,
especially when the verbose mode is passed.
2021-01-04 21:00:48 -08:00
Harshavardhana 95ee8f0714 list with maxKeys=1 for url2Stat() calls (#3557) 2021-01-03 11:34:53 -08:00
Harshavardhana c041d86f03 fix: add hidden flag to return count number of locks (#3552) 2020-12-30 14:58:00 -08:00
Anis Elleuch e13737383f mirror: FS should ignore some non supported S3 events (#3554)
Bucket creation & removal are events only supported by MinIO server and
they are not meaningful for FS. Just ignore them at FS level and avoid
reporting an error.
2020-12-30 07:02:10 -08:00
Damien Degois c00afbc516 Fix code block issue in remote section (#3531) 2020-12-24 15:53:57 -08:00
Poorna Krishnamoorthy 766b69802c Remove transition targets (#3547)
Remove transition targets from `mc admin bucket remote` command 
and references to transition s.c label in `mc ilm add` command and docs.

This is being deprecated in favor of an improved approach
to transition in the works.
2020-12-24 14:09:26 -08:00
Anis Elleuch 864e4589ac doc: Update missing versioning documentation (#3417) 2020-12-22 09:23:04 -08:00
Harshavardhana 41c804b179 fix: update to minio/pkg/console changes (#3545) 2020-12-20 10:10:29 -08:00
Anis Elleuch fca6cb2815 cp: Add unit test for copying directories (#3540)
Add unit tests to copy a directory in S3 with and without a trailing
slash.
2020-12-18 09:19:36 -08:00
Anis ElleuchandAnis Elleuch d0e1456be3 client-s3: Stat() should return data for passed directories (#3539)
Co-authored-by: Anis Elleuch <anis@min.io>
2020-12-18 02:42:34 -08:00
SaintMalik 2b99236a22 Fix broken url in docs (#3537)
## Summary

Easy navigation and easy reading for others
2020-12-17 08:53:22 -08:00
Harshavardhana 5023905a3a use minio/pkg/certs instead of custom implementation (#3536)
also depends on https://github.com/minio/minio/pull/11123
for k8s automatic trust for MinIO deployments under operator
2020-12-16 19:41:15 -08:00
Poorna Krishnamoorthy 5ed74df9ed Add mc admin bucket remote edit to edit credentials (#3480) 2020-12-16 15:51:29 -08:00
Anis Elleuch 4e8e67fb04 mirror: Add support of site-wide mirroring (#3467) 2020-12-14 14:10:09 -08:00
Harshavardhana 1967d38dd4 remove arm32 binary 2020-12-12 17:29:33 -08:00
Chengyou LiuandHarshavardhana 74fc02e5eb Add --summarize for ls (#3517)
Co-authored-by: Harshavardhana <harsha@minio.io>
2020-12-09 15:26:29 -08:00
Harshavardhana 52fc5e8c15 fix extra space character in docker files 2020-12-07 16:17:40 -08:00
Nitish Tiwari 7ef637884c Move to Red Hat UBI (#3514)
Also use multi-arch Dockerfile instead of separate
files for each arch.
2020-12-07 16:09:05 -08:00
Harshavardhana 24101f18aa update minio/minio deps to honor dynamic config settings (#3526) 2020-12-07 16:02:56 -08:00
Harshavardhana b6969bc501 add support for watching for replication/ilm events (#3525) 2020-12-07 12:23:11 -08:00
Harshavardhana 4dc0a44ebf docs: update 'mc admin config' doc (#3522) 2020-12-03 23:56:18 -08:00
Harshavardhana c691cc5488 update dependencies to minio master (#3518) 2020-12-03 13:43:12 -08:00
Anis Elleuch d4fbfb5975 Show better looking help when a wrong flag is passed (#3461) 2020-12-02 22:19:26 -08:00
Harshavardhana 00873e4b93 update dependencies (#3515) 2020-12-01 18:44:48 -08:00
Harshavardhana b1f5e78980 fix indentation/help across commands (#3512) 2020-12-01 16:34:43 -08:00
Ritesh H Shukla bd7442fbc6 Add under what condition overwrite flag will copy data from source to target (#3513) 2020-12-01 12:26:01 -08:00
Lenin Alevski c7989d06bc Support for setting custom Transport in S3Client configuration (#3510) 2020-11-30 20:52:08 -08:00
Harshavardhana 681cbb06de use directly S3 event types instead of re-defining them (#3511) 2020-11-30 09:10:34 -08:00
Shireesh Anjal 3dffa04f66 Implement new format of the health report (#3492) 2020-11-26 05:41:14 -08:00
Poorna Krishnamoorthy 060b0762fb Remove trailing slash for mc admin bucket remote ls (#3506)
if any, after alias/bucket
2020-11-25 13:12:43 -08:00
Poorna Krishnamoorthy df5f03a109 Fix cutoff header in mc admin bucket remote ls (#3502) 2020-11-25 12:05:37 -08:00
Harshavardhana 465e6cf63c fix: indent help properly (#3504) 2020-11-25 12:05:05 -08:00
Anis Elleuch 25fd302af6 More flags check in replicate add command (#3503) 2020-11-25 10:20:43 -08:00
Poorna Krishnamoorthy bf2f7f0292 do not append default port to target in bucket remote cmd(#3501) 2020-11-24 17:12:37 -08:00
Poorna Krishnamoorthy 138587816a Rename ilm set as ilm edit (#3420) 2020-11-23 13:46:44 -08:00
Cesar N d4f9ea859d Change GetOptions' fields to public (#3498)
This allows minio/console to take advantage of the current
S3Client Get function for downloading objects with version
2020-11-19 13:43:35 -08:00
Harshavardhana adafa0024f fix: allow mirror to perform 'dir/ -> alias/' (#3493)
fixes a regression introduced in #3488
2020-11-16 15:52:34 -08:00
Anis Elleuch 9ac1bf4a29 fix: copy bucket policy/lock config only with new buckets and with -a (#3488)
mc did not require -a to trigger mirroring of bucket policy & locking
configurations, this commit enforces this requirement. Besides, the config
mirroring will only happen if the mirror command is creating new buckets in
the target server.
2020-11-16 11:36:50 -08:00
Anis Elleuch f3dd24f578 Implement barrier in parallel manager (#3469)
Mirroring watch supports parallel manager to run actions of the received
events in parallel, but sometimes the order of the execution of those
actions matter.

For example:
- A new bucket is created
- A new file is uploaded in the new bucket

This PR will bring support of the barrier concept. A task with a barrier
will only executed after all the previous tasks finish, the
subsequent tasks will also be only executed when the barrier task is
finished.

Later, we will bring support of tasks dependency to optimize the
parallelism.
2020-11-15 13:26:38 -08:00
Harshavardhana 3792e9f906 multiple bug fixes for mirror, ls, rm (#3491)
- fixes errant top level directory creation, regression introduced in #3313
- fixes `mc ls -r` regression introduced in #3476
- fixes other bugs such as `mc mirror` would perpetually hang if the
  destination bucket doesn't exist, create and proceed instead.
- removes DirOpt style implementations for List, ListIncompleteUploads
  these are not useful anymore.
2020-11-15 13:24:00 -08:00
Harshavardhana f1c04ad4b8 fix: no reason to look for file extensions (#3490)
fixes #3489
2020-11-13 12:12:49 -08:00
Anis Elleuch e216394765 Better autocompletion msg (#3481)
This commit also removes checking for msgp generated files since snap
command is not merged yet.

msgp check will be added in snap change.
2020-11-12 16:27:05 -08:00
Anis Elleuch 6ab70467cc Always send MD5 when creating an empty directory (#3487)
Otherwise it could fail with a bucket with locking enabled.
2020-11-12 10:25:20 -08:00
Harshavardhana b2ab462551 add workers per GOMAXPROCS (#3483) 2020-11-11 09:22:39 -08:00
Poorna Krishnamoorthy 786a53672b Add flag to allow delete marker replication (#3395) 2020-11-10 19:36:48 -08:00
Harshavardhana 63ce578c46 update go mod tidy 2020-11-06 13:56:50 -08:00
Anis Elleuch 965747e45d Fix client-s3.Makebucket behavior with object in path (#3470) 2020-11-06 09:38:43 -08:00
Anis Elleuch 0289d32164 errorIf(): Convert context canceled to canceling upon request (#3463) 2020-11-06 09:37:59 -08:00
Ritesh H Shukla 40e328eac2 Add support for setting bandwidth limit (#3430) 2020-11-03 16:02:17 -08:00
Harshavardhana 470ae1ee5f allow empty buckets listed with mc ls -r (#3476) 2020-11-02 15:49:07 -08:00
Shireesh Anjal 50bfa26724 Remove logging info from health report (#3465) 2020-11-01 21:50:46 -08:00
Poorna Krishnamoorthy ab396ae957 Add a --label flag to mc admin bucket remote add command (#3443) 2020-10-29 10:58:36 -07:00
Poorna Krishnamoorthy 7838365102 fix mc stat with --versions flag to show versionID correctly (#3471)
If --versions flag is specified, instead of HEAD currently
repeated listing is being done and latest version ID reported
for all the versions instead of actual version ID.
2020-10-27 16:54:05 -07:00
Anis Elleuch 6c2325129f Simply queueing to parallel manager (#3468) 2020-10-24 14:02:35 -07:00
Anis Elleuch fa4da03a4f ls: Fix listing buckets with --versions (#3462)
mc ls --versions alias/ has an unexpected output due to missing
consideration of this use case. This commit fixes the behavior.
2020-10-22 17:35:51 -07:00
Maxime Bochon d1232dc089 fix: missing closing part of code block and italic (#3460) 2020-10-22 09:23:59 -07:00
Harshavardhana 91c9364f3c add context for mirror failures (#3464) 2020-10-21 13:42:18 -07:00
Shireesh Anjal 440f6dccbc Deprecate admin health, add admin subnet health (#3455)
The existing command `admin health` is being restructured to `admin
subnet health` as the reports generated by this command are primarily
intended to be uploaded to Subnet.

If user runs the `admin health` command, they'll be asked to run `admin
subnet health` command.
2020-10-21 09:29:58 -07:00
Anis Elleuch 6bae0eb218 More fixes for retention/legalhold docs (#3458) 2020-10-19 14:00:02 -07:00
Ravind Kumar b47b2e19a8 Update mc retention, remove mc lock links. (#3457) 2020-10-19 09:20:48 -07:00
Anis Elleuch 00f655ac41 Fix missing completion rules for new/modified cmds (#3454)
Add a unit test to check new or any command modification as well.
2020-10-18 11:35:15 -07:00
Anis Elleuch b7a3dff287 Fix 'did you mean' message (#3448) 2020-10-12 09:53:51 -07:00
Anis Elleuch 8a8611cf74 s3: Stat() to filter object name when falling back to listing (#3449)
client S3 Stat() API tries to use HEAD requests but fall back to regular
listing when there is a permission issue with HEAD or when the object is
encrypted using SSE-C.

However the code accepts any entry from the minio-go listing API
which is wrong. It needs to only accept the object name as passed
by the the upper layer.
2020-10-10 15:24:39 -07:00
Anis Elleuch bb2bfdc918 Show a better err msg when Control-C is hit (#3446)
Currently the error message is "context canceled" which is cryptic
2020-10-08 11:46:11 -07:00
Anis Elleuch 0324fdcc6e mv: Fail only if bucket locking is enabled in source urls (#3444) 2020-10-08 11:04:49 -07:00
Anis Elleuch 2b36376bbc retention: Fix status msg with info --default command (#3445)
Make the output little more prettier as well.
2020-10-08 11:04:33 -07:00
Shireesh Anjal f11c3a9733 Update minio dependency and go version (#3440)
Update the minio dependency to latest master branch, and bump the go
version number to 1.14 (same as minio)
2020-10-07 22:19:11 -07:00
Anis Elleuch 3b65e9cba6 client-s3: List sends bucket names when bucket not specified (#3439)
This commit also has some simplifications in the the listing code.
2020-10-06 11:17:58 -07:00
Harshavardhana f11ae85566 allow selection of tests in 'mc admin health' (#3434) 2020-10-02 12:02:03 -07:00
Cesar N 7f2df96e48 Change ListOptions' fields to public (#3433) 2020-10-01 09:50:56 -07:00
Anis Elleuch 4b34df590a Makefile should check for possible changes in the generated code (#3427)
We should not release mc while the code is not according to the
generated code, like when we forgot to run go generate command.
2020-10-01 08:13:52 -07:00
Anis Elleuch 177f15db2e Fix help for cp and head commands (#3418) 2020-09-30 16:06:38 -07:00
Anis Elleuch 2568f9e7bf rm: Remove a delete marker (#3422)
A code refactor made rm to invoke HEAD request instead of LIST to stat
object to remove, and this introduced a problem removing a delete-marker
since HEAD of a delete-marker returns 405 Method Not Allowed
2020-09-30 15:13:19 -07:00
Harshavardhana 217f5fcbae rename obd->health - keep the alias for now (#3429)
Also additionally fix colorjson usage
2020-09-30 13:10:29 -07:00
Poorna Krishnamoorthy 1ca2182203 Change mc stat output format for bucket info (#3318) 2020-09-30 13:07:19 -07:00
Harshavardhana 150d2494e9 update admin top locks implementation (#3424) 2020-09-29 09:18:00 -07:00
Harshavardhana db1b508d8b update minio to pkg/madmin changes 2020-09-23 13:00:06 -07:00
Harshavardhana d24de97cde pretty print KMS key status (#3412) 2020-09-23 08:32:57 -07:00
Nugine 3776dff20f fix: make assert_failure exit properly (#3415) 2020-09-22 10:41:53 -07:00
Anis Elleuch 9ff6c146b4 rm: Show deleted error msg when delete marker is found (#3407)
HEAD object returns 404 with a delete-marker header when the object is a
delete-marker in a versioning bucket. This PR will show a better error
message in that case.

Use url2Stat() and ignore 400 bad request error.
2020-09-21 11:42:31 -07:00
Harshavardhana ce0c109ae3 update json flag help to indicate the correct format (#3411)
some users may get confused without reading the docs
might end up assuming that --json is a full JSON document.
2020-09-21 00:43:41 -07:00
Andreas Auernhammer 0449df8887 admin: add new command for creating KMS master keys (#3287)
This commit adds a new admin command for creating
KMS master keys:
```
mc admin kms key create <alias> <key-name>
```
2020-09-19 22:00:46 -07:00
Anis Elleuch a5d03c51e2 ls: New output format when versioning is enabled (#3392) 2020-09-19 21:56:37 -07:00
poornas 0c1f1e29f1 vendorize pkg/madmin needed for mc admin remote fixes (#3410) 2020-09-17 16:06:07 -07:00
Harshavardhana 1dde65d9c0 fix: display objects endpoint with / properly (#3408) 2020-09-17 15:34:47 -07:00
Anis Elleuch f7b1b4a139 obd: Add log spinner (#3406) 2020-09-17 15:30:07 -07:00
Anis Elleuch fede0756d4 Implement undo command (#3394) 2020-09-16 18:59:28 -07:00
John Hixson 64fb8f0a8f FreeBSD build fixes (#3404)
commit a80eca5af8 broke mc from building
on FreeBSD. This commit seperates out the files to have individual NetBSD files.
2020-09-15 09:46:57 -07:00
Harshavardhana 93209e842c re-implement metadata handling to preserve nanosecs as well (#3402) 2020-09-12 10:20:03 -07:00
Anis Elleuch 8f2ffbfa86 cp: Fix url check not considering version-id in some cases (#3401)
cp checks the existance of the source object in Type A and Type B, but
forgets to pass version-id as well. Fix this behavior.
2020-09-08 07:08:35 -07:00
Anis Elleuch af6cff00a5 retention: Refactor and add support of versioning (#3347) 2020-09-06 10:33:15 -07:00
Anis Elleuch 7f550f9482 legalhold: Refactor & add versioning support (#3343) 2020-09-05 17:11:38 -07:00
Harshavardhana 19c49468b7 handle admin info output for offline nodes properly (#3397)
```
●  localhost:9002
   Uptime: 11 minutes
   Version: 2020-09-03T23:04:07Z
   Network: 3/4 OK
   Drives: 1/1 OK

●  localhost:9003
   Uptime: offline
   Drives: 0/1 OK

●  localhost:9005
   Uptime: 11 minutes
   Version: 2020-09-03T23:04:07Z
   Network: 3/4 OK
   Drives: 1/1 OK

●  localhost:9004
   Uptime: 11 minutes
   Version: 2020-09-03T23:04:07Z
   Network: 3/4 OK
   Drives: 1/1 OK

3 drives online, 1 drive offline
```
2020-09-04 14:33:41 -07:00
Harshavardhana f992322606 fix encrypt info UI (#3393) 2020-09-02 10:28:22 -07:00
Harshavardhana b7e4a633d8 rename all 'cannot' messages to 'unable to' (#3388) 2020-09-01 15:40:31 -07:00
Harshavardhana 5649deee40 fix ls output when latest version is delete marker (#3391) 2020-09-01 13:46:07 -07:00
poornas b55e3e2d29 Update minio-go dependency (#3390) 2020-08-31 19:11:41 -07:00
飞雪无情 05d63c9aba upgrade minio module to fix mc admin trace bug. (#3385)
fixes https://github.com/minio/minio/issues/10369
2020-08-31 18:11:45 -07:00
Harshavardhana d5b4a04592 allow specifying a custom region override for any endpoint (#3386) 2020-08-31 09:04:22 -07:00
poornas d584adda01 Add ilm set command (#3384) 2020-08-28 11:57:54 -07:00
Harshavardhana 25a043b508 continue to remove content upon any error (#3383) 2020-08-28 08:13:35 -07:00
Anis Elleuch 85cce08a85 cat: Fix a regression when copying from stdin (#3381)
`mc cat >/tmp/output` is not working properly due to mc cat versioning
changes, this commit fixes the issue to make mc cat works as expected.

It also adds a unit test for it.
2020-08-27 10:31:53 -07:00
Cédric Roger 8f1ce3c59f Update minio-client-complete-guide.md (#3382) 2020-08-27 09:30:14 -07:00
Harshavardhana 41d337e95c fix: messages for version-id and rewind (#3380) 2020-08-26 15:48:47 -07:00
Anis Elleuch e10c597425 stat: Add support of --rewind, --versions and --version-id (#3350) 2020-08-26 15:04:52 -07:00
Harshavardhana 6fc39cdf8e imply rewind correctly what it does (#3373) 2020-08-26 14:51:37 -07:00
Anis Elleuch 35632bc1af head: Add support of --version-id and --rewind (#3354) 2020-08-26 10:38:35 -07:00
Anis Elleuch a104aa1cb2 tag: Add --version-id support (#3364) 2020-08-25 21:40:09 -07:00
ebozduman 2a6bdd8164 preserve the same dir structure for backup and restore (#3313) 2020-08-25 17:16:48 -07:00
Harshavardhana c58148a421 avoid calling get bucket object lock config for same bucket (#3378) 2020-08-25 10:50:40 -07:00
Anis Elleuch b1ca6482d5 share: Support --version-id in Download command (#3365) 2020-08-21 00:08:55 -07:00
Anis Elleuch 54fab0ad8f du: Add support of --rewind and --versions (#3367) 2020-08-21 12:10:24 +05:30
Harshavardhana ebb05ce469 fix: rm --version-id option (#3372) 2020-08-19 16:55:02 -07:00
Harshavardhana ce7ffc38df fix: alignment in help for multiple commands (#3371) 2020-08-19 15:44:12 -07:00
poornas ff9731a0d2 fix functional test test_copy_object_with_sse_rewrite (#3369)
`mc rm` on sse-c encrypted object needs encrypt-key flag passed.
2020-08-19 14:22:48 -07:00
Harshavardhana b604a89a9c rename 'config host add' to 'alias set' (#3366) 2020-08-17 22:41:42 -07:00
Harshavardhana fe5e714593 migrate CI to go1.14, go1.15 (#3361) 2020-08-17 08:40:27 -07:00
Anis Elleuch cd41dbc0a2 tree: Add --rewind flag (#3359) 2020-08-14 22:11:38 -07:00
Anis Elleuch 24e58fce38 ls: --rewind without --versions shows correct version number (#3360) 2020-08-14 15:46:12 -07:00
Anis Elleuch 6f2dc37ad8 cat: Add version-id flag (#3352) 2020-08-14 14:07:03 -07:00
poornas eafc9ee7b4 Add --remote-bucket as flag in mc replicate add/set (#3349) 2020-08-14 13:59:52 -07:00
Tobias Nygren a80eca5af8 fix mc build on NetBSD (#3358) 2020-08-13 15:09:23 -07:00
Harshavardhana 091a109e5a fix: set replace metadata to preserve (#3356) 2020-08-12 19:41:44 -07:00
Harshavardhana cdb458c987 fix: do not close contentCh prematurely without versioning 2020-08-12 16:03:30 -07:00
Harshavardhana f9dc22561c fix: mc rb site-wide removal with versioning (#3355) 2020-08-12 14:19:10 -07:00
poornas 5ad2d36f5c Add ReplicationStatus to stat cmd output (#3351) 2020-08-11 14:19:17 -07:00
Anis Elleuch 6313ee7dab Add versioning support for rm cmd (#3339) 2020-08-10 15:19:06 -07:00
Anis Elleuch 73d8b35425 cp: Add support of --version-id flag (#3342) 2020-08-08 20:15:34 -07:00
Harshavardhana 4d70066990 use credits file from master 2020-08-07 23:05:18 -07:00
Anis Elleuch 7e52c104be ls: New printing format for versions (#3341) 2020-08-07 17:56:14 -07:00
kannappanr 588a8fcd17 rename versioning to version (#3345) 2020-08-07 13:32:11 -07:00
poornas 0ba1633a04 Change admin bucket remote cli args (#3340)
Add support to list all remote targets for a tenant
2020-08-07 10:52:09 -07:00
poornas 069968c8aa Change replicate command cli (#3335) 2020-08-07 08:15:27 -07:00
Anis Elleuch 0c4b649369 stat: Show lifecycle expiration date if set (#3344)
Add a new field in the stat output to show if the object has any
expiration date due to lifecycle expiration rules. The expiration date
is show in machine local time.
2020-08-06 14:19:41 -07:00
Harshavardhana bd03dfbb15 fix: docs command line typo 2020-08-03 18:26:58 -07:00
Harshavardhana 9498227542 fix: fallback listing to regular objects (#3338) 2020-08-03 17:22:33 -07:00
Harshavardhana 32c13f2977 fix: rb command regression deleting bucket (#3337) 2020-08-03 15:32:42 -07:00
Harshavardhana 6f8859262c fix go mod tidy 2020-08-03 14:01:50 -07:00
poornas cd1f28e20c Rename mc admin bucket replication command (#3328)
Rename to `mc admin bucket remote` to manage generic
bucket targets
2020-08-03 13:57:54 -07:00
Anis Elleuch b1aa159838 rb: Delete object versions as well (#3322) 2020-08-03 13:54:07 -07:00
Harshavardhana 3c0bc7ec33 update CREDITS with new deps (#3336) 2020-08-01 11:53:13 -07:00
Harshavardhana 6a98216c53 rename all bucket commands (#3334) 2020-07-31 15:18:57 -07:00
poornas 7ffa755cd9 Move version commands to top level (#3329) 2020-07-30 09:53:15 -07:00
kannappanr 0631315535 Fix mc encrypt documentation (#3330) 2020-07-29 23:12:26 -07:00
poornas 2be7f6dd13 Fix example for mc admin bucket quota (#3326) 2020-07-29 21:27:07 -07:00
poornas ceb216f8a3 Add mc encrypt command (#3312) 2020-07-29 21:26:42 -07:00
Anis Elleuch d93b7f7638 More fixes in the doc for mc alias command (#3327) 2020-07-28 15:04:27 -07:00
Anis Elleuch ec734d0f71 Add --rewind flag for cat command (#3321) 2020-07-28 13:19:56 -07:00
Anis Elleuch 90dc31f6ba Move from mc config host to alias command (#3311)
```
mc alias set
   alias remove
   alias list
```

are new commands that replace mc config host sub-commands.

mc config host will still be available but hidden for backward
compatiblity. The JSON output is also kept if the user is running mc
config host command.
2020-07-28 10:26:41 -07:00
Harshavardhana 9c09f78982 add license section about Apache2.0 2020-07-26 01:02:14 -07:00
Harshavardhana 90d22b271f move 'mc ilm' to 'mc bucket ilm' (#3320)
update relevant docs and use the same
usage message consistently
2020-07-25 11:31:42 -07:00
poornas 2750c4bfe6 Add replication commands (#3272)
`mc admin bucket replication` command
manages replication targets on MinIO server

`mc bucket replicate` allows setting replication 
configuration on the source bucket
2020-07-24 12:34:13 -07:00
poornas c61a26269f Move mc lock to mc bucket lock (#3309) 2020-07-24 01:18:55 -07:00
Anis Elleuch 65d564dd87 ilm: Add ignores bucket lifecycle not found error (#3315) 2020-07-23 11:31:13 -07:00
Anis Elleuch 442facedd1 Implement rewind flag in ls and cp commands (#3304)
--rewind will go back in time and select specific object versions that are
the latest at the specified time.

--versions will display all the versions

cp will just ignore if the latest version is a delete marker
ls will print delete markers with a (deleted) at the end
2020-07-23 11:18:38 -07:00
Anis Elleuch a2592cef84 mirror: Exit with status code 1 if source does not exist (#3314) 2020-07-22 17:48:15 -07:00
poornas 023e56e0a1 Add mc bucket version command (#3308) 2020-07-21 10:10:57 -07:00
Anis Elleuch c8a3b7bff0 ilm: Add doc to the complete mc guide (#3270) 2020-07-19 12:46:30 -07:00
Harshavardhana 12acca5abd upgrade minio-go to fix lifecycle removal issue (#3310) 2020-07-19 12:40:37 -07:00
Harshavardhana 67f2472d24 api: upgrade to minio-go v7.0.1 (#3306) 2020-07-17 08:03:04 -07:00
Dmitry Afanasiev f19a10dce2 fix attr argument parsing - support quoted keys and values (#3294) 2020-07-16 19:23:35 -07:00
Harshavardhana ea8c0db96e update minio-go/v7 APIs again (#3305) 2020-07-16 18:03:17 -07:00
Harshavardhana 0b0acc611f Revert "cli: Load global flags in initBeforeRunningCmd (#3283)" (#3302)
This reverts commit 712ff33319.
2020-07-16 11:10:35 -07:00
ebozduman 7b5d5ea990 Fixes --attr regression (#3303) 2020-07-16 08:59:38 -07:00
Anis Elleuch 56c2c1a5c5 Fix object copying after upgrading to v7 (#3298) 2020-07-15 16:53:38 -07:00
Harshavardhana f3c9e9172a honor preserve flag during Copy operation (#3299)
continuation of #3285 which wasn't complete
2020-07-15 16:39:04 -07:00
Harshavardhana 9193388568 fix go mod tidy 2020-07-14 15:50:12 -07:00
Anis Elleuch a419bb4130 Use minio-go v7 and madmin master (#3295) 2020-07-14 11:15:19 -07:00
Harshavardhana 469665f886 update the correct cross platform qemu 2020-07-10 23:02:15 -07:00
Harshavardhana 5d98d19608 for release use the dl.min.io for containers 2020-07-10 22:40:06 -07:00
kannappanr 9d762f5aa6 Fix typos in the examples (#3289) 2020-07-07 21:08:33 -07:00
P R 51a3d287bb mc ilm list cell alignment for text (#3291) 2020-07-07 20:52:01 -07:00
Harshavardhana fbb7d75c1c support proper proxy for all transports (#3290)
fixes #3225
2020-07-07 17:07:49 -07:00
Harshavardhana 53dc65c92a move to latest released minio to fix policy (#3288)
fixes #3265
2020-07-07 12:19:48 -07:00
ebozduman d811d416a5 Fixes copy with partial metadata failure (#3282) 2020-07-06 17:22:06 -07:00
Harshavardhana ba37e08f1f support goreleaser for mc (#3286) 2020-07-05 18:37:43 -07:00
ebozduman 5c713e5ecb Adds support to preserve X-Amz-Meta-Mc-Attrs when os -> fs (#3285) 2020-07-03 15:31:27 -07:00
Anis Elleuch 712ff33319 cli: Load global flags in initBeforeRunningCmd (#3283)
app.Before receives a cli.Context but without flags parsed. There is no
point calling ctx.Bool() or ctx.IsSet() at that stage.

However, flags are parsed in commands, so minio initialization and
setting global variables (globalJSON, globalQuiet, etc..) can be moved
to the Before function of all commands.

Avoid setting command.Before for non leaf commands, otherwise Before
function will be called multiples times until it reaches the leaf
command.
2020-07-01 17:28:43 -07:00
Anis Elleuch 90d6e7df24 policy: Recalculate permission mode after setting a new one (#3280)
`mc policy set` can confuse users by showing that a bucket has 'none'
policy mode although issuing `mc policy get` will show it is `custom`
when the bucket already other policy statements for some sub-resources.

For better UX, mc will issue another request to get the real policy
mode.
2020-07-01 09:22:22 -07:00
poornas b8570a9a0b Fix mc cp regression for recursive copy (#3278)
Fixes #3267. Revert commit dc430afe07
which attempted to preserve similar behavior across mc cp and mc
mirror, but introduces a regression for cp when wildcards are
specified.
2020-06-29 20:33:31 -07:00
Anis Elleuch 360d094828 s3: Use list object v1 in case of GCS (#3274) 2020-06-24 05:22:29 -07:00
Harshavardhana 08685bae6a make sure active/active enables watch by default (#3271)
- effectively use context everywhere
- effectively look for source-mtime in all
  variations
- `mc diff` should do metadata diff as well
2020-06-23 16:56:08 -07:00
Harshavardhana 4989d51e2c fix: overwrite is implicit with active-active (#3268)
refactor lengthy options as mirrorOptions{} for
ease of readability and usage.
2020-06-22 23:41:24 -07:00
Harshavardhana a62a539399 fix: support STS for admin commands (#3264) 2020-06-19 12:37:57 -07:00
ebozduman d5b6931a1e Apply global context for all apis (#3240) 2020-06-16 16:55:31 -07:00
poornas 397f41c71c Fix mc cp when legal-hold or retention is set (#3257)
- Send Content-MD5 header if default retention is set on the bucket
- legal-hold needs to be case insensitive
2020-06-16 12:13:35 -07:00
Harshavardhana 707f46c32b rename multi-master to active-active (#3255) 2020-06-15 18:16:31 -07:00
Anis Elleuch 133dd1f7da add helpers for repeated code in bucket and object info (#3251)
Use bucketInfo2ClientContent() and objectInfo2ClientContent()
extensively to avoid code duplication.
2020-06-12 07:40:49 -07:00
Klaus Post bdefdc0169 cp: Fix Windows paths (#3250)
Paths without `/` separator were not trimmed correctly.

Fixes #3241

Regression originating from #3115
2020-06-10 09:31:59 -07:00
Anis Elleuch c51e3b3ec9 Return 1 as exit code when the cmd is unknown (#3249) 2020-06-09 08:52:04 -07:00
Harshavardhana 88223f96be simplify FS put behavior for partial files (#3246) 2020-06-08 12:26:03 -07:00
Harshavardhana fa520cbd1a enable golang-lint CI run and -race tests (#3247) 2020-06-08 05:55:10 -07:00
Justin Hutchings 166db95464 Add CodeQL security scanning (#3243) 2020-06-05 10:26:11 -07:00
Federico Pellegrin 0e27dd4ed4 Fix policy command flags order online help and partially doc (#3244) 2020-06-05 01:09:38 -07:00
kannappanr 2403e7a744 Check if destination and source are same (#3234)
Fixes #3229
2020-05-27 20:15:08 -07:00
Anis Elleuch ea03e61fac Avoid annoying error when alias has a leading slash (#3236)
```
mc config host list
mc config host add
mc config host remove
mc admin prometheus generate
```

The above mc commands generate an annoying error message complaining
about the leading slash in the alias argument.

Although alias does not support any slash or backslash, we allow the
user to enter it for convenience and the code will just clean it before
using it.
2020-05-27 14:23:31 -07:00
poornas f55e9c1997 Add admin bucket quota command to manage quota (#3179) 2020-05-26 22:56:53 -07:00
kannappanr 7664bb2c8d mirror: check if bucket exists before creating it (#3233)
Fixes #3228
2020-05-26 20:04:20 -07:00
kannappanr 09f832f597 copyobject: Do not ignore storage class in the target (#3232)
Fixes #3230
2020-05-24 14:23:28 -07:00
Anis Elleuch 4cc297ba4e diff: Disable comparing modtimes when multimaster context is not found (#3226) 2020-05-21 23:50:29 -07:00
Harshavardhana bf731558cd remove panic on double close watch channel (#3223) 2020-05-19 14:31:24 -07:00
Anis Elleuch 949dd282f9 fix copy issue when the source is not seekable (#3216)
The downloaded data will be stored in [file].part.minio
first and then renamed to [file]

The code also does not behave correctly when the source 
reader is not seekable. the reader is wrapped by a reader 
hook and then tested if it is seekable or not, though the 
reader hook is always seekable.
2020-05-18 20:05:46 -07:00
P R 61b74e90bf mc ilm fix some functionality changes (#3221) 2020-05-18 19:57:08 -07:00
Harshavardhana 3b479cf92e refactor cleanup ilm command to make it more maintainable (#3220) 2020-05-15 16:54:34 -07:00
Bala FA 09c31c4ab2 add bucket tagging support (#3182) 2020-05-15 12:10:50 -07:00
Anis Elleuch 71196b1013 completion: Complete path starting with ~/ (#3217)
posener/complete library does not support paths starting
with a tilde. This commit implements a workaround for that.
2020-05-15 08:12:47 -07:00
P R 72c8e92459 Add ilm command. (#3097) 2020-05-14 08:55:21 -07:00
César Nieto a6d82862cd make WatchOptions and WatchObject fields public (#3218) 2020-05-12 10:42:34 -07:00
ebozduman 672390b86a fix a simple typo #3159 2020-05-09 21:33:26 -07:00
Harshavardhana 2e586e6b9d support session tokens as part of ENV (#3213) 2020-05-07 15:21:12 -07:00
P R ad0bc4c33d progress bar update on obj write failure (#3195)
Fixes #3193
2020-05-07 10:28:27 -07:00
ebozduman a75dca16bd fix: cp preserve ownership issue (#3202) 2020-05-07 09:00:48 -07:00
Bala FA 4e3b501528 add --storage-class flag to pipe command. (#3204)
Fixes #3157
2020-05-06 23:06:01 -07:00
Harshavardhana dc2ad27429 fix mirror crash if source is deleted (#3206) 2020-05-05 23:55:35 -07:00
Harshavardhana b99c313366 cleanup legal-hold/retention and update docs (#3197) 2020-05-04 20:09:36 -07:00
kannappanr e13751f5d5 doc: Remove example related to object locked bucket (#3201)
mv does not support this command for object locked buckets.
2020-05-04 10:09:49 -07:00
Bala FA ca650e227a fix: create empty probe error to fatalIf() (#3199)
Fixes #3198
2020-05-04 07:58:28 -07:00
Harshavardhana df8bb795ba refactor watch mirror for performance (#3196) 2020-05-02 12:07:21 -07:00
Harshavardhana 2fe7d04043 run go mod tidy 2020-04-26 15:34:57 -07:00
Nitish Tiwari 138d7656ba fix: Update to use minio-go with jsoniter (#3191)
Also remove unused args in doMirror()
2020-04-24 23:56:51 -07:00
Anis Elleuch 2018319125 sql: Adapt the code to the change in minio-go SQL API (#3161) 2020-04-24 09:34:51 -07:00
Harshavardhana c8c5c15249 fix auto-complete for missing commands (#3189) 2020-04-23 20:11:35 -07:00
Chloe Kudryavtsev 32d8ef24ef feat: allow fetching arbitrary object puburls (#3043)
This fix should be backward-compatible, since strings do not need 
to be initialized by default, and JSON explicitly allows it to be omitted
when empty.
2020-04-22 18:36:41 -07:00
ebozduman f82a7b13c1 fix: copy filesytem to objectstore regression (#3183) 2020-04-22 18:28:50 -07:00
BigUstad 49c2beec79 check object stat first before continuing with sql select call. (#3188) 2020-04-22 18:28:30 -07:00
Harshavardhana 24a72e4a33 fix add disable-multipart/md5 options for mirror (#3174) 2020-04-21 13:05:01 +05:30
Anis Elleuch c7166eac3a mirror: Use source time attr in multi-master mode (#3162) 2020-04-20 17:03:47 -07:00
Harshavardhana 20dd7011b9 Add lock/stale bot 2020-04-19 13:42:05 -07:00
Harshavardhana f23f814764 fix: allow watch to use queueCh from parallel manager (#3180) 2020-04-19 10:59:05 -07:00
kannappanr e1617a504b Canonicalize metadata recevied as part of events (#3181) 2020-04-19 10:10:40 -07:00
Harshavardhana 89930fed29 rb shouldn't hang on empty folders (#3178)
fixes #3176
fixes #3177
2020-04-19 09:50:18 -07:00
Marco Perrando 8c262e1f3f Fix: sql does not accept --encrypt-key flag. (#3175) 2020-04-18 23:09:07 -07:00
Harshavardhana e6a6cfcebf Update issue templates 2020-04-17 12:12:42 -07:00
Harshavardhana bb43b2adf1 add bug_report template 2020-04-17 12:09:51 -07:00
Harshavardhana 2d6a960f94 fix avoid multiple HEAD operations (#3173)
- Get() already has the metadata to preserve
- Stat() doesn't need to be sent multiple times
  do preserve attributes, use it once.
2020-04-17 01:01:34 -07:00
Harshavardhana 4036009dc2 fix optimize content-type detection for only FS (#3172)
Also avoid a secondary Stat() operation during
GetObject(), when preserving the metadata

Fixes #3170
2020-04-16 19:03:02 -07:00
BigUstad ab2500e2ef match S3 within URL in full appropriately (#3163)
Fixes #3140
2020-04-16 18:25:40 -07:00
Harshavardhana 5c4add2000 optimize client admin transport (#3168) 2020-04-16 18:24:11 -07:00
Anis Elleuch 59187f2ef7 s3: Use head API before listing in client.Stat() (#3156)
Stat() is supposed to return valid information for existing
objects and existing prefixes as well.

The current mechanism issues a listing request and searches
for the object or prefix in the returned list, but this could take
time if there are a lot of entries under a parent prefix.

The new commit changes the internal behavior but not the
functional output. It issues a HEAD request first, if there
is no object then assumes it is a prefix and does listing
in order to find it.
2020-04-16 16:23:37 -07:00
Nitish Tiwari 37ee28a051 Enforce issue templates for new issues (#3171) 2020-04-16 12:13:11 -07:00
Harshavardhana 91ca683b03 improve signature probe avoid repeated code (#3169) 2020-04-16 11:45:28 -07:00
Harshavardhana 68b638f2f9 update mc to latest minio (#3167) 2020-04-15 12:37:18 -07:00
Daniel Valdivia 42023a1298 allow mc event remove to remove individual events (#3145) 2020-04-14 18:44:29 -07:00
BigUstad 150bc75a2c Documentation for mc tag (#3136) 2020-04-14 18:40:29 -07:00
Harshavardhana 4388f6d69b trim alias from obd filename avoid local write failure (#3164) 2020-04-14 17:37:31 -07:00
Sidhartha Mani 9e4e435c56 make admin obd deadline configurable (#3154) 2020-04-14 13:12:06 -07:00
Bala FA dfa1e42b25 add mc mv command (#3134)
Fixes #3077
2020-04-14 11:59:16 -07:00
Harshavardhana cb9e103714 upgrade to latest pkg/madmin package (#3151) 2020-04-10 08:57:45 -07:00
ebozduman dee04e3d73 Adds and rewords policy examples (#3146) 2020-04-08 18:53:34 -07:00
Nitish Tiwari 18f81e5458 cp: Add object lock related flags (#3127)
- Adds --retention-mode,--retention-duration &
  --legal-hold flags in cp command

- Adds --bypass flag in rm command
2020-04-07 19:51:20 -07:00
Harshavardhana 8cae137525 fix all the build errors 2020-04-03 22:22:20 -07:00
Bala FA 3b31837927 add disableMultipart option to Copy() (#3141) 2020-04-03 20:14:05 -07:00
Harshavardhana f0f56ac906 update to minio-go latest release v6.0.52 (#3142) 2020-04-03 18:16:56 -07:00
Daniel Valdivia 4d36c1f8b8 Make NewS3Config and NewAdminFactory Public (#3138) 2020-04-02 19:41:31 -07:00
César Nieto a9e875b503 set S3Client struct as public (#3139) 2020-04-02 19:33:44 -07:00
Bala FA 51ef254a41 add --disable-multipart flag in cp (#3135) 2020-04-02 08:21:33 -07:00
Harshavardhana e05f02d9f4 add build trimpaths to remove gopath (#3137) 2020-04-01 15:09:42 -07:00
Daniel Valdivia 0ea8d1d479 Make BuildS3Config public (#3132) 2020-04-01 07:41:53 -07:00
Sidhartha Mani eeeca2332d Onboard Diagnostics (#3114)
Also colorize JSON output in all admin commands
2020-04-01 01:35:46 -07:00
BigUstad 080414009e mc watch windows URL/absolute path event path (#3133) 2020-03-31 09:50:29 -07:00
poornas 25de1da81b Add legalhold command (#3095) 2020-03-31 09:18:26 -07:00
kannappanr 1fb87a492e cleanup tag command (#3126) 2020-03-23 09:23:52 -07:00
BigUstad 71eb7f6689 Add tag command (#3117) 2020-03-22 20:59:49 -07:00
Anis Elleuch 64a78e7811 Add global context and adapt context change in admin API (#3125)
This commit adds a new global context, monitors os signals
and cancels the global context in such cases to exit
on going process gracefully.

It will also update minio-go and adapts the code with
the new context changes in the admin API.
2020-03-21 13:42:41 -07:00
Harshavardhana b010699112 cleanup legacy metadata handling (#3118) 2020-03-19 17:00:20 -07:00
poornas 3230acae32 mc retention: add --recursive and --bypass flags. (#3100)
--bypass flag allows overriding governance if user
has override permissions
2020-03-19 12:24:09 -07:00
ebozduman 91da0da183 fix for incorrect mtime handling (#3121) 2020-03-18 11:33:53 -07:00
Anis Elleuch fc04dc6463 info: Add missing new lines in the output (#3119) 2020-03-17 15:28:21 -07:00
poornas fd43df09a1 mc cp: Fix prefix handling in TypeC (#3115)
for copy from filesystem to objectstorage.

Avoid prefixing dirname to file on target side
when doing a `mc cp /tmp/dir myminio/bucket --r`
to make `mc mirror` and `mc cp` behavior consistent
2020-03-15 17:47:35 -07:00
Anis Elleuch b621ae58f5 heal: Show scheduled next healing (#3111)
mc admin heal alias command will show the next healing time.

Also, show 'Never completed' when the server returns zero last healing activity
2020-03-14 22:30:27 -07:00
Jeffrey Clark bcbbfa7352 Secret key prompt (#3083) 2020-03-14 00:03:44 -07:00
Anis Elleuch 5b5d65a142 info: Fix showing offline nodes in the pretty output (#3112)
Also do some simplification in the code.
2020-03-13 18:16:17 -07:00
Klaus Post 1a27f7f51d mc cp -continue: Fix escape/colorization of JSON (#3116) 2020-03-13 13:21:39 -07:00
poornas 1092f6932f fix: Make sure Ctrl-C cancels mc cp right away (#3113) 2020-03-11 21:42:38 -07:00
Nitish Tiwari 128f81461c Update docs for mc admin update (#3110) 2020-03-10 21:34:54 -07:00
Kody A Kantor 7a26f993a2 resolve build issues on illumos (#3098) 2020-03-09 21:23:21 -07:00
Anis Elleuch c170a2db6c Update minio-go to bring some fixes (#3106) 2020-03-06 15:21:06 -08:00
Harshavardhana d58cf3c8c6 fix go mod tidy 2020-03-06 12:14:00 -08:00
Anis Elleuch a7dd97f140 Add support of threads & goroutines profiling type (#3108) 2020-03-06 12:12:38 -08:00
kannappanr 093bf0d54a deprecate 'mc session' documentation (#3104) 2020-03-05 09:27:51 -08:00
kannappanr a0d9e26dc7 Support arm32, 386 compilation: (#3103) 2020-03-05 09:27:20 -08:00
Harshavardhana 24e7caa146 Use listObjectsV1 for GCS S3 implementation (#3101)
Fixes #3073
2020-03-03 23:13:10 +03:00
poornas b65d6797cd retention - cleanup unused code (#3094) 2020-02-26 10:56:49 +05:30
Harshavardhana 67e90b8fcb fix handling of directories in Stat (#3092)
Fixes #3089
Fixes #3091
2020-02-25 18:08:20 +05:30
Dmitry Wagin fd89251270 added pkg/disk/stat_freebsd.go (#3090) 2020-02-25 09:26:56 +05:30
Harshavardhana 4152714126 fix go mod tidy again 2020-02-19 12:05:24 +05:30
ebozduman 3862184a8a honor prefix for object and directory names in 'rm -r' (#3012) 2020-02-19 10:42:41 +05:30
Harshavardhana 7e1e91d9c9 go mod tidy (#3081) 2020-02-19 09:02:21 +05:30
Harshavardhana 5d9a04bac6 allow mirror to copy zero byte file (#3084)
this PR also cleans up code and avoids
extra calls for source target
2020-02-18 11:09:42 -08:00
kannappanr 2f2aecb09d use latest minio-go version (#3080) 2020-02-14 11:22:22 -08:00
poornas e03d8d99a3 Fix crash in mc admin console (#3079)
Fixes : #3078
2020-02-14 10:54:22 -08:00
Harshavardhana f7c366ae3d add debug support for 'config host add' (#3076) 2020-02-13 21:36:10 +05:30
Harshavardhana 0724774bd8 Fix go.sum file missing entries (#3071) 2020-02-06 12:02:46 +05:30
Andreas Auernhammer 551a124804 add the mc admin kms subcommands (#2882)
This commit adds the first set of KMS admin
commands.

For new there is only the
`mc admin kms key status <endpoint> [key-ID]` command
that can be used to fetch status information for a
KMS master key. Listing and rotation commands are
planed.
2020-02-05 10:29:17 -08:00
Reinhard Koehn 609274326b Ensure 64bit alignment on 32bit builds for atomics (#3065)
Keep elements that are used with atomic.* functions as first element
of struct because it guarantees 64bit alignment on 32 bit machines.
atomic.* functions crash if operand is not aligned at 64bit.
See https://github.com/golang/go/issues/599
2020-02-04 13:17:27 -08:00
ebozduman ac9b942397 check for bucket exists in 'admin heal' (#3059) 2020-02-01 10:55:13 -08:00
Harshavardhana b70a79e39b fix: handle symlinks by reading/following as needed (#3053)
Avoid using filepath.EvalSymlinks and let the caller
fail appropriately for symlinks.

Fixes #3011
2020-01-23 02:33:58 -08:00
Harshavardhana 0baee49a66 fix: update admin docs for latest changes (#3054) 2020-01-20 16:51:06 -08:00
Harshavardhana 6a2da1a6ef upgrade to latest server to remove replace tags (#3051) 2020-01-18 17:01:00 -08:00
Harshavardhana 28aae43c8c fix: best effort save permissions always (#3050) 2020-01-17 14:02:12 -08:00
Harshavardhana 0596acea95 admin/console: Fix a crash in console string generation (#3049) 2020-01-17 05:51:01 -08:00
Harshavardhana 8694ddb3ee Update pkg/madmin to support multiple profilers (#3048) 2020-01-16 12:31:49 -08:00
Maël Valais c27941bc2a cp: add missing } in help template (#3047) 2020-01-15 01:43:14 -08:00
Harshavardhana 79e183fd0f fix: update minio-go to support snowball data-transfer (#3042) 2020-01-11 15:15:30 -08:00
Anis Elleuch 632f0949bd retention: Error out early when url argument does not point to S3 server (#3041) 2020-01-10 16:53:09 -08:00
Harshavardhana 374100da7e fix: update docs for --attr command (#3040)
Also canonicalize metadata headers automatically
before, minio-go consumes it.
2020-01-10 19:18:42 +05:30
Harshavardhana 3f87064138 fix: du to ignore too many recursive symlinks (#3033) 2020-01-08 07:30:44 -08:00
Harshavardhana 63821bbe3f fix: crash in cp when cpURLs return error (#3035) 2020-01-07 12:17:00 -08:00
Klaus Post 2a66f9ba2b Only rename config directories (#3032)
If the user placed an `mc.exe` in the user directory and wasn't used it, it would be renamed.
2020-01-07 10:45:39 -08:00
poornas 27a033440e Add lock and retention docs (#3034) 2020-01-06 15:16:47 -08:00
Bala FA 50766862c1 fix default flag behaviour in du command (#3031)
- `mc du` without args should print help like other `mc` commands
- `mc du` should behave like `du -h --max-depth=1` as default
- optional `--recursive` if they want capacity for each folder.
fixes #2871
2020-01-04 12:56:35 -08:00
Harshavardhana 6d1a41458b Use colorjson to indent json properly in cp (#3030)
Additionally also do not initialize progress bar in json
or quiet mode in mirror.

Fixes #3029
Fixes #3017
2020-01-03 12:14:39 -08:00
Harshavardhana 9663319e9e Update mc dependencies to recent dep change on MinIO (#3026) 2019-12-31 11:27:59 -08:00
kannappanr 8f0b923312 Mirror: Generate STag and ETag on destination only in Multimaster mode (#3021) 2019-12-26 12:54:28 -08:00
Harshavardhana 7c9ea88742 Update to latest minio/minio (#3020) 2019-12-24 05:46:13 -08:00
Harshavardhana ee283811a3 fix: ignore APINotImplemented errors from filesystem (#3018) 2019-12-19 15:24:34 -08:00
Harshavardhana d92d2f0d4f Upgrade to new Listen bucket API (#3008) 2019-12-14 08:53:55 -08:00
Anis Elleuch f2f8f858a6 cp: Only use session when -c is passed (#2989) 2019-12-13 10:20:56 -08:00
ebozduman 64e0c36e3b Extraneous line in 'mc admin info' output (#3010) 2019-12-12 12:01:22 -08:00
ebozduman 85f814eb44 Stops showing usage info if Bucket#=0 (#3007) 2019-12-11 20:46:30 -08:00
ebozduman 2616a1d051 New admin info (#2982) 2019-12-11 18:25:55 -08:00
BigUstad 7038207039 Replace Timestamp separator (#3002)
Replace time stamp separator to use `-`
2019-12-11 17:33:17 -08:00
Klaus Post 23aab5b458 mc sql: Use compression parameter (#2996)
The compression parameter is not actually used, but always guessed from the file extension.

Only guess the compression type if it is not explicitly set.

Uploading a file called `out.csv.geezipd`:

Before:
```
λ mc sql -e="SELECT * from s3object LIMIT 1" --compression=GZIP --csv-input "rd=\n,fh=USE,fd=;" local/test/out.csv.geezipd
�""���k↔��Xs��W.v�      ��)��{2#��,r���:�|D▲�.��f♫��→�i�p�2l�♫��ʭ���Q��v▲�5ر�c
```
(content actually not ungzipped)

After:
```
λ mc sql -e="SELECT * from s3object LIMIT 1" --compression=GZIP --csv-input "rd=\n,fh=USE,fd=;" local/test/out.csv.geezipd
"281,1285,159625,159627,2637,20000827.0117590018,1239029,1663,-6.7535419,1533,0.53597438,8"
```

We leave validation of the compression value to the server.
2019-12-11 09:24:45 -08:00
Harshavardhana e109a5370a Multi-master only run single startMirror at a time (#3003)
Also randomize the sleep appropriately based
on Unix() time source.
2019-12-10 23:00:41 -08:00
poornas 871b8da9a6 Fix mirroring of PutObjectRetention event (#3004) 2019-12-10 16:23:42 -08:00
Harshavardhana 34757e2ce2 Mirror with fallback list in multimaster mode, copy missing files (#2999) 2019-12-09 07:56:18 -08:00
Harshavardhana dff0f0318c Avoid mirror fatalIf in multi-master (#2998) 2019-12-09 18:50:11 +05:30
Harshavardhana 45df811a89 update minio-go to master (#2995) 2019-12-09 01:36:25 -08:00
Krishna Srinivas 8a488ba0e4 Do full scan diff+mirror in multi-site mirror mode (#2994) 2019-12-09 01:32:58 -08:00
Krishna Srinivas ea0a4b2142 Fix multi-master setup help text (#2993) 2019-12-09 00:52:47 -08:00
kannappanr 4482063fb9 Retry mirror forever on watch (#2992) 2019-12-08 19:44:46 -08:00
Krishna Srinivas 2d8bd7aecc Support for multi master sites (#2991) 2019-12-08 16:25:50 -08:00
Harshavardhana 69bea2eb96 Continue listing upon error during diff and mirror (#2988) 2019-12-08 14:34:52 -08:00
Anis Elleuch c5112d4a0f watch: Add site wide level support (#2987) 2019-12-08 11:35:35 -08:00
Krishna Srinivas a8064ff644 Continue mirroring inspite of error events (#2986) 2019-12-07 18:00:58 -08:00
Harshavardhana fccdcfe803 fix: Source content can be nil when updating progress bar (#2984) 2019-12-07 10:06:16 +05:30
Harshavardhana 543ea4bd90 change target to name in config help (#2983) 2019-12-07 10:05:32 +05:30
Harshavardhana da47ed8ac4 Avoid re-parsing config history elements (#2981) 2019-12-06 07:17:35 +05:30
Harshavardhana f3b2d5471f Add finalized command line options (#2979) 2019-12-04 21:03:34 -08:00
Harshavardhana 3f426ff7e0 Update export command to print disabled sub-sys as comments (#2978) 2019-12-03 12:10:12 -08:00
Harshavardhana 1e1480f408 Fix progress bar update regression (#2976)
Regression introduced in cf6defe025
2019-11-30 17:19:23 -08:00
poornas 4e316c3a40 Remove duplicated API method(s) for object retention (#2973) 2019-11-27 09:44:39 -08:00
Harshavardhana cb110f7403 Add support for auto-complete in 'mc admin config' commands (#2975) 2019-11-27 09:36:40 -08:00
Harshavardhana 21a79b4a44 Add import/export command (#2974) 2019-11-26 10:08:41 -08:00
Harshavardhana cf6defe025 Fix totalSize and totalCounts calculation (#2969) 2019-11-25 18:27:01 +05:30
kannappanr 6eaf0dd05e Retention command to apply retention to objects with a Prefix (#2963) 2019-11-22 12:39:46 -08:00
poornas c2a771f51c Handle PutObjectRetention notification events correctly (#2966) 2019-11-22 09:38:36 -08:00
Harshavardhana 6cfbc809cf Add mirror command to compare metadata and copy (#2965)
mirror now uses the newly introduced
ListObjectsV2WithMetadata API in minio-go
2019-11-21 22:25:46 -08:00
Harshavardhana 3dc37f1ecd Add default values in 'get' (#2962) 2019-11-21 14:35:40 +05:30
poornas 5dda155f81 mirror object lock configuration to dest bucket (#2964)
if bucket does not exist on the target side.
2019-11-20 16:17:07 -08:00
Harshavardhana c51267871c help command is now part of mc admin config get/set (#2961) 2019-11-19 15:15:10 -08:00
Ashish Kumar Sinha 9a9a6d853d Rectify usage section of policy help (#2959) 2019-11-15 10:37:32 -08:00
Harshavardhana 9aebf1e818 update to latest minio (#2957) 2019-11-13 22:35:23 -08:00
poornas 3df8101903 Fix encrypt-key flag parsing (#2955) 2019-11-12 10:24:00 -08:00
Harshavardhana 94943334d4 update to latest minio (#2956) 2019-11-12 03:26:52 -08:00
Bala FA 27d1131825 add lock command (#2880)
`lock` command enables to set, get and clear object lock configuration
of given bucket.
2019-11-11 11:36:04 -08:00
Harshavardhana e0c6fabda6 Fix config history to list in git style format (#2951)
```
~ mc admin config history list -n 2 myminio
RestoreId: df0ebb1e-69b0-4043-b9dd-ab54508f2897
Date: Mon, 04 Nov 2019 17:27:27 GMT

region name="us-east-1" state="on"
region name="us-east-1" state="on"
region name="us-east-1" state="on"
region name="us-east-1" state="on"

RestoreId: ecc6873a-0ed3-41f9-b03e-a2a1bab48b5f
Date: Mon, 04 Nov 2019 17:28:23 GMT

region name=us-east-1 state=off
```
2019-11-05 14:41:52 -08:00
Praveen raj Mani 71f5a7568f Fix the storage prints for xl/fs disks in admin info server (#2947) 2019-10-31 10:14:53 -07:00
Wesley Collin Wright 2a33d28cb9 print disk usage as a plain integer when formatting as json (#2946) 2019-10-31 10:05:55 -07:00
Harshavardhana 9927c0d5c7 mc admin config set/get/del/history/help (#2835)
Related to https://github.com/minio/minio/pull/8392
2019-10-30 21:36:41 -07:00
Ashish Kumar Sinha 42898064f2 Add options to preserve filesystem attributes (#2938) 2019-10-30 00:35:25 -07:00
kannappanr 810978720f Fix typo in error message (#2945)
Change the error message from `Cannot remove new user` to 
`Cannot remove <User>`, when a non-existent user is removed.
2019-10-30 09:08:00 +05:30
kannappanr 90a60d3b6a Avoid index out of range errors (#2943)
Fixes #2941
2019-10-28 12:01:56 +05:30
Nitish Tiwari f6240587db Fix arrow signs to use more common U+2191 & U+2193 (#2942) 2019-10-27 20:55:36 -07:00
Praveen raj Mani 80aecfddff Adapt new changes in StorageInfo (#2889) 2019-10-23 08:47:38 -07:00
Bala FA 72403ecbd1 fix mc cp termination on signals (#2934) 2019-10-21 22:12:56 +05:30
Ashish Kumar Sinha 16965bc19a continue flag: Fix inconsistent punctuation in usage text (#2933) 2019-10-21 14:32:46 +05:30
Bala FA d7078ae153 Refactor mc cp and make session optional. (#2910)
Now `mc cp --recursive --continue` creates copy session on failure or
resumes if previous failed session is found.

Fixes #2893
2019-10-18 22:52:20 +05:30
Harshavardhana bced96ee98 Update mc to use secure-io package (#2931) 2019-10-17 03:04:05 -07:00
poornas 990a7b6d51 Add --type flag to mc admin console (#2914)
This allows filtering error logs by type
2019-10-15 00:47:09 +05:30
poornas 735aa139b1 Fix removing empty prefixes with mc rm command (#2912)
Fixes: 2909
2019-10-12 09:49:14 +05:30
Klaus Post aa4a4774da Fix Windows config path (#2898)
Remove '.exe' (case insensitive) from executable name for consistent config folder.

Potentially breaking: If people (for whatever reason) used 'mc.exe', this will potentially break their setup.
2019-10-12 00:07:10 +05:30
yiranzai c389ee4aa0 Fix zh_CN doc about policy errors (#2927) 2019-10-11 04:21:20 +05:30
kannappanr f93fe1330a Update minio-go to v6.0.39 (#2924) 2019-10-09 09:08:39 -07:00
ebozduman 3710c443bb No 'Removing ...' messages for prefixes(dirs) (#2925) 2019-10-09 06:58:55 +05:30
poornas 0f8345b207 trace - Add TimeToFirstByte to output in --json mode (#2904) 2019-10-09 01:25:54 +05:30
Oleg Utkin 6f478d0a6f update docker alpine base image to 3.10 (#2920) 2019-10-08 07:16:43 +05:30
Andy Boyett d902705d90 README: update minimum go version (#2923)
PR #2888 bumped the minimum go version from 1.12 to 1.13 but did not
update README.md to reflect the change. This commit updates the readme
to be in line with the code.

Attempting to build `mc` from source on go 1.12 yields this error:
```
$ GO111MODULE=on go get github.com/minio/mc
go: finding github.com/minio/mc latest
package github.com/minio/mc: build constraints exclude all Go files in /home/andy/go/pkg/mod/github.com/minio/mc@v0.0.0-20191004065813-f79aefa79713
```
2019-10-08 01:04:46 +05:30
poornas f79aefa797 mc sql - default to json output if global json flag set (#2921) 2019-10-04 12:28:13 +05:30
kannappanr 196723372c Doc: Remove text on s3V4 incompatibility with GCS (#2916)
GCS right now works with S3V4, so removed the documentation
where it says that GCS only supports s3V2.

Fixes #2915
2019-10-04 10:17:58 +05:30
Harshavardhana f687722587 Add default query for sql (#2919) 2019-10-02 21:09:10 -07:00
kannappanr 26b9044a86 mod: update minio-go package to v6.0.38 (#2917) 2019-10-03 00:47:43 +05:30
ebozduman a9c606f119 Customize service help for Windows/Linux users (#2908) 2019-09-28 08:33:28 +05:30
poornas 26b71711e8 Show server startup messages on admin console cmd (#2897) 2019-09-26 00:27:22 +05:30
Harshavardhana 6438350130 Update minio-go to latest (#2905)
- Change LDAP XML names to follow server changes (#1164)
- Fix listObjects hang when listing special characters (#1165)
2019-09-24 07:00:03 +05:30
Praveen raj Mani 508869e3f1 Prometheus config generation (#2781)
Add `admin promethes --generate` to generate the prometheus config
2019-09-22 20:28:17 +05:30
Harshavardhana 1db7a3bbed Add go.yml github workflow (#2902) 2019-09-20 05:56:49 +05:30
Harshavardhana 57a9c6fab2 Fix mc functional tests to work with new changed behavior (#2901)
- mc rm doesn't fail for SSE-C encrypted objects because
  we use multi-object delete - this behavior is S3 compatible
- changes needed to ensure that keys are set appropriately
  when doing server side copy.
2019-09-20 04:48:02 +05:30
Harshavardhana 93297260be Remove 'mc update' prompt just update automatically (#2900) 2019-09-19 09:01:24 -07:00
Harshavardhana dff077e34b Add support for attr flag in mirror (#2892) 2019-09-19 08:22:45 -07:00
Harshavardhana a8380a00ef Remove codecov for mc builds 2019-09-18 17:43:50 -07:00
Vivian Kong 5afb0a3aa7 Build staticcheck as pre-built binaries are not available on s390x (#2890) 2019-09-12 23:59:34 +05:30
Harshavardhana 54ee3a2800 Migrate to go1.13 (#2888) 2019-09-09 02:54:43 +05:30
poornas 9f75caef55 fix mc rb to accept bucket or alias as valid args (#2886)
Fixes: #2869
2019-09-07 12:13:52 +05:30
poornas bc1c6bde1d admin console - fix output format (#2885) 2019-09-07 06:44:31 +05:30
poornas 1dd2b4494d Fix error message wording in mc admin commands (#2887) 2019-09-06 17:09:44 -07:00
Harshavardhana 5fc35b6682 Fix admin help messages and docs (#2884) 2019-09-06 10:07:30 -07:00
poornas 22ab93da0f Add mc admin console command (#2794)
Also replace thrift package location
2019-09-05 07:04:25 +05:30
Ashish Kumar Sinha 1582b1cf35 Add support for passing non-printable charachter as key (#2851) 2019-08-29 16:57:04 -07:00
Harshavardhana bd7564a2d4 Add 'mc admin update' command (#2857)
Also this PR deprecates `service status` command
2019-08-28 15:57:25 -07:00
Daniel Valdivia af7d551010 Add support for Total Space and Available Space on mc admin info (#2872) 2019-08-23 09:33:38 -07:00
Ashish Kumar Sinha 3acbeda9c2 Merge mc monitor to mc info (#2838) 2019-08-23 00:26:51 +05:30
Praveen raj Mani 89d30e9aa2 Recognise dot prefixed endpoints in admin info (#2868)
Fixes #2867
2019-08-18 10:25:03 +05:30
Sidhartha Mani 64d45ac35a fix formatting for admin trace (#2854) 2019-08-16 16:57:40 -07:00
poornas f8661fd87e Fix broken link to go installation docs (#2866) 2019-08-15 15:23:12 -07:00
Harshavardhana 12add870fc Add missing commands to autocomplete (#2862) 2019-08-15 12:20:31 -07:00
jgkirschbaum 00a2f81589 Clarified the used JSON format (#2864) 2019-08-15 11:33:53 -07:00
jgkirschbaum 617b5e39f5 Clarified the used JSON format (#2863) 2019-08-15 10:51:27 -07:00
Aditya Manthramurthy 1555979f96 Fix help message bug in group disable command (#2860) 2019-08-14 15:04:55 -07:00
Praveen raj Mani 418c8e7182 Remove empty parent directories while mirroring fs (#2849)
Fixes 2826
2019-08-14 09:26:57 -07:00
Aditya Manthramurthy 3b94d4d3e0 Add policy set command (#2852)
This is a BREAKING change.

- This command sets policy for user and group
- `mc admin user set-policy` is now removed.
- `mc admin uesr add` no longer accepts a policy to set on the user.

Add user info command to show groups of a user
2019-08-13 14:11:27 -07:00
Praveen raj Mani e541715e42 Fix error message in mc tree (#2855) 2019-08-13 13:35:47 -07:00
Harshavardhana 37bdbd037e Colorize du output appropriately (#2856) 2019-08-12 18:05:17 -07:00
Bala FA d399b1e70b add du command support (#2802)
This command works like `du` command in unices i.e. summarize disk
usage of given TARGET recursively.
2019-08-07 21:02:09 -07:00
Ashish Kumar Sinha fef437bdd6 Modify policy command (#2768)
Add set, set-json, get , get-json sub-commands.

Example:
mc policy set download s3/mybucket
mc policy set-json path-to-json-file s3/mybucket
mc policy get s3/mybucket
mc policy get-json s3/mybucket
2019-08-06 21:09:28 -07:00
Harshavardhana 809741e161 Update README.md for source builds 2019-08-06 15:46:32 -07:00
Harshavardhana 0f360131cb Remove runtime checks use go build tag (#2848)
Project can be only built with go1.12 or newer
other build related changes to use new go1.12
features.

Fixes #2815
2019-08-06 15:41:04 -07:00
Aditya Manthramurthy cb3ce8fb97 Add mc admin group command (#2841)
This change is in preparation to add user-groups support to MinIO
server.

- Adds add, remove, enable/disable, list and info sub-commands for the
  group command
2019-08-05 11:37:07 -07:00
poornas b56e297be0 fix admin trace crash on 32 bit systems (#2847) 2019-07-31 17:06:42 -07:00
Harshavardhana 81eb54d146 Fix broken functional tests (#2843) 2019-07-30 14:28:13 -07:00
Ashish Kumar Sinha 9fabc08520 Accept metadata of form Cache-Control=max-age=xxxxxxx (#2840) 2019-07-30 06:52:31 -07:00
kannappanr b885d13060 Windows stat: Compare URLs in windows style path (#2774)
Convert user provided URL into windows style to compare in statURL

Fixes #2772
2019-07-25 17:37:52 -07:00
poornas 67dbada736 Minor changes to admin trace output fmt (#2834) 2019-07-23 17:31:31 -07:00
Harshavardhana c25461640b Fix tree docs and error handling (#2833)
Fixes #2832
2019-07-22 13:02:49 -07:00
poornas c727be5a48 Add error filter flag to mc admin trace command (#2824) 2019-07-21 06:30:33 +01:00
Harshavardhana ae098462c9 Fix admin info dot coloring (#2830) 2019-07-19 08:20:14 +01:00
poornas 74a7c3dc9a Show call stats in admin trace command (#2823)
- Add call latency, input and output bytes to trace
2019-07-19 02:20:08 +01:00
Harshavardhana c2fcfe6512 Make sure to error out if depth is -1 (#2828)
Current code silently converts -1 to 0, which
is not needed and we should fail instead.
2019-07-18 14:40:51 +01:00
Praveen raj Mani bdcb9dcb2f Add tree listing (#2804) 2019-07-17 22:23:02 -07:00
Aditya Manthramurthy 6200a34522 Add "mc admin policy info" command to display policy content (#2818) 2019-07-18 01:43:10 +01:00
Ashish Kumar Sinha 9a25e66e87 Add --ignore-existing/-p flag in mc event add command (#2773)
If the event is already present the server throws an error. With the --ignore-existing/ -p flag these error messages are discarded
2019-07-16 10:40:06 +01:00
Harshavardhana 7c454d8f94 Migrate to new minio/cli, fix all extra spaces across commands (#2825) 2019-07-15 19:59:28 +01:00
Harshavardhana ab3e70ae9f Fix escape characters in trace command (#2822) 2019-07-13 09:07:34 +05:30
Mauricio Scheffer 1818191dca Fix inner link (#2820) 2019-07-12 10:21:15 +05:30
Harshavardhana 31e5ac02bd Fix auto-completion code (#2819)
Reverts the code in #2812

Fixes #2816
2019-07-11 10:41:14 -07:00
Harshavardhana aa3c9f58df Remove port 9000 for play.min.io (#2817)
Most corporate environments block port 9000,
since we already allow access from port 80 and
port 443 just default to https port instead.
2019-07-10 21:16:45 +01:00
Anis Elleuch df9320134b autocompletion: Add control flag and a prompt (#2812)
*) Add --no-autocompletion to disable the automatic install of
the auto completion
*) Add a prompt to ask for permission to install automatic
auto completion when not installed yet
2019-07-04 22:40:56 -07:00
Harshavardhana 6003da8daa update command with json flag shouldn't throw prompt (#2809) 2019-06-27 15:43:14 -07:00
kannappanr 41e3ea5664 Update latest minio-go version in go.mod (#2811) 2019-06-27 12:58:04 -07:00
Krishnan Parthasarathi 8b33b2809c Improve next action suggestion in mc admin config set (#2810) 2019-06-27 12:15:21 -07:00
Ashish Kumar Sinha 56309a4999 mc command cleanup (#2783) 2019-06-27 14:47:08 +05:30
Anis Elleuch 2d691508c2 Show background heal stats in mc admin heal (#2808) 2019-06-26 15:14:20 -07:00
Harshavardhana 98e88c2ff0 Add proper JSON status field for API compatibility (#2807) 2019-06-26 10:51:17 -07:00
poornas 675618574a Change short trace message display format (#2798)
to abridge function name,time format and
add client ip in the output
2019-06-24 15:43:23 -07:00
Harshavardhana d97cfaa55d Fix trace formatting (#2805) 2019-06-19 15:11:03 -07:00
Adara ec76f67668 doc: add info about --attr flag for cp command (#2793) 2019-06-19 12:13:20 -07:00
Harshavardhana a12c507bec Update minio-go to v6.0.29 (#2799) 2019-06-15 10:12:32 -07:00
poornas ca26dac8e2 Add mc admin trace command. (#2655) 2019-06-11 16:25:33 -07:00
Harshavardhana 5d0a9c0803 Make sure to preserve region specific URLs (#2791)
This is to ensure that restricted access
to certain buckets is allowed on certain
regions.

This is a continuation of last commit
2019-06-11 13:59:10 -07:00
Harshavardhana b85dabd6b4 Update to minio-go v6.0.28 (#2790) 2019-06-06 18:11:49 +05:30
Harshavardhana e978c71b7c Add staticcheck based builds (#2788)
Additionally this PR also supports
multi-platform builds to avoid cross
platform build issues.
2019-06-03 11:22:31 -07:00
Anis Elleuch eb9493458e autocomplete: update github.com/posener/complete to include macOS fix (#2784)
https://github.com/posener/complete/commit/afda8e00c6d48e7d20bff281c321bc8aca00699a
is sent to fix a rare macOS issue with installing completion command.

The commit will require a specific commit in posener/complete to have our fix
included.
2019-05-29 17:55:15 -07:00
Harshavardhana f4bb0b8850 Update minio-go to latest release v6.0.26 (#2782) 2019-05-29 08:27:18 -07:00
Aditya Manthramurthy dd4e356c64 Fixup go.mod and go.sum files (#2777) 2019-05-24 20:02:30 -07:00
Harshavardhana c1ed052638 Update madmin API deps with new retry functionality (#2769) 2019-05-11 00:04:08 -07:00
Andreas Auernhammer 88a3c2b1e1 remove admin-credential command (#2767)
This commit removes the admin credentials command
to fix the build since github.com/minio/minio
ae002aa7241bd35d5fd9b47e8b62df2176ad2ab1 removes
the admin API for updating the admin credentials.
2019-05-05 22:32:41 -07:00
Ashish Kumar Sinha f0f156aca8 Skip error upon deletion of non existing object and force flag (#2765)
On the similar lines of standard linux  rm command.
mc retruns exit status as 0 and skips the error message when --force argument is used.
2019-05-02 10:18:15 -07:00
Harshavardhana b1aa2232ef Disable http2.0 for now until upstream bugs are fixed (#2764) 2019-05-01 15:42:36 -07:00
Ashish Kumar Sinha 4b4555b811 Policy list: Return error if policy doesn't exist (#2760) 2019-04-25 13:41:46 -07:00
poornas ecdeb3934d Remove Insufficient permission error from ignored errors (#2755)
Remove Insufficient permission error from ignored list of errors.

Fixes #2752 -  When mirror fails due to insufficient
permissions of user on a bucket, this should be
displayed
2019-04-22 12:22:21 -07:00
fgma abceea8fa1 fix crash when parsing empty/invalid MC_HOST_* env variable (#2757) 2019-04-22 21:53:31 +05:30
ebozduman 83a9d8b91d Adds missing codebase MinIO and min.io changes (#2745) 2019-04-16 22:31:54 -07:00
kannappanr 68a9eeae18 Fix: do not check if object listed equals object being removed (#2748)
List within the statURL function considers object name as a prefix
and lists objects that have the same prefix.
currently, it errors out if the object is a subset of another object.

This PR will fix this.

Fixes #2746
2019-04-16 20:44:57 -07:00
kannappanr 5729a01e69 doc: Document top command (#2672) 2019-04-10 15:48:45 -07:00
kannappanr ea469140d5 Display request header in anonymous mode (#2733)
Currently if authorization header is missing, then request is not displayed
This resulted in just the response being displayed, in anonymous mode.

This PR fixes that issue.
2019-04-05 14:04:16 -07:00
ebozduman b5b7a56eca Replace Minio refs with MinIO and links in mc docs (#2742) 2019-04-05 14:03:18 -07:00
Harshavardhana 66677d7c21 alpine 3.7 is eol'ed migrate (#2743)
Alpine 3.7 is EOL. This PR migrates to Alpine 3.9
2019-04-04 12:07:53 -07:00
Harshavardhana 7805774cf3 Instead of rename use moveFile for cross device renames (#2738) 2019-04-03 12:19:53 -07:00
poornas 8ae04b41b0 mirror: fix 0 byte files not getting mirrored (#2739)
Fixes: #2737
2019-04-03 08:15:17 -07:00
Harshavardhana b27cd5ada8 Make csv-input optional for default cases (#2741)
Fixes #2740
2019-04-03 18:31:23 +05:30
Tufan Barış YILDIRIM a1355e50e2 Documented --json for diff command (#2736) 2019-03-31 20:01:44 -07:00
kannappanr 2ad65c0799 ls: Remove space between size and unit (#2735)
With the move to go.mod, the latest humanize package is being used.
This introduces a space between size and the unit. Manually removing the space
to make it consistent with the older mc releases.
2019-03-29 15:02:26 -07:00
kannappanr 7f2770e68f updating go.mod to use latest sha256-simd pkg (#2732) 2019-03-28 13:02:39 -07:00
Harshavardhana c34dec5495 Set correct compressionType for compression select request (#2730) 2019-03-28 10:52:13 -07:00
Harshavardhana ba92305de0 Migrate to go1.12, deprecate vendor directory (#2727) 2019-03-27 10:08:19 -07:00
poornas 0a790a1a2e ls: consistent output while listing directories on file system (#2723) 2019-03-21 19:19:11 -07:00
Harshavardhana 3ea090fe18 Fix rm to behave properly deleting prefixes (#2720) 2019-03-20 13:08:36 -07:00
poornas 0490231b34 For non-canned policies, show policy status as custom (#2716) 2019-03-19 09:11:16 +05:30
Anis Elleuch 030aa5aba5 Add normal/deep scan flag to admin heal cmd (#2692) 2019-03-15 15:40:51 -07:00
kannappanr 09d04326dc Deprecate MC_HOSTS_ env variable (#2718)
MC_HOSTS_ env variable will be replaced with MC_HOST_ as it is more
appropriate

MC_HOSTS_ will be removed in the near future.
2019-03-14 17:29:07 -07:00
Sidhartha Mani cfb25fe81b mc admin info changes (#2712) 2019-03-14 18:20:29 +05:30
Anis Elleuch ecfd4526a3 tests: Clean per test created buckets (#2717)
In addition to the general bucket name created for functinal tests,
some tests inside this latter creates separated buckets but remove
them using rm command which does not support removing buckets anymore.
2019-03-13 10:38:18 -07:00
Anis Elleuch affc127af0 mirror: Return non-zero exit code for errors occuring during mirror (#2705)
An error, such as, `Bad Request` when copying an object without supplied
keys is not reflected in the exit code.

This commit simplifies a bit the mirror code. It makes mirror before and
after starting to send the status to mj.status.
2019-03-12 16:36:14 -07:00
Anis Elleuch a498b9b3a2 rm: Force removing an object when it is encrypted without key specified (#2700)
Currently, a single remove HEAD an object, but this latter can return
400 Bad Request when the object is encrypted and the user doesn't specify
any encryption key.

So when HEAD fail, this PR will use GET listing to find the object and
remove it if existent.

We can avoid calling HEAD in the first place and use only listing, but this
has some penality on the server.
2019-03-12 14:03:59 -07:00
poornas e684b48cfe Add --dangerous flag for mc rb sitewide removal (#2709)
Also fix mc rb bug while deleting folders on file system
2019-03-11 22:27:35 -07:00
poornas 5b585c4759 Additional flags for mc sql command (#2687)
add sql select options
change flag names and remove parquet option
add csv-output-header option
2019-03-11 22:23:45 -07:00
Ashish Kumar Sinha 2e612b23d6 Add metadata in mc copy (#2671)
Example : mc cp --attr key1=value1,key2=value2 
play/mybucket/burningman2011/ ~/latest/
2019-03-11 12:47:28 +05:30
Anis Elleuch 4a130c60a8 rb: Fix removing an empty bucket when passed as argument (#2703)
rb was relying on client.List() to find all elements that needs to be
removed. However it doesn't include 'alias/bucket' in the listing
when 'alias/bucket' itself is passed as an argument in rb command.

This PR will always attempt to delete the passed argument as this is
what the user wants in the first place.

This PR also fixes teardown() in functional-tests.sh to remove
the bucket using rb instead rm since rm does not remove buckets
anymore.
2019-03-08 17:07:06 +05:30
Anis Elleuch b72d2d9cc5 tests: Use rb instead of rm to clean test bucket (#2708)
rm command is not able to remove buckets anymore, so use the new rb
command instead.
2019-03-07 09:04:32 -08:00
Harshavardhana b3229507a9 Fix functional tests to use --older-than (#2706)
Change missed in previous PR 1761b338f9
2019-03-06 02:33:07 -08:00
Ashish Kumar Sinha 1761b338f9 OlderThan & NewerThan configured for Days, Hours and Minutes (#2614)
Previously OlderThan and NewerThan was configured for day
which has been changed to Days, Hours and minutes.

Also, changed the `flag` in `find` command to be `newer-than` and `older-than` to be consistent with other commands.
2019-03-03 20:18:34 -08:00
poornas c63c5732e9 Fix policy set error (#2701)
When policy is being set,json does not need to be indented - it
is causing a policy has invalid resource error
2019-03-02 10:38:16 -08:00
poornas dba70c0b92 Stat: display Expires header if present (#2697) 2019-03-01 13:03:53 -08:00
Sidhartha Mani c75abbb3f9 use colorjson for all other mc outputs (#2683)
- Update to MarshalIndent instead of Marshal
- Allow unmarshalling
2019-02-28 14:33:13 -08:00
Harshavardhana 19e14db50a Avoid ListBuckets to keep Stat() ops on bucket simpler (#2699)
Due to multi-user feature on Minio and mc adoption in
many different restrictive environments, most users disable
access to ListBuckets() calls. We can avoid such network
operations as they only add marginal value.
2019-02-28 14:23:47 -08:00
Eco bd5372f165 Update mc complete guide with PPC binary link (#2675)
Linux specific
2019-02-22 11:03:35 -08:00
Anis Elleuch a3203d4fe7 complete: Add support of rb completion (#2689)
Add completion for rb command:
- Support filesystem paths
- S3 paths only supports this format: `alias/bucket/`, for that s3Complete{}
has deepLevel parameter to configure maximum path deep level.
2019-02-20 14:35:23 -08:00
poornas e538599e2f Add mc rb command to remove empty bucket (#2662)
Change mc rm --recursive behavior to
delete objects in bucket but not the
bucket itself.

Fixes #2635
2019-02-16 20:12:38 -08:00
Anis Elleuch 4b62f520e8 Add support of bash completion (#2592)
Users of bash/zsh will have completion config enabled in the next
shell session start. This commit provides completion for commands
and all subcommands, their flags and completion of filesystems paths,
mc aliases, buckets and prefixes.
2019-02-14 22:17:43 +05:30
Anis Elleuch bc1a108e5c pb: Do not exceed the specified total transfer bytes (#2685)
mc, via minio-go, can retries some requests for many reasons, such as, network
disconnect. This commit ensures that the progress bar does not show transfered
bytes greater then the total transfered bytes to avoid confusing users.
2019-02-13 11:02:00 -08:00
Anis Elleuch 38965dd432 mirror: Proper exit when preparing diff returns an error (#2681)
A bad synchornization between startMirror() and its caller mirror() happens when preparing the difference of objects between source & target returns an error: mirror() quits when it receives an error from startMirror() without give a chance for that latter to properly stop the parallel mirror manager.

This PR will:
1. Quit mirroring when listing returns an error: this means calculating diff needs to stop and no further action needs to be taken since it can be dangerous especially when --remove flag is passed.
2. Properly stop parallel mirroring manager before quitting.
2019-02-12 14:28:38 -08:00
Eco 30491f369d Update mc quickstart guide with PPC binary link (#2677) 2019-02-11 21:51:40 -08:00
Eco 1941a2532a Update mc admin guide with PPC binary link (#2676)
fixes #2644
2019-02-12 10:26:36 +05:30
Harshavardhana 3a22044471 Vendorize all the latest dependencies with go mod (#2674) 2019-02-08 18:32:17 -08:00
kannappanr da3e027145 Strip trailing separator in URL in config host add (#2680)
Also, in the case of find command for existing configs that has a 
trailing separator in the URL, trim the separator from the URL.

Fixes #2645
2019-02-07 21:10:38 -08:00
Sidhartha Mani 7bc792e745 Add json pretty print (#2661)
Enable jq style color output in github.com/minio/mc/pkg/json
- Drop in replacement of encoding/json
- Bold struct keys in blue
- Strings in green
- Numbers in default color
- Indenting and spacing matches exact jq specifications

Additionally, color coding needs '\x1b[...m' to be whitelisted in encoding/json's parser
2019-02-05 11:52:33 +05:30
Sidhartha Mani 939e1006cc add mc admin monitor command (#2657) 2019-02-02 22:44:21 +05:30
Harshavardhana 57faed2725 Add go mod support and update dependencies (#2668) 2019-01-31 20:37:08 -08:00
Harshavardhana f9a6d70bc0 Add IAM docs about AWS S3 users (#2667) 2019-01-31 15:39:29 -08:00
kannappanr e3854b077a List oldest locks currently used in a distributed XL setup (#2549) 2019-01-31 12:37:04 -08:00
poornas 75a36b4831 Change mc config host list format to record style (#2659) 2019-01-28 16:52:50 -08:00
Praveen raj Mani 30965763d6 Support setting of custom policies from a JSON file (#2649)
Fixes #2633
2019-01-28 13:30:31 -08:00
kannappanr e940856fee Vendorize minio-go (#2660) 2019-01-25 15:19:04 -08:00
Harshavardhana 07169d421e Add sql docs (#2658) 2019-01-24 15:56:09 -08:00
Anis Elleuch a5ea937df2 mirror: Fix double printing of remove object msg (#2639)
Mirror code depends on rm code which naturally prints delete messages,
this PR will make mirror uses its own delete code since it is simple
enough to do.

Also add size information to remove message
2019-01-24 07:13:46 -08:00
1215 changed files with 80061 additions and 304505 deletions
+2 -2
View File
@@ -4,8 +4,8 @@
## Steps to reproduce the behavior
## mc version
- (paste output of `mc version`)
## mc --version
- (paste output of `mc --version`)
## System information
+19
View File
@@ -0,0 +1,19 @@
---
name: Bug report
about: Bug report template
title: ''
labels: community, triage
assignees: ''
---
## Expected behavior
## Actual behavior
## Steps to reproduce the behavior
## mc --version
- (paste output of `mc --version`)
## System information
+5
View File
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: MinIO Community Support
url: https://slack.min.io
about: Please ask and answer questions here.
+26
View File
@@ -0,0 +1,26 @@
## Community Contribution License
All community contributions in this pull request are licensed to the project maintainers
under the terms of the [Apache 2 license](https://www.apache.org/licenses/LICENSE-2.0).
By creating this pull request I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 license.
## Description
## Motivation and Context
## How to test this PR?
## Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Optimization (provides speedup with no functional changes)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
## Checklist:
- [ ] Fixes a regression (If yes, please add `commit-id` or `PR #` here)
- [ ] Unit tests added/updated
- [ ] Internal documentation updated
- [ ] Create a documentation update request [here](https://github.com/minio/docs/issues/new?label=doc-change,title=Doc+Updated+Needed+For+PR+github.com%2fminio%2fmc%2fpull%2fNNNNN)
+39
View File
@@ -0,0 +1,39 @@
# Configuration for Lock Threads - https://github.com/dessant/lock-threads-app
# Number of days of inactivity before a closed issue or pull request is locked
daysUntilLock: 365
# Skip issues and pull requests created before a given timestamp. Timestamp must
# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable
skipCreatedBefore: false
# Issues and pull requests with these labels will be ignored. Set to `[]` to disable
exemptLabels: []
# Label to add before locking, such as `outdated`. Set to `false` to disable
lockLabel: false
# Comment to post before locking. Set to `false` to disable
lockComment: >-
This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.
# Assign `resolved` as the reason for locking. Set to `false` to disable
setLockReason: true
# Limit to only `issues` or `pulls`
only: issues
# Optionally, specify configuration settings just for `issues` or `pulls`
# issues:
# exemptLabels:
# - help-wanted
# lockLabel: outdated
# pulls:
# daysUntilLock: 30
# Repository to extend settings from
# _extends: repo
+59
View File
@@ -0,0 +1,59 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 90
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 30
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
onlyLabels: []
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- "security"
- "pending discussion"
# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: false
# Set to true to ignore issues with an assignee (defaults to false)
exemptAssignees: false
# Label to use when marking as stale
staleLabel: stale
# Comment to post when marking as stale. Set to `false` to disable
markComment: >-
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed after 21 days if no further activity
occurs. Thank you for your contributions.
# Comment to post when removing the stale label.
# unmarkComment: >
# Your comment here.
# Comment to post when closing a stale Issue or Pull Request.
# closeComment: >
# Your comment here.
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 1
# Limit to only `issues` or `pulls`
# only: issues
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
# pulls:
# daysUntilStale: 30
# markComment: >
# This pull request has been automatically marked as stale because it has not had
# recent activity. It will be closed if no further activity occurs. Thank you
# for your contributions.
# issues:
# exemptLabels:
# - confirmed
+39
View File
@@ -0,0 +1,39 @@
name: Crosscompile
on:
pull_request:
branches:
- master
# This ensures that previous jobs for the PR are canceled when the PR is
# updated.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
name: Build Tests with Go ${{ matrix.go-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version: [1.25.x]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
check-latest: true
- name: Build on ${{ matrix.os }}
if: matrix.os == 'ubuntu-latest'
env:
CGO_ENABLED: 0
GO111MODULE: on
run: |
sudo sysctl net.ipv6.conf.all.disable_ipv6=0
sudo sysctl net.ipv6.conf.default.disable_ipv6=0
make crosscompile
+79
View File
@@ -0,0 +1,79 @@
name: Go
on:
pull_request:
branches:
- master
# This ensures that previous jobs for the PR are canceled when the PR is
# updated.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
build:
name: Test on Go ${{ matrix.go-version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
GO111MODULE: on
strategy:
matrix:
go-version: [1.25.x]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Build on ${{ matrix.os }}
if: matrix.os == 'windows-latest'
run: |
go build --ldflags="-s -w" -o %GOPATH%\bin\mc.exe
go test -v -race --timeout 30m ./...
- name: Build on ${{ matrix.os }}
if: matrix.os == 'macos-latest'
run: |
go build --ldflags="-s -w" -o %GOPATH%\bin\mc
go test -v -race --timeout 30m ./...
- name: Build on ${{ matrix.os }}
if: matrix.os == 'ubuntu-latest'
env:
ACCESS_KEY: minioadmin
SECRET_KEY: minioadmin
ENABLE_HTTPS: 1
MINIO_CI_CD: 1
SERVER_ENDPOINT: localhost:9000
MC_TEST_ENABLE_HTTPS: true
MC_TEST_SKIP_INSECURE: true
MC_TEST_SKIP_BUILD: true
run: |
wget https://dl.min.io/server/minio/release/linux-amd64/minio && chmod +x minio
mkdir -p ~/.minio/certs/ && cp testdata/localhost.crt ~/.minio/certs/public.crt && cp testdata/localhost.key ~/.minio/certs/private.key
sudo cp testdata/localhost.crt /usr/local/share/ca-certificates/ && sudo update-ca-certificates
./minio server /tmp/test-xl/{1...4}/ & sleep 10
make
make test-race
make verify
./functional-tests.sh
vetchecks: # Run vet checks against one version.
env:
CGO_ENABLED: 0
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.24.x
- name: Checkout code
uses: actions/checkout@v2
- name: Test 386
run: GOOS=linux GOARCH=386 go test -short ./...
+18
View File
@@ -0,0 +1,18 @@
# @format
name: Issue Workflow
on:
issues:
types:
- opened
jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v0.5.0
with:
project-url: https://github.com/orgs/miniohq/projects/2
github-token: ${{ secrets.BOT_PAT }}
+25
View File
@@ -0,0 +1,25 @@
name: VulnCheck
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
vulncheck:
name: Analysis
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.25.x
- name: Get official govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
shell: bash
- name: Run govulncheck
run: govulncheck ./...
shell: bash
+7
View File
@@ -9,3 +9,10 @@ parts/
prime/
stage/
mc
.run*
.idea/
mc.RELEASE*
mc.gz
.DS_Store
.vscode/
.bin/
+42
View File
@@ -0,0 +1,42 @@
version: "2"
linters:
default: none
enable:
- gomodguard
- govet
- ineffassign
- misspell
- revive
- staticcheck
- unused
settings:
misspell:
locale: US
exclusions:
generated: lax
rules:
- path: (.+)\.go$
text: instead of using struct literal
- path: (.+)\.go$
text: should have a package comment
- path: (.+)\.go$
text: error strings should not be capitalized or end with punctuation or a newline
- path: (.+)\.go$
text: error strings should not end with punctuation or newlines
- path: (.+)\.go$
text: error strings should not be capitalized
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- gofumpt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
+167
View File
@@ -0,0 +1,167 @@
project_name: mc
release:
name_template: "Version {{.Version}}"
disable: true
github:
owner: minio
name: mc
env:
- CGO_ENABLED=0
- GO111MODULE=on
before:
hooks:
- make clean
- go generate ./...
- go mod tidy
- go mod download
builds:
-
goos:
- linux
- darwin
- windows
- freebsd
goarch:
- amd64
- arm64
- arm
- ppc64le
- s390x
goarm:
- 7
ignore:
- goos: darwin
goarch: arm64
- goos: darwin
goarch: arm
- goos: darwin
goarch: ppc64le
- goos: darwin
goarch: s390x
- goos: windows
goarch: arm64
- goos: windows
goarch: arm
- goos: windows
goarch: ppc64le
- goos: windows
goarch: s390x
- goos: freebsd
goarch: arm
- goos: freebsd
goarch: arm64
- goos: freebsd
goarch: ppc64le
- goos: freebsd
goarch: s390x
flags:
- -tags=kqueue
- -trimpath
ldflags:
- "-s -w -X github.com/minio/mc/cmd.Version={{.Version}} -X github.com/minio/mc/cmd.ReleaseTag={{.Tag}} -X github.com/minio/mc/cmd.CommitID={{.FullCommit}} -X github.com/minio/mc/cmd.ShortCommitID={{.ShortCommit}}"
archives:
-
format: binary
name_template: "{{ .Binary }}-release/{{ .Os }}-{{ .Arch }}/{{ .Binary }}.{{ .Version }}"
nfpms:
-
id: minio
package_name: mc
vendor: MinIO, Inc.
homepage: https://min.io/
maintainer: dev@min.io
description: MinIO Client (mc) provides a modern alternative to UNIX commands like ls, cat, cp, mirror, diff, find etc. It supports filesystems and Amazon S3 compatible cloud storage service (AWS Signature v2 and v4).
license: Apache 2.0
bindir: /usr/bin
formats:
- deb
- rpm
overrides:
deb:
file_name_template: "{{ .Binary }}-release/debs/{{ .ProjectName }}-{{ .Version }}_{{ .Arch }}"
replacements:
arm: armv7
files:
"NOTICE": "/usr/share/mc/NOTICE"
"CREDITS": "/usr/share/mc/CREDITS"
"LICENSE": "/usr/share/mc/LICENSE"
"README.md": "/usr/share/mc/README.md"
rpm:
file_name_template: "{{ .Binary }}-release/rpms/{{ .ProjectName }}-{{ .Version }}.{{ .Arch }}"
replacements:
amd64: x86_64
arm64: aarch64
arm: armv7
files:
"NOTICE": "/usr/share/mc/NOTICE"
"CREDITS": "/usr/share/mc/CREDITS"
"LICENSE": "/usr/share/mc/LICENSE"
"README.md": "/usr/share/mc/README.md"
checksum:
algorithm: sha256
signs:
-
signature: "${artifact}.asc"
cmd: "sh"
args:
- '-c'
- 'gpg --quiet --detach-sign -a ${artifact}'
artifacts: all
changelog:
sort: asc
filters:
exclude:
- '^Update yaml files'
dockers:
-
goos: linux
goarch: amd64
dockerfile: Dockerfile.release
image_templates:
- minio/mc:{{ .Tag }}
- minio/mc:latest
-
goos: linux
goarch: ppc64le
dockerfile: Dockerfile.ppc64le.release
image_templates:
- minio/mc:{{ .Tag }}-ppc64le
-
goos: linux
goarch: s390x
dockerfile: Dockerfile.s390x.release
image_templates:
- minio/mc:{{ .Tag }}-s390x
-
goos: linux
goarch: arm64
goarm: ''
dockerfile: Dockerfile.arm64.release
image_templates:
- minio/mc:{{ .Tag }}-arm64
-
goos: linux
goarch: arm
goarm: '7'
dockerfile: Dockerfile.arm.release
image_templates:
- minio/mc:{{ .Tag }}-arm
+5 -5
View File
@@ -6,10 +6,10 @@
#
# For explanation on this file format: man git-shortlog
Anand Babu (AB) Periasamy <ab@minio.io> Anand Babu (AB) Periasamy <abperiasamy@users.noreply.github.com>
Anand Babu (AB) Periasamy <ab@minio.io> <ab@unlocksmith.org>
Anand Babu (AB) Periasamy <ab@min.io> Anand Babu (AB) Periasamy <abperiasamy@users.noreply.github.com>
Anand Babu (AB) Periasamy <ab@min.io> <ab@unlocksmith.org>
Anis Elleuch <vadmeste@gmail.com>
Frederick F. Kautz IV <fkautz@minio.io> <fkautz@alumni.cmu.edu>
Harshavardhana <harsha@minio.io> <harsha@harshavardhana.net>
Krishna Srinivas <krishna@minio.io> <krishna.srinivas@gmail.com>
Frederick F. Kautz IV <fkautz@min.io> <fkautz@alumni.cmu.edu>
Harshavardhana <harsha@min.io> <harsha@harshavardhana.net>
Krishna Srinivas <krishna@min.io> <krishna.srinivas@gmail.com>
Bosky <bosky@helpshift.com>
-41
View File
@@ -1,41 +0,0 @@
go_import_path: github.com/minio/mc
language: go
# this ensures PRs based on a local branch are not built twice
# the downside is that a PR targeting a different branch is not built
# but as a workaround you can add the branch to this list
branches:
only:
- master
matrix:
include:
- os: linux
dist: trusty
env:
- ARCH=x86_64
go: 1.11.4
script:
- diff -au <(gofmt -d *.go) <(printf "")
- diff -au <(gofmt -d cmd) <(printf "")
- diff -au <(gofmt -d pkg) <(printf "")
- for d in $(go list ./...); do go test -v -race "$d"; done
- make coverage
- make test
- os: windows
env:
- ARCH=x86_64
go: 1.11.4
script:
- go build --ldflags="$(go run buildscripts/gen-ldflags.go)" -o %GOPATH%\bin\mc.exe
- for d in $(go list ./...); do go test -v -race "$d"; done
- bash buildscripts/go-coverage.sh
before_script:
# Add an IPv6 config - see the corresponding Travis issue
# https://github.com/travis-ci/travis-ci/issues/8361
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'; fi
after_success:
- bash <(curl -s https://codecov.io/bash)
+4 -4
View File
@@ -1,11 +1,11 @@
## mc (Minio Client) v/s Midnight Commander (mc)
## mc (MinIO Client) v/s Midnight Commander (mc)
There has been some amount of [requests](https://github.com/minio/mc/issues?q=is%3Aissue+midnight+commander+is%3Aclosed) on renaming this project to avoid the conflict with Midnight Commander for Unix distributions. We struggled with this, it is harder to find a name sweeter and shorter than `mc` for Minio Client.
There has been some amount of [requests](https://github.com/minio/mc/issues?q=is%3Aissue+midnight+commander+is%3Aclosed) on renaming this project to avoid the conflict with Midnight Commander for Unix distributions. We struggled with this, it is harder to find a name sweeter and shorter than `mc` for MinIO Client.
Besides `mc` is a single static binary and can reside inside your application and is fully self contained. Midnight Commander (mc) is a free software clone of Norton Commander (nc). Minio and Midnight shares no code or ideas. Only their abbreviation matches.
Besides `mc` is a single static binary and can reside inside your application and is fully self contained. Midnight Commander (mc) is a free software clone of Norton Commander (nc). MinIO and Midnight shares no code or ideas. Only their abbreviation matches.
Package managers are free to choose a different name if they like. One such solution [pointed out](https://github.com/minio/mc/issues/873#issuecomment-267583013) by one of our community members.
```sh
```
mv ./mc ./mcli
```
+5 -9
View File
@@ -1,12 +1,12 @@
### Setup your mc Github Repository
Fork [mc upstream](https://github.com/minio/mc/fork) source repository to your own personal repository.
```sh
```
$ mkdir -p $GOPATH/src/github.com/minio
$ cd $GOPATH/src/github.com/minio
$ git clone https://github.com/$USER_ID/mc
$ cd mc
$ make
$ mc --help
$ ./mc --help
```
### Developer Guidelines
@@ -20,20 +20,16 @@ $ mc --help
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
* If you have additional dependencies for ``mc``, ``mc`` manages its dependencies using [govendor](https://github.com/kardianos/govendor)
* If you have additional dependencies for ``mc``, ``mc`` manages its dependencies using `go mod`
- Run `go get foo/bar`
- Edit your code to import foo/bar
- Run `make pkg-add PKG=foo/bar` from top-level folder
* If you have dependencies which needs to be removed from ``mc``
- Edit your code to not import foo/bar
- Run `make pkg-remove PKG=foo/bar` from top-level folder
- Run `GO111MODULE=on go mod tidy` from top-level folder
* When you're ready to create a pull request, be sure to:
- Have test cases for the new code. If you have questions about how to do it, please ask in your pull request.
- Run `go fmt`
- Squash your commits into a single commit. `git rebase -i`. It's okay to force update your pull request.
- Make sure `make build` completes.
- Make sure `make install` completes.
* Read [Effective Go](https://github.com/golang/go/wiki/CodeReviewComments) article from Golang project
- `mc` project is conformant with Golang style
+12703
View File
File diff suppressed because it is too large Load Diff
+12 -14
View File
@@ -1,24 +1,22 @@
FROM golang:1.11.4-alpine3.7
FROM golang:1.22-alpine as build
LABEL maintainer="Minio Inc <dev@minio.io>"
LABEL maintainer="MinIO Inc <dev@min.io>"
ENV GOPATH /go
ENV CGO_ENABLED 0
WORKDIR /go/src/github.com/minio/
RUN \
apk add --no-cache git && \
go get -v -d github.com/minio/mc && \
cd /go/src/github.com/minio/mc && \
go install -v -ldflags "$(go run buildscripts/gen-ldflags.go)"
RUN apk add -U --no-cache ca-certificates
RUN apk add -U curl
RUN curl -s -q https://raw.githubusercontent.com/minio/mc/master/LICENSE -o /go/LICENSE
RUN curl -s -q https://raw.githubusercontent.com/minio/mc/master/CREDITS -o /go/CREDITS
RUN go install -v -ldflags "$(go run buildscripts/gen-ldflags.go)" "github.com/minio/mc@latest"
FROM alpine:3.7
FROM scratch
COPY --from=0 /go/bin/mc /usr/bin/mc
RUN \
apk add --no-cache ca-certificates && \
echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf
COPY --from=build /go/bin/mc /usr/bin/mc
COPY --from=build /go/CREDITS /licenses/CREDITS
COPY --from=build /go/LICENSE /licenses/LICENSE
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT ["mc"]
+14
View File
@@ -0,0 +1,14 @@
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8
LABEL maintainer="MinIO Inc <dev@min.io>"
COPY mc /usr/bin/
COPY CREDITS /licenses/CREDITS
COPY LICENSE /licenses/LICENSE
RUN \
microdnf update --nodocs --assumeyes && \
microdnf install ca-certificates --nodocs --assumeyes && \
microdnf clean all
ENTRYPOINT ["mc"]
+24
View File
@@ -0,0 +1,24 @@
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest as build
RUN microdnf update --nodocs --assumeyes && microdnf install ca-certificates --nodocs --assumeyes
FROM registry.access.redhat.com/ubi9/ubi-micro:latest
ARG TARGETARCH
ARG RELEASE
LABEL maintainer="MinIO Inc <dev@min.io>"
# On RHEL the certificate bundle is located at:
# - /etc/pki/tls/certs/ca-bundle.crt (RHEL 6)
# - /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem (RHEL 7)
COPY --from=build /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem /etc/pki/ca-trust/extracted/pem/
COPY CREDITS /licenses/CREDITS
COPY LICENSE /licenses/LICENSE
ADD https://dl.min.io/client/mc/hotfixes/linux-${TARGETARCH}/archive/mc.${RELEASE} /usr/bin/mc
RUN chmod +x /usr/bin/mc
ENTRYPOINT ["mc"]
+20 -7
View File
@@ -1,11 +1,24 @@
FROM alpine:3.7
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest AS build
MAINTAINER Minio Inc <dev@minio.io>
RUN microdnf update --nodocs --assumeyes && microdnf install ca-certificates --nodocs --assumeyes
RUN \
apk add --no-cache ca-certificates && \
apk add --no-cache --virtual .build-deps curl && \
curl https://dl.minio.io/client/mc/release/linux-amd64/mc > /usr/bin/mc && \
chmod +x /usr/bin/mc && apk del .build-deps
FROM registry.access.redhat.com/ubi9/ubi-micro:latest
ARG TARGETARCH
ARG RELEASE
LABEL maintainer="MinIO Inc <dev@min.io>"
# On RHEL the certificate bundle is located at:
# - /etc/pki/tls/certs/ca-bundle.crt (RHEL 6)
# - /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem (RHEL 7)
COPY --from=build /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem /etc/pki/ca-trust/extracted/pem/
COPY CREDITS /licenses/CREDITS
COPY LICENSE /licenses/LICENSE
ADD https://dl.minio.io/client/mc/release/linux-${TARGETARCH}/archive/mc.${RELEASE} /usr/bin/mc
RUN chmod +x /usr/bin/mc
ENTRYPOINT ["mc"]
+24
View File
@@ -0,0 +1,24 @@
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest AS build
RUN microdnf update --nodocs --assumeyes && microdnf install ca-certificates --nodocs --assumeyes
FROM registry.access.redhat.com/ubi8/ubi-micro:latest
ARG TARGETARCH
ARG RELEASE
LABEL maintainer="MinIO Inc <dev@min.io>"
# On RHEL the certificate bundle is located at:
# - /etc/pki/tls/certs/ca-bundle.crt (RHEL 6)
# - /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem (RHEL 7)
COPY --from=build /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem /etc/pki/ca-trust/extracted/pem/
COPY CREDITS /licenses/CREDITS
COPY LICENSE /licenses/LICENSE
ADD https://dl.minio.io/client/mc/release/linux-${TARGETARCH}/archive/mc.${RELEASE} /usr/bin/mc
RUN chmod +x /usr/bin/mc
ENTRYPOINT ["mc"]
+628 -169
View File
@@ -1,202 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
Preamble
1. Definitions.
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
The precise terms and conditions for copying, distribution and
modification follow.
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
TERMS AND CONDITIONS
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
0. Definitions.
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
"This License" refers to version 3 of the GNU Affero General Public License.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
A "covered work" means either the unmodified Program or a work based
on the Program.
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
1. Source Code.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
END OF TERMS AND CONDITIONS
The Corresponding Source for a work in source code form is that
same work.
APPENDIX: How to apply the Apache License to your work.
2. Basic Permissions.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
Copyright [yyyy] [name of copyright owner]
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
http://www.apache.org/licenses/LICENSE-2.0
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.
+60 -58
View File
@@ -2,93 +2,95 @@ PWD := $(shell pwd)
GOPATH := $(shell go env GOPATH)
LDFLAGS := $(shell go run buildscripts/gen-ldflags.go)
BUILD_LDFLAGS := '$(LDFLAGS)'
TARGET_GOARCH ?= $(shell go env GOARCH)
TARGET_GOOS ?= $(shell go env GOOS)
VERSION ?= $(shell git describe --tags)
TAG ?= "minio/mc:$(VERSION)"
GOLANGCI = $(GOPATH)/bin/golangci-lint
all: build
checks:
@echo "Checking dependencies"
@(env bash $(PWD)/buildscripts/checkdeps.sh)
@echo "Checking for project in GOPATH"
@(env bash $(PWD)/buildscripts/checkgopath.sh)
getdeps:
@echo "Installing golint" && go get -u golang.org/x/lint/golint
@echo "Installing gocyclo" && go get -u github.com/fzipp/gocyclo
@echo "Installing deadcode" && go get -u github.com/remyoudompheng/go-misc/deadcode
@echo "Installing misspell" && go get -u github.com/client9/misspell/cmd/misspell
@echo "Installing ineffassign" && go get -u github.com/gordonklaus/ineffassign
@mkdir -p ${GOPATH}/bin
@echo "Installing tools" && go install tool
verifiers: getdeps vet fmt lint cyclo deadcode spelling
crosscompile:
@(env bash $(PWD)/buildscripts/cross-compile.sh)
verifiers: getdeps vet lint
docker: build
@docker build -t $(TAG) . -f Dockerfile.dev
vet:
@echo "Running $@"
@go vet github.com/minio/mc/...
@GO111MODULE=on go vet github.com/minio/mc/...
fmt:
@echo "Running $@"
@gofmt -d cmd
@gofmt -d pkg
lint-fix: getdeps ## runs golangci-lint suite of linters with automatic fixes
@echo "Running $@ check"
@$(GOLANGCI) run --build-tags kqueue --timeout=10m --config ./.golangci.yml --fix
lint:
@echo "Running $@"
@${GOPATH}/bin/golint -set_exit_status github.com/minio/mc/cmd...
@${GOPATH}/bin/golint -set_exit_status github.com/minio/mc/pkg...
lint: getdeps
@echo "Running $@ check"
@$(GOLANGCI) run --build-tags kqueue --timeout=10m --config ./.golangci.yml
ineffassign:
@echo "Running $@"
@${GOPATH}/bin/ineffassign .
cyclo:
@echo "Running $@"
@${GOPATH}/bin/gocyclo -over 100 cmd
@${GOPATH}/bin/gocyclo -over 100 pkg
deadcode:
@echo "Running $@"
@${GOPATH}/bin/deadcode -test $(shell go list ./...)
spelling:
@${GOPATH}/bin/misspell -error `find cmd/`
@${GOPATH}/bin/misspell -error `find pkg/`
@${GOPATH}/bin/misspell -error `find docs/`
# Builds minio, runs the verifiers then runs the tests.
# Builds mc, runs the verifiers then runs the tests.
check: test
test: verifiers build
@echo "Running unit tests"
@go test -tags kqueue ./...
@GO111MODULE=on CGO_ENABLED=0 go test -tags kqueue ./... 1>/dev/null
@echo "Running functional tests"
@(env bash $(PWD)/functional-tests.sh)
@GO111MODULE=on MC_TEST_RUN_FULL_SUITE=true go test -race -v --timeout 20m ./... -run Test_FullSuite
coverage: build
@echo "Running all coverage for minio"
@(env bash $(PWD)/buildscripts/go-coverage.sh)
test-race: verifiers build
@echo "Running unit tests under -race"
@GO111MODULE=on go test -race -v --timeout 20m ./... 1>/dev/null
# Builds minio locally.
# Verify mc binary
verify:
@echo "Verifying build with race"
@GO111MODULE=on CGO_ENABLED=1 go build -race -tags kqueue -trimpath --ldflags "$(LDFLAGS)" -o $(PWD)/mc 1>/dev/null
@echo "Running functional tests"
@GO111MODULE=on MC_TEST_RUN_FULL_SUITE=true go test -race -v --timeout 20m ./... -run Test_FullSuite
# Builds mc locally.
build: checks
@echo "Building minio binary to './mc'"
@GO_FLAGS="" CGO_ENABLED=0 go build -tags kqueue --ldflags $(BUILD_LDFLAGS) -o $(PWD)/mc
@echo "Building mc binary to './mc'"
@GO111MODULE=on GOOS=$(TARGET_GOOS) GOARCH=$(TARGET_GOARCH) CGO_ENABLED=0 go build -trimpath -tags kqueue --ldflags "$(LDFLAGS)" -o $(PWD)/mc
pkg-add:
@echo "Adding new package $(PKG)"
@${GOPATH}/bin/govendor add $(PKG)
hotfix-vars:
$(eval LDFLAGS := $(shell MC_RELEASE="RELEASE" MC_HOTFIX="hotfix.$(shell git rev-parse --short HEAD)" go run buildscripts/gen-ldflags.go $(shell git describe --tags --abbrev=0 | \
sed 's#RELEASE\.\([0-9]\+\)-\([0-9]\+\)-\([0-9]\+\)T\([0-9]\+\)-\([0-9]\+\)-\([0-9]\+\)Z#\1-\2-\3T\4:\5:\6Z#')))
$(eval VERSION := $(shell git describe --tags --abbrev=0).hotfix.$(shell git rev-parse --short HEAD))
$(eval TAG := "minio/mc:$(VERSION)")
pkg-update:
@echo "Updating new package $(PKG)"
@${GOPATH}/bin/govendor update $(PKG)
hotfix: hotfix-vars install ## builds mc binary with hotfix tags
@mv -f ./mc ./mc.$(VERSION)
@minisign -qQSm ./mc.$(VERSION) -s "${CRED_DIR}/minisign.key" < "${CRED_DIR}/minisign-passphrase"
@sha256sum < ./mc.$(VERSION) | sed 's, -,mc.$(VERSION),g' > mc.$(VERSION).sha256sum
pkg-remove:
@echo "Remove new package $(PKG)"
@${GOPATH}/bin/govendor remove $(PKG)
hotfix-push: hotfix
@scp -q -r mc.$(VERSION)* minio@dl-0.min.io:~/releases/client/mc/hotfixes/$(TARGET_GOOS)-$(TARGET_GOARCH)/archive/
@scp -q -r mc.$(VERSION)* minio@dl-1.min.io:~/releases/client/mc/hotfixes/$(TARGET_GOOS)-$(TARGET_GOARCH)/archive/
@echo "Published new hotfix binaries at https://dl.min.io/client/mc/hotfixes/$(TARGET_GOOS)-$(TARGET_GOARCH)/archive/mc.$(VERSION)"
pkg-list:
@$(GOPATH)/bin/govendor list
docker-hotfix-push: docker-hotfix
@docker push -q $(TAG) && echo "Published new container $(TAG)"
# Builds minio and installs it to $GOPATH/bin.
docker-hotfix: hotfix-push checks ## builds mc docker container with hotfix tags
@echo "Building mc docker image '$(TAG)'"
@docker build -q --no-cache -t $(TAG) --build-arg RELEASE=$(VERSION) . -f Dockerfile.hotfix
# Builds MinIO and installs it to $GOPATH/bin.
install: build
@echo "Installing mc binary to '$(GOPATH)/bin/mc'"
@mkdir -p $(GOPATH)/bin && cp $(PWD)/mc $(GOPATH)/bin/mc
@mkdir -p $(GOPATH)/bin && cp -f $(PWD)/mc $(GOPATH)/bin/mc
@echo "Installation successful. To learn more, try \"mc --help\"."
clean:
+4 -4
View File
@@ -1,9 +1,9 @@
Minio Client (C) 2014, 2015 Minio, Inc.
MinIO Client (C) 2014-2020 MinIO, Inc.
This product includes software developed at Minio, Inc.
(https://minio.io/).
This product includes software developed at MinIO, Inc.
(https://min.io/).
The Minio project contains unmodified/modified subcomponents too with
The MinIO project contains unmodified/modified subcomponents too with
separate copyright notices and license terms. Your use of the source
code for the these subcomponents is subject to the terms and conditions
of the following licenses.
+127 -79
View File
@@ -1,30 +1,53 @@
# Minio Client Quickstart Guide
[![Slack](https://slack.minio.io/slack?type=svg)](https://slack.minio.io) [![Go Report Card](https://goreportcard.com/badge/minio/mc)](https://goreportcard.com/report/minio/mc) [![Docker Pulls](https://img.shields.io/docker/pulls/minio/mc.svg?maxAge=604800)](https://hub.docker.com/r/minio/mc/)
# MinIO Client Quickstart Guide
[![Slack](https://slack.min.io/slack?type=svg)](https://slack.min.io) [![Go Report Card](https://goreportcard.com/badge/minio/mc)](https://goreportcard.com/report/minio/mc) [![Docker Pulls](https://img.shields.io/docker/pulls/minio/mc.svg?maxAge=604800)](https://hub.docker.com/r/minio/mc/) [![license](https://img.shields.io/badge/license-AGPL%20V3-blue)](https://github.com/minio/mc/blob/master/LICENSE)
Minio Client (mc) provides a modern alternative to UNIX commands like ls, cat, cp, mirror, diff, find etc. It supports filesystems and Amazon S3 compatible cloud storage service (AWS Signature v2 and v4).
# Documentation
- [MC documentation](https://docs.min.io/community/minio-object-store/reference/minio-mc.html)
MinIO Client (mc) provides a modern alternative to UNIX commands like ls, cat, cp, mirror, diff, find etc. It supports filesystems and Amazon S3 compatible cloud storage service (AWS Signature v2 and v4).
```
ls list buckets and objects
mb make a bucket
cat display object contents
head display first 'n' lines of an object
pipe stream STDIN to an object
share generate URL for temporary access to an object
cp copy objects
mirror synchronize objects to a remote site
find search for objects
sql run sql queries on objects
stat stat contents of objects
diff list differences in object name, size, and date between buckets
rm remove objects
event manage object notifications
watch watch for object events
policy manage anonymous access to objects
admin manage minio servers
session manage saved sessions for cp command
config manage mc configuration file
update check for a new software update
version print version info
alias manage server credentials in configuration file
admin manage MinIO servers
anonymous manage anonymous access to buckets and objects
batch manage batch jobs
cp copy objects
cat display object contents
diff list differences in object name, size, and date between two buckets
du summarize disk usage recursively
encrypt manage bucket encryption config
event manage object notifications
find search for objects
get get s3 object to local
head display first 'n' lines of an object
ilm manage bucket lifecycle
idp manage MinIO IDentity Provider server configuration
license license related commands
legalhold manage legal hold for object(s)
ls list buckets and objects
mb make a bucket
mv move objects
mirror synchronize object(s) to a remote site
od measure single stream upload and download
ping perform liveness check
pipe stream STDIN to an object
put upload an object to a bucket
quota manage bucket quota
rm remove object(s)
retention set retention for object(s)
rb remove a bucket
replicate configure server side bucket replication
ready checks if the cluster is ready or not
sql run sql queries on objects
stat show object metadata
support support related commands
share generate URL for temporary access to an object
tree list buckets and objects in a tree format
tag manage tags for bucket and object(s)
undo undo PUT/DELETE operations
update update mc to latest release
version manage bucket versioning
watch listen for object notification events
```
## Docker Container
@@ -40,19 +63,34 @@ docker pull minio/mc:edge
docker run minio/mc:edge ls play
```
**Note:** Above examples run `mc` against Minio [_play_ environment](#test-your-setup) by default. To run `mc` against other S3 compatible servers, start the container this way:
**Note:** Above examples run `mc` against MinIO [_play_ environment](#test-your-setup) by default. To run `mc` against other S3 compatible servers, start the container this way:
```sh
```
docker run -it --entrypoint=/bin/sh minio/mc
```
then use the [`mc config` command](#add-a-cloud-storage-service).
then use the [`mc alias` command](#add-a-cloud-storage-service).
### GitLab CI
When using the Docker container in GitLab CI, you must [set the entrypoint to an empty string](https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#override-the-entrypoint-of-an-image).
```
deploy:
image:
name: minio/mc
entrypoint: ['']
stage: deploy
before_script:
- mc alias set minio $MINIO_HOST $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
script:
- mc cp <source> <destination>
```
## macOS
### Homebrew
Install mc packages using [Homebrew](http://brew.sh/)
```sh
```
brew install minio/stable/mc
mc --help
```
@@ -61,10 +99,13 @@ mc --help
### Binary Download
| Platform | Architecture | URL |
| ---------- | -------- |------|
|GNU/Linux|64-bit Intel|https://dl.minio.io/client/mc/release/linux-amd64/mc |
|GNU/Linux|64-bit Intel|https://dl.min.io/client/mc/release/linux-amd64/mc |
|GNU/Linux|64-bit PPC|https://dl.min.io/client/mc/release/linux-ppc64le/mc |
|GNU/Linux|64-bit ARM|https://dl.min.io/client/mc/release/linux-arm64/mc |
|Linux/s390x|S390X|https://dl.min.io/client/mc/release/linux-s390x/mc |
```sh
wget https://dl.minio.io/client/mc/release/linux-amd64/mc
```
wget https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc
./mc --help
```
@@ -73,21 +114,17 @@ chmod +x mc
### Binary Download
| Platform | Architecture | URL |
| ---------- | -------- |------|
|Microsoft Windows|64-bit Intel|https://dl.minio.io/client/mc/release/windows-amd64/mc.exe |
|Microsoft Windows|64-bit Intel|https://dl.min.io/client/mc/release/windows-amd64/mc.exe |
```sh
```
mc.exe --help
```
## Install from Source
Source installation is intended only for developers and advanced users. `mc update` command does not support update notifications for source based installations. Please download official releases from https://minio.io/downloads/#minio-client.
If you do not have a working Golang environment, please follow [How to install Golang](https://docs.minio.io/docs/how-to-install-golang).
Source installation is only intended for developers and advanced users. If you do not have a working Golang environment, please follow [How to install Golang](https://golang.org/doc/install). Minimum version required is [go1.22](https://golang.org/dl/#stable)
```sh
go get -d github.com/minio/mc
cd ${GOPATH}/src/github.com/minio/mc
make
go install github.com/minio/mc@latest
```
## Add a Cloud Storage Service
@@ -95,45 +132,70 @@ If you are planning to use `mc` only on POSIX compatible filesystems, you may sk
To add one or more Amazon S3 compatible hosts, please follow the instructions below. `mc` stores all its configuration information in ``~/.mc/config.json`` file.
```sh
mc config host add <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> --api <API-SIGNATURE> --lookup <BUCKET-LOOKUP-TYPE>
```
mc alias set <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> --api <API-SIGNATURE> --path <BUCKET-LOOKUP-TYPE>
```
Alias is simply a short name to your cloud storage service. S3 end-point, access and secret keys are supplied by your cloud storage provider. API signature is an optional argument. By default, it is set to "S3v4".
`<ALIAS>` is simply a short name to your cloud storage service. S3 end-point, access and secret keys are supplied by your cloud storage provider. API signature is an optional argument. By default, it is set to "S3v4".
Lookup is an optional argument. It is used to indicate whether dns or path style url requests are supported by the server. It accepts "dns", "path" or "auto" as valid values. By default, it is set to "auto" and SDK automatically determines the type of url lookup to use.
Path is an optional argument. It is used to indicate whether dns or path style url requests are supported by the server. It accepts "on", "off" as valid values to enable/disable path style requests.. By default, it is set to "auto" and SDK automatically determines the type of url lookup to use.
### Example - Minio Cloud Storage
Minio server displays URL, access and secret keys.
### Example - MinIO Cloud Storage
MinIO server startup banner displays URL, access and secret keys.
```sh
mc config host add minio http://192.168.1.51 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
```
mc alias set minio http://192.168.1.51 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
```
### Example - Amazon S3 Cloud Storage
Get your AccessKeyID and SecretAccessKey by following [AWS Credentials Guide](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html).
```sh
mc config host add s3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
```
mc alias set s3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
```
**Note**: As an IAM user on Amazon S3 you need to make sure the user has full access to the buckets or set the following restricted policy for your IAM user
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowBucketStat",
"Effect": "Allow",
"Action": [
"s3:HeadBucket"
],
"Resource": "*"
},
{
"Sid": "AllowThisBucketOnly",
"Effect": "Allow",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::<your-restricted-bucket>/*",
"arn:aws:s3:::<your-restricted-bucket>"
]
}
]
}
```
### Example - Google Cloud Storage
Get your AccessKeyID and SecretAccessKey by following [Google Credentials Guide](https://cloud.google.com/storage/docs/migrating?hl=en#keys)
```sh
mc config host add gcs https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
```
mc alias set gcs https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
```
NOTE: Google Cloud Storage only supports Legacy Signature Version 2, so you have to pick - S3v2
## Test Your Setup
`mc` is pre-configured with https://play.minio.io:9000, aliased as "play". It is a hosted Minio server for testing and development purpose. To test Amazon S3, simply replace "play" with "s3" or the alias you used at the time of setup.
`mc` is pre-configured with https://play.min.io, aliased as "play". It is a hosted MinIO server for testing and development purpose. To test Amazon S3, simply replace "play" with "s3" or the alias you used at the time of setup.
*Example:*
List all buckets from https://play.minio.io:9000
List all buckets from https://play.min.io
```sh
```
mc ls play
[2016-03-22 19:47:48 PDT] 0B my-bucketname/
[2016-03-22 22:01:07 PDT] 0B mytestbucket/
@@ -146,7 +208,7 @@ Make a bucket
`mb` command creates a new bucket.
*Example:*
```sh
```
mc mb play/mybucket
Bucket created successfully `play/mybucket`.
```
@@ -155,20 +217,17 @@ Copy Objects
`cp` command copies data from one or more sources to a target.
*Example:*
```sh
```
mc cp myobject.txt play/mybucket
myobject.txt: 14 B / 14 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.00 % 41 B/s 0
```
<a name="everyday-use"></a>
## Everyday Use
### Shell aliases
You may add shell aliases to override your common Unix tools.
```sh
```
alias ls='mc ls'
alias cp='mc cp'
alias cat='mc cat'
@@ -178,27 +237,16 @@ alias find='mc find'
```
### Shell autocompletion
You may also download [`autocomplete/bash_autocomplete`](https://raw.githubusercontent.com/minio/mc/master/autocomplete/bash_autocomplete) into `/etc/bash_completion.d/` and rename it to `mc`. Don't forget to source the file to make it active on your current shell.
In case you are using bash, zsh or fish. Shell completion is embedded by default in `mc`, to install auto-completion use `mc --autocompletion`. Restart the shell, mc will auto-complete commands as shown below.
```sh
sudo wget https://raw.githubusercontent.com/minio/mc/master/autocomplete/bash_autocomplete -O /etc/bash_completion.d/mc
source /etc/bash_completion.d/mc
```
```sh
mc <TAB>
admin config diff ls mirror policy session update watch
cat cp event mb pipe rm share version
admin config diff find ls mirror policy session sql update watch
cat cp event head mb pipe rm share stat version
```
## Explore Further
- [Minio Client Complete Guide](https://docs.minio.io/docs/minio-client-complete-guide)
- [Minio Quickstart Guide](https://docs.minio.io/docs/minio-quickstart-guide)
- [The Minio documentation website](https://docs.minio.io)
## Contribute to Minio Project
Please follow Minio [Contributor's Guide](https://github.com/minio/mc/blob/master/CONTRIBUTING.md)
## Contribute to MinIO Project
Please follow MinIO [Contributor's Guide](https://github.com/minio/mc/blob/master/CONTRIBUTING.md)
## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fminio%2Fmc.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fminio%2Fmc?ref=badge_large)
Use of `mc` is governed by the GNU AGPLv3 license that can be found in the [LICENSE](https://github.com/minio/mc/blob/master/LICENSE) file.
+50 -50
View File
@@ -1,27 +1,27 @@
# Minio客户端快速入门指南
[![Slack](https://slack.minio.io/slack?type=svg)](https://slack.minio.io) [![Go Report Card](https://goreportcard.com/badge/minio/mc)](https://goreportcard.com/report/minio/mc) [![Docker Pulls](https://img.shields.io/docker/pulls/minio/mc.svg?maxAge=604800)](https://hub.docker.com/r/minio/mc/)
# MinIO客户端快速入门指南
[![Slack](https://slack.min.io/slack?type=svg)](https://slack.min.io) [![Go Report Card](https://goreportcard.com/badge/minio/mc)](https://goreportcard.com/report/minio/mc) [![Docker Pulls](https://img.shields.io/docker/pulls/minio/mc.svg?maxAge=604800)](https://hub.docker.com/r/minio/mc/)
Minio Client (mc)为ls,cat,cp,mirror,diff,find等UNIX命令提供了一种替代方案。它支持文件系统和兼容Amazon S3的云存储服务(AWS Signature v2和v4)。
MinIO Client (mc)为ls,cat,cp,mirror,diff,find等UNIX命令提供了一种替代方案。它支持文件系统和兼容Amazon S3的云存储服务(AWS Signature v2和v4)。
```
ls 列出文件和文件夹。
mb 创建一个存储桶或一个文件夹。
cat 显示文件和对象内容。
pipe 将一个STDIN重定向到一个对象或者文件或者STDOUT。
share 生成用于共享的URL。
cp 拷贝文件和对象。
mirror 给存储桶和文件夹做镜像。
find 基于参数查找文件。
diff 对两个文件夹或者存储桶比较差异。
rm 删除文件和对象。
events 管理对象通知。
watch 监听文件和对象的事件。
policy 管理访问策略。
session 为cp命令管理保存的会话。
config 管理mc配置文件。
update 检查软件更新。
version 输出版本信息。
ls 列出文件和文件夹。
mb 创建一个存储桶或一个文件夹。
cat 显示文件和对象内容。
pipe 将一个STDIN重定向到一个对象或者文件或者STDOUT。
share 生成用于共享的URL。
cp 拷贝文件和对象。
mirror 给存储桶和文件夹做镜像。
find 基于参数查找文件。
diff 对两个文件夹或者存储桶比较差异。
rm 删除文件和对象。
events 管理对象通知。
watch 监听文件和对象的事件。
anonymous 管理访问策略。
session 为cp命令管理保存的会话。
config 管理mc配置文件。
update 检查软件更新。
version 输出版本信息。
```
## Docker容器
@@ -37,9 +37,9 @@ docker pull minio/mc:edge
docker run minio/mc:edge ls play
```
**注意:** 上述示例默认使用Minio[演示环境](#test-your-setup)做演示,如果想用`mc`操作其它S3兼容的服务,采用下面的方式来启动容器:
**注意:** 上述示例默认使用MinIO[演示环境](#test-your-setup)做演示,如果想用`mc`操作其它S3兼容的服务,采用下面的方式来启动容器:
```sh
```
docker run -it --entrypoint=/bin/sh minio/mc
```
@@ -49,7 +49,7 @@ docker run -it --entrypoint=/bin/sh minio/mc
### Homebrew
使用[Homebrew](http://brew.sh/)安装mc。
```sh
```
brew install minio/stable/mc
mc --help
```
@@ -58,9 +58,9 @@ mc --help
### 下载二进制文件
| 平台 | CPU架构 | URL |
| ---------- | -------- |------|
|GNU/Linux|64-bit Intel|https://dl.minio.io/client/mc/release/linux-amd64/mc |
|GNU/Linux|64-bit Intel|https://dl.min.io/client/mc/release/linux-amd64/mc |
```sh
```
chmod +x mc
./mc --help
```
@@ -69,18 +69,18 @@ chmod +x mc
### 下载二进制文件
| 平台 | CPU架构 | URL |
| ---------- | -------- |------|
|Microsoft Windows|64-bit Intel|https://dl.minio.io/client/mc/release/windows-amd64/mc.exe |
|Microsoft Windows|64-bit Intel|https://dl.min.io/client/mc/release/windows-amd64/mc.exe |
```sh
```
mc.exe --help
```
## 通过源码安装
通过源码安装仅适用于开发人员和高级用户。`mc update`命令不支持基于源码安装的更新通知。请从https://minio.io/downloads/#minio-client下载官方版本。
通过源码安装仅适用于开发人员和高级用户。`mc update`命令不支持基于源码安装的更新通知。请从https://min.io/download/#minio-client下载官方版本。
如果您没有Golang环境,请参照[如何安装Golang](https://docs.minio.io/docs/how-to-install-golang)。
如果您没有Golang环境,请参照[如何安装Golang](https://golang.org/doc/install)。
```sh
```
go get -d github.com/minio/mc
cd ${GOPATH}/src/github.com/minio/mc
make
@@ -91,43 +91,43 @@ make
添加一个或多个S3兼容的服务,请参考下面说明。`mc`将所有的配置信息都存储在``~/.mc/config.json``文件中。
```sh
mc config host add <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> <API-SIGNATURE>
```
mc alias set <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> [--api API-SIGNATURE]
```
别名就是给你的云存储服务起了一个短点的外号。S3 endpoint,access key和secret key是你的云存储服务提供的。API签名是可选参数,默认情况下,它被设置为"S3v4"。
### 示例-Minio云存储
从Minio服务获得URL、access key和secret key。
### 示例-MinIO云存储
从MinIO服务获得URL、access key和secret key。
```sh
mc config host add minio http://192.168.1.51 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v4
```
mc alias set minio http://192.168.1.51 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 --api s3v4
```
### 示例-Amazon S3云存储
参考[AWS Credentials指南](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html)获取你的AccessKeyID和SecretAccessKey。
```sh
mc config host add s3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v4
```
mc alias set s3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 --api s3v4
```
### 示例-Google云存储
参考[Google Credentials Guide](https://cloud.google.com/storage/docs/migrating?hl=en#keys)获取你的AccessKeyID和SecretAccessKey。
```sh
mc config host add gcs https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v2
```
mc alias set gcs https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 --api s3v2
```
注意:Google云存储只支持旧版签名版本V2,所以你需要选择S3v2。
## 验证
`mc`预先配置了云存储服务URL:https://play.minio.io:9000,别名“play”。它是一个用于研发和测试的Minio服务。如果想测试Amazon S3,你可以将“play”替换为“s3”。
`mc`预先配置了云存储服务URL:https://play.min.io,别名“play”。它是一个用于研发和测试的MinIO服务。如果想测试Amazon S3,你可以将“play”替换为“s3”。
*示例:*
列出https://play.minio.io:9000上的所有存储桶。
列出https://play.min.io上的所有存储桶。
```sh
```
mc ls play
[2016-03-22 19:47:48 PDT] 0B my-bucketname/
[2016-03-22 22:01:07 PDT] 0B mytestbucket/
@@ -141,7 +141,7 @@ mc ls play
### Shell别名
你可以添加shell别名来覆盖默认的Unix工具命令。
```sh
```
alias ls='mc ls'
alias cp='mc cp'
alias cat='mc cat'
@@ -153,21 +153,21 @@ alias find='mc find'
### Shell自动补全
你也可以下载[`autocomplete/bash_autocomplete`](https://raw.githubusercontent.com/minio/mc/master/autocomplete/bash_autocomplete)到`/etc/bash_completion.d/`,然后将其重命名为`mc`。别忘了在这个文件运行source命令让其在你的当前shell上可用。
```sh
```
sudo wget https://raw.githubusercontent.com/minio/mc/master/autocomplete/bash_autocomplete -O /etc/bash_completion.d/mc
source /etc/bash_completion.d/mc
```
```sh
```
mc <TAB>
admin config diff ls mirror policy session update watch
cat cp events mb pipe rm share version
```
## 了解更多
- [Minio Client完全指南](https://docs.minio.io/docs/minio-client-complete-guide)
- [Minio快速入门](https://docs.minio.io/docs/minio-quickstart-guide)
- [Minio官方文档](https://docs.minio.io)
- [MinIO Client完全指南](https://docs.min.io/community/minio-object-store/reference/minio-mc.html?ref=gh)
- [MinIO快速入门](https://docs.min.io/community/minio-object-store/operations/deployments/baremetal-deploy-minio-on-redhat-linux.html?ref=gh)
- [MinIO官方文档](https://docs.min.io/community/minio-object-store/index.html?ref=gh)
## 贡献
请遵守Minio[贡献者指南](https://github.com/minio/mc/blob/master/docs/zh_CN/CONTRIBUTING.md)
请遵守MinIO[贡献者指南](https://github.com/minio/mc/blob/master/docs/zh_CN/CONTRIBUTING.md)
+1
View File
@@ -0,0 +1 @@
theme: jekyll-theme-minimal
-14
View File
@@ -1,14 +0,0 @@
#!/bin/bash
: ${PROG:=$(basename ${BASH_SOURCE})}
_cli_bash_autocomplete() {
local cur opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --compgen )
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
}
complete -F _cli_bash_autocomplete $PROG -q
-5
View File
@@ -1,5 +0,0 @@
autoload -U compinit && compinit
autoload -U bashcompinit && bashcompinit
script_dir=$(dirname $0)
source ${script_dir}/bash_autocomplete
+24
View File
@@ -0,0 +1,24 @@
## FIXME:
## In OSX, 'sort -V' option does not exist, hence
## we have our own version compare function.
## Once OSX has the option, below function is good enough.
##
## check_minimum_version() {
## versions=($(echo -e "$1\n$2" | sort -V))
## return [ "$1" == "${versions[0]}" ]
## }
##
check_minimum_version() {
IFS='.' read -r -a varray1 <<< "$1"
IFS='.' read -r -a varray2 <<< "$2"
for i in "${!varray1[@]}"; do
if [[ ${varray1[i]} -lt ${varray2[i]} ]]; then
return 0
elif [[ ${varray1[i]} -gt ${varray2[i]} ]]; then
return 1
fi
done
return 0
}
+18
View File
@@ -1,4 +1,22 @@
#!/bin/bash
#
# Copyright (c) 2015-2021 MinIO, Inc.
#
# This file is part of MinIO Object Storage stack
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
_init() {
# Save release LDFLAGS
+20 -39
View File
@@ -1,19 +1,25 @@
#!/usr/bin/env bash
#
# Minio Client, (C) 2015, 2016, 2017 Minio, Inc.
# Copyright (c) 2015-2021 MinIO, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# This file is part of MinIO Object Storage stack
#
# http://www.apache.org/licenses/LICENSE-2.0
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# shellcheck source=buildscripts/build.env
. "$(pwd)/buildscripts/build.env"
_init() {
@@ -21,7 +27,7 @@ _init() {
## Minimum required versions for build dependencies
GIT_VERSION="1.0"
GO_VERSION="1.10.1"
GO_VERSION="1.13"
OSX_VERSION="10.8"
KNAME=$(uname -s)
ARCH=$(uname -m)
@@ -62,38 +68,13 @@ readlink() {
echo $RESULT
}
## FIXME:
## In OSX, 'sort -V' option does not exist, hence
## we have our own version compare function.
## Once OSX has the option, below function is good enough.
##
## check_minimum_version() {
## versions=($(echo -e "$1\n$2" | sort -V))
## return [ "$1" == "${versions[0]}" ]
## }
##
check_minimum_version() {
IFS='.' read -r -a varray1 <<< "$1"
IFS='.' read -r -a varray2 <<< "$2"
for i in "${!varray1[@]}"; do
if [[ ${varray1[i]} -lt ${varray2[i]} ]]; then
return 0
elif [[ ${varray1[i]} -gt ${varray2[i]} ]]; then
return 1
fi
done
return 0
}
assert_is_supported_arch() {
case "${ARCH}" in
x86_64 | amd64 | ppc64le | aarch64 | arm* | s390x )
x86_64 | amd64 | ppc64le | aarch64 | arm* | s390x | loong64 | loongarch64 )
return
;;
*)
echo "Arch '${ARCH}' is not supported. Supported Arch: [x86_64, amd64, ppc64le, aarch64, arm*, s390x]"
echo "Arch '${ARCH}' is not supported. Supported Arch: [x86_64, amd64, ppc64le, aarch64, arm*, s390x, loong64, loongarch64]"
exit 1
esac
}
@@ -119,7 +100,7 @@ assert_is_supported_os() {
assert_check_golang_env() {
if ! which go >/dev/null 2>&1; then
echo "Cannot find go binary in your PATH configuration, please refer to Go installation document at https://docs.minio.io/docs/how-to-install-golang"
echo "Cannot find go binary in your PATH configuration, please refer to Go installation document at https://golang.org/doc/install"
exit 1
fi
-34
View File
@@ -1,34 +0,0 @@
#!/usr/bin/env bash
#
# Minio Client, (C) 2015, 2016, 2017, 2018 Minio, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
main() {
gopath=$(go env GOPATH)
IFS=':' read -r -a paths <<< "$gopath"
for path in "${paths[@]}"; do
mcpath="$path/src/github.com/minio/mc"
if [ -d "$mcpath" ]; then
if [ "$mcpath" -ef "$PWD" ]; then
exit 0
fi
fi
done
echo "Project not found in ${gopath}. Follow instructions at https://github.com/minio/mc/blob/master/CONTRIBUTING.md#setup-your-mc-github-repository"
exit 1
}
main
+57
View File
@@ -0,0 +1,57 @@
#!/bin/bash
#
# Copyright (c) 2015-2021 MinIO, Inc.
#
# This file is part of MinIO Object Storage stack
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
set -e
# Enable tracing if set.
[ -n "$BASH_XTRACEFD" ] && set -x
function _init() {
## All binaries are static make sure to disable CGO.
export CGO_ENABLED=0
## List of architectures and OS to test coss compilation.
SUPPORTED_OSARCH="linux/ppc64le linux/s390x linux/mips64 linux/amd64 windows/amd64 darwin/amd64 darwin/arm64 linux/arm64 linux/arm"
}
function _build() {
local osarch=$1
IFS=/ read -r -a arr <<<"$osarch"
os="${arr[0]}"
arch="${arr[1]}"
package=$(go list -f '{{.ImportPath}}')
printf -- "--> %15s:%s\n" "${osarch}" "${package}"
# Go build to build the binary.
export GOOS=$os
export GOARCH=$arch
export GO111MODULE=on
export CGO_ENABLED=0
go build -tags kqueue -o /dev/null
}
function main() {
echo "Testing builds for OS/Arch: ${SUPPORTED_OSARCH}"
for each_osarch in ${SUPPORTED_OSARCH}; do
_build "${each_osarch}"
done
}
_init && main "$@"
+73 -23
View File
@@ -1,20 +1,22 @@
//go:build ignore
// +build ignore
/*
* Minio Client (C) 2014, 2015, 2016, 2017, 2018 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright (c) 2015-2021 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package main
@@ -27,25 +29,44 @@ import (
)
func genLDFlags(version string) string {
releaseTag, date := releaseTag(version)
copyrightYear := fmt.Sprintf("%d", date.Year())
var ldflagsStr string
ldflagsStr = "-s -w -X github.com/minio/mc/cmd.Version=" + version + " "
ldflagsStr = ldflagsStr + "-X github.com/minio/mc/cmd.ReleaseTag=" + releaseTag(version) + " "
ldflagsStr = ldflagsStr + "-X github.com/minio/mc/cmd.CopyrightYear=" + copyrightYear + " "
ldflagsStr = ldflagsStr + "-X github.com/minio/mc/cmd.ReleaseTag=" + releaseTag + " "
ldflagsStr = ldflagsStr + "-X github.com/minio/mc/cmd.CommitID=" + commitID() + " "
ldflagsStr = ldflagsStr + "-X github.com/minio/mc/cmd.ShortCommitID=" + commitID()[:12]
return ldflagsStr
}
// genReleaseTag prints release tag to the console for easy git tagging.
func releaseTag(version string) string {
// releaseTag prints release tag to the console for easy git tagging.
func releaseTag(version string) (string, time.Time) {
relPrefix := "DEVELOPMENT"
if prefix := os.Getenv("MC_RELEASE"); prefix != "" {
relPrefix = prefix
}
relTag := strings.Replace(version, " ", "-", -1)
relTag = strings.Replace(relTag, ":", "-", -1)
relTag = strings.Replace(relTag, ",", "", -1)
return relPrefix + "." + relTag
relSuffix := ""
if hotfix := os.Getenv("MC_HOTFIX"); hotfix != "" {
relSuffix = hotfix
}
relTag := strings.ReplaceAll(version, " ", "-")
relTag = strings.ReplaceAll(relTag, ":", "-")
t, err := time.Parse("2006-01-02T15-04-05Z", relTag)
if err != nil {
panic(err)
}
relTag = strings.ReplaceAll(relTag, ",", "")
relTag = relPrefix + "." + relTag
if relSuffix != "" {
relTag += "." + relSuffix
}
return relTag, t
}
// commitID returns the abbreviated commit-id hash of the last commit.
@@ -65,6 +86,35 @@ func commitID() string {
return strings.TrimSpace(string(commit))
}
func commitTime() time.Time {
// git log --format=%cD -n1
var (
commitUnix []byte
err error
)
cmdName := "git"
cmdArgs := []string{"log", "--format=%cI", "-n1"}
if commitUnix, err = exec.Command(cmdName, cmdArgs...).Output(); err != nil {
fmt.Fprintln(os.Stderr, "Error generating git commit-time: ", err)
os.Exit(1)
}
t, err := time.Parse(time.RFC3339, strings.TrimSpace(string(commitUnix)))
if err != nil {
fmt.Fprintln(os.Stderr, "Error generating git commit-time: ", err)
os.Exit(1)
}
return t.UTC()
}
func main() {
fmt.Println(genLDFlags(time.Now().UTC().Format(time.RFC3339)))
var version string
if len(os.Args) > 1 {
version = os.Args[1]
} else {
version = commitTime().Format(time.RFC3339)
}
fmt.Println(genLDFlags(version))
}
-12
View File
@@ -1,12 +0,0 @@
#!/usr/bin/env bash
set -e
echo "" > coverage.txt
for d in $(go list ./...); do
go test -coverprofile=profile.out -covermode=atomic $d
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
fi
done
+54 -16
View File
@@ -1,30 +1,66 @@
/*
* Minio Client (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"os"
json "github.com/minio/colorjson"
"github.com/minio/minio-go/v7/pkg/policy"
)
// isValidAccessPERM - is provided access perm string supported.
func (b accessPerms) isValidAccessPERM() bool {
switch b {
case accessNone, accessDownload, accessUpload, accessPublic:
case accessNone, accessDownload, accessUpload, accessPrivate, accessPublic:
return true
}
return false
}
func (b accessPerms) isValidAccessFile() bool {
file, err := os.Open(string(b))
if err != nil {
return false
}
defer file.Close()
var policy policy.BucketAccessPolicy
if json.NewDecoder(file).Decode(&policy) != nil {
fatalIf(errDummy().Trace(), "Unable to parse access file.")
return false
}
if policy.Version != "2012-10-17" {
fatalIf(errDummy().Trace(), "Invalid policy version. Only 2012-10-17 is supported.")
return false
}
for _, statement := range policy.Statements {
if statement.Effect != "Allow" && statement.Effect != "Deny" {
fatalIf(errDummy().Trace(), "Invalid policy effect. Only Allow and Deny are supported.")
return false
}
}
return true
}
// accessPerms - access level.
type accessPerms string
@@ -33,5 +69,7 @@ const (
accessNone = accessPerms("none")
accessDownload = accessPerms("download")
accessUpload = accessPerms("upload")
accessPrivate = accessPerms("private")
accessPublic = accessPerms("public")
accessCustom = accessPerms("custom")
)
+83 -29
View File
@@ -1,35 +1,41 @@
/*
* Minio Client (C) 2014, 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"fmt"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/fatih/color"
"github.com/minio/pkg/v3/console"
"github.com/cheggaaa/pb"
json "github.com/minio/colorjson"
"github.com/minio/mc/pkg/probe"
)
// accounter keeps tabs of ongoing data transfer information.
type accounter struct {
current int64
Total int64
total int64
startTime time.Time
startValue int64
refreshRate time.Duration
@@ -41,7 +47,7 @@ type accounter struct {
// Instantiate a new accounter.
func newAccounter(total int64) *accounter {
acct := &accounter{
Total: total,
total: total,
startTime: time.Now(),
startValue: 0,
refreshRate: time.Millisecond * 200,
@@ -53,14 +59,14 @@ func newAccounter(total int64) *accounter {
}
// write calculate the final speed.
func (a *accounter) write(current int64) float64 {
func (a *accounter) write(current int64) (float64, time.Duration) {
fromStart := time.Since(a.startTime)
currentFromStart := current - a.startValue
if currentFromStart > 0 {
speed := float64(currentFromStart) / (float64(fromStart) / float64(time.Second))
return speed
return speed, fromStart
}
return 0.0
return 0.0, 0
}
// writer update new accounting data for a specified refreshRate.
@@ -78,21 +84,58 @@ func (a *accounter) writer() {
// accountStat cantainer for current stats captured.
type accountStat struct {
Total int64
Transferred int64
Speed float64
Status string `json:"status"`
Total int64 `json:"total"`
Transferred int64 `json:"transferred"`
Duration time.Duration `json:"duration"`
Speed float64 `json:"speed"`
}
func (c accountStat) JSON() string {
c.Status = "success"
accountMessageBytes, e := json.MarshalIndent(c, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(accountMessageBytes)
}
func (c accountStat) String() string {
dspOrder := []col{colGreen} // Header
dspOrder = append(dspOrder, colGrey)
var printColors []*color.Color
for _, c := range dspOrder {
printColors = append(printColors, getPrintCol(c))
}
tbl := console.NewTable(printColors, []bool{false, false, false, false}, 0)
var builder strings.Builder
cellText := make([][]string, 0, 2)
cellText = append(cellText, []string{
"Total",
"Transferred",
"Duration",
"Speed",
})
speedBox := pb.Format(int64(c.Speed)).To(pb.U_BYTES).String()
if speedBox == "" {
speedBox = "0 MB"
} else {
speedBox = speedBox + "/s"
}
message := fmt.Sprintf("Total: %s, Transferred: %s, Speed: %s", pb.Format(c.Total).To(pb.U_BYTES),
pb.Format(c.Transferred).To(pb.U_BYTES), speedBox)
return message
cellText = append(cellText, []string{
pb.Format(c.Total).To(pb.U_BYTES).String(),
pb.Format(c.Transferred).To(pb.U_BYTES).String(),
pb.Format(int64(c.Duration)).To(pb.U_DURATION).String(),
speedBox,
})
e := tbl.PopulateTable(&builder, cellText)
fatalIf(probe.NewError(e), "unable to populate the table")
return builder.String()
}
// Stat provides current stats captured.
@@ -100,9 +143,9 @@ func (a *accounter) Stat() accountStat {
var acntStat accountStat
a.finishOnce.Do(func() {
close(a.isFinished)
acntStat.Total = a.Total
acntStat.Total = a.total
acntStat.Transferred = atomic.LoadInt64(&a.current)
acntStat.Speed = a.write(atomic.LoadInt64(&a.current))
acntStat.Speed, acntStat.Duration = a.write(atomic.LoadInt64(&a.current))
})
return acntStat
}
@@ -127,6 +170,10 @@ func (a *accounter) Get() int64 {
return atomic.LoadInt64(&a.current)
}
func (a *accounter) SetTotal(n int64) {
atomic.StoreInt64(&a.total, n)
}
// Add add to current value atomically.
func (a *accounter) Add(n int64) int64 {
return atomic.AddInt64(&a.current, n)
@@ -134,6 +181,13 @@ func (a *accounter) Add(n int64) int64 {
// Read implements Reader which internally updates current value.
func (a *accounter) Read(p []byte) (n int, err error) {
defer func() {
// Upload retry can read one object twice; Avoid read to be greater than Total
if n, t := a.Get(), atomic.LoadInt64(&a.total); t > 0 && n > t {
a.Set(t)
}
}()
n = len(p)
a.Add(int64(n))
return
+94
View File
@@ -0,0 +1,94 @@
// Copyright (c) 2015-2024 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/minio/cli"
)
var adminAccesskeyCreateFlags = []cli.Flag{
cli.StringFlag{
Name: "access-key",
Usage: "set an access key for the account",
},
cli.StringFlag{
Name: "secret-key",
Usage: "set a secret key for the account",
},
cli.StringFlag{
Name: "policy",
Usage: "path to a JSON policy file",
},
cli.StringFlag{
Name: "name",
Usage: "friendly name for the account",
},
cli.StringFlag{
Name: "description",
Usage: "description for the account",
},
cli.StringFlag{
Name: "expiry-duration",
Usage: "duration before the access key expires",
},
cli.StringFlag{
Name: "expiry",
Usage: "expiry date for the access key",
},
}
var adminAccesskeyCreateCmd = cli.Command{
Name: "create",
Usage: "create access key pairs for users",
Action: mainAdminAccesskeyCreate,
Before: setGlobalsFromContext,
Flags: append(adminAccesskeyCreateFlags, globalFlags...),
OnUsageError: onUsageError,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS] [TARGET]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Create a new access key pair with the same policy as the authenticated user
{{.Prompt}} {{.HelpName}} myminio/
2. Create a new access key pair with custom access key and secret key
{{.Prompt}} {{.HelpName}} myminio/ --access-key myaccesskey --secret-key mysecretkey
3. Create a new access key pair for user 'tester' that expires in 1 day
{{.Prompt}} {{.HelpName}} myminio/ tester --expiry-duration 24h
4. Create a new access key pair for authenticated user that expires on 2025-01-01
{{.Prompt}} {{.HelpName}} --expiry 2025-01-01
5. Create a new access key pair for user 'tester' with a custom policy
{{.Prompt}} {{.HelpName}} myminio/ tester --policy /path/to/policy.json
6. Create a new access key pair for user 'tester' with a custom name and description
{{.Prompt}} {{.HelpName}} myminio/ tester --name "Tester's Access Key" --description "Access key for tester"
`,
}
func mainAdminAccesskeyCreate(ctx *cli.Context) error {
return commonAccesskeyCreate(ctx, false)
}
+48
View File
@@ -0,0 +1,48 @@
// Copyright (c) 2015-2024 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/minio/cli"
)
var adminAccesskeyDisableCmd = cli.Command{
Name: "disable",
Usage: "disable an access key",
Action: mainAdminAccesskeyDisable,
Before: setGlobalsFromContext,
Flags: globalFlags,
OnUsageError: onUsageError,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS] [TARGET]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Disable access key
{{.Prompt}} {{.HelpName}} myminio myaccesskey
`,
}
func mainAdminAccesskeyDisable(ctx *cli.Context) error {
return enableDisableAccesskey(ctx, false)
}
+77
View File
@@ -0,0 +1,77 @@
// Copyright (c) 2015-2024 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/minio/cli"
)
var adminAccesskeyEditFlags = []cli.Flag{
cli.StringFlag{
Name: "secret-key",
Usage: "set a secret key for the account",
},
cli.StringFlag{
Name: "policy",
Usage: "path to a JSON policy file",
},
cli.StringFlag{
Name: "name",
Usage: "friendly name for the account",
},
cli.StringFlag{
Name: "description",
Usage: "description for the account",
},
cli.StringFlag{
Name: "expiry-duration",
Usage: "duration before the access key expires",
},
cli.StringFlag{
Name: "expiry",
Usage: "expiry date for the access key",
},
}
var adminAccesskeyEditCmd = cli.Command{
Name: "edit",
Usage: "edit existing access keys",
Action: mainAdminAccesskeyEdit,
Before: setGlobalsFromContext,
Flags: append(adminAccesskeyEditFlags, globalFlags...),
OnUsageError: onUsageError,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS] [TARGET]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Change the secret key for the access key "testkey"
{{.Prompt}} {{.HelpName}} myminio/ testkey --secret-key 'xxxxxxx'
2. Change the expiry duration for the access key "testkey"
{{.Prompt}} {{.HelpName}} myminio/ testkey ---expiry-duration 24h
`,
}
func mainAdminAccesskeyEdit(ctx *cli.Context) error {
return commonAccesskeyEdit(ctx)
}
+48
View File
@@ -0,0 +1,48 @@
// Copyright (c) 2015-2024 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/minio/cli"
)
var adminAccesskeyEnableCmd = cli.Command{
Name: "enable",
Usage: "enable an access key",
Action: mainAdminAccesskeyEnable,
Before: setGlobalsFromContext,
Flags: globalFlags,
OnUsageError: onUsageError,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS] [TARGET]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Enable access key
{{.Prompt}} {{.HelpName}} myminio myaccesskey
`,
}
func mainAdminAccesskeyEnable(ctx *cli.Context) error {
return enableDisableAccesskey(ctx, true)
}
+202
View File
@@ -0,0 +1,202 @@
// Copyright (c) 2015-2023 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"strings"
"time"
"github.com/charmbracelet/lipgloss"
humanize "github.com/dustin/go-humanize"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
)
var adminAccesskeyInfoCmd = cli.Command{
Name: "info",
Usage: "info about given access key pairs",
Action: mainAdminAccesskeyInfo,
Before: setGlobalsFromContext,
Flags: globalFlags,
OnUsageError: onUsageError,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS] TARGET ACCESSKEY [ACCESSKEY...]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Get info for the access key "testkey"
{{.Prompt}} {{.HelpName}} local/ testkey
2. Get info for the access keys "testkey" and "testkey2"
{{.Prompt}} {{.HelpName}} local/ testkey testkey2
`,
}
type accesskeyMessage struct {
op string
Status string `json:"status"`
AccessKey string `json:"accessKey"`
SecretKey string `json:"secretKey,omitempty"`
STS bool `json:"sts,omitempty"`
ParentUser string `json:"parentUser,omitempty"`
AccountStatus string `json:"accountStatus,omitempty"`
ImpliedPolicy bool `json:"impliedPolicy,omitempty"`
Policy json.RawMessage `json:"policy,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Expiration *time.Time `json:"expiration,omitempty"`
Provider string `json:"provider,omitempty"`
ProviderInfo providerInfo `json:"providerInfo,omitempty"`
}
func (m accesskeyMessage) String() string {
labelStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("#04B575")) // green
o := strings.Builder{}
switch m.op {
case "info":
expirationStr := "NONE"
if m.Expiration != nil && !m.Expiration.IsZero() && !m.Expiration.Equal(timeSentinel) {
expirationStr = humanize.Time(*m.Expiration)
}
policyStr := "embedded"
if m.ImpliedPolicy {
policyStr = "implied"
}
statusStr := "enabled"
if m.AccountStatus == "off" {
statusStr = "disabled"
}
stsStr := "false"
if m.STS {
stsStr = "true"
}
o.WriteString(iFmt(0, "%s %s\n", labelStyle.Render("Access Key:"), m.AccessKey))
o.WriteString(iFmt(0, "%s %s\n", labelStyle.Render("Parent User:"), m.ParentUser))
o.WriteString(iFmt(0, "%s %s\n", labelStyle.Render("Status:"), statusStr))
o.WriteString(iFmt(0, "%s %s\n", labelStyle.Render("Policy:"), policyStr))
o.WriteString(iFmt(0, "%s %s\n", labelStyle.Render("Name:"), m.Name))
o.WriteString(iFmt(0, "%s %s\n", labelStyle.Render("Description:"), m.Description))
o.WriteString(iFmt(0, "%s %s\n", labelStyle.Render("Expiration:"), expirationStr))
o.WriteString(iFmt(0, "%s %s\n", labelStyle.Render("STS:"), stsStr))
o.WriteString(iFmt(0, "%s %s\n", labelStyle.Render("Provider:"), m.Provider))
if m.ProviderInfo != nil {
o.WriteString(iFmt(0, "%s\n", labelStyle.Render("Provider Specific Info:")))
o.WriteString(m.ProviderInfo.String())
}
case "create":
expirationStr := "NONE"
if m.Expiration != nil && !m.Expiration.IsZero() && !m.Expiration.Equal(timeSentinel) {
expirationStr = m.Expiration.String()
}
o.WriteString(iFmt(0, "%s %s\n", labelStyle.Render("Access Key:"), m.AccessKey))
o.WriteString(iFmt(0, "%s %s\n", labelStyle.Render("Secret Key:"), m.SecretKey))
o.WriteString(iFmt(0, "%s %s\n", labelStyle.Render("Expiration:"), expirationStr))
o.WriteString(iFmt(0, "%s %s\n", labelStyle.Render("Name:"), m.Name))
o.WriteString(iFmt(0, "%s %s\n", labelStyle.Render("Description:"), m.Description))
case "remove":
o.WriteString(labelStyle.Render(iFmt(0, "Successfully removed access key `%s`.", m.AccessKey)))
case "edit":
o.WriteString(labelStyle.Render(iFmt(0, "Successfully edited access key `%s`.", m.AccessKey)))
case "enable":
o.WriteString(labelStyle.Render(iFmt(0, "Successfully enabled access key `%s`.", m.AccessKey)))
case "disable":
o.WriteString(labelStyle.Render(iFmt(0, "Successfully disabled access key `%s`.", m.AccessKey)))
}
return o.String()
}
func (m accesskeyMessage) JSON() string {
m.Status = "success"
jsonMessageBytes, e := json.MarshalIndent(m, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(jsonMessageBytes)
}
type providerInfo interface {
String() string
}
func mainAdminAccesskeyInfo(ctx *cli.Context) error {
return commonAccesskeyInfo(ctx)
}
func commonAccesskeyInfo(ctx *cli.Context) error {
if len(ctx.Args()) < 2 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
args := ctx.Args()
aliasedURL := args.Get(0)
accessKeys := args.Tail()
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
for _, accessKey := range accessKeys {
// Assume service account by default
res, e := client.InfoAccessKey(globalContext, accessKey)
fatalIf(probe.NewError(e), "Unable to get info for access key.")
m := accesskeyMessage{
op: "info",
AccessKey: accessKey,
ParentUser: res.ParentUser,
AccountStatus: res.AccountStatus,
ImpliedPolicy: res.ImpliedPolicy,
Policy: json.RawMessage(res.Policy),
Name: res.Name,
Description: res.Description,
Expiration: nilExpiry(res.Expiration),
Provider: res.UserProvider,
}
switch res.UserProvider {
case madmin.LDAPProvider:
info := res.LDAPSpecificInfo
m.ProviderInfo = ldapAccessKeyInfo{
Username: info.Username,
}
case madmin.OpenIDProvider:
info := res.OpenIDSpecificInfo
m.ProviderInfo = openIDAccessKeyInfo{
ConfigName: info.ConfigName,
UserID: info.UserID,
UserIDClaim: info.UserIDClaim,
DisplayName: info.DisplayName,
DisplayNameClaim: info.DisplayNameClaim,
}
}
printMsg(m)
}
return nil
}
func nilExpiry(expiry *time.Time) *time.Time {
if expiry != nil && expiry.Equal(timeSentinel) {
return nil
}
return expiry
}
+168
View File
@@ -0,0 +1,168 @@
// Copyright (c) 2015-2024 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"strings"
"github.com/charmbracelet/lipgloss"
humanize "github.com/dustin/go-humanize"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
)
var adminAccesskeyListFlags = []cli.Flag{
cli.BoolFlag{
Name: "users-only",
Usage: "only list user DNs",
},
cli.BoolFlag{
Name: "temp-only",
Usage: "only list temporary access keys",
},
cli.BoolFlag{
Name: "svcacc-only",
Usage: "only list service account access keys",
},
cli.BoolFlag{
Name: "self",
Usage: "list access keys for the authenticated user",
},
cli.BoolFlag{
Name: "all",
Usage: "list all access keys for all builtin users",
},
}
var adminAccesskeyListCmd = cli.Command{
Name: "list",
ShortName: "ls",
Usage: "list access key pairs for builtin users",
Action: mainAdminAccesskeyList,
Before: setGlobalsFromContext,
Flags: append(adminAccesskeyListFlags, globalFlags...),
OnUsageError: onUsageError,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS] TARGET [DN...]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Get list of all builtin users and associated access keys in local server
{{.Prompt}} {{.HelpName}} local/ --all
2. Get list of access keys for the authenticated user in local server
{{.Prompt}} {{.HelpName}} local/ --self
3. Get list of builtin users in local server
{{.Prompt}} {{.HelpName}} local/ --all --users-only
4. Get list of all builtin users and associated temporary access keys in play server (if admin)
{{.Prompt}} {{.HelpName}} play/ --temp-only
5. Get list of access keys associated with user 'foobar'
{{.Prompt}} {{.HelpName}} play/ foobar
6. Get list of access keys associated with users 'foobar' and 'tester'
{{.Prompt}} {{.HelpName}} play/ foobar tester
7. Get all users and access keys if admin, else get authenticated user and associated access keys
{{.Prompt}} {{.HelpName}} local/
`,
}
type userAccesskeyList struct {
Status string `json:"status"`
User string `json:"user"`
STSKeys []madmin.ServiceAccountInfo `json:"stsKeys"`
ServiceAccounts []madmin.ServiceAccountInfo `json:"svcaccs"`
LDAP bool `json:"ldap,omitempty"`
}
func (m userAccesskeyList) String() string {
labelStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("#04B575"))
o := strings.Builder{}
userStr := "User"
if m.LDAP {
userStr = "DN"
}
o.WriteString(iFmt(0, "%s %s\n", labelStyle.Render(userStr+":"), m.User))
if len(m.STSKeys) > 0 || len(m.ServiceAccounts) > 0 {
o.WriteString(iFmt(2, "%s\n", labelStyle.Render("Access Keys:")))
}
for _, k := range m.STSKeys {
expiration := "never"
if nilExpiry(k.Expiration) != nil {
expiration = humanize.Time(*k.Expiration)
}
o.WriteString(iFmt(4, "%s, expires: %s, sts: true\n", k.AccessKey, expiration))
}
for _, k := range m.ServiceAccounts {
expiration := "never"
if nilExpiry(k.Expiration) != nil {
expiration = humanize.Time(*k.Expiration)
}
o.WriteString(iFmt(4, "%s, expires: %s, sts: false\n", k.AccessKey, expiration))
}
return o.String()
}
func (m userAccesskeyList) JSON() string {
jsonMessageBytes, e := json.MarshalIndent(m, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(jsonMessageBytes)
}
func mainAdminAccesskeyList(ctx *cli.Context) error {
aliasedURL, tentativeAll, users, opts := commonAccesskeyList(ctx)
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
accessKeysMap, e := client.ListAccessKeysBulk(globalContext, users, opts)
if e != nil {
if e.Error() == "Access Denied." && tentativeAll {
// retry with self
opts.All = false
accessKeysMap, e = client.ListAccessKeysBulk(globalContext, users, opts)
}
fatalIf(probe.NewError(e), "Unable to list access keys.")
}
for user, accessKeys := range accessKeysMap {
m := userAccesskeyList{
Status: "success",
User: user,
ServiceAccounts: accessKeys.ServiceAccounts,
STSKeys: accessKeys.STSKeys,
LDAP: false,
}
printMsg(m)
}
return nil
}
+49
View File
@@ -0,0 +1,49 @@
// Copyright (c) 2015-2024 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/minio/cli"
)
var adminAccesskeyRemoveCmd = cli.Command{
Name: "remove",
ShortName: "rm",
Usage: "delete access key pairs for builtin users",
Action: mainAdminAccesskeyRemove,
Before: setGlobalsFromContext,
Flags: globalFlags,
OnUsageError: onUsageError,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS] TARGET ACCESSKEY
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Remove the access key "testkey" from local server
{{.Prompt}} {{.HelpName}} local/ testkey
`,
}
func mainAdminAccesskeyRemove(ctx *cli.Context) error {
return commonAccesskeyRemove(ctx)
}
+149
View File
@@ -0,0 +1,149 @@
// Copyright (c) 2015-2025 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
)
var adminAccesskeySTSRevokeFlags = []cli.Flag{
cli.BoolFlag{
Name: "all",
Usage: "revoke all STS accounts for the specified user",
},
cli.BoolFlag{
Name: "self",
Usage: "revoke all STS accounts for the authenticated user",
},
cli.StringFlag{
Name: "token-type",
Usage: "specify the token type to revoke",
},
}
var adminAccesskeySTSRevokeCmd = cli.Command{
Name: "sts-revoke",
Usage: "revokes all STS accounts or specified types for the specified user",
Action: mainAdminAccesskeySTSRevoke,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: append(adminAccesskeySTSRevokeFlags, globalFlags...),
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} ALIAS USER [--all | --token-type TOKEN_TYPE]
Exactly one of --all or --token-type must be specified.
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Revoke all STS accounts for user "user1"
{{.Prompt}} {{.HelpName}} myminio user1 --all
2. Revoke STS accounts of a token type "app-1" for user "user1"
{{.Prompt}} {{.HelpName}} myminio user1 --token-type app-1
3. Revoke all STS accounts for the authenticated user
{{.Prompt}} {{.HelpName}} myminio --self
4. Revoke STS accounts of a token type "app-1" for the authenticated user
{{.Prompt}} {{.HelpName}} myminio --self --token-type app-1
`,
}
type stsRevokeMessage struct {
Status string `json:"status"`
User string `json:"user"`
TokenRevokeType string `json:"tokenRevokeType,omitempty"`
}
func (m stsRevokeMessage) String() string {
userString := "user " + m.User
if m.User == "" {
userString = "authenticated user"
}
if m.TokenRevokeType == "" {
return "Successfully revoked all STS accounts for " + userString
}
return "Successfully revoked all STS accounts of type " + m.TokenRevokeType + " for " + userString
}
func (m stsRevokeMessage) JSON() string {
if m.Status == "" {
m.Status = "success"
}
jsonMessageBytes, e := json.MarshalIndent(m, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(jsonMessageBytes)
}
// checkSTSRevokeSyntax - validate all the passed arguments
func checkSTSRevokeSyntax(ctx *cli.Context) {
if len(ctx.Args()) > 2 || len(ctx.Args()) == 0 {
showCommandHelpAndExit(ctx, 1)
}
if !ctx.Bool("self") && ctx.Args().Get(1) == "" {
fatalIf(errInvalidArgument().Trace(), "Must specify user or use --self flag.")
}
if ctx.Bool("self") && ctx.Args().Get(1) != "" {
fatalIf(errInvalidArgument().Trace(), "Cannot specify user with --self flag.")
}
if (!ctx.Bool("all") && ctx.String("token-type") == "") || (ctx.Bool("all") && ctx.String("token-type") != "") {
fatalIf(errDummy().Trace(), "Exactly one of --all or --token-type must be specified.")
}
}
// mainAdminAccesskeySTSRevoke is the handle for "mc admin accesskey sts-revoke" command.
func mainAdminAccesskeySTSRevoke(ctx *cli.Context) error {
checkSTSRevokeSyntax(ctx)
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
user := args.Get(1) // will be empty if --self flag is set
tokenRevokeType := ctx.String("token-type")
fullRevoke := ctx.Bool("all")
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
e := client.RevokeTokens(globalContext, madmin.RevokeTokensReq{
User: user,
TokenRevokeType: tokenRevokeType,
FullRevoke: fullRevoke,
})
fatalIf(probe.NewError(e).Trace(args...), "Unable to revoke tokens for %s", user)
printMsg(stsRevokeMessage{
User: user,
TokenRevokeType: tokenRevokeType,
})
return nil
}
+46
View File
@@ -0,0 +1,46 @@
// Copyright (c) 2015-2024 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import "github.com/minio/cli"
var adminAccesskeySubcommands = []cli.Command{
adminAccesskeyListCmd,
adminAccesskeyRemoveCmd,
adminAccesskeyInfoCmd,
adminAccesskeyCreateCmd,
adminAccesskeyEditCmd,
adminAccesskeyEnableCmd,
adminAccesskeyDisableCmd,
adminAccesskeySTSRevokeCmd,
}
var adminAccesskeyCmd = cli.Command{
Name: "accesskey",
Usage: "manage access keys defined in the MinIO server",
Action: mainAdminAccesskey,
Before: setGlobalsFromContext,
Flags: globalFlags,
Subcommands: adminAccesskeySubcommands,
HideHelpCommand: true,
}
func mainAdminAccesskey(ctx *cli.Context) error {
commandNotFound(ctx, adminAccesskeySubcommands)
return nil
}
+40
View File
@@ -0,0 +1,40 @@
// Copyright (c) 2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/minio/cli"
)
var adminBucketInfoFlags = []cli.Flag{}
var adminBucketInfoCmd = cli.Command{
Name: "info",
Usage: "display bucket information",
Action: mainAdminBucketInfo,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: append(adminBucketInfoFlags, globalFlags...),
HideHelpCommand: true,
}
// mainAdminBucketInfo is the handler for "mc admin bucket info" command.
func mainAdminBucketInfo(_ *cli.Context) error {
deprecatedError("mc stat")
return nil
}
+49
View File
@@ -0,0 +1,49 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/minio/cli"
)
var adminQuotaFlags = []cli.Flag{
cli.StringFlag{
Name: "hard",
Usage: "set a hard quota, disallowing writes after quota is reached",
},
cli.BoolFlag{
Name: "clear",
Usage: "clears bucket quota configured for bucket",
},
}
var adminBucketQuotaCmd = cli.Command{
Name: "quota",
Usage: "manage bucket quota",
Action: mainAdminBucketQuota,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: append(adminQuotaFlags, globalFlags...),
HideHelpCommand: true,
}
// mainAdminBucketQuota is the handler for "mc admin bucket quota" command.
func mainAdminBucketQuota(_ *cli.Context) error {
deprecatedError("mc quota")
return nil
}
+38
View File
@@ -0,0 +1,38 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/minio/cli"
)
var adminBucketRemoteAddCmd = cli.Command{
Name: "add",
Usage: "add a new remote target",
Action: mainAdminBucketRemoteAdd,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
HideHelp: true,
}
// mainAdminBucketRemoteAdd is the handle for "mc admin bucket remote set" command.
func mainAdminBucketRemoteAdd(_ *cli.Context) error {
deprecatedError("mc replicate add")
return nil
}
+130
View File
@@ -0,0 +1,130 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"testing"
)
func TestGetBandwidthInBytes(t *testing.T) {
type args struct {
bandwidthStr string
}
f1 := 999.1234567 * 1024 * 1024
f2 := 10.123456789 * 1024 * 1024 * 1024
f3 := 10000.123456789 * 1024 * 1024 * 1024
f4 := 0.001 * 1024 * 1024 * 1024
tests := []struct {
name string
args args
want uint64
}{
{
name: "1MegaByte",
args: args{
bandwidthStr: "1Mi",
},
want: 1024 * 1024,
},
{
name: "1MegaBit",
args: args{
bandwidthStr: "1M",
},
want: 1000000,
},
{
name: "1GigaByte",
args: args{
bandwidthStr: "1G",
},
want: 1000000000,
},
{
name: "1GibiByte",
args: args{
bandwidthStr: "1Gi",
},
want: 1024 * 1024 * 1024,
},
{
name: "FractionalMegaBytes",
args: args{
bandwidthStr: "999.123456789123456789M",
},
want: 999123456,
},
{
name: "FractionalGigaBytes",
args: args{
bandwidthStr: "10.123456789123456789123456G",
},
want: 10123456789,
},
{
name: "FractionalBigGigaBytes",
args: args{
bandwidthStr: "10000.123456789123456789123456G",
},
want: 10000123456789,
},
{
name: "FractionalMebiBytes",
args: args{
bandwidthStr: "999.123456789123456789Mi",
},
want: uint64(f1),
},
{
name: "FractionalGibiBytes",
args: args{
bandwidthStr: "10.123456789123456789123456Gi",
},
want: uint64(f2),
},
{
name: "FractionalBigGibiBytes",
args: args{
bandwidthStr: "10000.123456789123456789123456Gi",
},
want: uint64(f3),
},
{
name: "SmallGiga",
args: args{
bandwidthStr: "0.001Gi",
},
want: uint64(f4),
},
{
name: "LargeK",
args: args{
bandwidthStr: "1024Ki",
},
want: 1024 * 1024,
},
}
t.Parallel()
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got, err := getBandwidthInBytes(tt.args.bandwidthStr); err != nil || got != tt.want {
t.Errorf("getBandwidthInBytes() = %v, want %v", got, tt.want)
}
})
}
}
+38
View File
@@ -0,0 +1,38 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/minio/cli"
)
var adminBucketRemoteEditCmd = cli.Command{
Name: "edit",
Usage: "edit remote target",
Action: mainAdminBucketRemoteEdit,
Before: setGlobalsFromContext,
OnUsageError: onUsageError,
Flags: globalFlags,
HideHelp: true,
}
// mainAdminBucketRemoteEdit is the handle for "mc admin bucket remote edit" command.
func mainAdminBucketRemoteEdit(_ *cli.Context) error {
deprecatedError("mc replicate update")
return nil
}
+43
View File
@@ -0,0 +1,43 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import "github.com/minio/cli"
var adminBucketRemoteSubcommands = []cli.Command{
adminBucketRemoteAddCmd,
adminBucketRemoteEditCmd,
adminBucketRemoteRmCmd,
}
var adminBucketRemoteCmd = cli.Command{
Name: "remote",
Usage: "configure remote target buckets",
Action: mainadminBucketRemote,
Before: setGlobalsFromContext,
Flags: globalFlags,
Subcommands: adminBucketRemoteSubcommands,
HideHelpCommand: true,
}
// mainadminBucketRemote is the handle for "mc admin bucket remote" command.
func mainadminBucketRemote(ctx *cli.Context) error {
commandNotFound(ctx, adminBucketRemoteSubcommands)
return nil
// Sub-commands like "add", "ls", "rm" have their own main.
}
+39
View File
@@ -0,0 +1,39 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/minio/cli"
)
var adminBucketRemoteRmCmd = cli.Command{
Name: "remove",
ShortName: "rm",
Usage: "remove configured remote target",
Action: mainAdminBucketRemoteRemove,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
HideHelp: true,
}
// mainAdminBucketRemoteRemove is the handle for "mc admin bucket remote rm" command.
func mainAdminBucketRemoteRemove(_ *cli.Context) error {
deprecatedError("mc replicate rm")
return nil
}
+44
View File
@@ -0,0 +1,44 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import "github.com/minio/cli"
var adminBucketSubcommands = []cli.Command{
adminBucketRemoteCmd,
adminBucketQuotaCmd,
adminBucketInfoCmd,
}
var adminBucketCmd = cli.Command{
Name: "bucket",
Usage: "manage buckets defined in the MinIO server",
Action: mainAdminBucket,
Before: setGlobalsFromContext,
Flags: globalFlags,
Subcommands: adminBucketSubcommands,
HideHelpCommand: true,
Hidden: true,
}
// mainAdminBucket is the handle for "mc admin bucket" command.
func mainAdminBucket(ctx *cli.Context) error {
commandNotFound(ctx, adminBucketSubcommands)
return nil
// Sub-commands like "quota", "remote" have their own main.
}
+141
View File
@@ -0,0 +1,141 @@
// Copyright (c) 2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"context"
"fmt"
"io"
"os"
"path/filepath"
"strings"
"time"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminClusterBucketExportCmd = cli.Command{
Name: "export",
Usage: "backup bucket metadata to a zip file",
Action: mainClusterBucketExport,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
HideHelpCommand: true,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS] TARGET/[BUCKET]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Save metadata of all buckets to a zip file.
{{.Prompt}} {{.HelpName}} myminio
`,
}
func checkBucketExportSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
// mainClusterBucketExport - metadata export command
func mainClusterBucketExport(ctx *cli.Context) error {
// Check for command syntax
checkBucketExportSyntax(ctx)
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
console.SetColor("File", color.New(color.FgWhite, color.Bold))
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
if err != nil {
fatalIf(err.Trace(aliasedURL), "Unable to initialize admin client.")
return nil
}
// Compute bucket and object from the aliased URL
aliasedURL = filepath.ToSlash(aliasedURL)
aliasedURL = filepath.Clean(aliasedURL)
_, bucket := url2Alias(aliasedURL)
r, e := client.ExportBucketMetadata(context.Background(), bucket)
fatalIf(probe.NewError(e).Trace(aliasedURL), "Unable to export bucket metadata.")
if bucket == "" {
bucket = "bucket"
}
// Create bucket metadata zip file
tmpFile, e := os.CreateTemp("", fmt.Sprintf("%s-%s-metadata-", strings.ReplaceAll(aliasedURL, "/", "-"), bucket))
fatalIf(probe.NewError(e), "Unable to download file data.")
ext := "zip"
// Copy zip content to target download file
_, e = io.Copy(tmpFile, r)
fatalIf(probe.NewError(e), "Unable to download bucket metadata.")
// Close everything
r.Close()
tmpFile.Close()
// We use 4 bytes of the 32 bytes to identify the file.
downloadPath := fmt.Sprintf("%s-%s-metadata.%s", aliasedURL, bucket, ext)
// Create necessary directories.
dir := filepath.Dir(downloadPath)
if e := os.MkdirAll(dir, 0o755); e != nil {
fatalIf(probe.NewError(e).Trace(dir), "Unable to create download directory")
}
fi, e := os.Stat(downloadPath)
if e == nil && !fi.IsDir() {
e = moveFile(downloadPath, downloadPath+"."+time.Now().Format(dateTimeFormatFilename))
fatalIf(probe.NewError(e), "Unable to create a backup of "+downloadPath)
} else {
if !os.IsNotExist(e) {
fatal(probe.NewError(e), "Unable to download file data")
}
}
fatalIf(probe.NewError(moveFile(tmpFile.Name(), downloadPath)), "Unable to rename downloaded data, file exists at %s", tmpFile.Name())
// Explicitly set permissions to 0o600 and override umask
// to ensure that the file is not world-readable.
e = os.Chmod(downloadPath, 0o600)
fatalIf(probe.NewError(e), "Unable to set file permissions for "+downloadPath)
if !globalJSON {
console.Infof("Bucket metadata successfully downloaded as %s\n", downloadPath)
return nil
}
v := struct {
File string `json:"file"`
Key string `json:"key,omitempty"`
}{
File: downloadPath,
}
b, e := json.Marshal(v)
fatalIf(probe.NewError(e), "Unable to serialize data")
console.Println(string(b))
return nil
}
+242
View File
@@ -0,0 +1,242 @@
// Copyright (c) 2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"bytes"
"context"
"fmt"
"io"
"os"
"path/filepath"
"strings"
"github.com/fatih/color"
"github.com/klauspost/compress/zip"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminClusterBucketImportCmd = cli.Command{
Name: "import",
Usage: "restore bucket metadata from a zip file",
Action: mainClusterBucketImport,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
HideHelpCommand: true,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS] TARGET/[BUCKET] /path/to/backups/bucket-metadata.zip
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Recover bucket metadata for all buckets from previously saved bucket metadata backup.
{{.Prompt}} {{.HelpName}} myminio /backups/myminio-bucket-metadata.zip
`,
}
func checkBucketImportSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
// mainClusterBucketImport - bucket metadata import command
func mainClusterBucketImport(ctx *cli.Context) error {
// Check for command syntax
checkBucketImportSyntax(ctx)
console.SetColor("Name", color.New(color.Bold, color.FgCyan))
console.SetColor("success", color.New(color.Bold, color.FgGreen))
console.SetColor("warning", color.New(color.Bold, color.FgYellow))
console.SetColor("errors", color.New(color.Bold, color.FgRed))
console.SetColor("statusMsg", color.New(color.Bold, color.FgHiWhite))
console.SetColor("failCell", color.New(color.FgRed))
console.SetColor("passCell", color.New(color.FgGreen))
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
var r io.Reader
var sz int64
f, e := os.Open(args.Get(1))
if e != nil {
fatalIf(probe.NewError(e).Trace(args...), "Unable to get bucket metadata")
}
if st, e := f.Stat(); e == nil {
sz = st.Size()
}
defer f.Close()
r = f
_, e = zip.NewReader(r.(io.ReaderAt), sz)
fatalIf(probe.NewError(e).Trace(args...), fmt.Sprintf("Unable to read zip file %s", args.Get(1)))
f, e = os.Open(args.Get(1))
fatalIf(probe.NewError(e).Trace(args...), "Unable to get bucket metadata")
defer f.Close()
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
if err != nil {
fatalIf(err.Trace(aliasedURL), "Unable to initialize admin client.")
return nil
}
// Compute bucket and object from the aliased URL
aliasedURL = filepath.ToSlash(aliasedURL)
aliasedURL = filepath.Clean(aliasedURL)
_, bucket := url2Alias(aliasedURL)
rpt, e := client.ImportBucketMetadata(context.Background(), bucket, f)
fatalIf(probe.NewError(e).Trace(aliasedURL), "Unable to import bucket metadata.")
printMsg(importMetaMsg{
BucketMetaImportErrs: rpt,
Status: "success",
URL: aliasedURL,
Op: ctx.Command.Name,
})
return nil
}
type importMetaMsg struct {
madmin.BucketMetaImportErrs
Op string
URL string `json:"url"`
Status string `json:"status"`
}
func statusTick(s madmin.MetaStatus) string {
switch {
case s.Err != "":
return console.Colorize("failCell", crossTickCell)
case !s.IsSet:
return blankCell
default:
return console.Colorize("passCell", tickCell)
}
}
func (i importMetaMsg) String() string {
m := i.Buckets
totBuckets := len(m)
totErrs := 0
for _, st := range m {
if st.ObjectLock.Err != "" || st.Versioning.Err != "" ||
st.SSEConfig.Err != "" || st.Tagging.Err != "" ||
st.Lifecycle.Err != "" || st.Quota.Err != "" ||
st.Policy.Err != "" || st.Notification.Err != "" ||
st.Cors.Err != "" || st.Err != "" {
totErrs++
}
}
var b strings.Builder
numSch := "success"
if totErrs > 0 {
numSch = "warning"
}
msg := "\n" + console.Colorize(numSch, totBuckets-totErrs) +
console.Colorize("statusMsg", "/") +
console.Colorize("success", totBuckets) +
console.Colorize("statusMsg", " buckets were imported successfully.")
fmt.Fprintln(&b, msg)
if totErrs > 0 {
fmt.Fprintln(&b, console.Colorize("errors", "Errors: \n"))
for bucket, st := range m {
if st.ObjectLock.Err != "" || st.Versioning.Err != "" ||
st.SSEConfig.Err != "" || st.Tagging.Err != "" ||
st.Lifecycle.Err != "" || st.Quota.Err != "" ||
st.Policy.Err != "" || st.Notification.Err != "" ||
st.Cors.Err != "" || st.Err != "" {
fmt.Fprintln(&b, printImportErrs(bucket, st))
}
}
}
return b.String()
}
func (i importMetaMsg) JSON() string {
buf := &bytes.Buffer{}
enc := json.NewEncoder(buf)
enc.SetIndent("", " ")
// Disable escaping special chars to display XML tags correctly
enc.SetEscapeHTML(false)
fatalIf(probe.NewError(enc.Encode(i.Buckets)), "Unable to marshal into JSON.")
return buf.String()
}
// pretty print import errors
func printImportErrs(bucket string, r madmin.BucketStatus) string {
var b strings.Builder
placeHolder := ""
key := fmt.Sprintf("%-10s: %s", "Name", bucket)
fmt.Fprintln(&b, console.Colorize("Name", key))
if r.Err != "" {
fmt.Fprintf(&b, "%2s%s %s", placeHolder, console.Colorize("errors", "Error: "), r.Err)
fmt.Fprintln(&b)
}
if r.ObjectLock.IsSet {
fmt.Fprintf(&b, "%2s%s %s", placeHolder, "Object lock: ", statusTick(r.ObjectLock))
fmt.Fprintln(&b)
}
if r.Versioning.IsSet {
fmt.Fprintf(&b, "%2s%s %s", placeHolder, "Versioning: ", statusTick(r.Versioning))
fmt.Fprintln(&b)
}
if r.SSEConfig.IsSet {
fmt.Fprintf(&b, "%2s%s %s", placeHolder, "Encryption: ", statusTick(r.SSEConfig))
fmt.Fprintln(&b)
}
if r.Lifecycle.IsSet {
fmt.Fprintf(&b, "%2s%s %s", placeHolder, "Lifecycle: ", statusTick(r.Lifecycle))
fmt.Fprintln(&b)
}
if r.Notification.IsSet {
fmt.Fprintf(&b, "%2s%s %s", placeHolder, "Notification: ", statusTick(r.Notification))
fmt.Fprintln(&b)
}
if r.Quota.IsSet {
fmt.Fprintf(&b, "%2s%s %s", placeHolder, "Quota: ", statusTick(r.Quota))
fmt.Fprintln(&b)
}
if r.Policy.IsSet {
fmt.Fprintf(&b, "%2s%s %s", placeHolder, "Policy: ", statusTick(r.Policy))
fmt.Fprintln(&b)
}
if r.Tagging.IsSet {
fmt.Fprintf(&b, "%2s%s %s", placeHolder, "Tagging: ", statusTick(r.Tagging))
fmt.Fprintln(&b)
}
if r.Cors.IsSet {
fmt.Fprintf(&b, "%2s%s %s", placeHolder, "CORS: ", statusTick(r.Cors))
fmt.Fprintln(&b)
}
return b.String()
}
+42
View File
@@ -0,0 +1,42 @@
// Copyright (c) 2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import "github.com/minio/cli"
var adminClusterBucketSubcommands = []cli.Command{
adminClusterBucketImportCmd,
adminClusterBucketExportCmd,
}
var adminClusterBucketCmd = cli.Command{
Name: "bucket",
Usage: "manage bucket metadata on MinIO cluster",
Action: mainAdminClusterBucket,
Before: setGlobalsFromContext,
Flags: globalFlags,
Subcommands: adminClusterBucketSubcommands,
HideHelpCommand: true,
}
// mainAdminClusterBucket is the handle for "mc admin cluster bucket" command.
func mainAdminClusterBucket(ctx *cli.Context) error {
commandNotFound(ctx, adminClusterBucketSubcommands)
return nil
// Sub-commands like "export", "import" have their own main.
}
+148
View File
@@ -0,0 +1,148 @@
// Copyright (c) 2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"context"
"fmt"
"io"
"os"
"path/filepath"
"time"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
// iam export specific flags.
var (
iamExportFlags = []cli.Flag{
cli.StringFlag{
Name: "output,o",
Usage: "output iam export to a custom file path",
},
}
)
var adminClusterIAMExportCmd = cli.Command{
Name: "export",
Usage: "exports IAM info to zipped file",
Action: mainClusterIAMExport,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: append(iamExportFlags, globalFlags...),
HideHelpCommand: true,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS] TARGET
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Download all IAM metadata for cluster into zip file.
{{.Prompt}} {{.HelpName}} myminio
2. Download all IAM metadata to a custom file.
{{.Prompt}} {{.HelpName}} myminio --output /tmp/myminio-iam.zip
`,
}
func checkIAMExportSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
// mainClusterIAMExport - metadata export command
func mainClusterIAMExport(ctx *cli.Context) error {
// Check for command syntax
checkIAMExportSyntax(ctx)
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := filepath.ToSlash(args.Get(0))
aliasedURL = filepath.Clean(aliasedURL)
console.SetColor("File", color.New(color.FgWhite, color.Bold))
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
if err != nil {
fatalIf(err.Trace(aliasedURL), "Unable to initialize admin client.")
return nil
}
r, e := client.ExportIAM(context.Background())
fatalIf(probe.NewError(e).Trace(aliasedURL), "Unable to export IAM info.")
// Create iam info zip file
tmpFile, e := os.CreateTemp("", fmt.Sprintf("%s-iam-info", aliasedURL))
fatalIf(probe.NewError(e), "Unable to download file data.")
ext := "zip"
// Copy zip content to target download file
_, e = io.Copy(tmpFile, r)
fatalIf(probe.NewError(e), "Unable to download IAM info.")
// Close everything
r.Close()
tmpFile.Close()
downloadPath := fmt.Sprintf("%s-iam-info.%s", aliasedURL, ext)
if ctx.String("output") != "" {
downloadPath = ctx.String("output")
}
fi, e := os.Stat(downloadPath)
if e == nil && !fi.IsDir() {
e = moveFile(downloadPath, downloadPath+"."+time.Now().Format(dateTimeFormatFilename))
fatalIf(probe.NewError(e), "Unable to create a backup of "+downloadPath)
} else {
if !os.IsNotExist(e) {
fatal(probe.NewError(e), "Unable to download file data")
}
}
fatalIf(probe.NewError(moveFile(tmpFile.Name(), downloadPath)), "Unable to rename downloaded data, file exists at %s", tmpFile.Name())
// Explicitly set permissions to 0o600 and override umask
// to ensure that the file is not world-readable.
e = os.Chmod(downloadPath, 0o600)
fatalIf(probe.NewError(e), "Unable to set file permissions for "+downloadPath)
if !globalJSON {
console.Infof("IAM info successfully downloaded as %s\n", downloadPath)
return nil
}
v := struct {
File string `json:"file"`
Key string `json:"key,omitempty"`
}{
File: downloadPath,
}
b, e := json.Marshal(v)
fatalIf(probe.NewError(e), "Unable to serialize data")
console.Println(string(b))
return nil
}
+232
View File
@@ -0,0 +1,232 @@
// Copyright (c) 2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"context"
"fmt"
"io"
"os"
"path/filepath"
"strings"
"github.com/klauspost/compress/zip"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminClusterIAMImportCmd = cli.Command{
Name: "import",
Usage: "imports IAM info from zipped file",
Action: mainClusterIAMImport,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
HideHelpCommand: true,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS] TARGET/BUCKET /path/to/myminio-iam-info.zip
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Set IAM info from previously exported metadata zip file.
{{.Prompt}} {{.HelpName}} myminio /tmp/myminio-iam-info.zip
`,
}
type iamImportInfo madmin.ImportIAMResult
func (i iamImportInfo) JSON() string {
bs, e := json.MarshalIndent(madmin.ImportIAMResult(i), "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(bs)
}
func (i iamImportInfo) String() string {
var messages []string
info := madmin.ImportIAMResult(i)
messages = append(messages, processIAMEntities(info.Skipped, "Skipped")...)
messages = append(messages, processIAMEntities(info.Removed, "Removed")...)
messages = append(messages, processIAMEntities(info.Added, "Added")...)
messages = append(messages, processErrIAMEntities(info.Failed)...)
return strings.Join(messages, "\n")
}
func processIAMEntities(entities madmin.IAMEntities, action string) []string {
var messages []string
if len(entities.Policies) > 0 {
messages = append(messages, fmt.Sprintf("%s policies: %v", action, strings.Join(entities.Policies, ", ")))
}
if len(entities.Users) > 0 {
messages = append(messages, fmt.Sprintf("%s users: %v", action, strings.Join(entities.Users, ", ")))
}
if len(entities.Groups) > 0 {
messages = append(messages, fmt.Sprintf("%s groups: %v", action, strings.Join(entities.Groups, ", ")))
}
if len(entities.ServiceAccounts) > 0 {
messages = append(messages, fmt.Sprintf("%s service accounts: %v", action, strings.Join(entities.ServiceAccounts, ", ")))
}
var users []string
for _, pol := range entities.UserPolicies {
for name := range pol {
users = append(users, name)
}
}
if len(users) > 0 {
messages = append(messages, fmt.Sprintf("%s policies for users: %v", action, strings.Join(users, ", ")))
}
var groups []string
for _, pol := range entities.GroupPolicies {
for name := range pol {
groups = append(groups, name)
}
}
if len(groups) > 0 {
messages = append(messages, fmt.Sprintf("%s policies for groups: %v", action, strings.Join(groups, ", ")))
}
var stsarr []string
for _, pol := range entities.STSPolicies {
for name := range pol {
stsarr = append(stsarr, name)
}
}
if len(stsarr) > 0 {
messages = append(messages, fmt.Sprintf("%s policies for sts: %v", action, strings.Join(stsarr, ", ")))
}
return messages
}
func processErrIAMEntities(entities madmin.IAMErrEntities) []string {
var messages []string
var policies []string
for _, entry := range entities.Policies {
policies = append(policies, entry.Name)
}
if len(policies) > 0 {
messages = append(messages, fmt.Sprintf("Failed to add policies: %v", strings.Join(policies, ", ")))
}
var users []string
for _, entry := range entities.Users {
users = append(users, entry.Name)
}
if len(users) > 0 {
messages = append(messages, fmt.Sprintf("Failed to add users: %v", strings.Join(users, ", ")))
}
var groups []string
for _, entry := range entities.Groups {
groups = append(groups, entry.Name)
}
if len(groups) > 0 {
messages = append(messages, fmt.Sprintf("Failed to add groups: %v", strings.Join(groups, ", ")))
}
var sas []string
for _, entry := range entities.ServiceAccounts {
sas = append(sas, entry.Name)
}
if len(sas) > 0 {
messages = append(messages, fmt.Sprintf("Failed to add service accounts: %v", strings.Join(sas, ", ")))
}
var polusers []string
for _, pol := range entities.UserPolicies {
polusers = append(polusers, pol.Name)
}
if len(polusers) > 0 {
messages = append(messages, fmt.Sprintf("Failed to add policies for users: %v", strings.Join(polusers, ", ")))
}
var polgroups []string
for _, pol := range entities.GroupPolicies {
polgroups = append(polgroups, pol.Name)
}
if len(polgroups) > 0 {
messages = append(messages, fmt.Sprintf("Failed to add policies for groups: %v", strings.Join(polgroups, ", ")))
}
var polsts []string
for _, pol := range entities.STSPolicies {
polsts = append(polsts, pol.Name)
}
if len(polsts) > 0 {
messages = append(messages, fmt.Sprintf("Failed to add policies for sts: %v", strings.Join(polsts, ", ")))
}
return messages
}
func checkIAMImportSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
// mainClusterIAMImport - iam info import command
func mainClusterIAMImport(ctx *cli.Context) error {
// Check for command syntax
checkIAMImportSyntax(ctx)
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := filepath.ToSlash(args.Get(0))
aliasedURL = filepath.Clean(aliasedURL)
var r io.Reader
var sz int64
f, e := os.Open(args.Get(1))
if e != nil {
fatalIf(probe.NewError(e).Trace(args...), "Unable to get IAM info")
}
if st, e := f.Stat(); e == nil {
sz = st.Size()
}
defer f.Close()
r = f
_, e = zip.NewReader(r.(io.ReaderAt), sz)
fatalIf(probe.NewError(e).Trace(args...), fmt.Sprintf("Unable to read zip file %s", args.Get(1)))
f, e = os.Open(args.Get(1))
fatalIf(probe.NewError(e).Trace(args...), "Unable to get IAM info")
defer f.Close()
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
if err != nil {
fatalIf(err.Trace(aliasedURL), "Unable to initialize admin client.")
return nil
}
iamr, e := client.ImportIAMV2(context.Background(), f)
if e != nil {
f.Seek(0, 0)
e = client.ImportIAM(context.Background(), f)
fatalIf(probe.NewError(e).Trace(aliasedURL), "Unable to import IAM info.")
if !globalJSON {
console.Infof("IAM info imported to %s from %s\n", aliasedURL, args.Get(1))
}
} else {
printMsg(iamImportInfo(iamr))
}
return nil
}
+42
View File
@@ -0,0 +1,42 @@
// Copyright (c) 2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import "github.com/minio/cli"
var adminClusterIAMSubcommands = []cli.Command{
adminClusterIAMImportCmd,
adminClusterIAMExportCmd,
}
var adminClusterIAMCmd = cli.Command{
Name: "iam",
Usage: "manage IAM info on MinIO cluster",
Action: mainadminClusterIAM,
Before: setGlobalsFromContext,
Flags: globalFlags,
Subcommands: adminClusterIAMSubcommands,
HideHelpCommand: true,
}
// mainadminClusterIAM is the handle for "mc admin cluster bucket" command.
func mainadminClusterIAM(ctx *cli.Context) error {
commandNotFound(ctx, adminClusterIAMSubcommands)
return nil
// Sub-commands like "export", "import" have their own main.
}
+42
View File
@@ -0,0 +1,42 @@
// Copyright (c) 2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import "github.com/minio/cli"
var adminClusterSubcommands = []cli.Command{
adminClusterBucketCmd,
adminClusterIAMCmd,
}
var adminClusterCmd = cli.Command{
Name: "cluster",
Usage: "manage MinIO cluster metadata",
Action: mainAdminCluster,
Before: setGlobalsFromContext,
Flags: globalFlags,
Subcommands: adminClusterSubcommands,
HideHelpCommand: true,
}
// mainAdminCluster is the handle for "mc admin cluster" command.
func mainAdminCluster(ctx *cli.Context) error {
commandNotFound(ctx, adminClusterSubcommands)
return nil
// Sub-commands like "bucket", "iam" have their own main.
}
+125
View File
@@ -0,0 +1,125 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"bufio"
"bytes"
"fmt"
"io"
"strings"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminConfigExportCmd = cli.Command{
Name: "export",
Usage: "export all config keys to STDOUT",
Before: setGlobalsFromContext,
Action: mainAdminConfigExport,
OnUsageError: onUsageError,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
The output includes environment variables set on the server. These cannot be overridden from the client.
1. Export the current config from MinIO server
{{.Prompt}} {{.HelpName}} play/ > config.txt
`,
}
// configExportMessage container to hold locks information.
type configExportMessage struct {
Status string `json:"status"`
Value []byte `json:"value"`
}
// String colorized service status message.
func (u configExportMessage) String() string {
console.SetColor("EnvVar", color.New(color.FgYellow))
bio := bufio.NewReader(bytes.NewReader(u.Value))
var lines []string
for {
s, e := bio.ReadString('\n')
// Make lines displaying environment variables bold.
if strings.HasPrefix(s, "# MINIO_") {
s = strings.TrimPrefix(s, "# ")
parts := strings.SplitN(s, "=", 2)
s = fmt.Sprintf("# %s=%s", console.Colorize("EnvVar", parts[0]), parts[1])
lines = append(lines, s)
} else {
lines = append(lines, s)
}
if e == io.EOF {
break
}
fatalIf(probe.NewError(e), "Unable to marshal to string.")
}
return strings.Join(lines, "")
}
// JSON jsonified service status Message message.
func (u configExportMessage) JSON() string {
u.Status = "success"
statusJSONBytes, e := json.MarshalIndent(u, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(statusJSONBytes)
}
// checkAdminConfigExportSyntax - validate all the passed arguments
func checkAdminConfigExportSyntax(ctx *cli.Context) {
if !ctx.Args().Present() || len(ctx.Args()) > 1 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
func mainAdminConfigExport(ctx *cli.Context) error {
checkAdminConfigExportSyntax(ctx)
// Export the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
// Call get config API
buf, e := client.GetConfig(globalContext)
fatalIf(probe.NewError(e), "Unable to get server config")
// Print
printMsg(configExportMessage{
Value: buf,
})
return nil
}
+103 -39
View File
@@ -1,35 +1,44 @@
/*
* Minio Client (C) 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"encoding/json"
"bufio"
"bytes"
"fmt"
"io"
"strings"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminConfigGetCmd = cli.Command{
Name: "get",
Usage: "get config of a minio server/cluster",
Before: setGlobalsFromContext,
Action: mainAdminConfigGet,
Flags: globalFlags,
Name: "get",
Usage: "interactively retrieve a config key parameters",
Before: setGlobalsFromContext,
Action: mainAdminConfigGet,
OnUsageError: onUsageError,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
@@ -40,58 +49,113 @@ FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Get server configuration of a Minio server/cluster.
$ {{.HelpName}} play/
The output includes environment variables set on the server. These cannot be overridden from the client.
1. Get the current region setting on MinIO server.
{{.Prompt}} {{.HelpName}} play/ region
region name=us-east-1
2. Get the current notification settings for Webhook target on MinIO server
{{.Prompt}} {{.HelpName}} myminio/ notify_webhook
notify_webhook endpoint="http://localhost:8080" auth_token= queue_limit=10000 queue_dir="/home/events"
3. Get the current compression settings on MinIO server
{{.Prompt}} {{.HelpName}} myminio/ compression
compression extensions=".txt,.csv" mime_types="text/*"
`,
}
// configGetMessage container to hold locks information.
type configGetMessage struct {
Status string `json:"status"`
Config string `json:"config"`
Status string `json:"status"`
Config []madmin.SubsysConfig `json:"config"`
value []byte
}
// String colorized service status message.
func (u configGetMessage) String() string {
return string(u.Config)
console.SetColor("EnvVar", color.New(color.FgYellow))
bio := bufio.NewReader(bytes.NewReader(u.value))
var lines []string
for {
s, e := bio.ReadString('\n')
// Make lines displaying environment variables bold.
if strings.HasPrefix(s, "# MINIO_") {
s = strings.TrimPrefix(s, "# ")
parts := strings.SplitN(s, "=", 2)
s = fmt.Sprintf("# %s=%s", console.Colorize("EnvVar", parts[0]), parts[1])
lines = append(lines, s)
} else {
lines = append(lines, s)
}
if e == io.EOF {
break
}
fatalIf(probe.NewError(e), "Unable to marshal to string.")
}
return strings.Join(lines, "")
}
// JSON jsonified service status Message message.
func (u configGetMessage) JSON() string {
u.Status = "success"
statusJSONBytes, e := json.MarshalIndent(u, "", "\t")
var err error
u.Config, err = madmin.ParseServerConfigOutput(string(u.value))
fatalIf(probe.NewError(err), "Unable to marshal into JSON.")
statusJSONBytes, e := json.MarshalIndent(u, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
// Remove \n and \t from u.Config which holds the config data
return strings.NewReplacer(`\n`, "", `\t`, "").Replace(string(statusJSONBytes))
return string(statusJSONBytes)
}
// checkAdminConfigGetSyntax - validate all the passed arguments
func checkAdminConfigGetSyntax(ctx *cli.Context) {
if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 {
cli.ShowCommandHelpAndExit(ctx, "get", 1) // last argument is exit code
if !ctx.Args().Present() || len(ctx.Args()) < 1 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
func mainAdminConfigGet(ctx *cli.Context) error {
checkAdminConfigGetSyntax(ctx)
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
// Create a new Minio Admin Client
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Cannot get a configured admin connection.")
fatalIf(err, "Unable to initialize admin connection.")
if len(ctx.Args()) == 1 {
// Call get config API
hr, e := client.HelpConfigKV(globalContext, "", "", false)
fatalIf(probe.NewError(e), "Unable to get help for the sub-system")
// Print
printMsg(configHelpMessage{
Value: hr,
envOnly: false,
})
return nil
}
subSys := strings.Join(args.Tail(), " ")
// Call get config API
c, e := client.GetConfig()
fatalIf(probe.NewError(e), "Cannot get server configuration file.")
buf, e := client.GetConfigKV(globalContext, subSys)
fatalIf(probe.NewError(e), "Unable to get server '%s' config", args.Tail())
// Print
printMsg(configGetMessage{Config: string(c)})
if globalJSON {
printMsg(configGetMessage{
value: buf,
})
} else {
// Print
printMsg(configGetMessage{
value: buf,
})
}
return nil
}
+84
View File
@@ -0,0 +1,84 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"strings"
"text/tabwriter"
"text/template"
"github.com/fatih/color"
json "github.com/minio/colorjson"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
)
// HelpTmpl template used by all sub-systems
const HelpTmpl = `{{if ne .SubSys ""}}{{colorBlueBold "KEY:"}}
{{if .MultipleTargets}}{{colorYellowBold .SubSys}}[:name]{{"\t"}}{{else}}{{colorYellowBold .SubSys}}{{"\t"}}{{end}}{{.Description}}
{{colorBlueBold "ARGS:"}}{{range .KeysHelp}}
{{if .Optional}}{{colorYellowBold .Key}}{{else}}{{colorRedBold .Key}}*{{end}}{{"\t"}}({{.Type}}){{"\t"}}{{.Description}}{{end}}{{else}}{{colorBlueBold "KEYS:"}}{{range .KeysHelp}}
{{colorGreenBold .Key}}{{"\t"}}{{.Description}}{{end}}{{end}}`
var funcMap = template.FuncMap{
"colorBlueBold": color.New(color.FgBlue, color.Bold).SprintfFunc(),
"colorYellowBold": color.New(color.FgYellow, color.Bold).SprintfFunc(),
"colorCyanBold": color.New(color.FgCyan, color.Bold).SprintFunc(),
"colorRedBold": color.New(color.FgRed, color.Bold).SprintfFunc(),
"colorGreenBold": color.New(color.FgGreen, color.Bold).SprintfFunc(),
}
// HelpTemplate - captures config help template
var HelpTemplate = template.Must(template.New("config-help").Funcs(funcMap).Parse(HelpTmpl))
// HelpEnvTemplate - captures config help template
var HelpEnvTemplate = template.Must(template.New("config-help-env").Funcs(funcMap).Parse(HelpTmpl))
// configHelpMessage container to hold locks information.
type configHelpMessage struct {
Status string `json:"status"`
Value madmin.Help `json:"help"`
envOnly bool
}
// String colorized service status message.
func (u configHelpMessage) String() string {
var s strings.Builder
w := tabwriter.NewWriter(&s, 1, 8, 2, ' ', 0)
var e error
if !u.envOnly {
e = HelpTemplate.Execute(w, u.Value)
} else {
e = HelpEnvTemplate.Execute(w, u.Value)
}
fatalIf(probe.NewError(e), "Unable to initialize template writer")
w.Flush()
return s.String()
}
// JSON jsonified service status Message message.
func (u configHelpMessage) JSON() string {
u.Status = "success"
statusJSONBytes, e := json.MarshalIndent(u, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(statusJSONBytes)
}
+156
View File
@@ -0,0 +1,156 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"strings"
"text/tabwriter"
"text/template"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var historyListFlags = []cli.Flag{
cli.IntFlag{
Name: "count, n",
Usage: "list only last 'n' entries",
Value: 10,
},
cli.BoolFlag{
Name: "clear, c",
Usage: "clear all history",
},
}
var adminConfigHistoryCmd = cli.Command{
Name: "history",
Usage: "show all historic configuration changes",
Before: setGlobalsFromContext,
Action: mainAdminConfigHistory,
OnUsageError: onUsageError,
Flags: append(append([]cli.Flag{}, globalFlags...), historyListFlags...),
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. List all history entries sorted by time.
{{.Prompt}} {{.HelpName}} play/
`,
}
// History template used by all sub-systems
const History = `{{range .}}{{colorYellowBold "RestoreId:"}} {{colorYellowBold .RestoreID}}
Date: {{.CreateTime}}
{{.Targets}}
{{end}}`
// HistoryTemplate - captures history list template
var HistoryTemplate = template.Must(template.New("history-list").Funcs(funcMap).Parse(History))
type historyEntry struct {
RestoreID string `json:"restoreId"`
CreateTime string `json:"createTime"`
Targets string `json:"targets"`
}
// configHistoryMessage container to hold locks information.
type configHistoryMessage struct {
Status string `json:"status"`
Entries []historyEntry `json:"entries"`
}
// String colorized service status message.
func (u configHistoryMessage) String() string {
var s strings.Builder
w := tabwriter.NewWriter(&s, 1, 8, 2, ' ', 0)
e := HistoryTemplate.Execute(w, u.Entries)
fatalIf(probe.NewError(e), "Unable to initialize template writer")
w.Flush()
return s.String()
}
// JSON jsonified service status Message message.
func (u configHistoryMessage) JSON() string {
u.Status = "success"
statusJSONBytes, e := json.MarshalIndent(u, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(statusJSONBytes)
}
// checkAdminConfigHistorySyntax - validate all the passed arguments
func checkAdminConfigHistorySyntax(ctx *cli.Context) {
if !ctx.Args().Present() || len(ctx.Args()) > 1 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
func mainAdminConfigHistory(ctx *cli.Context) error {
checkAdminConfigHistorySyntax(ctx)
console.SetColor("ConfigHistoryMessageRestoreID", color.New(color.Bold))
console.SetColor("ConfigHistoryMessageTime", color.New(color.FgGreen))
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
if ctx.Bool("clear") {
fatalIf(probe.NewError(client.ClearConfigHistoryKV(globalContext, "all")), "Unable to clear server configuration.")
// Print
printMsg(configHistoryMessage{})
return nil
}
chEntries, e := client.ListConfigHistoryKV(globalContext, ctx.Int("count"))
fatalIf(probe.NewError(e), "Unable to list server history configuration.")
hentries := make([]historyEntry, len(chEntries))
for i, chEntry := range chEntries {
hentries[i] = historyEntry{
RestoreID: chEntry.RestoreID,
CreateTime: chEntry.CreateTimeFormatted(),
}
hentries[i].Targets = chEntry.Data
}
// Print
printMsg(configHistoryMessage{
Entries: hentries,
})
return nil
}
+108
View File
@@ -0,0 +1,108 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"fmt"
"os"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminConfigImportCmd = cli.Command{
Name: "import",
Usage: "import multiple config keys from STDIN",
Before: setGlobalsFromContext,
Action: mainAdminConfigImport,
OnUsageError: onUsageError,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Import the new local config and apply to the MinIO server
{{.Prompt}} {{.HelpName}} play/ < config.txt
`,
}
// configImportMessage container to hold locks information.
type configImportMessage struct {
Status string `json:"status"`
targetAlias string
}
// String colorized service status message.
func (u configImportMessage) String() (msg string) {
msg += console.Colorize("SetConfigSuccess",
"Setting new key has been successful.\n")
suggestion := fmt.Sprintf("mc admin service restart %s", u.targetAlias)
msg += console.Colorize("SetConfigSuccess",
fmt.Sprintf("Please restart your server with `%s`.\n", suggestion))
return msg
}
// JSON jsonified service status Message message.
func (u configImportMessage) JSON() string {
u.Status = "success"
statusJSONBytes, e := json.MarshalIndent(u, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(statusJSONBytes)
}
// checkAdminConfigImportSyntax - validate all the passed arguments
func checkAdminConfigImportSyntax(ctx *cli.Context) {
if !ctx.Args().Present() || len(ctx.Args()) > 1 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
func mainAdminConfigImport(ctx *cli.Context) error {
checkAdminConfigImportSyntax(ctx)
// Set color preference of command outputs
console.SetColor("SetConfigSuccess", color.New(color.FgGreen, color.Bold))
// Import the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
// Call set config API
fatalIf(probe.NewError(client.SetConfig(globalContext, os.Stdin)), "Unable to set server config")
// Print
printMsg(configImportMessage{
targetAlias: aliasedURL,
})
return nil
}
+152
View File
@@ -0,0 +1,152 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"fmt"
"strings"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminConfigEnvFlags = []cli.Flag{
cli.BoolFlag{
Name: "env",
Usage: "list all the env only help",
},
}
var adminConfigResetCmd = cli.Command{
Name: "reset",
Usage: "interactively reset a config key parameters",
Before: setGlobalsFromContext,
Action: mainAdminConfigReset,
OnUsageError: onUsageError,
Flags: append(adminConfigEnvFlags, globalFlags...),
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET [CONFIG-KEY...]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Reset MQTT notifcation target 'name1' settings to default values.
{{.Prompt}} {{.HelpName}} myminio/ notify_mqtt:name1
2. Reset compression's 'extensions' setting to default value.
{{.Prompt}} {{.HelpName}} myminio/ compression extensions
3. Reset site name and site region to default values.
{{.Prompt}} {{.HelpName}} myminio/ site name region
`,
}
// configResetMessage container to hold locks information.
type configResetMessage struct {
Status string `json:"status"`
targetAlias string
key string
restart bool
}
// String colorized service status message.
func (u configResetMessage) String() (msg string) {
msg += console.Colorize("ResetConfigSuccess",
fmt.Sprintf("'%s' is successfully reset.", u.key))
if u.restart {
suggestion := fmt.Sprintf("mc admin service restart %s", u.targetAlias)
msg += console.Colorize("ResetConfigSuccess",
fmt.Sprintf("\nPlease restart your server with `%s`.", suggestion))
}
return
}
// JSON jsonified service status message.
func (u configResetMessage) JSON() string {
u.Status = "success"
statusJSONBytes, e := json.MarshalIndent(u, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(statusJSONBytes)
}
// checkAdminConfigResetSyntax - validate all the passed arguments
func checkAdminConfigResetSyntax(ctx *cli.Context) {
if !ctx.Args().Present() {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
// main config set function
func mainAdminConfigReset(ctx *cli.Context) error {
// Check command arguments
checkAdminConfigResetSyntax(ctx)
// Reset color preference of command outputs
console.SetColor("ResetConfigSuccess", color.New(color.FgGreen, color.Bold))
console.SetColor("ResetConfigFailure", color.New(color.FgRed, color.Bold))
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
if len(ctx.Args()) == 1 {
// Call get config API
hr, e := client.HelpConfigKV(globalContext, "", "", ctx.Bool("env"))
fatalIf(probe.NewError(e), "Unable to get help for the sub-system")
// Print
printMsg(configHelpMessage{
Value: hr,
envOnly: ctx.Bool("env"),
})
return nil
}
input := strings.Join(args.Tail(), " ")
// Check if user has attempted to set values
for _, k := range args.Tail() {
if strings.Contains(k, "=") {
e := fmt.Errorf("new settings may not be provided for sub-system keys")
fatalIf(probe.NewError(e), "Unable to reset '%s' on the server", args.Tail()[0])
}
}
// Call reset config API
restart, e := client.DelConfigKV(globalContext, input)
fatalIf(probe.NewError(e), "Unable to reset '%s' on the server", input)
// Print set config result
printMsg(configResetMessage{
targetAlias: aliasedURL,
restart: restart,
key: input,
})
return nil
}
+107
View File
@@ -0,0 +1,107 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"fmt"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminConfigRestoreCmd = cli.Command{
Name: "restore",
Usage: "rollback back changes to a specific config history",
Before: setGlobalsFromContext,
Action: mainAdminConfigRestore,
OnUsageError: onUsageError,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET RESTOREID
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Restore 'restore-id' history key value on MinIO server.
{{.Prompt}} {{.HelpName}} play/ <restore-id>
`,
}
// configRestoreMessage container to hold locks information.
type configRestoreMessage struct {
Status string `json:"status"`
RestoreID string `json:"restoreID"`
targetAlias string
}
// String colorized service status message.
func (u configRestoreMessage) String() (msg string) {
suggestion := fmt.Sprintf("mc admin service restart %s", u.targetAlias)
msg += console.Colorize("ConfigRestoreMessage",
fmt.Sprintf("Please restart your server with `%s`.\n", suggestion))
msg += console.Colorize("ConfigRestoreMessage", "Restored "+u.RestoreID+" kv successfully.")
return msg
}
// JSON jsonified service status Message message.
func (u configRestoreMessage) JSON() string {
u.Status = "success"
statusJSONBytes, e := json.MarshalIndent(u, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(statusJSONBytes)
}
// checkAdminConfigRestoreSyntax - validate all the passed arguments
func checkAdminConfigRestoreSyntax(ctx *cli.Context) {
if !ctx.Args().Present() || len(ctx.Args()) > 2 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
func mainAdminConfigRestore(ctx *cli.Context) error {
checkAdminConfigRestoreSyntax(ctx)
console.SetColor("ConfigRestoreMessage", color.New(color.FgGreen))
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
// Call get config API
fatalIf(probe.NewError(client.RestoreConfigHistoryKV(globalContext, args.Get(1))), "Unable to restore server configuration.")
// Print
printMsg(configRestoreMessage{
RestoreID: args.Get(1),
targetAlias: aliasedURL,
})
return nil
}
+71 -51
View File
@@ -1,37 +1,41 @@
/*
* Minio Client (C) 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"encoding/json"
"os"
"fmt"
"strings"
"github.com/fatih/color"
"github.com/minio/cli"
"github.com/minio/mc/pkg/console"
json "github.com/minio/colorjson"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminConfigSetCmd = cli.Command{
Name: "set",
Usage: "set new config file to a minio server/cluster.",
Before: setGlobalsFromContext,
Action: mainAdminConfigSet,
Flags: globalFlags,
Name: "set",
Usage: "interactively set a config key parameters",
Before: setGlobalsFromContext,
Action: mainAdminConfigSet,
OnUsageError: onUsageError,
Flags: append(adminConfigEnvFlags, globalFlags...),
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
@@ -42,41 +46,40 @@ FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Set server configuration of a Minio server/cluster.
$ cat myconfig | {{.HelpName}} myminio/
1. Enable webhook notification target for MinIO server.
{{.Prompt}} {{.HelpName}} myminio/ notify_webhook endpoint="http://localhost:8080/minio/events"
2. Change region name for the MinIO server to 'us-west-1'.
{{.Prompt}} {{.HelpName}} myminio/ region name=us-west-1
3. Change healing settings on a distributed MinIO server setup.
{{.Prompt}} {{.HelpName}} mydist/ heal max_delay=300ms max_io=50
`,
}
// configSetMessage container to hold locks information.
type configSetMessage struct {
Status string `json:"status"`
setConfigStatus bool
Status string `json:"status"`
targetAlias string
restart bool
}
// String colorized service status message.
func (u configSetMessage) String() (msg string) {
// Print the general set config status
if u.setConfigStatus {
msg += console.Colorize("SetConfigSuccess",
"Successfully applied new settings.")
if u.restart {
suggestion := color.RedString("mc admin service restart %s", u.targetAlias)
msg += console.Colorize("SetConfigSuccess",
"Setting new Minio configuration file has been successful.\n")
msg += console.Colorize("SetConfigSuccess",
"Please restart your server with `mc admin service restart`.\n")
} else {
msg += console.Colorize("SetConfigFailure",
"Setting new Minio configuration file has failed.\n")
fmt.Sprintf("\nPlease restart your server '%s'.", suggestion))
}
return
}
// JSON jsonified service status Message message.
// JSON jsonified service status message.
func (u configSetMessage) JSON() string {
if u.setConfigStatus {
u.Status = "success"
} else {
u.Status = "error"
}
statusJSONBytes, e := json.Marshal(u)
u.Status = "success"
statusJSONBytes, e := json.MarshalIndent(u, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(statusJSONBytes)
@@ -84,35 +87,52 @@ func (u configSetMessage) JSON() string {
// checkAdminConfigSetSyntax - validate all the passed arguments
func checkAdminConfigSetSyntax(ctx *cli.Context) {
if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 {
cli.ShowCommandHelpAndExit(ctx, "set", 1) // last argument is exit code
if !ctx.Args().Present() && len(ctx.Args()) < 1 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
// main config set function
func mainAdminConfigSet(ctx *cli.Context) error {
// Check command arguments
checkAdminConfigSetSyntax(ctx)
// Set color preference of command outputs
console.SetColor("SetConfigSuccess", color.New(color.FgGreen, color.Bold))
console.SetColor("SetConfigFailure", color.New(color.FgRed, color.Bold))
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
// Create a new Minio Admin Client
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Cannot get a configured admin connection.")
fatalIf(err, "Unable to initialize admin connection.")
// Call get config API
fatalIf(probe.NewError(client.SetConfig(os.Stdin)), "Cannot set server configuration file.")
input := strings.Join(args.Tail(), " ")
if !strings.Contains(input, madmin.KvSeparator) {
// Call get config API
hr, e := client.HelpConfigKV(globalContext, args.Get(1), args.Get(2), ctx.Bool("env"))
fatalIf(probe.NewError(e), "Unable to get help for the sub-system")
// Print
printMsg(configHelpMessage{
Value: hr,
envOnly: ctx.Bool("env"),
})
return nil
}
// Call set config API
restart, e := client.SetConfigKV(globalContext, input)
fatalIf(probe.NewError(e), "Unable to set '%s' to server", input)
// Print set config result
printMsg(configSetMessage{
setConfigStatus: true,
targetAlias: aliasedURL,
restart: restart,
})
return nil
+33 -25
View File
@@ -1,39 +1,47 @@
/*
* Minio Client (C) 2017, 2018 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import "github.com/minio/cli"
var adminConfigSubcommands = []cli.Command{
adminConfigGetCmd,
adminConfigSetCmd,
adminConfigResetCmd,
adminConfigHistoryCmd,
adminConfigRestoreCmd,
adminConfigExportCmd,
adminConfigImportCmd,
}
var adminConfigCmd = cli.Command{
Name: "config",
Usage: "manage configuration file",
Action: mainAdminConfig,
Before: setGlobalsFromContext,
Flags: globalFlags,
Subcommands: []cli.Command{
adminConfigGetCmd,
adminConfigSetCmd,
},
Name: "config",
Usage: "manage MinIO server configuration",
Action: mainAdminConfig,
Before: setGlobalsFromContext,
Flags: globalFlags,
Subcommands: adminConfigSubcommands,
HideHelpCommand: true,
}
// mainAdminConfig is the handle for "mc admin config" command.
func mainAdminConfig(ctx *cli.Context) error {
cli.ShowCommandHelp(ctx, ctx.Args().First())
commandNotFound(ctx, adminConfigSubcommands)
return nil
// Sub-commands like "get", "set" have their own main.
}
+71
View File
@@ -0,0 +1,71 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"fmt"
"strings"
"github.com/minio/cli"
)
var adminConsoleFlags = []cli.Flag{
cli.IntFlag{
Name: "limit, l",
Usage: "show last n log entries",
Value: 10,
},
cli.StringFlag{
Name: "type, t",
Usage: "list error logs by type. Valid options are '[minio, application, all]'",
Value: "all",
},
}
var adminConsoleCmd = cli.Command{
Name: "console",
Usage: "show MinIO logs",
Action: mainAdminConsole,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: append(adminConsoleFlags, globalFlags...),
Hidden: true,
HideHelpCommand: true,
CustomHelpTemplate: "This command is not supported now and replaced by 'admin logs' command. Please use 'mc admin logs'.\n",
}
// mainAdminConsole - the entry function of console command
func mainAdminConsole(ctx *cli.Context) error {
newCmd := []string{"mc admin logs"}
var flgStr string
if ctx.IsSet("limit") {
flgStr = fmt.Sprintf("%s %d", "--last", ctx.Int("limit"))
newCmd = append(newCmd, flgStr)
}
if ctx.IsSet("type") {
flgStr = fmt.Sprintf("%s %s", "--type", strings.ToLower(ctx.String("type")))
newCmd = append(newCmd, flgStr)
}
newCmd = append(newCmd, ctx.Args()...)
deprecatedError(strings.Join(newCmd, " "))
return nil
}
-81
View File
@@ -1,81 +0,0 @@
/*
* Minio Client (C) 2016, 2017, 2018 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cmd
import (
"github.com/minio/cli"
"github.com/minio/mc/pkg/probe"
)
var (
adminCredsFlags = []cli.Flag{}
)
const credsCmdName = "credential"
var adminCredsCmd = cli.Command{
Name: credsCmdName,
Usage: "change admin server access and secret keys",
Action: mainAdminCreds,
Flags: append(adminCredsFlags, globalFlags...),
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET ACCESSKEY SECRETKEY
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Set new **admin** credential of a Minio server represented by its alias 'alias'.
$ {{.HelpName}} alias/ minio minio123
`,
}
// checkAdminCredsSyntax - validate all the passed arguments
func checkAdminCredsSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 3 {
cli.ShowCommandHelpAndExit(ctx, credsCmdName, 1) // last argument is exit code
}
}
func mainAdminCreds(ctx *cli.Context) error {
setGlobalsFromContext(ctx)
checkAdminCredsSyntax(ctx)
// Get the alias parameter from cli
args := ctx.Args()
// TODO: if accessKey and secretKey are not supplied we should
// display the existing credential. This needs GetCredential
// support from Minio server.
aliasedURL := args.First()
accessKey, secretKey := args.Get(1), args.Get(2)
// Create a new Minio Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Cannot get a configured admin connection.")
// Change the credential of the specified Minio server
e := client.SetAdminCredentials(accessKey, secretKey)
fatalIf(probe.NewError(e), "Unable to set new credential to '"+aliasedURL+"'.")
return nil
}
+139
View File
@@ -0,0 +1,139 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"path/filepath"
humanize "github.com/dustin/go-humanize"
"github.com/fatih/color"
"github.com/minio/cli"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminDecommissionCancelCmd = cli.Command{
Name: "cancel",
Usage: "cancel an ongoing decommissioning of a pool",
Action: mainAdminDecommissionCancel,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Cancel an ongoing decommissioning of a pool.
{{.Prompt}} {{.HelpName}} myminio/ http://server{5...8}/disk{1...4}
2. Cancel all ongoing decommissioning of pools.
{{.Prompt}} {{.HelpName}} myminio/
`,
}
// checkAdminDecommissionCancelSyntax - validate all the passed arguments
func checkAdminDecommissionCancelSyntax(ctx *cli.Context) {
if len(ctx.Args()) > 2 || len(ctx.Args()) == 0 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
// mainAdminDecommissionCancel is the handle for "mc admin decommission cancel" command.
func mainAdminDecommissionCancel(ctx *cli.Context) error {
checkAdminDecommissionCancelSyntax(ctx)
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
aliasedURL = filepath.Clean(aliasedURL)
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
if pool := args.Get(1); pool != "" {
e := client.CancelDecommissionPool(globalContext, pool)
fatalIf(probe.NewError(e).Trace(args...), "Unable to cancel decommissioning, please try again")
return nil
}
poolStatuses, e := client.ListPoolsStatus(globalContext)
fatalIf(probe.NewError(e).Trace(args...), "Unable to get status for all pools")
var newPoolStatuses []madmin.PoolStatus
for _, pool := range poolStatuses {
if pool.Decommission != nil {
if pool.Decommission.StartTime.IsZero() {
continue
}
if pool.Decommission.Complete {
continue
}
}
newPoolStatuses = append(newPoolStatuses, pool)
}
dspOrder := []col{colGreen} // Header
for i := 0; i < len(newPoolStatuses); i++ {
dspOrder = append(dspOrder, colGrey)
}
var printColors []*color.Color
for _, c := range dspOrder {
printColors = append(printColors, getPrintCol(c))
}
tbl := console.NewTable(printColors, []bool{false, false, false, false}, 0)
cellText := make([][]string, len(newPoolStatuses)+1)
cellText[0] = []string{
"ID",
"Pools",
"Capacity",
"Status",
}
for idx, pool := range poolStatuses {
idx++
totalSize := uint64(pool.Decommission.TotalSize)
currentSize := uint64(pool.Decommission.CurrentSize)
capacity := humanize.IBytes(totalSize-currentSize) + " (used) / " + humanize.IBytes(totalSize) + " (total)"
status := ""
if pool.Decommission != nil {
if pool.Decommission.StartTime.IsZero() {
continue
}
if pool.Decommission.Complete {
continue
}
status = "Draining"
}
cellText[idx] = []string{
humanize.Ordinal(pool.ID + 1),
pool.CmdLine,
capacity,
status,
}
}
return tbl.DisplayTable(cellText)
}
+102
View File
@@ -0,0 +1,102 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"path/filepath"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminDecommissionStartCmd = cli.Command{
Name: "start",
Usage: "start decommissioning a pool",
Action: mainAdminDecommissionStart,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Start decommissioning a pool for removal.
{{.Prompt}} {{.HelpName}} myminio/ http://server{5...8}/disk{1...4}
`,
}
// checkAdminDecommissionStartSyntax - validate all the passed arguments
func checkAdminDecommissionStartSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
// startDecomMessage is container for make bucket success and failure messages.
type startDecomMessage struct {
Status string `json:"status"`
Pool string `json:"pool"`
}
// String colorized construct a string message.
func (s startDecomMessage) String() string {
return console.Colorize("DecomPool", "Decommission started successfully for `"+s.Pool+"`.")
}
// JSON jsonified decom message.
func (s startDecomMessage) JSON() string {
startDecomBytes, e := json.MarshalIndent(s, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(startDecomBytes)
}
// mainAdminDecommissionStart is the handle for "mc admin decommission start" command.
func mainAdminDecommissionStart(ctx *cli.Context) error {
checkAdminDecommissionStartSyntax(ctx)
// Additional command speific theme customization.
console.SetColor("DecomPool", color.New(color.FgGreen, color.Bold))
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
aliasedURL = filepath.Clean(aliasedURL)
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
e := client.DecommissionPool(globalContext, args.Get(1))
fatalIf(probe.NewError(e).Trace(args...), "Unable to start decommission on the specified pool")
printMsg(startDecomMessage{
Status: "success",
Pool: args.Get(1),
})
return nil
}
+175
View File
@@ -0,0 +1,175 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"fmt"
"path/filepath"
"time"
"github.com/dustin/go-humanize"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminDecommissionStatusCmd = cli.Command{
Name: "status",
Usage: "show current decommissioning status",
Action: mainAdminDecommissionStatus,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Show current decommissioning status.
{{.Prompt}} {{.HelpName}} myminio/ http://server{5...8}/disk{1...4}
2. List all current decommissioning status of all pools.
{{.Prompt}} {{.HelpName}} myminio/
`,
}
// checkAdminDecommissionStatusSyntax - validate all the passed arguments
func checkAdminDecommissionStatusSyntax(ctx *cli.Context) {
if len(ctx.Args()) > 2 || len(ctx.Args()) == 0 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
// mainAdminDecommissionStatus is the handle for "mc admin decomission status" command.
func mainAdminDecommissionStatus(ctx *cli.Context) error {
checkAdminDecommissionStatusSyntax(ctx)
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
aliasedURL = filepath.Clean(aliasedURL)
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
if pool := args.Get(1); pool != "" {
poolStatus, e := client.StatusPool(globalContext, pool)
fatalIf(probe.NewError(e).Trace(args...), "Unable to get status per pool")
if globalJSON {
statusJSONBytes, e := json.MarshalIndent(poolStatus, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
console.Println(string(statusJSONBytes))
return nil
}
var msg string
if poolStatus.Decommission.Complete {
msg = color.GreenString(fmt.Sprintf("Decommission of pool %s is complete, you may now remove it from server command line", poolStatus.CmdLine))
} else if poolStatus.Decommission.Failed {
msg = color.GreenString(fmt.Sprintf("Decommission of pool %s failed, please retry again", poolStatus.CmdLine))
} else if poolStatus.Decommission.Canceled {
msg = color.GreenString(fmt.Sprintf("Decommission of pool %s was canceled, you may start again", poolStatus.CmdLine))
} else if !poolStatus.Decommission.StartTime.IsZero() {
usedStart := (poolStatus.Decommission.TotalSize - poolStatus.Decommission.StartSize)
usedCurrent := (poolStatus.Decommission.TotalSize - poolStatus.Decommission.CurrentSize)
duration := float64(time.Since(poolStatus.Decommission.StartTime)) / float64(time.Second)
if usedStart > usedCurrent && duration > 10 {
copied := uint64(usedStart - usedCurrent)
speed := uint64(float64(copied) / duration)
msg = "Decommissioning rate at " + humanize.IBytes(speed) + "/sec " + "[" + humanize.IBytes(
uint64(usedCurrent)) + "/" + humanize.IBytes(uint64(poolStatus.Decommission.TotalSize)) + "]"
msg += "\nStarted: " + humanize.RelTime(time.Now().UTC(), poolStatus.Decommission.StartTime, "", "ago")
} else {
msg = "Decommissioning is starting..."
}
msg = color.GreenString(msg)
} else {
errorIf(errDummy().Trace(args...), "This pool is currently not scheduled for decomissioning")
return nil
}
fmt.Println(msg)
return nil
}
poolStatuses, e := client.ListPoolsStatus(globalContext)
fatalIf(probe.NewError(e).Trace(args...), "Unable to get status for all pools")
if globalJSON {
statusJSONBytes, e := json.MarshalIndent(poolStatuses, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
console.Println(string(statusJSONBytes))
return nil
}
dspOrder := []col{colGreen} // Header
for range poolStatuses {
dspOrder = append(dspOrder, colGrey)
}
var printColors []*color.Color
for _, c := range dspOrder {
printColors = append(printColors, getPrintCol(c))
}
tbl := console.NewTable(printColors, []bool{false, false, false, false}, 0)
cellText := make([][]string, len(poolStatuses)+1)
cellText[0] = []string{
"ID",
"Pools",
"Drives Usage",
"Status",
}
for idx, pool := range poolStatuses {
idx++
totalSize := uint64(pool.Decommission.TotalSize)
usedCurrent := uint64(pool.Decommission.TotalSize - pool.Decommission.CurrentSize)
var capacity string
if totalSize == 0 {
capacity = "0% (total: 0B)"
} else {
capacity = fmt.Sprintf("%.1f%% (total: %s)", 100*float64(usedCurrent)/float64(totalSize), humanize.IBytes(totalSize))
}
status := "Active"
if pool.Decommission != nil {
if pool.Decommission.Complete {
status = "Complete"
} else if pool.Decommission.Failed {
status = "Draining(Failed)"
} else if pool.Decommission.Canceled {
status = "Draining(Canceled)"
} else if !pool.Decommission.StartTime.IsZero() {
status = "Draining"
}
}
cellText[idx] = []string{
humanize.Ordinal(pool.ID + 1),
pool.CmdLine,
capacity,
status,
}
}
return tbl.DisplayTable(cellText)
}
+46
View File
@@ -0,0 +1,46 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/minio/cli"
)
var adminDecommissionSubcommands = []cli.Command{
adminDecommissionStartCmd,
adminDecommissionStatusCmd,
adminDecommissionCancelCmd,
}
var adminDecommissionCmd = cli.Command{
Name: "decommission",
Aliases: []string{"decom"},
Usage: "manage MinIO server pool decommissioning",
Action: mainAdminDecommission,
Before: setGlobalsFromContext,
Flags: globalFlags,
Subcommands: adminDecommissionSubcommands,
HideHelpCommand: true,
}
// mainAdminDecommission is the handle for "mc admin decommission" command.
func mainAdminDecommission(ctx *cli.Context) error {
commandNotFound(ctx, adminDecommissionSubcommands)
return nil
// Sub-commands like "get", "set" have their own main.
}
+149
View File
@@ -0,0 +1,149 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"fmt"
"strings"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminGroupAddCmd = cli.Command{
Name: "add",
Usage: "add users to a new or existing group",
Action: mainAdminGroupAdd,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET GROUPNAME MEMBERS...
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Add users 'fivecent' and 'tencent' to the group 'allcents':
{{.Prompt}} {{.HelpName}} myminio allcents fivecent tencent
2. Add user "james" to group "staff", then add the "readwrite" policy to the group "staff".
{{.Prompt}} {{.HelpName}} myminio staff james
{{.Prompt}} mc admin policy attach myminio readwrite --group staff
`,
}
// checkAdminGroupAddSyntax - validate all the passed arguments
func checkAdminGroupAddSyntax(ctx *cli.Context) {
if len(ctx.Args()) < 3 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
// groupMessage container for content message structure
type groupMessage struct {
op string
Status string `json:"status"`
GroupName string `json:"groupName,omitempty"`
Groups []string `json:"groups,omitempty"`
Members []string `json:"members,omitempty"`
GroupStatus string `json:"groupStatus,omitempty"`
GroupPolicy string `json:"groupPolicy,omitempty"`
}
func (u groupMessage) String() string {
switch u.op {
case "list":
var s []string
for _, g := range u.Groups {
s = append(s, console.Colorize("GroupMessage", g))
}
return strings.Join(s, "\n")
case "disable":
return console.Colorize("GroupMessage", "Disabled group `"+u.GroupName+"` successfully.")
case "enable":
return console.Colorize("GroupMessage", "Enabled group `"+u.GroupName+"` successfully.")
case "add":
membersStr := fmt.Sprintf("`%s`", strings.Join(u.Members, ","))
return console.Colorize("GroupMessage", "Added members "+membersStr+" to group `"+u.GroupName+"` successfully.")
case "remove":
if len(u.Members) > 0 {
membersStr := fmt.Sprintf("{%s}", strings.Join(u.Members, ","))
return console.Colorize("GroupMessage", "Removed members "+membersStr+" from group "+u.GroupName+" successfully.")
}
return console.Colorize("GroupMessage", "Removed group "+u.GroupName+" successfully.")
case "info":
return strings.Join([]string{
console.Colorize("GroupMessage", "Group: "+u.GroupName),
console.Colorize("GroupMessage", "Status: "+u.GroupStatus),
console.Colorize("GroupMessage", "Policy: "+u.GroupPolicy),
console.Colorize("GroupMessage", "Members: "+strings.Join(u.Members, ",")),
}, "\n")
}
return ""
}
func (u groupMessage) JSON() string {
u.Status = "success"
jsonMessageBytes, e := json.MarshalIndent(u, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(jsonMessageBytes)
}
// mainAdminGroupAdd is the handle for "mc admin group add" command.
func mainAdminGroupAdd(ctx *cli.Context) error {
checkAdminGroupAddSyntax(ctx)
console.SetColor("GroupMessage", color.New(color.FgGreen))
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
members := []string{}
for i := 2; i < ctx.NArg(); i++ {
members = append(members, args.Get(i))
}
gAddRemove := madmin.GroupAddRemove{
Group: args.Get(1),
Members: members,
IsRemove: false,
}
fatalIf(probe.NewError(client.UpdateGroupMembers(globalContext, gAddRemove)).Trace(args...), "Unable to add new group")
printMsg(groupMessage{
op: ctx.Command.Name,
GroupName: args.Get(1),
Members: members,
})
return nil
}
+44
View File
@@ -0,0 +1,44 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/minio/cli"
)
var adminGroupDisableCmd = cli.Command{
Name: "disable",
Usage: "disable a group",
Action: mainAdminGroupEnableDisable,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET GROUPNAME
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Disable group 'allcents'.
{{.Prompt}} {{.HelpName}} myminio allcents
`,
}
+91
View File
@@ -0,0 +1,91 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/fatih/color"
"github.com/minio/cli"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminGroupEnableCmd = cli.Command{
Name: "enable",
Usage: "enable a group",
Action: mainAdminGroupEnableDisable,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET GROUPNAME
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Enable group 'allcents'.
{{.Prompt}} {{.HelpName}} myminio allcents
`,
}
// checkAdminGroupEnableSyntax - validate all the passed arguments
func checkAdminGroupEnableSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
// mainAdminGroupEnableDisable is the handle for "mc admin group enable|disable" command.
func mainAdminGroupEnableDisable(ctx *cli.Context) error {
checkAdminGroupEnableSyntax(ctx)
console.SetColor("GroupMessage", color.New(color.FgGreen))
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
group := args.Get(1)
var status madmin.GroupStatus
switch ctx.Command.Name {
case "enable":
status = madmin.GroupEnabled
case "disable":
status = madmin.GroupDisabled
default:
fatalIf(errInvalidArgument().Trace(ctx.Command.Name), "Invalid group status name")
}
e := client.SetGroupStatus(globalContext, group, status)
fatalIf(probe.NewError(e).Trace(args...), "Unable set group status")
printMsg(groupMessage{
op: ctx.Command.Name,
GroupName: group,
GroupStatus: string(status),
})
return nil
}
+83
View File
@@ -0,0 +1,83 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/fatih/color"
"github.com/minio/cli"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminGroupInfoCmd = cli.Command{
Name: "info",
Usage: "display group info",
Action: mainAdminGroupInfo,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET GROUPNAME
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Get info on group 'allcents'.
{{.Prompt}} {{.HelpName}} myminio allcents
`,
}
// checkAdminGroupInfoSyntax - validate all the passed arguments
func checkAdminGroupInfoSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
// mainAdminGroupInfo is the handle for "mc admin group info" command.
func mainAdminGroupInfo(ctx *cli.Context) error {
checkAdminGroupInfoSyntax(ctx)
console.SetColor("GroupMessage", color.New(color.FgGreen))
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
group := args.Get(1)
gd, e := client.GetGroupDescription(globalContext, group)
fatalIf(probe.NewError(e).Trace(args...), "Unable to fetch group info")
printMsg(groupMessage{
op: ctx.Command.Name,
GroupName: group,
GroupStatus: gd.Status,
GroupPolicy: gd.Policy,
Members: gd.Members,
})
return nil
}
+80
View File
@@ -0,0 +1,80 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/fatih/color"
"github.com/minio/cli"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminGroupListCmd = cli.Command{
Name: "list",
ShortName: "ls",
Usage: "display list of groups",
Action: mainAdminGroupList,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. List all groups.
{{.Prompt}} {{.HelpName}} myminio
`,
}
// checkAdminGroupListSyntax - validate all the passed arguments
func checkAdminGroupListSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
// mainAdminGroupList is the handle for "mc admin group list" command.
func mainAdminGroupList(ctx *cli.Context) error {
checkAdminGroupListSyntax(ctx)
console.SetColor("GroupMessage", color.New(color.FgGreen))
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
gs, e := client.ListGroups(globalContext)
fatalIf(probe.NewError(e).Trace(args...), "Unable to list groups")
printMsg(groupMessage{
op: ctx.Command.Name,
Groups: gs,
})
return nil
}
+95
View File
@@ -0,0 +1,95 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/fatih/color"
"github.com/minio/cli"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminGroupRemoveCmd = cli.Command{
Name: "remove",
ShortName: "rm",
Usage: "remove group or members from a group",
Action: mainAdminGroupRemove,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET GROUPNAME [USERNAMES...]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Remove members 'tencent' and 'fivecent' from group 'allcents'.
{{.Prompt}} {{.HelpName}} myminio allcents tencent fivecent
2. Remove group 'allcents'.
{{.Prompt}} {{.HelpName}} myminio allcents
`,
}
// checkAdminGroupRemoveSyntax - validate all the passed arguments
func checkAdminGroupRemoveSyntax(ctx *cli.Context) {
if len(ctx.Args()) < 2 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
// mainAdminGroupRemove is the handle for "mc admin group remove" command.
func mainAdminGroupRemove(ctx *cli.Context) error {
checkAdminGroupRemoveSyntax(ctx)
console.SetColor("GroupMessage", color.New(color.FgGreen))
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
members := []string{}
for i := 2; i < ctx.NArg(); i++ {
members = append(members, args.Get(i))
}
gAddRemove := madmin.GroupAddRemove{
Group: args.Get(1),
Members: members,
IsRemove: true,
}
e := client.UpdateGroupMembers(globalContext, gAddRemove)
fatalIf(probe.NewError(e).Trace(args...), "Could not perform remove operation")
printMsg(groupMessage{
op: ctx.Command.Name,
GroupName: args.Get(1),
Members: members,
})
return nil
}
+46
View File
@@ -0,0 +1,46 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import "github.com/minio/cli"
var adminGroupSubcommands = []cli.Command{
adminGroupAddCmd,
adminGroupRemoveCmd,
adminGroupInfoCmd,
adminGroupListCmd,
adminGroupEnableCmd,
adminGroupDisableCmd,
}
var adminGroupCmd = cli.Command{
Name: "group",
Usage: "manage groups",
Action: mainAdminGroup,
Before: setGlobalsFromContext,
Flags: globalFlags,
Subcommands: adminGroupSubcommands,
HideHelpCommand: true,
}
// mainAdminGroup is the handle for "mc admin config" command.
func mainAdminGroup(ctx *cli.Context) error {
commandNotFound(ctx, adminGroupSubcommands)
return nil
// Sub-commands like "get", "set" have their own main.
}
+75 -19
View File
@@ -1,25 +1,27 @@
/*
* Minio Client (C) 2018 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"errors"
"fmt"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/madmin-go/v3"
)
type hri struct {
@@ -42,11 +44,56 @@ func (h hri) getObjectHCCChange() (b, a col, err error) {
b, err = getHColCode(surplusShardsBeforeHeal, parityShards)
if err != nil {
err = fmt.Errorf("%w: surplusShardsBeforeHeal: %d, parityShards: %d",
err, surplusShardsBeforeHeal, parityShards)
return
}
a, err = getHColCode(surplusShardsAfterHeal, parityShards)
if err != nil {
err = fmt.Errorf("%w: surplusShardsAfterHeal: %d, parityShards: %d",
err, surplusShardsAfterHeal, parityShards)
}
return
}
// getBucketHCCChange - fetches health color code for bucket healing
// this does not return a Grey color since it does not have any meaning
// for a bucket healing. Return green if the bucket is found in a drive,
// yellow for missing, and red for everything else, grey for weird situations
func (h hri) getBucketHCCChange() (b, a col, err error) {
if h.HealResultItem == nil {
return colGrey, colGrey, errors.New("empty result")
}
getColCode := func(drives []madmin.HealDriveInfo) (c col) {
var missing, unavailable int
for i := range drives {
switch drives[i].State {
case madmin.DriveStateOk:
case madmin.DriveStateMissing:
missing++
default:
unavailable++
}
}
if unavailable > 0 {
return colRed
}
if missing > 0 {
return colYellow
}
return colGreen
}
a, b = colGrey, colGrey
if len(h.Before.Drives) > 0 {
b = getColCode(h.Before.Drives)
}
if len(h.After.Drives) > 0 {
a = getColCode(h.After.Drives)
}
return
}
// getReplicatedFileHCCChange - fetches health color code for metadata
@@ -55,9 +102,18 @@ func (h hri) getReplicatedFileHCCChange() (b, a col, err error) {
getColCode := func(numAvail int) (c col, err error) {
// calculate color code for replicated object similar
// to erasure coded objects
quorum := h.DiskCount/h.SetCount/2 + 1
surplus := numAvail/h.SetCount - quorum
parity := h.DiskCount/h.SetCount - quorum
var quorum, surplus, parity int
if h.SetCount > 0 {
quorum = h.DiskCount/h.SetCount/2 + 1
surplus = numAvail/h.SetCount - quorum
parity = h.DiskCount/h.SetCount - quorum
} else {
// in case of bucket healing, disk count is for the node
// also explicitly set count would be set to invalid value of -1
quorum = h.DiskCount/2 + 1
surplus = numAvail - quorum
parity = h.DiskCount - quorum
}
c, err = getHColCode(surplus, parity)
return
}
+61 -60
View File
@@ -1,36 +1,35 @@
/*
* Minio Client (C) 2018 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"encoding/json"
"errors"
"fmt"
"math"
"os"
"strings"
"syscall"
"time"
humanize "github.com/dustin/go-humanize"
"github.com/fatih/color"
"github.com/minio/mc/pkg/console"
json "github.com/minio/colorjson"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/pkg/v3/console"
)
const (
@@ -53,7 +52,7 @@ var (
func getHColCode(surplusShards, parityShards int) (c col, err error) {
if parityShards < 1 || parityShards > 8 || surplusShards > parityShards {
return c, fmt.Errorf("Invalid parity shard count/surplus shard count given")
return c, errors.New("Invalid parity shard count/surplus shard count given")
}
if surplusShards < 0 {
return colGrey, err
@@ -64,7 +63,7 @@ func getHColCode(surplusShards, parityShards int) (c col, err error) {
return hColOrder[index], err
}
}
return c, fmt.Errorf("cannot get a heal color code")
return c, errors.New("cannot get a heal color code")
}
type uiData struct {
@@ -128,7 +127,9 @@ func (ui *uiData) updateStats(i madmin.HealResultItem) error {
var afterCol col
h := newHRI(&i)
switch h.Type {
case madmin.HealItemMetadata, madmin.HealItemBucket:
case madmin.HealItemBucket:
_, afterCol, err = h.getBucketHCCChange()
case madmin.HealItemMetadata, madmin.HealItemBucketMetadata:
_, afterCol, err = h.getReplicatedFileHCCChange()
default:
_, afterCol, err = h.getObjectHCCChange()
@@ -206,17 +207,24 @@ func (ui *uiData) printItemsQuietly(s *madmin.HealTaskStatus) (err error) {
var b, a col
for _, item := range s.Items {
h := newHRI(&item)
hrStr := h.getHealResultStr()
switch h.Type {
case madmin.HealItemMetadata, madmin.HealItemBucket:
case madmin.HealItemBucket:
b, a, err = h.getBucketHCCChange()
case madmin.HealItemMetadata, madmin.HealItemBucketMetadata:
b, a, err = h.getReplicatedFileHCCChange()
default:
b, a, err = h.getObjectHCCChange()
}
if err != nil {
return err
errMsg := err.Error()
if h.Detail != "" {
errMsg = h.Detail
}
console.PrintC("[ERROR] ** ", hrStr, " **", ": ", errMsg, "\n")
continue
}
printColStr(b, a)
hrStr := h.getHealResultStr()
switch h.Type {
case madmin.HealItemMetadata, madmin.HealItemBucketMetadata:
console.PrintC(fmt.Sprintln("**", hrStr, "**"))
@@ -227,7 +235,7 @@ func (ui *uiData) printItemsQuietly(s *madmin.HealTaskStatus) (err error) {
return nil
}
func (ui *uiData) printStatsQuietly(s *madmin.HealTaskStatus) {
func (ui *uiData) printStatsQuietly() {
totalObjects, totalSize, totalTime := ui.getProgress()
healedStr := fmt.Sprintf("Healed:\t%s/%s objects; %s in %s\n",
@@ -238,13 +246,10 @@ func (ui *uiData) printStatsQuietly(s *madmin.HealTaskStatus) {
}
func (ui *uiData) printItemsJSON(s *madmin.HealTaskStatus) (err error) {
type change struct {
Before string `json:"before"`
After string `json:"after"`
}
type healRec struct {
Status string `json:"status"`
Error string `json:"error,omitempty"`
Detail string `json:"detail,omitempty"`
Type string `json:"type"`
Name string `json:"name"`
Before struct {
@@ -265,13 +270,16 @@ func (ui *uiData) printItemsJSON(s *madmin.HealTaskStatus) (err error) {
} `json:"after"`
Size int64 `json:"size"`
}
makeHR := func(h *hri) (r healRec, err error) {
makeHR := func(h *hri) (r healRec) {
r.Status = "success"
r.Type, r.Name = h.getHRTypeAndName()
var b, a col
var err error
switch h.Type {
case madmin.HealItemMetadata, madmin.HealItemBucket:
case madmin.HealItemBucket:
b, a, err = h.getBucketHCCChange()
case madmin.HealItemMetadata, madmin.HealItemBucketMetadata:
b, a, err = h.getReplicatedFileHCCChange()
default:
if h.Type == madmin.HealItemObject {
@@ -280,8 +288,9 @@ func (ui *uiData) printItemsJSON(s *madmin.HealTaskStatus) (err error) {
b, a, err = h.getObjectHCCChange()
}
if err != nil {
return r, err
r.Error = err.Error()
}
r.Detail = h.Detail
r.Before.Color = strings.ToLower(string(b))
r.After.Color = strings.ToLower(string(a))
r.Before.Online, r.After.Online = h.GetOnlineCounts()
@@ -290,23 +299,19 @@ func (ui *uiData) printItemsJSON(s *madmin.HealTaskStatus) (err error) {
r.Before.Offline, r.After.Offline = h.GetOfflineCounts()
r.Before.Drives = h.Before.Drives
r.After.Drives = h.After.Drives
return r, nil
return r
}
for _, item := range s.Items {
h := newHRI(&item)
r, err := makeHR(h)
if err != nil {
return err
}
jsonBytes, err := json.Marshal(r)
fatalIf(probe.NewError(err), "Unable to marshal to JSON.")
jsonBytes, e := json.MarshalIndent(makeHR(h), "", " ")
fatalIf(probe.NewError(e), "Unable to marshal to JSON.")
console.Println(string(jsonBytes))
}
return nil
}
func (ui *uiData) printStatsJSON(s *madmin.HealTaskStatus) {
func (ui *uiData) printStatsJSON(_ *madmin.HealTaskStatus) {
var summary struct {
Status string `json:"status"`
Error string `json:"error,omitempty"`
@@ -329,8 +334,8 @@ func (ui *uiData) printStatsJSON(s *madmin.HealTaskStatus) {
summary.Size = ui.BytesScanned
summary.ElapsedTime = int64(ui.HealDuration.Round(time.Second).Seconds())
jBytes, err := json.Marshal(summary)
fatalIf(probe.NewError(err), "Unable to marshal to JSON.")
jBytes, e := json.MarshalIndent(summary, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal to JSON.")
console.Println(string(jBytes))
}
@@ -368,7 +373,7 @@ func (ui *uiData) updateUI(s *madmin.HealTaskStatus) (err error) {
for i := range cellText {
cellText[i] = []string{
string(dspOrder[i]),
fmt.Sprintf(humanize.Comma(ui.HealthCols[dspOrder[i]])),
fmt.Sprint(humanize.Comma(ui.HealthCols[dspOrder[i]])),
fmt.Sprintf("%5.1f%% %s", percentMap[dspOrder[i]], barMap[dspOrder[i]]),
}
}
@@ -377,7 +382,7 @@ func (ui *uiData) updateUI(s *madmin.HealTaskStatus) (err error) {
return nil
}
func (ui *uiData) UpdateDisplay(s *madmin.HealTaskStatus) (err error) {
func (ui *uiData) UpdateDisplay(s *madmin.HealTaskStatus) {
// Update state
ui.updateDuration(s)
for _, i := range s.Items {
@@ -387,13 +392,12 @@ func (ui *uiData) UpdateDisplay(s *madmin.HealTaskStatus) (err error) {
// Update display
switch {
case globalJSON:
err = ui.printItemsJSON(s)
ui.printItemsJSON(s)
case globalQuiet:
err = ui.printItemsQuietly(s)
ui.printItemsQuietly(s)
default:
err = ui.updateUI(s)
ui.updateUI(s)
}
return
}
func (ui *uiData) healResumeMsg(aliasedURL string) string {
@@ -408,16 +412,15 @@ func (ui *uiData) healResumeMsg(aliasedURL string) string {
}
func (ui *uiData) DisplayAndFollowHealStatus(aliasedURL string) (res madmin.HealTaskStatus, err error) {
trapCh := signalTrap(os.Interrupt, syscall.SIGTERM, syscall.SIGKILL)
trapMsg := ui.healResumeMsg(aliasedURL)
quitMsg := ui.healResumeMsg(aliasedURL)
firstIter := true
for {
select {
case <-trapCh:
return res, errors.New(trapMsg)
case <-globalContext.Done():
return res, errors.New(quitMsg)
default:
_, res, err = ui.Client.Heal(ui.Bucket, ui.Prefix, *ui.HealOpts,
_, res, err = ui.Client.Heal(globalContext, ui.Bucket, ui.Prefix, *ui.HealOpts,
ui.ClientToken, ui.ForceStart, false)
if err != nil {
return res, err
@@ -429,16 +432,14 @@ func (ui *uiData) DisplayAndFollowHealStatus(aliasedURL string) (res madmin.Heal
console.RewindLines(8)
}
}
err = ui.UpdateDisplay(&res)
if err != nil {
return res, err
}
ui.UpdateDisplay(&res)
if res.Summary == "finished" {
if globalJSON {
ui.printStatsJSON(&res)
} else if globalQuiet {
ui.printStatsQuietly(&res)
ui.printStatsQuietly()
}
return res, nil
}
+663 -57
View File
@@ -1,55 +1,118 @@
/*
* Minio Client (C) 2017, 2018 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright (c) 2015-2024 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"encoding/json"
"bufio"
"fmt"
"math"
"net/url"
"os"
"path/filepath"
"sort"
"strings"
"time"
"github.com/dustin/go-humanize"
"github.com/fatih/color"
"github.com/minio/cli"
"github.com/minio/mc/pkg/console"
json "github.com/minio/colorjson"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/pkg/v3/console"
)
const (
scanNormalMode = "normal"
scanDeepMode = "deep"
)
var adminHealFlags = []cli.Flag{
cli.BoolFlag{
Name: "recursive, r",
Usage: "heal recursively",
cli.IntFlag{
Name: "pool",
Usage: "heal only the given pool",
Hidden: true,
},
cli.IntFlag{
Name: "set",
Usage: "heal only the given set",
Hidden: true,
},
cli.StringFlag{
Name: "scan",
Usage: "select the healing scan mode (normal/deep)",
Value: scanNormalMode,
Hidden: true,
},
cli.BoolFlag{
Name: "dry-run, n",
Usage: "only inspect data, but do not mutate",
Name: "recursive, r",
Usage: "heal recursively",
Hidden: true,
},
cli.BoolFlag{
Name: "force-start, f",
Usage: "force start a new heal sequence",
Name: "dry-run, n",
Usage: "only inspect data, but do not mutate",
Hidden: true,
},
cli.BoolFlag{
Name: "force-stop, s",
Usage: "Force stop a running heal sequence",
Name: "force-start, f",
Usage: "force start a new heal sequence",
Hidden: true,
},
cli.BoolFlag{
Name: "force-stop, s",
Usage: "force stop a running heal sequence",
Hidden: true,
},
cli.BoolFlag{
Name: "force",
Usage: "avoid showing a warning prompt",
},
cli.BoolFlag{
Name: "remove",
Usage: "remove dangling objects in heal sequence",
Hidden: true,
},
cli.StringFlag{
Name: "storage-class",
Usage: "show server/drives failure tolerance with the given storage class",
Hidden: true,
},
cli.BoolFlag{
Name: "rewrite",
Usage: "rewrite objects from older to newer format",
Hidden: true,
},
cli.BoolFlag{
Name: "verbose, v",
Usage: "show verbose information",
},
cli.BoolFlag{
Name: "all-drives, a",
Usage: "select all drives for verbose printing",
},
}
var adminHealCmd = cli.Command{
Name: "heal",
Usage: "heal disks, buckets and objects on minio server",
Usage: "monitor healing for bucket(s) and object(s) on MinIO server",
Action: mainAdminHeal,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: append(adminHealFlags, globalFlags...),
HideHelpCommand: true,
@@ -63,27 +126,21 @@ FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. To format newly replaced disks in a Minio server with alias 'play'
$ {{.HelpName}} play
2. Heal 'testbucket' in a Minio server with alias 'play'
$ {{.HelpName}} play/testbucket/
3. Heal all objects under 'dir' prefix
$ {{.HelpName}} --recursive play/testbucket/dir/
4. Issue a dry-run heal operation to inspect objects health but not heal them
$ {{.HelpName}} --dry-run play
5. Issue a dry-run heal operation to inspect objects health under 'dir' prefix
$ {{.HelpName}} --recursive --dry-run play/testbucket/dir/
1. Monitor healing status on a running server at alias 'myminio':
{{.Prompt}} {{.HelpName}} myminio/
`,
}
func checkAdminHealSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 {
cli.ShowCommandHelpAndExit(ctx, "heal", 1) // last argument is exit code
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
// Check for scan argument
scanArg := ctx.String("scan")
scanArg = strings.ToLower(scanArg)
if scanArg != scanNormalMode && scanArg != scanDeepMode {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
@@ -100,15 +157,498 @@ func (s stopHealMessage) String() string {
// JSON jsonified stop heal message.
func (s stopHealMessage) JSON() string {
stopHealJSONBytes, e := json.Marshal(s)
stopHealJSONBytes, e := json.MarshalIndent(s, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(stopHealJSONBytes)
}
type setIndex struct {
pool, set int
}
type poolInfo struct {
tolerance int
endpoints []string
}
type setInfo struct {
totalDisks int
readyDisksCount int // disks online and not in healing state
readyDisksUsedSpace uint64 // the total used space of ready disks
incapableDisks int
}
type serverInfo struct {
pool int
disks []madmin.Disk
}
func (s serverInfo) onlineDisksForSet(index setIndex) (setFound bool, count int) {
for _, disk := range s.disks {
if disk.PoolIndex != index.pool || disk.SetIndex != index.set {
continue
}
setFound = true
if disk.State == "ok" && !disk.Healing {
count++
}
}
return
}
// Get all drives from set statuses
func getAllDisks(sets []madmin.SetStatus) []madmin.Disk {
var disks []madmin.Disk
for _, set := range sets {
disks = append(disks, set.Disks...)
}
return disks
}
// Get all pools id from all drives
func getPoolsIndexes(disks []madmin.Disk) []int {
m := make(map[int]struct{})
for _, d := range disks {
m[d.PoolIndex] = struct{}{}
}
var pools []int
for pool := range m {
pools = append(pools, pool)
}
sort.Ints(pools)
return pools
}
// Generate sets info from disks
func generateSetsStatus(disks []madmin.Disk) map[setIndex]setInfo {
m := make(map[setIndex]setInfo)
for _, d := range disks {
idx := setIndex{pool: d.PoolIndex, set: d.SetIndex}
setSt, ok := m[idx]
if !ok {
setSt = setInfo{}
}
setSt.totalDisks++
if d.State != "ok" || d.Healing {
setSt.incapableDisks++
} else {
setSt.readyDisksCount++
setSt.readyDisksUsedSpace += d.UsedSpace
}
m[idx] = setSt
}
return m
}
// Return a map of server endpoints and the corresponding status
func generateServersStatus(disks []madmin.Disk) map[string]serverInfo {
m := make(map[string]serverInfo)
for _, d := range disks {
u, e := url.Parse(d.Endpoint)
if e != nil {
continue
}
endpoint := u.Host
if endpoint == "" {
endpoint = "local-pool" + humanize.Ordinal(d.PoolIndex+1)
}
serverSt, ok := m[endpoint]
if !ok {
serverSt = serverInfo{
pool: d.PoolIndex,
}
}
serverSt.disks = append(serverSt.disks, d)
m[endpoint] = serverSt
}
return m
}
// Return the list of endpoints of a given pool index
func computePoolEndpoints(pool int, serversStatus map[string]serverInfo) []string {
var endpoints []string
for endpoint, server := range serversStatus {
if server.pool != pool {
continue
}
endpoints = append(endpoints, endpoint)
}
return endpoints
}
// Compute the tolerance of each node in a given pool
func computePoolTolerance(pool, parity int, setsStatus map[setIndex]setInfo, serversStatus map[string]serverInfo) int {
var (
onlineDisksPerSet = make(map[setIndex]int)
tolerancePerSet = make(map[setIndex]int)
)
for set, setStatus := range setsStatus {
if set.pool != pool {
continue
}
onlineDisksPerSet[set] = setStatus.totalDisks - setStatus.incapableDisks
tolerancePerSet[set] = 0
for _, server := range serversStatus {
if server.pool != pool {
continue
}
canShutdown := true
setFound, count := server.onlineDisksForSet(set)
if !setFound {
continue
}
minDisks := setStatus.totalDisks - parity
if onlineDisksPerSet[set]-count < minDisks {
canShutdown = false
}
if canShutdown {
tolerancePerSet[set]++
onlineDisksPerSet[set] -= count
} else {
break
}
}
}
minServerTolerance := len(serversStatus)
for _, tolerance := range tolerancePerSet {
if tolerance < minServerTolerance {
minServerTolerance = tolerance
}
}
return minServerTolerance
}
// Extract offline nodes from offline full path endpoints
func getOfflineNodes(endpoints []string) map[string]struct{} {
offlineNodes := make(map[string]struct{})
for _, endpoint := range endpoints {
offlineNodes[endpoint] = struct{}{}
}
return offlineNodes
}
// verboseBackgroundHealStatusMessage is container for stop heal success and failure messages.
type verboseBackgroundHealStatusMessage struct {
Status string `json:"status"`
HealInfo madmin.BgHealState
allDrives bool
// Specify storage class to show servers/disks tolerance
ToleranceForSC string `json:"-"`
}
// String colorized to show background heal status message.
func (s verboseBackgroundHealStatusMessage) String() string {
var msg strings.Builder
parity, showTolerance := s.HealInfo.SCParity[s.ToleranceForSC]
offlineEndpoints := getOfflineNodes(s.HealInfo.OfflineEndpoints)
allDisks := getAllDisks(s.HealInfo.Sets)
pools := getPoolsIndexes(allDisks)
setsStatus := generateSetsStatus(allDisks)
serversStatus := generateServersStatus(allDisks)
poolsInfo := make(map[int]poolInfo)
for _, pool := range pools {
tolerance := computePoolTolerance(pool, parity, setsStatus, serversStatus)
endpoints := computePoolEndpoints(pool, serversStatus)
poolsInfo[pool] = poolInfo{tolerance: tolerance, endpoints: endpoints}
}
distributed := len(serversStatus) > 1
plural := ""
if distributed {
plural = "s"
}
fmt.Fprintf(&msg, "Server%s status:\n", plural)
fmt.Fprintf(&msg, "==============\n")
for _, pool := range pools {
fmt.Fprintf(&msg, "Pool %s:\n", humanize.Ordinal(pool+1))
// Sort servers in this pool by name
orderedEndpoints := make([]string, len(poolsInfo[pool].endpoints))
copy(orderedEndpoints, poolsInfo[pool].endpoints)
sort.Strings(orderedEndpoints)
for _, endpoint := range orderedEndpoints {
// Print offline status if node is offline
_, ok := offlineEndpoints[endpoint]
if ok {
stateText := console.Colorize("NodeFailed", "OFFLINE")
fmt.Fprintf(&msg, " %s: %s\n", endpoint, stateText)
continue
}
var serverHeader strings.Builder
var serverHeaderPrinted bool
serverStatus := serversStatus[endpoint]
switch {
case showTolerance:
hdr := " %s: (Tolerance: %d server(s))\n"
fmt.Fprintf(&serverHeader, hdr, endpoint, poolsInfo[serverStatus.pool].tolerance)
default:
hdr := " %s:\n"
fmt.Fprintf(&serverHeader, hdr, endpoint)
}
for _, d := range serverStatus.disks {
if d.PoolIndex != pool {
continue
}
stateText := ""
switch {
case d.State == "ok" && d.Healing:
stateText = console.Colorize("DiskHealing", "HEALING")
case d.State == "ok":
if !s.allDrives {
continue
}
stateText = console.Colorize("DiskOK", "OK")
default:
stateText = console.Colorize("DiskFailed", d.State)
}
if !serverHeaderPrinted {
serverHeaderPrinted = true
fmt.Fprint(&msg, serverHeader.String())
}
drivePath := d.DrivePath
if drivePath == "" {
if u, e := url.Parse(d.Endpoint); e == nil {
drivePath = u.Path
}
}
fmt.Fprintf(&msg, " + %s : %s\n", drivePath, stateText)
thisSet := setsStatus[setIndex{d.PoolIndex, d.SetIndex}]
if d.Healing && d.HealInfo != nil && !d.HealInfo.Finished {
refUsedSpace := uint64(math.MaxUint64)
if thisSet.readyDisksCount > 0 { // to avoid crashing
refUsedSpace = thisSet.readyDisksUsedSpace / uint64(thisSet.readyDisksCount)
}
if refUsedSpace < d.UsedSpace { // normalize
refUsedSpace = d.UsedSpace
}
fmt.Fprintf(&msg, " |__ Progress: %d%%\n", 100*d.UsedSpace/refUsedSpace)
fmt.Fprintf(&msg, " |__ Started: %s\n", humanize.Time(d.HealInfo.Started))
if d.HealInfo.RetryAttempts > 0 {
fmt.Fprintf(&msg, " |__ Retries: %d\n", d.HealInfo.RetryAttempts)
}
}
fmt.Fprintf(&msg, " |__ Capacity: %s/%s\n", humanize.IBytes(d.UsedSpace), humanize.IBytes(d.TotalSpace))
if showTolerance {
fmt.Fprintf(&msg, " |__ Tolerance: %d drive(s)\n", parity-thisSet.incapableDisks)
}
}
if serverHeaderPrinted {
fmt.Fprintf(&msg, "\n")
}
}
}
if showTolerance {
fmt.Fprintf(&msg, "\n")
fmt.Fprintf(&msg, "Server Failure Tolerance:\n")
fmt.Fprintf(&msg, "========================\n")
for i, pool := range poolsInfo {
fmt.Fprintf(&msg, "Pool %s:\n", humanize.Ordinal(i+1))
fmt.Fprintf(&msg, " Tolerance : %d server(s)\n", pool.tolerance)
fmt.Fprintf(&msg, " Nodes :")
for _, endpoint := range pool.endpoints {
fmt.Fprintf(&msg, " %s", endpoint)
}
fmt.Fprintf(&msg, "\n")
}
}
summary := shortBackgroundHealStatusMessage{HealInfo: s.HealInfo}
fmt.Fprint(&msg, "\n")
fmt.Fprint(&msg, "Summary:\n")
fmt.Fprint(&msg, "=======\n")
fmt.Fprint(&msg, summary.String())
fmt.Fprint(&msg, "\n")
return msg.String()
}
// JSON jsonified stop heal message.
func (s verboseBackgroundHealStatusMessage) JSON() string {
healJSONBytes, e := json.MarshalIndent(s, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(healJSONBytes)
}
// shortBackgroundHealStatusMessage is container for stop heal success and failure messages.
type shortBackgroundHealStatusMessage struct {
Status string `json:"status"`
HealInfo madmin.BgHealState
}
// String colorized to show background heal status message.
func (s shortBackgroundHealStatusMessage) String() string {
healPrettyMsg := ""
var (
itemsHealed uint64
bytesHealed uint64
itemsFailed uint64
bytesFailed uint64
itemsHealedPerSec float64
bytesHealedPerSec float64
startedAt time.Time
setsExceedsStd int
setsExceedsReduced int
// The addition of Elapsed time of each parallel healing operation
// this is needed to calculate the rate of healing
accumulatedElapsedTime time.Duration
)
var problematicDisks int
leastPct := 100.0
for _, set := range s.HealInfo.Sets {
setsStatus := generateSetsStatus(set.Disks)
// Furthest along disk...
var furthestHealingDisk *madmin.Disk
missingInSet := 0
for _, disk := range set.Disks {
// Ignore disk with non 'ok' status
if disk.State != madmin.DriveStateOk {
if disk.State != madmin.DriveStateUnformatted {
missingInSet++
problematicDisks++
}
continue
}
if disk.HealInfo != nil && !disk.HealInfo.Finished {
missingInSet++
thisSet := setsStatus[setIndex{pool: disk.PoolIndex, set: disk.SetIndex}]
refUsedSpace := uint64(math.MaxUint64)
if thisSet.readyDisksCount > 0 {
refUsedSpace = thisSet.readyDisksUsedSpace / uint64(thisSet.readyDisksCount)
}
if refUsedSpace < disk.UsedSpace {
refUsedSpace = disk.UsedSpace
}
if refUsedSpace > 0 {
if pct := float64(disk.UsedSpace) / float64(refUsedSpace); pct < leastPct {
leastPct = pct
}
} else {
// Unlikely to have max used space in an erasure set to be zero, but still set this to zero
leastPct = 0
}
disk := disk
if furthestHealingDisk == nil {
furthestHealingDisk = &disk
continue
}
if disk.HealInfo.ItemsHealed+disk.HealInfo.ItemsFailed > furthestHealingDisk.HealInfo.ItemsHealed+furthestHealingDisk.HealInfo.ItemsFailed {
furthestHealingDisk = &disk
continue
}
}
}
if furthestHealingDisk != nil {
disk := furthestHealingDisk
// Approximate values
itemsHealed += disk.HealInfo.ItemsHealed
bytesHealed += disk.HealInfo.BytesDone
bytesFailed += disk.HealInfo.BytesFailed
itemsFailed += disk.HealInfo.ItemsFailed
if !disk.HealInfo.Started.IsZero() {
if !disk.HealInfo.Started.Before(startedAt) {
startedAt = disk.HealInfo.Started
}
if !disk.HealInfo.LastUpdate.IsZero() {
accumulatedElapsedTime += disk.HealInfo.LastUpdate.Sub(disk.HealInfo.Started)
}
bytesHealedPerSec += float64(time.Second) * float64(disk.HealInfo.BytesDone) / float64(disk.HealInfo.LastUpdate.Sub(disk.HealInfo.Started))
itemsHealedPerSec += float64(time.Second) * float64(disk.HealInfo.ItemsHealed+disk.HealInfo.ItemsFailed) / float64(disk.HealInfo.LastUpdate.Sub(disk.HealInfo.Started))
}
if n, ok := s.HealInfo.SCParity["STANDARD"]; ok && missingInSet > n {
setsExceedsStd++
}
if n, ok := s.HealInfo.SCParity["REDUCED_REDUNDANCY"]; ok && missingInSet > n {
setsExceedsReduced++
}
}
}
if startedAt.IsZero() && itemsHealed == 0 {
healPrettyMsg += "No active healing is detected for new disks"
if problematicDisks > 0 {
healPrettyMsg += fmt.Sprintf(", though %d offline disk(s) found.", problematicDisks)
} else {
healPrettyMsg += "."
}
return healPrettyMsg
}
// Objects healed information
healPrettyMsg += fmt.Sprintf("Objects Healed: %s, %s (%s)\n",
humanize.Comma(int64(itemsHealed)), humanize.IBytes(bytesHealed), humanize.CommafWithDigits(leastPct*100, 1)+"%")
healPrettyMsg += fmt.Sprintf("Objects Failed: %s\n", humanize.Comma(int64(itemsFailed)))
if accumulatedElapsedTime > 0 {
healPrettyMsg += fmt.Sprintf("Heal rate: %d obj/s, %s/s\n", int64(itemsHealedPerSec), humanize.IBytes(uint64(bytesHealedPerSec)))
}
if problematicDisks > 0 {
healPrettyMsg += "\n"
healPrettyMsg += fmt.Sprintf("%d offline disk(s) found.", problematicDisks)
}
if setsExceedsStd > 0 {
healPrettyMsg += "\n"
healPrettyMsg += fmt.Sprintf("%d of %d sets exceeds standard parity count EC:%d lost/offline disks", setsExceedsStd, len(s.HealInfo.Sets), s.HealInfo.SCParity["STANDARD"])
}
if setsExceedsReduced > 0 {
healPrettyMsg += "\n"
healPrettyMsg += fmt.Sprintf("%d of %d sets exceeds reduced parity count EC:%d lost/offline disks", setsExceedsReduced, len(s.HealInfo.Sets), s.HealInfo.SCParity["REDUCED_REDUNDANCY"])
}
return healPrettyMsg
}
// JSON jsonified stop heal message.
func (s shortBackgroundHealStatusMessage) JSON() string {
healJSONBytes, e := json.MarshalIndent(s, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(healJSONBytes)
}
func transformScanArg(scanArg string) madmin.HealScanMode {
switch scanArg {
case "deep":
return madmin.HealDeepScan
}
return madmin.HealNormalScan
}
// mainAdminHeal - the entry function of heal command
func mainAdminHeal(ctx *cli.Context) error {
// Check for command syntax
checkAdminHealSyntax(ctx)
@@ -117,13 +657,21 @@ func mainAdminHeal(ctx *cli.Context) error {
aliasedURL := args.Get(0)
console.SetColor("Heal", color.New(color.FgGreen, color.Bold))
console.SetColor("Dot", color.New(color.FgGreen, color.Bold))
console.SetColor("HealBackgroundTitle", color.New(color.FgGreen, color.Bold))
console.SetColor("HealBackground", color.New(color.Bold))
console.SetColor("HealUpdateUI", color.New(color.FgYellow, color.Bold))
console.SetColor("HealStopped", color.New(color.FgGreen, color.Bold))
// Create a new Minio Admin Client
client, err := newAdminClient(aliasedURL)
console.SetColor("DiskHealing", color.New(color.FgYellow, color.Bold))
console.SetColor("DiskOK", color.New(color.FgGreen, color.Bold))
console.SetColor("DiskFailed", color.New(color.FgRed, color.Bold))
console.SetColor("NodeFailed", color.New(color.FgRed, color.Bold))
// Create a new MinIO Admin Client
adminClnt, err := newAdminClient(aliasedURL)
if err != nil {
fatalIf(err.Trace(aliasedURL), "Cannot initialize admin client.")
fatalIf(err.Trace(aliasedURL), "Unable to initialize admin client.")
return nil
}
@@ -132,27 +680,85 @@ func mainAdminHeal(ctx *cli.Context) error {
splits := splitStr(aliasedURL, "/", 3)
bucket, prefix := splits[1], splits[2]
clnt, err := newClient(aliasedURL)
if err != nil {
fatalIf(err.Trace(clnt.GetURL().String()), "Unable to create client for URL ", aliasedURL)
return nil
}
// Return the background heal status when the user
// doesn't pass a bucket or --recursive flag.
if bucket == "" && !ctx.Bool("recursive") {
bgHealStatus, e := adminClnt.BackgroundHealStatus(globalContext)
fatalIf(probe.NewError(e), "Unable to get background heal status.")
if ctx.Bool("verbose") {
printMsg(verboseBackgroundHealStatusMessage{
Status: "success",
HealInfo: bgHealStatus,
allDrives: ctx.Bool("all-drives"),
ToleranceForSC: strings.ToUpper(ctx.String("storage-class")),
})
} else {
printMsg(shortBackgroundHealStatusMessage{
Status: "success",
HealInfo: bgHealStatus,
})
}
return nil
}
opts := madmin.HealOpts{
ScanMode: transformScanArg(ctx.String("scan")),
Remove: ctx.Bool("remove"),
Recursive: ctx.Bool("recursive"),
DryRun: ctx.Bool("dry-run"),
Recreate: ctx.Bool("rewrite"),
}
if ctx.IsSet("pool") {
p := ctx.Int("pool")
if p < 1 {
fatalIf(errInvalidArgument(), "--pool takes a non zero positive number.")
}
p--
opts.Pool = &p
}
if ctx.IsSet("set") {
s := ctx.Int("set")
if s < 1 {
fatalIf(errInvalidArgument(), "--set takes a non zero positive number.")
}
s--
opts.Set = &s
}
forceStart := ctx.Bool("force-start")
forceStop := ctx.Bool("force-stop")
if forceStop {
_, _, herr := client.Heal(bucket, prefix, opts, "", forceStart, forceStop)
errorIf(probe.NewError(herr), "Failed to stop heal sequence.")
_, _, e := adminClnt.Heal(globalContext, bucket, prefix, opts, "", forceStart, forceStop)
fatalIf(probe.NewError(e), "Unable to stop healing.")
printMsg(stopHealMessage{Status: "success", Alias: aliasedURL})
return nil
}
healStart, _, herr := client.Heal(bucket, prefix, opts, "", forceStart, false)
errorIf(probe.NewError(herr), "Failed to start heal sequence.")
if opts.Recursive && opts.Pool == nil && opts.Set == nil && isTerminal() && !ctx.Bool("force") {
fmt.Printf("You are about to scan and heal the whole namespace in all pools and sets, please confirm [y/N]: ")
answer, e := bufio.NewReader(os.Stdin).ReadString('\n')
fatalIf(probe.NewError(e), "Unable to parse user input.")
if answer = strings.TrimSpace(strings.ToLower(answer)); answer != "y" && answer != "yes" {
fmt.Println("Heal aborted!")
return nil
}
}
healStart, _, e := adminClnt.Heal(globalContext, bucket, prefix, opts, "", forceStart, false)
fatalIf(probe.NewError(e), "Unable to start healing.")
ui := uiData{
Bucket: bucket,
Prefix: prefix,
Client: client,
Client: adminClnt,
ClientToken: healStart.ClientToken,
ForceStart: forceStart,
HealOpts: &opts,
@@ -164,11 +770,11 @@ func mainAdminHeal(ctx *cli.Context) error {
res, e := ui.DisplayAndFollowHealStatus(aliasedURL)
if e != nil {
if res.FailureDetail != "" {
data, _ := json.Marshal(res)
data, _ := json.MarshalIndent(res, "", " ")
traceStr := string(data)
errorIf(probe.NewError(e).Trace(aliasedURL, traceStr), "Unable to display heal status.")
fatalIf(probe.NewError(e).Trace(aliasedURL, traceStr), "Unable to display heal status.")
} else {
errorIf(probe.NewError(e).Trace(aliasedURL), "Unable to display heal status.")
fatalIf(probe.NewError(e).Trace(aliasedURL), "Unable to display heal status.")
}
}
return nil
+39
View File
@@ -0,0 +1,39 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import "github.com/minio/cli"
var adminIDPCmd = cli.Command{
Name: "idp",
Usage: "manage MinIO IDentity Provider server configuration",
Action: mainAdminIDP,
Before: setGlobalsFromContext,
Flags: globalFlags,
HideHelpCommand: true,
Hidden: true,
CustomHelpTemplate: `This command's functionality has moved and this command is DEPRECATED.
Please use commands under 'mc idp ldap|openid' instead.
`,
}
func mainAdminIDP(_ *cli.Context) error {
deprecatedError("mc idp ldap|openid")
return nil
}
+348 -210
View File
@@ -1,45 +1,55 @@
/*
* Minio Client (C) 2016, 2017, 2018 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright (c) 2015-2024 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"encoding/json"
"errors"
"fmt"
"net/url"
"sort"
"strconv"
"strings"
"time"
humanize "github.com/dustin/go-humanize"
"github.com/dustin/go-humanize"
"github.com/dustin/go-humanize/english"
"github.com/fatih/color"
"github.com/minio/cli"
"github.com/minio/mc/pkg/console"
json "github.com/minio/colorjson"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio/pkg/madmin"
"github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/pkg/v3/console"
)
var (
adminInfoFlags = []cli.Flag{}
)
var adminInfoFlags = []cli.Flag{
cli.BoolFlag{
Name: "offline",
Usage: "show only offline nodes/drives",
},
}
var adminInfoCmd = cli.Command{
Name: "info",
Usage: "display minio server information",
Action: mainAdminInfo,
Before: setGlobalsFromContext,
Flags: append(adminInfoFlags, globalFlags...),
Name: "info",
Usage: "display MinIO server information",
Action: mainAdminInfo,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: append(globalFlags, adminInfoFlags...),
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
@@ -50,221 +60,349 @@ FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Get server information of the 'play' Minio server.
$ {{.HelpName}} play/
1. Get server information of the 'play' MinIO server.
{{.Prompt}} {{.HelpName}} play/
`,
}
// backendType - indicates the type of backend storage
type backendType string
const (
fsType = backendType("FS")
erasureType = backendType("Erasure")
)
// fsBackend contains specific FS storage information
type fsBackend struct {
Type backendType `json:"backendType"`
type poolSummary struct {
index int
setsCount int
drivesPerSet int
driveTolerance int
drivesTotalFreeSpace uint64
drivesTotalUsableSpace uint64
endpoints set.StringSet
}
// xlBackend contains specific erasure storage information
type xlBackend struct {
Type backendType `json:"backendType"`
OnlineDisks int `json:"onlineDisks"`
OfflineDisks int `json:"offlineDisks"`
// Data disks for currently configured Standard storage class.
StandardSCData int `json:"standardSCData"`
// Parity disks for currently configured Standard storage class.
StandardSCParity int `json:"standardSCParity"`
// Data disks for currently configured Reduced Redundancy storage class.
RRSCData int `json:"rrSCData"`
// Parity disks for currently configured Reduced Redundancy storage class.
RRSCParity int `json:"rrSCParity"`
type clusterInfo map[int]*poolSummary
// List of all disk status.
Sets [][]madmin.DriveInfo `json:"sets"`
func clusterSummaryInfo(info madmin.InfoMessage) clusterInfo {
summary := make(clusterInfo)
for _, srv := range info.Servers {
for _, disk := range srv.Disks {
if disk.PoolIndex < 0 {
continue
}
pool := summary[disk.PoolIndex]
if pool == nil {
pool = &poolSummary{
index: disk.PoolIndex,
endpoints: set.NewStringSet(),
driveTolerance: info.StandardParity(),
}
}
if len(info.Backend.DrivesPerSet) > 0 {
if disk.DiskIndex < (info.Backend.DrivesPerSet[disk.PoolIndex] - info.Backend.StandardSCParity) {
pool.drivesTotalFreeSpace += disk.AvailableSpace
pool.drivesTotalUsableSpace += disk.TotalSpace
}
}
pool.endpoints.Add(srv.Endpoint)
summary[disk.PoolIndex] = pool
}
}
for idx := range info.Backend.TotalSets {
pool := summary[idx]
if pool != nil {
pool.setsCount = info.Backend.TotalSets[idx]
pool.drivesPerSet = info.Backend.DrivesPerSet[idx]
summary[idx] = pool
}
}
return summary
}
// backendStatus represents the overall information of all backend storage types
type backendStatus struct {
Used uint64 `json:"used"`
Backend interface{} `json:"backend"`
}
// ServerInfo holds the whole server information that will be
// returned by ServerInfo API.
type ServerInfo struct {
StorageInfo backendStatus `json:"storage"`
ConnStats madmin.ServerConnStats `json:"network"`
Properties madmin.ServerProperties `json:"server"`
}
// infoMessage container to hold service status information.
type infoMessage struct {
Status string `json:"status"`
Service string `json:"service"`
Addr string `json:"address"`
Err string `json:"error"`
*ServerInfo
}
// String colorized service status message.
func (u infoMessage) String() (msg string) {
defer func() {
msg += "\n"
}()
dot := "●"
// When service is offline
if u.Service == "off" {
msg += fmt.Sprintf("%s %s\n", console.Colorize("InfoFail", dot), u.Addr)
msg += fmt.Sprintf(" Uptime : Server is %s", console.Colorize("InfoFail", "offline"))
return
}
// Print error if any and exit
if u.Err != "" {
msg += fmt.Sprintf("%s %s\n", console.Colorize("InfoFail", dot), u.Addr)
msg += fmt.Sprintf(" Uptime : Server is %s\n", console.Colorize("InfoFail", "offline"))
msg += fmt.Sprintf(" Error : %s", u.Err)
return
}
// Print server title
msg += fmt.Sprintf("%s %s\n", console.Colorize("Info", dot), u.Addr)
// Print server information
// Uptime
msg += fmt.Sprintf(" Uptime : %s since %s\n", console.Colorize("Info", "online"),
humanize.Time(time.Now().UTC().Add(-u.ServerInfo.Properties.Uptime)))
// Version
msg += fmt.Sprintf(" Version : %s\n", u.ServerInfo.Properties.Version)
// Region
msg += fmt.Sprintf(" Region : %s\n", u.ServerInfo.Properties.Region)
// ARNs
sqsARNs := ""
for _, v := range u.ServerInfo.Properties.SQSARN {
sqsARNs += fmt.Sprintf("%s ", v)
}
if sqsARNs == "" {
sqsARNs = "<none>"
}
msg += fmt.Sprintf(" SQS ARNs : %s\n", sqsARNs)
// Incoming/outgoing
msg += fmt.Sprintf(" Stats : Incoming %s, Outgoing %s\n",
humanize.IBytes(u.ServerInfo.ConnStats.TotalInputBytes),
humanize.IBytes(u.ServerInfo.ConnStats.TotalOutputBytes))
// Get storage information
msg += fmt.Sprintf(" Storage : Used %s", humanize.IBytes(u.StorageInfo.Used))
if v, ok := u.ServerInfo.StorageInfo.Backend.(xlBackend); ok {
msg += fmt.Sprintf("\n Disks : %s, %s\n", console.Colorize("Info", v.OnlineDisks),
console.Colorize("InfoFail", v.OfflineDisks))
func endpointToPools(endpoint string, c clusterInfo) (pools []int) {
for poolNumber, poolSummary := range c {
if poolSummary.endpoints.Contains(endpoint) {
pools = append(pools, poolNumber)
}
}
sort.Ints(pools)
return
}
// JSON jsonified service status Message message.
func (u infoMessage) JSON() string {
u.Status = "success"
statusJSONBytes, e := json.Marshal(u)
// Wrap "Info" message together with fields "Status" and "Error"
type clusterStruct struct {
Status string `json:"status"`
Error string `json:"error,omitempty"`
Info madmin.InfoMessage `json:"info,omitempty"`
onlyOffline bool
}
// String provides colorized info messages
func (u clusterStruct) String() (msg string) {
// Check cluster level "Status" field for error
if u.Status == "error" {
fatal(probe.NewError(errors.New(u.Error)), "Unable to get service info")
}
// If nothing has been collected, error out
if u.Info.Servers == nil {
fatal(probe.NewError(errors.New("Unable to get service info")), "")
}
// Initialization
var totalOfflineNodes int
// Color palette initialization
console.SetColor("Info", color.New(color.FgGreen, color.Bold))
console.SetColor("InfoFail", color.New(color.FgRed, color.Bold))
console.SetColor("InfoWarning", color.New(color.FgYellow, color.Bold))
backendType := u.Info.BackendType()
coloredDot := console.Colorize("Info", dot)
if madmin.ItemState(u.Info.Mode) == madmin.ItemInitializing {
coloredDot = console.Colorize("InfoWarning", dot)
}
sort.Slice(u.Info.Servers, func(i, j int) bool {
return u.Info.Servers[i].Endpoint < u.Info.Servers[j].Endpoint
})
clusterSummary := clusterSummaryInfo(u.Info)
// Loop through each server and put together info for each one
for _, srv := range u.Info.Servers {
// Check if MinIO server is not online ("Mode" field),
if srv.State != string(madmin.ItemOnline) {
totalOfflineNodes++
// "PrintB" is color blue in console library package
msg += fmt.Sprintf("%s %s\n", console.Colorize("InfoFail", dot), console.Colorize("PrintB", srv.Endpoint))
msg += fmt.Sprintf(" Uptime: %s\n", console.Colorize("InfoFail", srv.State))
if backendType == madmin.Erasure {
// Info about drives on a server, only available for non-FS types
var OffDrives int
var OnDrives int
var dispNoOfDrives string
for _, disk := range srv.Disks {
switch disk.State {
case madmin.DriveStateOk, madmin.DriveStateUnformatted:
OnDrives++
default:
OffDrives++
}
}
totalDrivesPerServer := OnDrives + OffDrives
dispNoOfDrives = strconv.Itoa(OnDrives) + "/" + strconv.Itoa(totalDrivesPerServer)
msg += fmt.Sprintf(" Drives: %s %s\n", dispNoOfDrives, console.Colorize("InfoFail", "OK "))
}
msg += "\n"
// Continue to the next server
continue
}
if u.onlyOffline {
continue
}
// Print server title
msg += fmt.Sprintf("%s %s\n", coloredDot, console.Colorize("PrintB", srv.Endpoint))
// Uptime
msg += fmt.Sprintf(" Uptime: %s\n", console.Colorize("Info",
humanize.RelTime(time.Now(), time.Now().Add(time.Duration(srv.Uptime)*time.Second), "", "")))
// Version
version := srv.Version
if strings.Contains(srv.Version, "DEVELOPMENT") {
version = "<development>"
}
msg += fmt.Sprintf(" Version: %s\n", version)
// Network info, only available for non-FS types
connectionAlive := 0
totalNodes := len(srv.Network)
if srv.Network != nil && backendType == madmin.Erasure {
for _, v := range srv.Network {
if v == "online" {
connectionAlive++
}
}
clr := "Info"
if connectionAlive != totalNodes {
clr = "InfoWarning"
}
displayNwInfo := strconv.Itoa(connectionAlive) + "/" + strconv.Itoa(totalNodes)
msg += fmt.Sprintf(" Network: %s %s\n", displayNwInfo, console.Colorize(clr, "OK "))
}
if backendType == madmin.Erasure {
// Info about drives on a server, only available for non-FS types
var OffDrives int
var OnDrives int
var dispNoOfDrives string
for _, disk := range srv.Disks {
switch disk.State {
case madmin.DriveStateOk, madmin.DriveStateUnformatted:
OnDrives++
default:
OffDrives++
}
}
totalDrivesPerServer := OnDrives + OffDrives
clr := "Info"
if OnDrives != totalDrivesPerServer {
clr = "InfoWarning"
}
dispNoOfDrives = strconv.Itoa(OnDrives) + "/" + strconv.Itoa(totalDrivesPerServer)
msg += fmt.Sprintf(" Drives: %s %s\n", dispNoOfDrives, console.Colorize(clr, "OK "))
// Print pools belonging to this server
var prettyPools []string
for _, pool := range endpointToPools(srv.Endpoint, clusterSummary) {
prettyPools = append(prettyPools, strconv.Itoa(pool+1))
}
msg += fmt.Sprintf(" Pool: %s\n", console.Colorize("Info", fmt.Sprintf("%+v", strings.Join(prettyPools, ", "))))
}
msg += "\n"
}
if backendType == madmin.Erasure {
dspOrder := []col{colGreen} // Header
for i := 0; i < len(clusterSummary); i++ {
dspOrder = append(dspOrder, colGrey)
}
var printColors []*color.Color
for _, c := range dspOrder {
printColors = append(printColors, getPrintCol(c))
}
tbl := console.NewTable(printColors, []bool{false, false, false, false}, 0)
var builder strings.Builder
cellText := make([][]string, 0, len(clusterSummary)+1)
cellText = append(cellText, []string{
"Pool",
"Drives Usage",
"Erasure stripe size",
"Erasure sets",
})
var printSummary bool
// Keep the pool order while printing the output
for poolIdx := 0; poolIdx < len(clusterSummary); poolIdx++ {
summary := clusterSummary[poolIdx]
if summary == nil {
break
}
totalSize := summary.drivesTotalUsableSpace
usedCurrent := summary.drivesTotalUsableSpace - summary.drivesTotalFreeSpace
var capacity string
if totalSize > 0 {
capacity = fmt.Sprintf("%.1f%% (total: %s)", 100*float64(usedCurrent)/float64(totalSize), humanize.IBytes(totalSize))
}
if summary.drivesPerSet > 0 {
printSummary = true
}
cellText = append(cellText, []string{
humanize.Ordinal(poolIdx + 1),
capacity,
strconv.Itoa(summary.drivesPerSet),
strconv.Itoa(summary.setsCount),
})
}
if printSummary {
e := tbl.PopulateTable(&builder, cellText)
fatalIf(probe.NewError(e), "unable to populate the table")
msg += builder.String() + "\n"
}
}
// Summary on used space, total no of buckets and
// total no of objects at the Cluster level
usedTotal := humanize.IBytes(u.Info.Usage.Size)
if u.Info.Buckets.Count > 0 {
msg += fmt.Sprintf("%s Used, %s, %s", usedTotal,
english.Plural(int(u.Info.Buckets.Count), "Bucket", ""),
english.Plural(int(u.Info.Objects.Count), "Object", ""))
if u.Info.Versions.Count > 0 {
msg += ", " + english.Plural(int(u.Info.Versions.Count), "Version", "")
}
if u.Info.DeleteMarkers.Count > 0 {
msg += ", " + english.Plural(int(u.Info.DeleteMarkers.Count), "Delete Marker", "")
}
msg += "\n"
}
if backendType == madmin.Erasure {
if totalOfflineNodes != 0 {
msg += fmt.Sprintf("%s offline, ", english.Plural(totalOfflineNodes, "node", ""))
}
// Summary on total no of online and total
// number of offline drives at the Cluster level
msg += fmt.Sprintf("%s online, %s offline, EC:%d\n",
english.Plural(u.Info.Backend.OnlineDisks, "drive", ""),
english.Plural(u.Info.Backend.OfflineDisks, "drive", ""),
u.Info.Backend.StandardSCParity)
}
// Remove the last new line if any
// since this is a String() function
msg = strings.TrimSuffix(msg, "\n")
return
}
// JSON jsonifies service status message.
func (u clusterStruct) JSON() string {
statusJSONBytes, e := json.MarshalIndent(u, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(statusJSONBytes)
}
// checkAdminInfoSyntax - validate all the passed arguments
// checkAdminInfoSyntax - validate arguments passed by a user
func checkAdminInfoSyntax(ctx *cli.Context) {
if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 {
cli.ShowCommandHelpAndExit(ctx, "info", 1) // last argument is exit code
if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
func mainAdminInfo(ctx *cli.Context) error {
// Validate service status syntax.
checkAdminInfoSyntax(ctx)
console.SetColor("Info", color.New(color.FgGreen, color.Bold))
console.SetColor("InfoDegraded", color.New(color.FgYellow, color.Bold))
console.SetColor("InfoFail", color.New(color.FgRed, color.Bold))
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
// Create a new Minio Admin Client
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Cannot get a configured admin connection.")
fatalIf(err, "Unable to initialize admin connection.")
clusterInfo := clusterStruct{
onlyOffline: ctx.Bool("offline"),
}
// Fetch info of all servers (cluster or single server)
serversInfo, e := client.ServerInfo()
// Check the availability of the server: online or offline. A server is considered
// offline if we can't get any response or we get a bad format response
var serviceOffline bool
switch e.(type) {
case *json.SyntaxError:
serviceOffline = true
case *url.Error:
serviceOffline = true
admInfo, e := client.ServerInfo(globalContext)
if e != nil {
clusterInfo.Status = "error"
clusterInfo.Error = e.Error()
} else {
clusterInfo.Status = "success"
clusterInfo.Error = ""
}
if serviceOffline {
printMsg(infoMessage{Addr: aliasedURL, Service: "off"})
return nil
}
// If the error is not nil and not unrecognizable, just print it and exit
fatalIf(probe.NewError(e), "Cannot get service status.")
for _, serverInfo := range serversInfo {
// Print the error if exists and jump to the next server
if serverInfo.Error != "" {
printMsg(infoMessage{
Service: "on",
Addr: serverInfo.Addr,
Err: serverInfo.Error,
})
continue
}
// Construct the backend status
storageInfo := backendStatus{
Used: serverInfo.Data.StorageInfo.Used,
}
if serverInfo.Data.StorageInfo.Backend.Type == madmin.Erasure {
storageInfo.Backend = xlBackend{
Type: erasureType,
OnlineDisks: serverInfo.Data.StorageInfo.Backend.OnlineDisks,
OfflineDisks: serverInfo.Data.StorageInfo.Backend.OfflineDisks,
StandardSCData: serverInfo.Data.StorageInfo.Backend.StandardSCData,
StandardSCParity: serverInfo.Data.StorageInfo.Backend.StandardSCParity,
RRSCData: serverInfo.Data.StorageInfo.Backend.RRSCData,
RRSCParity: serverInfo.Data.StorageInfo.Backend.RRSCParity,
Sets: serverInfo.Data.StorageInfo.Backend.Sets,
}
} else {
storageInfo.Backend = fsBackend{
Type: fsType,
}
}
printMsg(infoMessage{
Service: "on",
Addr: serverInfo.Addr,
Err: serverInfo.Error,
ServerInfo: &ServerInfo{
StorageInfo: storageInfo,
ConnStats: serverInfo.Data.ConnStats,
Properties: serverInfo.Data.Properties,
},
})
}
clusterInfo.Info = admInfo
printMsg(clusterInfo)
return nil
}
+39
View File
@@ -0,0 +1,39 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"github.com/minio/cli"
)
var adminInspectCmd = cli.Command{
Name: "inspect",
Usage: "inspect files on MinIO server",
Action: mainAdminInspect,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
HideHelpCommand: true,
Hidden: true,
CustomHelpTemplate: "Please use 'mc support inspect'",
}
// mainAdminHeal - the entry function of heal command
func mainAdminInspect(_ *cli.Context) error {
deprecatedError("mc support inspect")
return nil
}
+70
View File
@@ -0,0 +1,70 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"fmt"
"os"
"github.com/fatih/color"
"github.com/minio/cli"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
"golang.org/x/term"
)
var adminKMSCreateKeyCmd = cli.Command{
Name: "create",
Usage: "creates a new master KMS key",
Action: mainAdminKMSCreateKey,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET [KEY_NAME]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Create a new master key named 'my-key' default master key.
$ {{.HelpName}} play my-key
`,
}
// adminKMSCreateKeyCmd is the handler for the "mc admin kms key create" command.
func mainAdminKMSCreateKey(ctx *cli.Context) error {
if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
client, err := newAdminClient(ctx.Args().Get(0))
fatalIf(err, "Cannot get a configured admin connection.")
keyID := ctx.Args().Get(1)
e := client.CreateKey(globalContext, keyID)
fatalIf(probe.NewError(e), "Failed to create master key")
if term.IsTerminal(int(os.Stdout.Fd())) {
console.Println(color.GreenString(fmt.Sprintf("Created master key `%s` successfully", keyID)))
}
return nil
}
+116
View File
@@ -0,0 +1,116 @@
// Copyright (c) 2015-2023 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"fmt"
"os"
"github.com/fatih/color"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/jedib0t/go-pretty/v6/text"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminKMSKeyListCmd = cli.Command{
Name: "list",
Usage: "request list of KMS master keys",
Action: mainAdminKMSKeyList,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Get list of master keys from a MinIO server/cluster.
$ {{.HelpName}} play
`,
}
// adminKMSKeyCmd is the handle for the "mc admin kms key" command.
func mainAdminKMSKeyList(ctx *cli.Context) error {
if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
console.SetColor("KeyName", color.New(color.FgBlue))
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Unable to initialize admin connection.")
keys, e := client.ListKeys(globalContext, "*")
fatalIf(probe.NewError(e).Trace(args...), "Unable to list KMS keys")
var rows []table.Row
kmsKeys := []string{}
for idx, k := range keys {
rows = append(rows, table.Row{idx + 1, k.Name})
kmsKeys = append(kmsKeys, k.Name)
}
if globalJSON {
printMsg(kmsKeysMsg{
Status: "success",
Target: aliasedURL,
Keys: kmsKeys,
})
return nil
}
t := table.NewWriter()
t.SetOutputMirror(os.Stdout)
t.SetColumnConfigs([]table.ColumnConfig{{Align: text.AlignCenter}})
t.SetTitle("KMS Keys")
t.AppendHeader(table.Row{"S N", "Name"})
t.AppendRows(rows)
t.SetStyle(table.StyleLight)
t.Render()
return nil
}
type kmsKeysMsg struct {
Status string `json:"status"`
Target string `json:"target"`
Keys []string `json:"keys"`
}
func (k kmsKeysMsg) JSON() string {
kmsBytes, e := json.MarshalIndent(k, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(kmsBytes)
}
func (k kmsKeysMsg) String() string {
return fmt.Sprintf("Keys: %s\n", k.Keys)
}
+120
View File
@@ -0,0 +1,120 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"fmt"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
var adminKMSKeyStatusCmd = cli.Command{
Name: "status",
Usage: "request status information for a KMS master key",
Action: mainAdminKMSKeyStatus,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET [KEY_NAME]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Get default master key and its status from a MinIO server/cluster.
$ {{.HelpName}} play
2. Get the status of one particular master key from a MinIO server/cluster.
$ {{.HelpName}} play my-master-key
`,
}
// adminKMSKeyCmd is the handle for the "mc admin kms key" command.
func mainAdminKMSKeyStatus(ctx *cli.Context) error {
if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
console.SetColor("StatusSuccess", color.New(color.FgGreen, color.Bold))
console.SetColor("StatusError", color.New(color.FgRed, color.Bold))
console.SetColor("StatusUnknown", color.New(color.FgYellow, color.Bold))
client, err := newAdminClient(ctx.Args().Get(0))
fatalIf(err, "Unable to get a configured admin connection.")
var keyID string
if len(ctx.Args()) == 2 {
keyID = ctx.Args().Get(1)
}
status, e := client.GetKeyStatus(globalContext, keyID)
fatalIf(probe.NewError(e), "Failed to get status information")
printMsg(kmsKeyStatusMsg{
KeyID: status.KeyID,
EncryptionErr: status.EncryptionErr,
DecryptionErr: status.DecryptionErr,
})
return nil
}
type kmsKeyStatusMsg struct {
KeyID string `json:"keyId"`
EncryptionErr string `json:"encryptionError,omitempty"`
DecryptionErr string `json:"decryptionError,omitempty"`
Status string `json:"status"`
}
func (s kmsKeyStatusMsg) JSON() string {
s.Status = "success"
kmsBytes, e := json.MarshalIndent(s, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(kmsBytes)
}
func (s kmsKeyStatusMsg) String() string {
msg := fmt.Sprintf("Key: %s\n", s.KeyID)
success := console.Colorize("StatusSuccess", "✔")
failure := console.Colorize("StatusError", "✗")
dunno := console.Colorize("StatusUnknown", "?")
formatStatus := func(name string, unknown bool, err string) string {
st := ""
switch {
case !unknown && err == "":
st = success
case unknown:
st = dunno
case err != "":
st = fmt.Sprintf("%s (%s)", failure, err)
}
return fmt.Sprintf(" - %s %s\n", name, st)
}
msg += formatStatus("Encryption", false, s.EncryptionErr)
msg += formatStatus("Decryption", s.EncryptionErr != "", s.DecryptionErr)
return msg
}
+42
View File
@@ -0,0 +1,42 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import "github.com/minio/cli"
var adminKMSKeySubcommands = []cli.Command{
adminKMSCreateKeyCmd,
adminKMSKeyStatusCmd,
adminKMSKeyListCmd,
}
var adminKMSKeyCmd = cli.Command{
Name: "key",
Usage: "manage KMS master keys: Request key status information",
Action: mainAdminKMSKey,
Before: setGlobalsFromContext,
Flags: globalFlags,
Subcommands: adminKMSKeySubcommands,
HideHelpCommand: true,
}
// mainAdminKMSKey is the handle for the "mc admin kms key" command.
func mainAdminKMSKey(ctx *cli.Context) error {
commandNotFound(ctx, adminKMSKeySubcommands)
return nil
}
+40
View File
@@ -0,0 +1,40 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import "github.com/minio/cli"
var adminKMSSubcommands = []cli.Command{
adminKMSKeyCmd,
}
var adminKMSCmd = cli.Command{
Name: "kms",
Usage: "perform KMS management operations",
Action: mainAdminKMS,
Before: setGlobalsFromContext,
Flags: globalFlags,
Subcommands: adminKMSSubcommands,
HideHelpCommand: true,
}
// mainAdminKMS is the handle for the "mc admin kms" command.
func mainAdminKMS(ctx *cli.Context) error {
commandNotFound(ctx, adminKMSSubcommands)
return nil
}
+211
View File
@@ -0,0 +1,211 @@
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"context"
"fmt"
"strings"
"time"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/madmin-go/v3"
"github.com/minio/mc/pkg/probe"
"github.com/minio/pkg/v3/console"
)
const logTimeFormat string = "15:04:05 MST 01/02/2006"
var logsShowFlags = []cli.Flag{
cli.IntFlag{
Name: "last, l",
Usage: "show last n log entries",
Value: 10,
},
cli.StringFlag{
Name: "type, t",
Usage: "list error logs by type. Valid options are '[minio, application, all]'",
Value: "all",
},
}
var adminLogsCmd = cli.Command{
Name: "logs",
Usage: "show MinIO logs",
OnUsageError: onUsageError,
Action: mainAdminLogs,
Before: setGlobalsFromContext,
Flags: append(logsShowFlags, globalFlags...),
HideHelpCommand: true,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} [FLAGS] TARGET [NODENAME]
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Show logs for a MinIO server with alias 'myminio'
{{.Prompt}} {{.HelpName}} myminio
2. Show last 5 log entries for node 'node1' for a MinIO server with alias 'myminio'
{{.Prompt}} {{.HelpName}} --last 5 myminio node1
3. Show application errors in logs for a MinIO server with alias 'myminio'
{{.Prompt}} {{.HelpName}} --type application myminio
`,
}
func checkLogsShowSyntax(ctx *cli.Context) {
if len(ctx.Args()) == 0 || len(ctx.Args()) > 3 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
}
}
// Extend madmin.LogInfo to add String() and JSON() methods
type logMessage struct {
Status string `json:"status"`
madmin.LogInfo
}
// JSON - jsonify loginfo
func (l logMessage) JSON() string {
l.Status = "success"
logJSON, e := json.MarshalIndent(&l, "", " ")
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(logJSON)
}
func getLogTime(lt string) string {
tm, e := time.Parse(time.RFC3339Nano, lt)
if e != nil {
return lt
}
return tm.Format(logTimeFormat)
}
// String - return colorized loginfo as string.
func (l logMessage) String() string {
var hostStr string
b := &strings.Builder{}
if l.NodeName != "" {
hostStr = fmt.Sprintf("%s ", colorizedNodeName(l.NodeName))
}
if l.API != nil {
apiString := "API: " + l.API.Name + "("
if l.API.Args != nil && l.API.Args.Bucket != "" {
apiString = apiString + "bucket=" + l.API.Args.Bucket
}
if l.API.Args != nil && l.API.Args.Object != "" {
apiString = apiString + ", object=" + l.API.Args.Object
}
apiString += ")"
fmt.Fprintf(b, "\n%s %s", hostStr, console.Colorize("API", apiString))
}
if l.Time != "" {
fmt.Fprintf(b, "\n%s Time: %s", hostStr, getLogTime(l.Time))
}
if l.DeploymentID != "" {
fmt.Fprintf(b, "\n%s DeploymentID: %s", hostStr, l.DeploymentID)
}
if l.RequestID != "" {
fmt.Fprintf(b, "\n%s RequestID: %s", hostStr, l.RequestID)
}
if l.RemoteHost != "" {
fmt.Fprintf(b, "\n%s RemoteHost: %s", hostStr, l.RemoteHost)
}
if l.UserAgent != "" {
fmt.Fprintf(b, "\n%s UserAgent: %s", hostStr, l.UserAgent)
}
if l.Message != "" {
fmt.Fprintf(b, "\n%s Message: %s", hostStr, l.Message)
}
if l.Trace != nil {
if l.Trace.Message != "" {
fmt.Fprintf(b, "\n%s Error: %s", hostStr, console.Colorize("LogMessage", l.Trace.Message))
}
if l.Trace.Variables != nil {
for key, value := range l.Trace.Variables {
if value != "" {
fmt.Fprintf(b, "\n%s %s=%s", hostStr, key, value)
}
}
}
if l.Trace.Source != nil {
traceLength := len(l.Trace.Source)
for i, element := range l.Trace.Source {
fmt.Fprintf(b, "\n%s %8v: %s", hostStr, traceLength-i, element)
}
}
}
logMsg := strings.TrimPrefix(b.String(), "\n")
return fmt.Sprintf("%s\n", logMsg)
}
// mainAdminLogs - the entry function of admin logs
func mainAdminLogs(ctx *cli.Context) error {
// Check for command syntax
checkLogsShowSyntax(ctx)
console.SetColor("LogMessage", color.New(color.Bold, color.FgRed))
console.SetColor("Api", color.New(color.Bold, color.FgWhite))
for _, c := range colors {
console.SetColor(fmt.Sprintf("Node%d", c), color.New(c))
}
aliasedURL := ctx.Args().Get(0)
var node string
if len(ctx.Args()) > 1 {
node = ctx.Args().Get(1)
}
var last int
if ctx.IsSet("last") {
last = ctx.Int("last")
if last <= 0 {
fatalIf(errInvalidArgument().Trace(ctx.Args()...), "please set a proper limit, for example: '--last 5' to display last 5 logs, omit this flag to display all available logs")
}
}
logType := strings.ToLower(ctx.String("type"))
if logType != "minio" && logType != "application" && logType != "all" {
fatalIf(errInvalidArgument().Trace(ctx.Args()...), "Invalid value for --type flag. Valid options are [minio, application, all]")
}
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
if err != nil {
fatalIf(err.Trace(aliasedURL), "Unable to initialize admin client.")
return nil
}
ctxt, cancel := context.WithCancel(globalContext)
defer cancel()
// Start listening on all console log activity.
logCh := client.GetLogs(ctxt, node, last, logType)
for logInfo := range logCh {
if logInfo.Err != nil {
fatalIf(probe.NewError(logInfo.Err), "Unable to listen to console logs")
}
// drop nodeName from output if specified as cli arg
if node != "" {
logInfo.NodeName = ""
}
if logInfo.DeploymentID != "" {
printMsg(logMessage{LogInfo: logInfo})
}
}
return nil
}
+60 -30
View File
@@ -1,49 +1,79 @@
/*
* Minio Client (C) 2016, 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import "github.com/minio/cli"
var (
adminFlags = []cli.Flag{}
var adminFlags = []cli.Flag{}
const (
// dot represents a list item, for eg. server status - online (green) or offline (red)
dot = "●"
// check represents successful operation
check = "✔"
)
var adminCmdSubcommands = []cli.Command{
adminServiceCmd,
adminServerUpdateCmd,
adminInfoCmd,
adminInspectCmd,
adminUserCmd,
adminGroupCmd,
adminPolicyCmd,
adminReplicateCmd,
adminIDPCmd,
adminConfigCmd,
adminDecommissionCmd,
adminHealCmd,
adminPrometheusCmd,
adminKMSCmd,
adminHealthCmd(),
adminSubnetCmd,
adminBucketCmd,
adminTierCmd,
adminSpeedtestCmd,
adminProfileCmd,
adminScannerCmd,
adminTopCmd,
adminTraceCmd,
adminConsoleCmd,
adminClusterCmd,
adminRebalanceCmd,
adminLogsCmd,
adminAccesskeyCmd,
}
var adminCmd = cli.Command{
Name: "admin",
Usage: "manage minio servers",
Usage: "manage MinIO servers",
Action: mainAdmin,
Subcommands: adminCmdSubcommands,
HideHelpCommand: true,
Before: setGlobalsFromContext,
Flags: append(adminFlags, globalFlags...),
Subcommands: []cli.Command{
adminServiceCmd,
adminInfoCmd,
adminUserCmd,
adminPolicyCmd,
adminCredsCmd,
adminConfigCmd,
adminHealCmd,
adminProfileCmd,
},
}
const dateTimeFormatFilename = "2006-01-02T15-04-05.999999-07-00"
// mainAdmin is the handle for "mc admin" command.
func mainAdmin(ctx *cli.Context) error {
cli.ShowCommandHelp(ctx, ctx.Args().First())
commandNotFound(ctx, adminCmdSubcommands)
return nil
// Sub-commands like "service", "heal", "lock" have their own main.
// Sub-commands like "service", "heal", "top" have their own main.
}
+27 -111
View File
@@ -1,123 +1,39 @@
/*
* Minio Client (C) 2018 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright (c) 2015-2022 MinIO, Inc.
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"encoding/json"
"io/ioutil"
"github.com/fatih/color"
"github.com/minio/cli"
"github.com/minio/mc/pkg/console"
"github.com/minio/mc/pkg/probe"
)
var adminPolicyAddCmd = cli.Command{
Name: "add",
Usage: "add new policy",
Action: mainAdminPolicyAdd,
Before: setGlobalsFromContext,
Flags: globalFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} TARGET POLICYNAME POLICYFILE
POLICYNAME:
Name of the canned policy on Minio server.
POLICYFILE:
Name of the policy file associated with the policy name.
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
EXAMPLES:
1. Add a new canned policy 'writeonly'.
$ {{.HelpName}} myminio writeonly /tmp/writeonly.json
`,
Name: "add",
Usage: "add an IAM policy",
Action: mainAdminPolicyAdd,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
Flags: globalFlags,
HideHelpCommand: true,
Hidden: true,
CustomHelpTemplate: `Please use 'mc admin policy create'`,
}
// checkAdminPolicyAddSyntax - validate all the passed arguments
func checkAdminPolicyAddSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 3 {
cli.ShowCommandHelpAndExit(ctx, "add", 1) // last argument is exit code
}
}
// userPolicyMessage container for content message structure
type userPolicyMessage struct {
op string
Status string `json:"status"`
Policy string `json:"policy,omitempty"`
PolicyJSON []byte `json:"policyJSON,omitempty"`
}
func (u userPolicyMessage) String() string {
switch u.op {
case "list":
if len(u.PolicyJSON) > 0 {
return string(u.PolicyJSON)
}
policyFieldMaxLen := 20
// Create a new pretty table with cols configuration
return newPrettyTable(" ",
Field{"Policy", policyFieldMaxLen},
).buildRow(u.Policy)
case "remove":
return console.Colorize("PolicyMessage", "Removed policy `"+u.Policy+"` successfully.")
case "add":
return console.Colorize("PolicyMessage", "Added policy `"+u.Policy+"` successfully.")
}
return ""
}
func (u userPolicyMessage) JSON() string {
u.Status = "success"
jsonMessageBytes, e := json.Marshal(u)
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
return string(jsonMessageBytes)
}
// mainAdminPolicyAdd is the handle for "mc admin policy add" command.
func mainAdminPolicyAdd(ctx *cli.Context) error {
checkAdminPolicyAddSyntax(ctx)
console.SetColor("PolicyMessage", color.New(color.FgGreen))
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
policy, e := ioutil.ReadFile(args.Get(2))
fatalIf(probe.NewError(e).Trace(args...), "Unable to get policy")
// Create a new Minio Admin Client
client, err := newAdminClient(aliasedURL)
fatalIf(err, "Cannot get a configured admin connection.")
fatalIf(probe.NewError(client.AddCannedPolicy(args.Get(1), string(policy))).Trace(args...), "Cannot add new policy")
printMsg(userPolicyMessage{
op: "add",
Policy: args.Get(1),
})
func mainAdminPolicyAdd(_ *cli.Context) error {
deprecatedError("mc admin policy create")
return nil
}

Some files were not shown because too many files have changed in this diff Show More