-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #339 from jadarsie/e2e
v1alpha2 e2e initial work
- Loading branch information
Showing
25 changed files
with
1,558 additions
and
555 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
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,54 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2019 The Kubernetes 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
GOPATH_BIN="$(go env GOPATH)/bin/" | ||
MINIMUM_KUSTOMIZE_VERSION=3.1.0 | ||
|
||
# Ensure the kustomize tool exists and is a viable version, or installs it | ||
verify_kustomize_version() { | ||
|
||
# If kustomize is not available on the path, get it | ||
if ! [ -x "$(command -v kustomize)" ]; then | ||
if [[ "${OSTYPE}" == "linux-gnu" ]]; then | ||
echo 'kustomize not found, installing' | ||
if ! [ -d "${GOPATH_BIN}" ]; then | ||
mkdir -p "${GOPATH_BIN}" | ||
fi | ||
curl -sLo "${GOPATH_BIN}/kustomize" https://github.com/kubernetes-sigs/kustomize/releases/download/v${MINIMUM_KUSTOMIZE_VERSION}/kustomize_${MINIMUM_KUSTOMIZE_VERSION}_linux_amd64 | ||
chmod +x "${GOPATH_BIN}/kustomize" | ||
else | ||
echo "Missing required binary in path: kustomize" | ||
return 2 | ||
fi | ||
fi | ||
|
||
local kustomize_version | ||
kustomize_version=$(kustomize version) | ||
if [[ "${MINIMUM_KUSTOMIZE_VERSION}" != $(echo -e "${MINIMUM_KUSTOMIZE_VERSION}\n${kustomize_version}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) ]]; then | ||
cat <<EOF | ||
Detected kustomize version: ${kustomize_version}. | ||
Requires ${MINIMUM_KUSTOMIZE_VERSION} or greater. | ||
Please install ${MINIMUM_KUSTOMIZE_VERSION} or later. | ||
EOF | ||
return 2 | ||
fi | ||
} | ||
|
||
verify_kustomize_version |
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,66 @@ | ||
/* | ||
Copyright 2019 The Kubernetes 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. | ||
*/ | ||
|
||
package auth | ||
|
||
import ( | ||
"fmt" | ||
"io/ioutil" | ||
"os" | ||
|
||
"github.com/pelletier/go-toml" | ||
) | ||
|
||
// Config stores the auth info | ||
type Config struct { | ||
Creds | ||
} | ||
|
||
// Creds stores the auth info | ||
type Creds struct { | ||
ClientID string | ||
ClientSecret string | ||
TenantID string | ||
SubscriptionID string | ||
StorageAccountName string | ||
StorageAccountKey string | ||
} | ||
|
||
// LoadFromFile loads auth info from the input file path | ||
// This was mostly copied from the test-infra repo | ||
func LoadFromFile(credsFile string) (Creds, error) { | ||
fmt.Printf("Loading credentials from file %v\n", credsFile) | ||
content, err := ioutil.ReadFile(credsFile) | ||
if err != nil { | ||
return Creds{}, fmt.Errorf("error reading credentials file %v %v", credsFile, err) | ||
} | ||
config := Config{} | ||
if err = toml.Unmarshal(content, &config); err != nil { | ||
return Creds{}, fmt.Errorf("error parsing credentials file %v %v", credsFile, err) | ||
} | ||
return config.Creds, nil | ||
} | ||
|
||
// LoadFromEnvironment loads auth info from the environment | ||
func LoadFromEnvironment() (Creds, error) { | ||
fmt.Print("Loading credentials from environment\n") | ||
return Creds{ | ||
TenantID: os.Getenv("AZURE_TENANT_ID"), | ||
SubscriptionID: os.Getenv("AZURE_SUBSCRIPTION_ID"), | ||
ClientID: os.Getenv("AZURE_CLIENT_ID"), | ||
ClientSecret: os.Getenv("AZURE_CLIENT_SECRET"), | ||
}, nil | ||
} |
Oops, something went wrong.