Merge pull request #1622 from monopole/fixNits

Fix some nits
This commit is contained in:
Jeff Regan
2019-10-12 07:43:03 -07:00
committed by GitHub
11 changed files with 103 additions and 123 deletions

View File

@@ -82,13 +82,13 @@ following:
"docID45", "docID45",
... ...
], ],
} },
{ {
"identifier": "another:k8s:feature", "identifier": "another:k8s:feature",
"documents": [ "documents": [
... ...
], ],
} },
... ...
] ]

View File

@@ -27,7 +27,7 @@ type Crawler interface {
// Crawl returns when it is done processing. This method does not take // Crawl returns when it is done processing. This method does not take
// ownership of the channel. The channel is write only, and it // ownership of the channel. The channel is write only, and it
// designates where the crawler should forward the documents. // designates where the crawler should forward the documents.
Crawl(ctx context.Context, output chan<- CrawlerDocument) error Crawl(ctx context.Context, output chan<- CrawledDocument) error
// Get the document data given the FilePath, Repo, and Ref/Tag/Branch. // Get the document data given the FilePath, Repo, and Ref/Tag/Branch.
FetchDocument(context.Context, *doc.Document) error FetchDocument(context.Context, *doc.Document) error
@@ -37,21 +37,21 @@ type Crawler interface {
Match(*doc.Document) bool Match(*doc.Document) bool
} }
type CrawlerDocument interface { type CrawledDocument interface {
ID() string ID() string
GetDocument() *doc.Document GetDocument() *doc.Document
GetResources() ([]*doc.Document, error) GetResources() ([]*doc.Document, error)
WasCached() bool WasCached() bool
} }
type CrawlerSeed []*doc.Document type CrawlSeed []*doc.Document
type IndexFunc func(CrawlerDocument, Crawler) error type IndexFunc func(CrawledDocument, Crawler) error
type Converter func(*doc.Document) (CrawlerDocument, error) type Converter func(*doc.Document) (CrawledDocument, error)
// Cleaner, more efficient, and more extensible crawler implementation. // Cleaner, more efficient, and more extensible crawler implementation.
// The seed must include the ids of each document in the index. // The seed must include the ids of each document in the index.
func CrawlFromSeed(ctx context.Context, seed CrawlerSeed, func CrawlFromSeed(ctx context.Context, seed CrawlSeed,
crawlers []Crawler, conv Converter, indx IndexFunc) { crawlers []Crawler, conv Converter, indx IndexFunc) {
seen := make(map[string]struct{}) seen := make(map[string]struct{})
@@ -63,7 +63,7 @@ func CrawlFromSeed(ctx context.Context, seed CrawlerSeed,
logger.Println("error: ", err) logger.Println("error: ", err)
} }
stack := make(CrawlerSeed, 0) stack := make(CrawlSeed, 0)
findMatch := func(d *doc.Document) Crawler { findMatch := func(d *doc.Document) Crawler {
for _, crawl := range crawlers { for _, crawl := range crawlers {
@@ -75,7 +75,7 @@ func CrawlFromSeed(ctx context.Context, seed CrawlerSeed,
return nil return nil
} }
addBranches := func(cdoc CrawlerDocument, match Crawler) { addBranches := func(cdoc CrawledDocument, match Crawler) {
if _, ok := seen[cdoc.ID()]; ok { if _, ok := seen[cdoc.ID()]; ok {
return return
} }
@@ -101,7 +101,7 @@ func CrawlFromSeed(ctx context.Context, seed CrawlerSeed,
} }
} }
doCrawl := func(docsPtr *CrawlerSeed) { doCrawl := func(docsPtr *CrawlSeed) {
for len(*docsPtr) > 0 { for len(*docsPtr) > 0 {
back := len(*docsPtr) - 1 back := len(*docsPtr) - 1
next := (*docsPtr)[back] next := (*docsPtr)[back]
@@ -139,7 +139,7 @@ func CrawlFromSeed(ctx context.Context, seed CrawlerSeed,
logger.Printf("crawling %d new documents found in the seed\n", len(stack)) logger.Printf("crawling %d new documents found in the seed\n", len(stack))
doCrawl(&stack) doCrawl(&stack)
ch := make(chan CrawlerDocument, 1<<10) ch := make(chan CrawledDocument, 1<<10)
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
wg.Add(1) wg.Add(1)
@@ -160,7 +160,7 @@ func CrawlFromSeed(ctx context.Context, seed CrawlerSeed,
}() }()
// Exploration through APIs. // Exploration through APIs.
errs := CrawlerRunner(ctx, ch, crawlers) errs := CRunner(ctx, ch, crawlers)
if errs != nil { if errs != nil {
for _, err := range errs { for _, err := range errs {
logIfErr(err) logIfErr(err)
@@ -175,7 +175,7 @@ func CrawlFromSeed(ctx context.Context, seed CrawlerSeed,
doCrawl(&stack) doCrawl(&stack)
} }
// CrawlerRunner is a blocking function and only returns once all of the // CRunner is a blocking function and only returns once all of the
// crawlers are finished with execution. // crawlers are finished with execution.
// //
// This function uses the output channel to forward kustomization documents // This function uses the output channel to forward kustomization documents
@@ -186,14 +186,14 @@ func CrawlFromSeed(ctx context.Context, seed CrawlerSeed,
// index of the crawler that emitted the error. Although the errors themselves // index of the crawler that emitted the error. Although the errors themselves
// can be nil, the array will always be exactly the size of the crawlers array. // can be nil, the array will always be exactly the size of the crawlers array.
// //
// Crawler Runner takes in a seed, which represents the documents stored in an // CRunner takes in a seed, which represents the documents stored in an
// index somewhere. The document data is not required to be populated. If there // index somewhere. The document data is not required to be populated. If there
// are many documents, this is preferable. The order of iteration over the seed // are many documents, this is preferable. The order of iteration over the seed
// is not garanteed, but the CrawlerRunner does guarantee that every element // is not garanteed, but the CRunner does guarantee that every element
// from the seed will be processed before any other documents from the // from the seed will be processed before any other documents from the
// crawlers. // crawlers.
func CrawlerRunner(ctx context.Context, func CRunner(ctx context.Context,
output chan<- CrawlerDocument, crawlers []Crawler) []error { output chan<- CrawledDocument, crawlers []Crawler) []error {
errs := make([]error, len(crawlers)) errs := make([]error, len(crawlers))
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
@@ -201,12 +201,12 @@ func CrawlerRunner(ctx context.Context,
for i, crawler := range crawlers { for i, crawler := range crawlers {
// Crawler implementations get their own channels to prevent a // Crawler implementations get their own channels to prevent a
// crawler from closing the main output channel. // crawler from closing the main output channel.
docs := make(chan CrawlerDocument) docs := make(chan CrawledDocument)
wg.Add(2) wg.Add(2)
// Forward all of the documents from this crawler's channel to // Forward all of the documents from this crawler's channel to
// the main output channel. // the main output channel.
go func(docs <-chan CrawlerDocument) { go func(docs <-chan CrawledDocument) {
defer wg.Done() defer wg.Done()
for doc := range docs { for doc := range docs {
output <- doc output <- doc
@@ -215,7 +215,7 @@ func CrawlerRunner(ctx context.Context,
// Run this crawler and capture its returned error. // Run this crawler and capture its returned error.
go func(idx int, crawler Crawler, go func(idx int, crawler Crawler,
docs chan<- CrawlerDocument) { docs chan<- CrawledDocument) {
defer func() { defer func() {
wg.Done() wg.Done()

View File

@@ -47,7 +47,7 @@ func (c testCrawler) FetchDocument(ctx context.Context, d *doc.Document) error {
d.DocumentData = c.docs[i].DocumentData d.DocumentData = c.docs[i].DocumentData
return nil return nil
} }
return fmt.Errorf("Document %v does not exist for matcher: %s", return fmt.Errorf("document %v does not exist for matcher: %s",
d, c.matchPrefix) d, c.matchPrefix)
} }
@@ -72,7 +72,7 @@ func newCrawler(matchPrefix string, err error,
// Crawl implements the Crawler interface for testing. // Crawl implements the Crawler interface for testing.
func (c testCrawler) Crawl(ctx context.Context, func (c testCrawler) Crawl(ctx context.Context,
output chan<- CrawlerDocument) error { output chan<- CrawledDocument) error {
for i, d := range c.docs { for i, d := range c.docs {
isResource := true isResource := true
@@ -107,7 +107,7 @@ func (s sortableDocs) Len() int {
} }
func TestCrawlerRunner(t *testing.T) { func TestCrawlerRunner(t *testing.T) {
fmt.Println("testing CrawlerRunner") fmt.Println("testing CRunner")
tests := []struct { tests := []struct {
tc []Crawler tc []Crawler
errs []error errs []error
@@ -169,7 +169,7 @@ func TestCrawlerRunner(t *testing.T) {
} }
for _, test := range tests { for _, test := range tests {
output := make(chan CrawlerDocument) output := make(chan CrawledDocument)
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
wg.Add(1) wg.Add(1)
@@ -178,7 +178,7 @@ func TestCrawlerRunner(t *testing.T) {
defer close(output) defer close(output)
defer wg.Done() defer wg.Done()
errs := CrawlerRunner(context.Background(), errs := CRunner(context.Background(),
output, test.tc) output, test.tc)
// Check that errors are returned as they should be. // Check that errors are returned as they should be.
@@ -215,12 +215,12 @@ func TestCrawlFromSeed(t *testing.T) {
fmt.Println("testing CrawlFromSeed") fmt.Println("testing CrawlFromSeed")
tests := []struct { tests := []struct {
seed CrawlerSeed seed CrawlSeed
matcher string matcher string
corpus []doc.KustomizationDocument corpus []doc.KustomizationDocument
}{ }{
{ {
seed: CrawlerSeed{ seed: CrawlSeed{
{ {
RepositoryURL: kustomizeRepo, RepositoryURL: kustomizeRepo,
FilePath: "examples/helloWorld/kustomization.yaml", FilePath: "examples/helloWorld/kustomization.yaml",
@@ -333,12 +333,12 @@ resources:
cr := newCrawler(tc.matcher, nil, tc.corpus) cr := newCrawler(tc.matcher, nil, tc.corpus)
visited := make(map[string]int) visited := make(map[string]int)
CrawlFromSeed(context.Background(), tc.seed, []Crawler{cr}, CrawlFromSeed(context.Background(), tc.seed, []Crawler{cr},
func(d *doc.Document) (CrawlerDocument, error) { func(d *doc.Document) (CrawledDocument, error) {
return &doc.KustomizationDocument{ return &doc.KustomizationDocument{
Document: *d, Document: *d,
}, nil }, nil
}, },
func(d CrawlerDocument, cr Crawler) error { func(d CrawledDocument, cr Crawler) error {
visited[d.ID()]++ visited[d.ID()]++
return nil return nil
}, },

View File

@@ -28,32 +28,22 @@ var logger = log.New(os.Stdout, "Github Crawler: ",
// Implements crawler.Crawler. // Implements crawler.Crawler.
type githubCrawler struct { type githubCrawler struct {
client GitHubClient client GhClient
query Query query Query
} }
type GitHubClient struct { type GhClient struct {
RequestConfig RequestConfig
retryCount uint64 retryCount uint64
client *http.Client client *http.Client
} }
func NewClient(accessToken string, retryCount uint64, client *http.Client) GitHubClient { /*
return GitHubClient{
retryCount: retryCount,
client: client,
RequestConfig: RequestConfig{
perPage: githubMaxPageSize,
accessToken: accessToken,
},
}
}
func NewCrawler(accessToken string, retryCount uint64, client *http.Client, func NewCrawler(accessToken string, retryCount uint64, client *http.Client,
query Query) githubCrawler { query Query) githubCrawler {
return githubCrawler{ return githubCrawler{
client: GitHubClient{ client: GhClient{
retryCount: retryCount, retryCount: retryCount,
client: client, client: client,
RequestConfig: RequestConfig{ RequestConfig: RequestConfig{
@@ -64,12 +54,13 @@ func NewCrawler(accessToken string, retryCount uint64, client *http.Client,
query: query, query: query,
} }
} }
*/
// Implements crawler.Crawler. // Implements crawler.Crawler.
func (gc githubCrawler) Crawl( func (gc githubCrawler) Crawl(
ctx context.Context, output chan<- crawler.CrawlerDocument) error { ctx context.Context, output chan<- crawler.CrawledDocument) error {
noETagClient := GitHubClient{ noETagClient := GhClient{
RequestConfig: gc.client.RequestConfig, RequestConfig: gc.client.RequestConfig,
client: &http.Client{Timeout: gc.client.client.Timeout}, client: &http.Client{Timeout: gc.client.client.Timeout},
retryCount: gc.client.retryCount, retryCount: gc.client.retryCount,
@@ -138,11 +129,11 @@ func (gc githubCrawler) FetchDocument(ctx context.Context, d *doc.Document) erro
continue continue
} }
} }
return fmt.Errorf("File Not Found: %s", url) return fmt.Errorf("file not found: %s", url)
} }
func (gc githubCrawler) SetCreated(ctx context.Context, d *doc.Document) error { func (gc githubCrawler) SetCreated(ctx context.Context, d *doc.Document) error {
fs := GithubFileSpec{} fs := GhFileSpec{}
fs.Repository.FullName = d.RepositoryURL + "/" + d.FilePath fs.Repository.FullName = d.RepositoryURL + "/" + d.FilePath
creationTime, err := gc.client.GetFileCreationTime(fs) creationTime, err := gc.client.GetFileCreationTime(fs)
if err != nil { if err != nil {
@@ -165,10 +156,10 @@ func (gc githubCrawler) Match(d *doc.Document) bool {
// processQuery follows all of the pages in a query, and updates/adds the // processQuery follows all of the pages in a query, and updates/adds the
// documents from the crawl to the datastore/index. // documents from the crawl to the datastore/index.
func processQuery(ctx context.Context, gcl GitHubClient, query string, func processQuery(ctx context.Context, gcl GhClient, query string,
output chan<- crawler.CrawlerDocument) error { output chan<- crawler.CrawledDocument) error {
queryPages := make(chan GithubResponseInfo) queryPages := make(chan GhResponseInfo)
go func() { go func() {
// Forward the document metadata to the retrieval channel. // Forward the document metadata to the retrieval channel.
@@ -209,8 +200,8 @@ func processQuery(ctx context.Context, gcl GitHubClient, query string,
return errs return errs
} }
func kustomizationResultAdapter(gcl GitHubClient, k GithubFileSpec) ( func kustomizationResultAdapter(gcl GhClient, k GhFileSpec) (
crawler.CrawlerDocument, error) { crawler.CrawledDocument, error) {
data, err := gcl.GetFileData(k) data, err := gcl.GetFileData(k)
if err != nil { if err != nil {
@@ -245,8 +236,8 @@ func kustomizationResultAdapter(gcl GitHubClient, k GithubFileSpec) (
// ForwardPaginatedQuery follows the links to the next pages and performs all of // ForwardPaginatedQuery follows the links to the next pages and performs all of
// the queries for a given search query, relaying the data from each request // the queries for a given search query, relaying the data from each request
// back to an output channel. // back to an output channel.
func (gcl GitHubClient) ForwardPaginatedQuery(ctx context.Context, query string, func (gcl GhClient) ForwardPaginatedQuery(ctx context.Context, query string,
output chan<- GithubResponseInfo) error { output chan<- GhResponseInfo) error {
logger.Println("querying: ", query) logger.Println("querying: ", query)
response := gcl.parseGithubResponse(query) response := gcl.parseGithubResponse(query)
@@ -275,7 +266,7 @@ func (gcl GitHubClient) ForwardPaginatedQuery(ctx context.Context, query string,
} }
// GetFileData gets the bytes from a file. // GetFileData gets the bytes from a file.
func (gcl GitHubClient) GetFileData(k GithubFileSpec) ([]byte, error) { func (gcl GhClient) GetFileData(k GhFileSpec) ([]byte, error) {
url := gcl.ContentsRequest(k.Repository.FullName, k.Path) url := gcl.ContentsRequest(k.Repository.FullName, k.Path)
@@ -314,7 +305,7 @@ func (gcl GitHubClient) GetFileData(k GithubFileSpec) ([]byte, error) {
return data, err return data, err
} }
func (gcl GitHubClient) GetDefaultBranch(url string) (string, error) { func (gcl GhClient) GetDefaultBranch(url string) (string, error) {
resp, err := gcl.GetReposData(url) resp, err := gcl.GetReposData(url)
if err != nil { if err != nil {
return "", fmt.Errorf( return "", fmt.Errorf(
@@ -341,8 +332,8 @@ func (gcl GitHubClient) GetDefaultBranch(url string) (string, error) {
} }
// GetFileCreationTime gets the earliest date of a file. // GetFileCreationTime gets the earliest date of a file.
func (gcl GitHubClient) GetFileCreationTime( func (gcl GhClient) GetFileCreationTime(
k GithubFileSpec) (time.Time, error) { k GhFileSpec) (time.Time, error) {
url := gcl.CommitsRequest(k.Repository.FullName, k.Path) url := gcl.CommitsRequest(k.Repository.FullName, k.Path)
@@ -378,7 +369,7 @@ func (gcl GitHubClient) GetFileCreationTime(
return defaultTime, fmt.Errorf( return defaultTime, fmt.Errorf(
"%+v: failed to read metadata: %v", k, err) "%+v: failed to read metadata: %v", k, err)
} }
earliestDate := []DateSpec{} var earliestDate []DateSpec
err = json.Unmarshal(data, &earliestDate) err = json.Unmarshal(data, &earliestDate)
size := len(earliestDate) size := len(earliestDate)
if err != nil || size == 0 { if err != nil || size == 0 {
@@ -413,18 +404,18 @@ func throttleRepoAPI() {
type multiError []error type multiError []error
func (me multiError) Error() string { func (e multiError) Error() string {
size := len(me) + 2 size := len(e) + 2
strs := make([]string, size) strs := make([]string, size)
strs[0] = "Errors [" strs[0] = "Errors ["
for i, err := range me { for i, err := range e {
strs[i+1] = "\t" + err.Error() strs[i+1] = "\t" + err.Error()
} }
strs[size-1] = "]" strs[size-1] = "]"
return strings.Join(strs, "\n") return strings.Join(strs, "\n")
} }
type GithubFileSpec struct { type GhFileSpec struct {
Path string `json:"path,omitempty"` Path string `json:"path,omitempty"`
Repository struct { Repository struct {
API string `json:"url,omitempty"` API string `json:"url,omitempty"`
@@ -439,10 +430,10 @@ type githubResponse struct {
TotalCount uint64 `json:"total_count,omitempty"` TotalCount uint64 `json:"total_count,omitempty"`
// Github representation of a file. // Github representation of a file.
Items []GithubFileSpec `json:"items,omitempty"` Items []GhFileSpec `json:"items,omitempty"`
} }
type GithubResponseInfo struct { type GhResponseInfo struct {
*http.Response *http.Response
Parsed *githubResponse Parsed *githubResponse
Error error Error error
@@ -480,9 +471,9 @@ func parseGithubLinkFormat(links string) (string, string) {
return next, last return next, last
} }
func (gcl GitHubClient) parseGithubResponse(getRequest string) GithubResponseInfo { func (gcl GhClient) parseGithubResponse(getRequest string) GhResponseInfo {
resp, err := gcl.SearchGithubAPI(getRequest) resp, err := gcl.SearchGithubAPI(getRequest)
requestInfo := GithubResponseInfo{ requestInfo := GhResponseInfo{
Response: resp, Response: resp,
Error: err, Error: err,
Parsed: nil, Parsed: nil,
@@ -529,7 +520,7 @@ func (gcl GitHubClient) parseGithubResponse(getRequest string) GithubResponseInf
// SearchGithubAPI performs a search query and handles rate limitting for // SearchGithubAPI performs a search query and handles rate limitting for
// the 'code/search?' endpoint as well as timed retries in the case of abuse // the 'code/search?' endpoint as well as timed retries in the case of abuse
// prevention. // prevention.
func (gcl GitHubClient) SearchGithubAPI(query string) (*http.Response, error) { func (gcl GhClient) SearchGithubAPI(query string) (*http.Response, error) {
throttleSearchAPI() throttleSearchAPI()
return gcl.getWithRetry(query) return gcl.getWithRetry(query)
} }
@@ -537,18 +528,18 @@ func (gcl GitHubClient) SearchGithubAPI(query string) (*http.Response, error) {
// GetReposData performs a search query and handles rate limitting for // GetReposData performs a search query and handles rate limitting for
// the '/repos' endpoint as well as timed retries in the case of abuse // the '/repos' endpoint as well as timed retries in the case of abuse
// prevention. // prevention.
func (gcl GitHubClient) GetReposData(query string) (*http.Response, error) { func (gcl GhClient) GetReposData(query string) (*http.Response, error) {
throttleRepoAPI() throttleRepoAPI()
return gcl.getWithRetry(query) return gcl.getWithRetry(query)
} }
// User content (file contents) is not API rate limited, so there's no use in // User content (file contents) is not API rate limited, so there's no use in
// throttling this call. // throttling this call.
func (gcl GitHubClient) GetRawUserContent(query string) (*http.Response, error) { func (gcl GhClient) GetRawUserContent(query string) (*http.Response, error) {
return gcl.getWithRetry(query) return gcl.getWithRetry(query)
} }
func (gcl GitHubClient) getWithRetry( func (gcl GhClient) getWithRetry(
query string) (resp *http.Response, err error) { query string) (resp *http.Response, err error) {
resp, err = gcl.client.Get(query) resp, err = gcl.client.Get(query)

View File

@@ -51,7 +51,7 @@ func (qf queryField) String() string {
type Query []queryField type Query []queryField
func QueryWith(qfs ...queryField) Query { func QueryWith(qfs ...queryField) Query {
return Query(qfs) return qfs
} }
func (q Query) String() string { func (q Query) String() string {

View File

@@ -147,11 +147,11 @@ type cachedSearch interface {
// cache's performance. // cache's performance.
type githubCachedSearch struct { type githubCachedSearch struct {
cache map[uint64]uint64 cache map[uint64]uint64
gcl GitHubClient gcl GhClient
baseRequest request baseRequest request
} }
func newCache(client GitHubClient, query Query) githubCachedSearch { func newCache(client GhClient, query Query) githubCachedSearch {
return githubCachedSearch{ return githubCachedSearch{
cache: map[uint64]uint64{ cache: map[uint64]uint64{
0: 0, 0: 0,

View File

@@ -35,7 +35,7 @@ func newIndex(ctx context.Context, name string) (*index, error) {
type readerFunc func(io.Reader) error type readerFunc func(io.Reader) error
func ignoreResponseBody(reader io.Reader) error { func ignoreResponseBody(_ io.Reader) error {
return nil return nil
} }

View File

@@ -61,7 +61,7 @@ kind: Secret
metadata: metadata:
labels: labels:
app: release-name-minecraft app: release-name-minecraft
chart: minecraft-1.1.1 chart: minecraft-1.1.2
heritage: Tiller heritage: Tiller
release: release-name release: release-name
name: LOOOOOOOONG-release-name-minecraft name: LOOOOOOOONG-release-name-minecraft
@@ -74,7 +74,7 @@ metadata:
volume.alpha.kubernetes.io/storage-class: default volume.alpha.kubernetes.io/storage-class: default
labels: labels:
app: release-name-minecraft app: release-name-minecraft
chart: minecraft-1.1.1 chart: minecraft-1.1.2
heritage: Tiller heritage: Tiller
release: release-name release: release-name
name: LOOOOOOOONG-release-name-minecraft-datadir name: LOOOOOOOONG-release-name-minecraft-datadir
@@ -90,7 +90,7 @@ kind: Service
metadata: metadata:
labels: labels:
app: release-name-minecraft app: release-name-minecraft
chart: minecraft-1.1.1 chart: minecraft-1.1.2
heritage: Tiller heritage: Tiller
release: release-name release: release-name
name: LOOOOOOOONG-release-name-minecraft name: LOOOOOOOONG-release-name-minecraft

View File

@@ -7,7 +7,7 @@ import (
"strings" "strings"
"testing" "testing"
kusttest_test "sigs.k8s.io/kustomize/v3/pkg/kusttest" "sigs.k8s.io/kustomize/v3/pkg/kusttest"
) )
const httpsService = ` const httpsService = `

View File

@@ -1,18 +1,5 @@
/* // Copyright 2019 The Kubernetes Authors.
Copyright 2018 The Kubernetes Authors. // SPDX-License-Identifier: Apache-2.0
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 target_test package target_test
@@ -343,31 +330,33 @@ resources:
- ../o2 - ../o2
`) `)
const presumablyDesired = ` /*
apiVersion: v1 const presumablyDesired = `
kind: Pod apiVersion: v1
metadata: kind: Pod
name: p1-base-myServerPod metadata:
spec: name: p1-base-myServerPod
containers: spec:
- env: containers:
- name: POD_NAME - env:
value: p1-base-myServerPod - name: POD_NAME
image: whatever value: p1-base-myServerPod
name: myServer image: whatever
--- name: myServer
apiVersion: v1 ---
kind: Pod apiVersion: v1
metadata: kind: Pod
name: p2-base-myServerPod metadata:
spec: name: p2-base-myServerPod
containers: spec:
- env: containers:
- name: POD_NAME - env:
value: p2-base-myServerPod - name: POD_NAME
image: whatever value: p2-base-myServerPod
name: myServer image: whatever
` name: myServer
`
*/
_, err := th.MakeKustTarget().MakeCustomizedResMap() _, err := th.MakeKustTarget().MakeCustomizedResMap()
if err == nil { if err == nil {
t.Fatalf("should have an error") t.Fatalf("should have an error")

View File

@@ -42,7 +42,7 @@ kind: Secret
metadata: metadata:
labels: labels:
app: release-name-minecraft app: release-name-minecraft
chart: minecraft-1.1.1 chart: minecraft-1.1.2
heritage: Tiller heritage: Tiller
release: release-name release: release-name
name: release-name-minecraft name: release-name-minecraft
@@ -55,7 +55,7 @@ metadata:
volume.alpha.kubernetes.io/storage-class: default volume.alpha.kubernetes.io/storage-class: default
labels: labels:
app: release-name-minecraft app: release-name-minecraft
chart: minecraft-1.1.1 chart: minecraft-1.1.2
heritage: Tiller heritage: Tiller
release: release-name release: release-name
name: release-name-minecraft-datadir name: release-name-minecraft-datadir
@@ -71,7 +71,7 @@ kind: Service
metadata: metadata:
labels: labels:
app: release-name-minecraft app: release-name-minecraft
chart: minecraft-1.1.1 chart: minecraft-1.1.2
heritage: Tiller heritage: Tiller
release: release-name release: release-name
name: release-name-minecraft name: release-name-minecraft