Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

Commit

Permalink
chore: Some fixes to tests and "kn admin" (#20)
Browse files Browse the repository at this point in the history
* Fixed access to read only variable CHANGEDFILES

and removed some bogus files

* plugin(admin): updated go.mod

* some minor updates

* Distribute OWNERS over subdirectories

* chore: Fix syntax error

* add missing test files
  • Loading branch information
rhuss authored Apr 22, 2020
1 parent 677ce85 commit 266a40d
Show file tree
Hide file tree
Showing 196 changed files with 2,074 additions and 6,721 deletions.
2 changes: 0 additions & 2 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
approvers:
- sixolet
- cppforlife
- rhuss
- maximilien
- navidshaikh
- zhanggbj
# TOC members as a fallback
- mattmoor
- evankanderson
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ All plugins are stored below the `plugins/` directory. Currently, you can find t

#### kn-hello

[kn-hello](plugin/hello) is a "Hello World" plugin which also serves as a blueprint for new plugins. It contains the pieces that a mandatory for any new (golang based) plugin.
[kn-hello](plugins/hello/README.adoc) is a "Hello World" plugin which also serves as a blueprint for new plugins. It contains the pieces that a mandatory for any new (golang based) plugin.

I.e. it demonstrates:

Expand All @@ -18,6 +18,11 @@ I.e. it demonstrates:
* How CI and testing, in general, can be setup
* Contains a sample build tool `build.sh` which can easily be customized

### kn-admin

[kn-admin](plugins/admin/README.adoc) helps in configuring a Knative installation on Kubernetes.


_list of plugins to be continued ..._

### How to contribute a plugin
Expand Down
Binary file removed kn-admin
Binary file not shown.
1 change: 1 addition & 0 deletions plugins/admin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kn-admin*
2 changes: 2 additions & 0 deletions plugins/admin/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
approvers:
- zhanggbj
19 changes: 9 additions & 10 deletions plugins/admin/README.adoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
## kn-admin

A kn plugin for Knative cluster management.

`kn hello` prints out a friendly message to the user.
`kn admin` helps for Knative configuration when running on a Kubernetes cluster.

### Description

Expand Down Expand Up @@ -59,32 +57,33 @@ Use "admin domain [command] --help" for more information about a command.
----

#### `kn admin private-registry`
#### `kn admin registry`

----
Manage Service deployment from a private registry
For example:
kn admin private-registry enable \
kn admin registry add \
--secret-name=[SECRET_NAME]
--docker-server=[PRIVATE_REGISTRY_SERVER_URL] \
--docker-email=[PRIVATE_REGISTRY_EMAIL] \
--docker-username=[PRIVATE_REGISTRY_USER] \
--docker-password=[PRIVATE_REGISTRY_PASSWORD]
Usage:
kn admin private-registry [command]
kn admin registry [command]
Available Commands:
enable enable Service deployment from a private registry
add Add a Service deployment from a registry
Flags:
-h, --help help for private-registry
Global Flags:
--config string config file (default is $HOME/.config/kn/plugins/admin.yaml)
Use "admin private-registry [command] --help" for more information about a command.
Use "admin registry [command] --help" for more information about a command.
----

Expand All @@ -111,10 +110,10 @@ Updated Knative route domain test.com

#### As a Knative administrator, I want to enable deploying from private registry.

.Enable a private registry with given credentials for Service creation
.Enable a private registry with given credentials for Service creation.
=====
-----
$ kn admin private-registry enable \
$ kn admin registry add \
--secret-name=[SECRET_NAME]
--docker-server=[PRIVATE_REGISTRY_SERVER_URL] \
--docker-email=[PRIVATE_REGISTRY_EMAIL] \
Expand Down
2 changes: 1 addition & 1 deletion plugins/admin/core/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"fmt"
"os"

"github.com/mitchellh/go-homedir"
homedir "github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/client-go/kubernetes"
Expand Down
8 changes: 0 additions & 8 deletions plugins/admin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,11 @@ module knative.dev/client-contrib/plugins/admin
go 1.13

require (
github.com/google/go-cmp v0.3.1 // indirect
github.com/googleapis/gnostic v0.2.2 // indirect
github.com/imdario/mergo v0.3.8 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/pkg/errors v0.8.1 // indirect
github.com/spf13/cobra v0.0.5
github.com/spf13/viper v1.6.2
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 // indirect
golang.org/x/sys v0.0.0-20191010194322-b09406accb47 // indirect
google.golang.org/appengine v1.6.2 // indirect
gotest.tools v2.2.0+incompatible
k8s.io/api v0.17.3
k8s.io/apimachinery v0.17.3
k8s.io/client-go v0.17.0
k8s.io/utils v0.0.0-20200124190032-861946025e34 // indirect
)
46 changes: 3 additions & 43 deletions plugins/admin/go.sum

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions plugins/admin/test/presubmit-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2020 The Knative Authors
#
# 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.

# ==========================================
# Unit and Build tests


# We can't use MD checks now as they will propagate into
# the plugins' vendor/ dir
# (the filter in markdown_build_tests() in test-infra/scripts/presumit-tests.sh is
# not strong enough
export DISABLE_MD_LINTING=1
export DISABLE_MD_LINK_CHECK=1

export PRESUBMIT_TEST_FAIL_FAST=1
export GO111MODULE=on

source $(dirname $0)/../../../test-infra/scripts/presubmit-tests.sh

# Run cross platform build to ensure kn compiles for Linux, macOS and Windows
function post_build_tests() {
local failed=0
header "Ensuring cross platform build"
./hack/build.sh -x || failed=1
if (( failed )); then
results_banner "Cross platform build" ${failed}
exit ${failed}
fi
}

# Run the unit tests with an additional flag '-mod=vendor' to avoid
# downloading the deps in unit tests CI job
function unit_tests() {
report_go_test -race -mod=vendor ./... || failed=1
}

# We use the default build and integration test runners.
main "$@"

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 266a40d

Please sign in to comment.