forked from kubernetes/minikube
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/kubernetes/minikube into …
…master_srikrishnabh
- Loading branch information
Showing
99 changed files
with
1,698 additions
and
640 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Sync docker images of minikube to Alibaba Cloud | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# every day at 7am & 7pm pacific | ||
- cron: "0 2,14 * * *" | ||
|
||
jobs: | ||
sync-images: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./image-syncer | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: denverdino/image-syncer | ||
path: ./image-syncer | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Build | ||
run: make | ||
|
||
- name: Synchronize images to Alibaba Cloud Container Registry Service | ||
env: | ||
ACR_USER: ${{ secrets.ALIBABA_CLOUD_ACR_USER }} | ||
ACR_PASSWORD: ${{ secrets.ALIBABA_CLOUD_ACR_PASSWORD }} | ||
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }} | ||
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} | ||
|
||
run: ./image-syncer --auth=auth.json --images=images.json --days=2 --proc=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
Copyright 2021 The Kubernetes Authors All rights reserved. | ||
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 config | ||
|
||
import ( | ||
"encoding/json" | ||
"os" | ||
"testing" | ||
|
||
"k8s.io/minikube/pkg/minikube/out" | ||
) | ||
|
||
func TestAddonsList(t *testing.T) { | ||
t.Run("NonExistingClusterTable", func(t *testing.T) { | ||
b := make([]byte, 167) | ||
r, w, err := os.Pipe() | ||
if err != nil { | ||
t.Fatalf("failed to create pipe: %v", err) | ||
} | ||
old := os.Stdout | ||
defer func() { os.Stdout = old }() | ||
os.Stdout = w | ||
printAddonsList(nil) | ||
if err := w.Close(); err != nil { | ||
t.Fatalf("failed to close pipe: %v", err) | ||
} | ||
if _, err := r.Read(b); err != nil { | ||
t.Fatalf("failed to read bytes: %v", err) | ||
} | ||
got := string(b) | ||
expected := `|-----------------------------|-----------------------| | ||
| ADDON NAME | MAINTAINER | | ||
|-----------------------------|-----------------------|` | ||
if got != expected { | ||
t.Errorf("Expected header to be: %q; got = %q", expected, got) | ||
} | ||
}) | ||
|
||
t.Run("NonExistingClusterJSON", func(t *testing.T) { | ||
type addons struct { | ||
Ambassador *interface{} `json:"ambassador"` | ||
} | ||
|
||
b := make([]byte, 534) | ||
r, w, err := os.Pipe() | ||
if err != nil { | ||
t.Fatalf("failed to create pipe: %v", err) | ||
} | ||
old := os.Stdout | ||
defer func() { | ||
os.Stdout = old | ||
out.SetOutFile(os.Stdout) | ||
}() | ||
os.Stdout = w | ||
out.SetOutFile(os.Stdout) | ||
printAddonsJSON(nil) | ||
if err := w.Close(); err != nil { | ||
t.Fatalf("failed to close pipe: %v", err) | ||
} | ||
if _, err := r.Read(b); err != nil { | ||
t.Fatalf("failed to read bytes: %v", err) | ||
} | ||
got := addons{} | ||
if err := json.Unmarshal(b, &got); err != nil { | ||
t.Fatalf("failed to unmarshal output; output: %q; err: %v", string(b), err) | ||
} | ||
if got.Ambassador == nil { | ||
t.Errorf("expected `ambassador` field to not be nil, but was") | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.