32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/examples/web/public/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kubernetes/kompose/ae2a394038ccd5b7d4127b4777183fc9402066c7/examples/web/public/logo.png
--------------------------------------------------------------------------------
/examples/web/public/style.css:
--------------------------------------------------------------------------------
1 | body, input {
2 | color: #123;
3 | font-family: "Gill Sans", sans-serif;
4 | }
5 |
6 | div {
7 | overflow: hidden;
8 | padding: 1em 0;
9 | position: relative;
10 | text-align: center;
11 | }
12 |
13 | h1, h2, p, input, a {
14 | font-weight: 300;
15 | margin: 0;
16 | }
17 |
18 | h1 {
19 | color: #BDB76B;
20 | font-size: 3.5em;
21 | }
22 |
23 | h2 {
24 | color: #999;
25 | }
26 |
27 | form {
28 | margin: 0 auto;
29 | max-width: 50em;
30 | text-align: center;
31 | }
32 |
33 | input {
34 | border: 0;
35 | border-radius: 1000px;
36 | box-shadow: inset 0 0 0 2px #BDB76B;
37 | display: inline;
38 | font-size: 1.5em;
39 | margin-bottom: 1em;
40 | outline: none;
41 | padding: .5em 5%;
42 | width: 55%;
43 | }
44 |
45 | form a {
46 | background: #BDB76B;
47 | border: 0;
48 | border-radius: 1000px;
49 | color: #FFF;
50 | font-size: 1.25em;
51 | font-weight: 400;
52 | padding: .75em 2em;
53 | text-decoration: none;
54 | text-transform: uppercase;
55 | white-space: normal;
56 | }
57 |
58 | p {
59 | font-size: 1.5em;
60 | line-height: 1.5;
61 | }
62 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/codegangsta/negroni/.gitignore:
--------------------------------------------------------------------------------
1 | /coverage.txt
2 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/codegangsta/negroni/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 |
3 | sudo: false
4 | dist: trusty
5 |
6 | go:
7 | - 1.x
8 | - 1.2.x
9 | - 1.3.x
10 | - 1.4.x
11 | - 1.5.x
12 | - 1.6.x
13 | - 1.7.x
14 | - 1.8.x
15 | - master
16 |
17 | before_install:
18 | - find "${GOPATH%%:*}" -name '*.a' -delete
19 | - rm -rf "${GOPATH%%:*}/src/golang.org"
20 | - go get golang.org/x/tools/cover
21 | - go get golang.org/x/tools/cmd/cover
22 |
23 | script:
24 | - go test -race -coverprofile=coverage.txt -covermode=atomic
25 |
26 | after_success:
27 | - bash <(curl -s "https://codecov.io/bash")
28 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/codegangsta/negroni/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Jeremy Saenz
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/codegangsta/negroni/doc.go:
--------------------------------------------------------------------------------
1 | // Package negroni is an idiomatic approach to web middleware in Go. It is tiny, non-intrusive, and encourages use of net/http Handlers.
2 | //
3 | // If you like the idea of Martini, but you think it contains too much magic, then Negroni is a great fit.
4 | //
5 | // For a full guide visit http://github.com/urfave/negroni
6 | //
7 | // package main
8 | //
9 | // import (
10 | // "github.com/urfave/negroni"
11 | // "net/http"
12 | // "fmt"
13 | // )
14 | //
15 | // func main() {
16 | // mux := http.NewServeMux()
17 | // mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
18 | // fmt.Fprintf(w, "Welcome to the home page!")
19 | // })
20 | //
21 | // n := negroni.Classic()
22 | // n.UseHandler(mux)
23 | // n.Run(":3000")
24 | // }
25 | package negroni
26 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/codegangsta/negroni/response_writer_pusher.go:
--------------------------------------------------------------------------------
1 | //go:build go1.8
2 | // +build go1.8
3 |
4 | package negroni
5 |
6 | import (
7 | "fmt"
8 | "net/http"
9 | )
10 |
11 | func (rw *responseWriter) Push(target string, opts *http.PushOptions) error {
12 | pusher, ok := rw.ResponseWriter.(http.Pusher)
13 | if ok {
14 | return pusher.Push(target, opts)
15 | }
16 | return fmt.Errorf("the ResponseWriter doesn't support the Pusher interface")
17 | }
18 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/gomodule/redigo/redis/reflect.go:
--------------------------------------------------------------------------------
1 | package redis
2 |
3 | import (
4 | "reflect"
5 | "runtime"
6 | )
7 |
8 | // methodName returns the name of the calling method,
9 | // assumed to be two stack frames above.
10 | func methodName() string {
11 | pc, _, _, _ := runtime.Caller(2)
12 | f := runtime.FuncForPC(pc)
13 | if f == nil {
14 | return "unknown method"
15 | }
16 | return f.Name()
17 | }
18 |
19 | // mustBe panics if f's kind is not expected.
20 | func mustBe(v reflect.Value, expected reflect.Kind) {
21 | if v.Kind() != expected {
22 | panic(&reflect.ValueError{Method: methodName(), Kind: v.Kind()})
23 | }
24 | }
25 |
26 | // fieldByIndexCreate returns the nested field corresponding
27 | // to index creating elements that are nil when stepping through.
28 | // It panics if v is not a struct.
29 | func fieldByIndexCreate(v reflect.Value, index []int) reflect.Value {
30 | if len(index) == 1 {
31 | return v.Field(index[0])
32 | }
33 |
34 | mustBe(v, reflect.Struct)
35 | for i, x := range index {
36 | if i > 0 {
37 | if v.Kind() == reflect.Ptr && v.Type().Elem().Kind() == reflect.Struct {
38 | if v.IsNil() {
39 | v.Set(reflect.New(v.Type().Elem()))
40 | }
41 | v = v.Elem()
42 | }
43 | }
44 | v = v.Field(x)
45 | }
46 |
47 | return v
48 | }
49 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/gomodule/redigo/redis/reflect_go117.go:
--------------------------------------------------------------------------------
1 | //go:build !go1.18
2 | // +build !go1.18
3 |
4 | package redis
5 |
6 | import (
7 | "errors"
8 | "reflect"
9 | )
10 |
11 | // fieldByIndexErr returns the nested field corresponding to index.
12 | // It returns an error if evaluation requires stepping through a nil
13 | // pointer, but panics if it must step through a field that
14 | // is not a struct.
15 | func fieldByIndexErr(v reflect.Value, index []int) (reflect.Value, error) {
16 | if len(index) == 1 {
17 | return v.Field(index[0]), nil
18 | }
19 |
20 | mustBe(v, reflect.Struct)
21 | for i, x := range index {
22 | if i > 0 {
23 | if v.Kind() == reflect.Ptr && v.Type().Elem().Kind() == reflect.Struct {
24 | if v.IsNil() {
25 | return reflect.Value{}, errors.New("reflect: indirection through nil pointer to embedded struct field " + v.Type().Elem().Name())
26 | }
27 | v = v.Elem()
28 | }
29 | }
30 | v = v.Field(x)
31 | }
32 |
33 | return v, nil
34 | }
35 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/gomodule/redigo/redis/reflect_go118.go:
--------------------------------------------------------------------------------
1 | //go:build go1.18
2 | // +build go1.18
3 |
4 | package redis
5 |
6 | import (
7 | "reflect"
8 | )
9 |
10 | // fieldByIndexErr returns the nested field corresponding to index.
11 | // It returns an error if evaluation requires stepping through a nil
12 | // pointer, but panics if it must step through a field that
13 | // is not a struct.
14 | func fieldByIndexErr(v reflect.Value, index []int) (reflect.Value, error) {
15 | return v.FieldByIndexErr(index)
16 | }
17 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/gorilla/mux/.editorconfig:
--------------------------------------------------------------------------------
1 | ; https://editorconfig.org/
2 |
3 | root = true
4 |
5 | [*]
6 | insert_final_newline = true
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | indent_style = space
10 | indent_size = 2
11 |
12 | [{Makefile,go.mod,go.sum,*.go,.gitmodules}]
13 | indent_style = tab
14 | indent_size = 4
15 |
16 | [*.md]
17 | indent_size = 4
18 | trim_trailing_whitespace = false
19 |
20 | eclint_indent_style = unset
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/gorilla/mux/.gitignore:
--------------------------------------------------------------------------------
1 | coverage.coverprofile
2 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/gorilla/mux/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2023 The Gorilla Authors. All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are
5 | met:
6 |
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above
10 | copyright notice, this list of conditions and the following disclaimer
11 | in the documentation and/or other materials provided with the
12 | distribution.
13 | * Neither the name of Google Inc. nor the names of its
14 | contributors may be used to endorse or promote products derived from
15 | this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/gorilla/mux/Makefile:
--------------------------------------------------------------------------------
1 | GO_LINT=$(shell which golangci-lint 2> /dev/null || echo '')
2 | GO_LINT_URI=github.com/golangci/golangci-lint/cmd/golangci-lint@latest
3 |
4 | GO_SEC=$(shell which gosec 2> /dev/null || echo '')
5 | GO_SEC_URI=github.com/securego/gosec/v2/cmd/gosec@latest
6 |
7 | GO_VULNCHECK=$(shell which govulncheck 2> /dev/null || echo '')
8 | GO_VULNCHECK_URI=golang.org/x/vuln/cmd/govulncheck@latest
9 |
10 | .PHONY: golangci-lint
11 | golangci-lint:
12 | $(if $(GO_LINT), ,go install $(GO_LINT_URI))
13 | @echo "##### Running golangci-lint"
14 | golangci-lint run -v
15 |
16 | .PHONY: gosec
17 | gosec:
18 | $(if $(GO_SEC), ,go install $(GO_SEC_URI))
19 | @echo "##### Running gosec"
20 | gosec ./...
21 |
22 | .PHONY: govulncheck
23 | govulncheck:
24 | $(if $(GO_VULNCHECK), ,go install $(GO_VULNCHECK_URI))
25 | @echo "##### Running govulncheck"
26 | govulncheck ./...
27 |
28 | .PHONY: verify
29 | verify: golangci-lint gosec govulncheck
30 |
31 | .PHONY: test
32 | test:
33 | @echo "##### Running tests"
34 | go test -race -cover -coverprofile=coverage.coverprofile -covermode=atomic -v ./...
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/gorilla/mux/test_helpers.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Gorilla Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package mux
6 |
7 | import "net/http"
8 |
9 | // SetURLVars sets the URL variables for the given request, to be accessed via
10 | // mux.Vars for testing route behaviour. Arguments are not modified, a shallow
11 | // copy is returned.
12 | //
13 | // This API should only be used for testing purposes; it provides a way to
14 | // inject variables into the request context. Alternatively, URL variables
15 | // can be set by making a route that captures the required variables,
16 | // starting a server and sending the request to that server.
17 | func SetURLVars(r *http.Request, val map[string]string) *http.Request {
18 | return requestWithVars(r, val)
19 | }
20 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/xyproto/pinterface/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 | *.test
24 | *.prof
25 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/xyproto/pinterface/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 |
3 | go:
4 | - "1.8"
5 | - "1.9"
6 | - "1.10"
7 | - "1.11"
8 | - "1.12"
9 | - "1.13"
10 | - "1.14"
11 | - tip
12 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/xyproto/pinterface/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2021 Alexander F. Rødseth
2 |
3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4 |
5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6 |
7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8 |
9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/xyproto/pinterface/README.md:
--------------------------------------------------------------------------------
1 | # pinterface
2 |
3 | [](https://goreportcard.com/report/github.com/xyproto/pinterface) [](https://raw.githubusercontent.com/xyproto/pinterface/main/LICENSE)
4 |
5 | Interface types for `simple*` and `permission*` packages.
6 |
7 | Interfaces for:
8 | ---------------
9 |
10 | * Redis: [permissions2](https://github.com/xyproto/permissions2) and [simpleredis](https://github.com/xyproto/simpleredis)
11 | * Bolt: [permissionbolt](https://github.com/xyproto/permissionbolt) and [simplebolt](https://github.com/xyproto/simplebolt)
12 | * MariaDB/MySQL: [permissionsql](https://github.com/xyproto/permissionsql) and [simplemaria](https://github.com/xyproto/simplemaria)
13 | * PostgreSQL: [pstore](https://github.com/xyproto/pstore) and [simplehstore](https://github.com/xyproto/simplehstore)
14 |
15 | [](https://repology.org/project/go:github-xyproto-pinterface/versions)
16 |
17 | General information
18 | -------------------
19 |
20 | * Version: 1.5.3 (The tag is `v1.5.3` to work better with `go mod`. The API has version `5.3`.)
21 | * License: BSD-3
22 | * Author: Alexander F. Rødseth <xyproto@archlinux.org>
23 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/xyproto/simpleredis/v2/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2023 Alexander F. Rødseth
2 |
3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4 |
5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6 |
7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8 |
9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 |
--------------------------------------------------------------------------------
/examples/web/vendor/github.com/xyproto/simpleredis/v2/creator.go:
--------------------------------------------------------------------------------
1 | package simpleredis
2 |
3 | import (
4 | "github.com/xyproto/pinterface"
5 | )
6 |
7 | // For implementing pinterface.ICreator
8 |
9 | type RedisCreator struct {
10 | pool *ConnectionPool
11 | dbindex int
12 | }
13 |
14 | func NewCreator(pool *ConnectionPool, dbindex int) *RedisCreator {
15 | return &RedisCreator{pool, dbindex}
16 | }
17 |
18 | func (c *RedisCreator) SelectDatabase(dbindex int) {
19 | c.dbindex = dbindex
20 | }
21 |
22 | func (c *RedisCreator) NewList(id string) (pinterface.IList, error) {
23 | return &List{c.pool, id, c.dbindex}, nil
24 | }
25 |
26 | func (c *RedisCreator) NewSet(id string) (pinterface.ISet, error) {
27 | return &Set{c.pool, id, c.dbindex}, nil
28 | }
29 |
30 | func (c *RedisCreator) NewHashMap(id string) (pinterface.IHashMap, error) {
31 | return &HashMap{c.pool, id, c.dbindex}, nil
32 | }
33 |
34 | func (c *RedisCreator) NewKeyValue(id string) (pinterface.IKeyValue, error) {
35 | return &KeyValue{c.pool, id, c.dbindex}, nil
36 | }
37 |
--------------------------------------------------------------------------------
/examples/web/vendor/modules.txt:
--------------------------------------------------------------------------------
1 | # github.com/codegangsta/negroni v1.0.0
2 | ## explicit
3 | github.com/codegangsta/negroni
4 | # github.com/gomodule/redigo v1.8.9
5 | ## explicit; go 1.16
6 | github.com/gomodule/redigo/redis
7 | # github.com/gorilla/mux v1.8.1
8 | ## explicit; go 1.20
9 | github.com/gorilla/mux
10 | # github.com/xyproto/pinterface v1.5.3
11 | ## explicit; go 1.8
12 | github.com/xyproto/pinterface
13 | # github.com/xyproto/simpleredis/v2 v2.6.5
14 | ## explicit; go 1.17
15 | github.com/xyproto/simpleredis/v2
16 |
--------------------------------------------------------------------------------
/main.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2017 The Kubernetes Authors All rights reserved.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | package main
18 |
19 | import (
20 | "fmt"
21 | "os"
22 |
23 | "github.com/kubernetes/kompose/cmd"
24 | )
25 |
26 | func main() {
27 | if err := cmd.Execute(); err != nil {
28 | fmt.Fprintln(os.Stderr, err)
29 | os.Exit(1)
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/pkg/loader/loader.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2017 The Kubernetes Authors All rights reserved.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | package loader
18 |
19 | import (
20 | "fmt"
21 |
22 | "github.com/kubernetes/kompose/pkg/kobject"
23 | "github.com/kubernetes/kompose/pkg/loader/compose"
24 | )
25 |
26 | // Loader interface defines loader that loads files and converts it to kobject representation
27 | type Loader interface {
28 | LoadFile(files []string, profiles []string, noInterpolate bool) (kobject.KomposeObject, error)
29 | ///Name() string
30 | }
31 |
32 | // GetLoader returns loader for given format
33 | func GetLoader(format string) (Loader, error) {
34 | if format != "compose" {
35 | return nil, fmt.Errorf("input file format %s is not supported", format)
36 | }
37 | return new(compose.Compose), nil
38 | }
39 |
--------------------------------------------------------------------------------
/pkg/testutils/kubernetes.go:
--------------------------------------------------------------------------------
1 | package testutils
2 |
3 | import (
4 | "errors"
5 |
6 | appsv1 "k8s.io/api/apps/v1"
7 | v1 "k8s.io/api/core/v1"
8 | "k8s.io/apimachinery/pkg/runtime"
9 | )
10 |
11 | // CheckForHeadless is helper function for tests.
12 | // It checks if all Services in objects are Headless Services and if there is at least one such Services.
13 | func CheckForHeadless(objects []runtime.Object) error {
14 | serviceCreated := false
15 | for _, obj := range objects {
16 | if svc, ok := obj.(*v1.Service); ok {
17 | serviceCreated = true
18 | // Check if it is a headless services
19 | if svc.Spec.ClusterIP != "None" {
20 | return errors.New("this is not a Headless services")
21 | }
22 | }
23 | }
24 | if !serviceCreated {
25 | return errors.New("no Service created")
26 | }
27 | return nil
28 | }
29 |
30 | // CheckForHealthCheckLivenessAndReadiness check if has liveness and readiness in healthcheck configured.
31 | func CheckForHealthCheckLivenessAndReadiness(objects []runtime.Object) error {
32 | serviceCreated := false
33 | for _, obj := range objects {
34 | if deployment, ok := obj.(*appsv1.Deployment); ok {
35 | serviceCreated = true
36 |
37 | // Check if it is a headless services
38 | if deployment.Spec.Template.Spec.Containers[0].ReadinessProbe == nil {
39 | return errors.New("there is not a ReadinessProbe")
40 | }
41 | if deployment.Spec.Template.Spec.Containers[0].LivenessProbe == nil {
42 | return errors.New("there is not a LivenessGate")
43 | }
44 | }
45 | }
46 | if !serviceCreated {
47 | return errors.New("no Service created")
48 | }
49 | return nil
50 | }
51 |
--------------------------------------------------------------------------------
/pkg/transformer/transformer.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2017 The Kubernetes Authors All rights reserved.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | package transformer
18 |
19 | import (
20 | "github.com/kubernetes/kompose/pkg/kobject"
21 | "k8s.io/apimachinery/pkg/runtime"
22 | )
23 |
24 | // Transformer interface defines transformer that is converting kobject to other resources
25 | type Transformer interface {
26 | // Transform converts KomposeObject to transformer specific objects.
27 | Transform(kobject.KomposeObject, kobject.ConvertOptions) ([]runtime.Object, error)
28 | }
29 |
--------------------------------------------------------------------------------
/pkg/utils/docker/client.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2016 The Kubernetes Authors All rights reserved
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | package docker
18 |
19 | import (
20 | "os"
21 |
22 | docker "github.com/fsouza/go-dockerclient"
23 | )
24 |
25 | // Client connects to Docker client on host
26 | func Client() (*docker.Client, error) {
27 | var (
28 | err error
29 | client *docker.Client
30 | )
31 |
32 | dockerHost := os.Getenv("DOCKER_HOST")
33 |
34 | if len(dockerHost) > 0 {
35 | // Create client instance from Docker's environment variables:
36 | // DOCKER_HOST, DOCKER_TLS_VERIFY, DOCKER_CERT_PATH
37 | client, err = docker.NewClientFromEnv()
38 | } else {
39 | // Default unix socket end-point
40 | endpoint := "unix:///var/run/docker.sock"
41 | client, err = docker.NewClient(endpoint)
42 | }
43 | if err != nil {
44 | return client, err
45 | }
46 |
47 | return client, nil
48 | }
49 |
--------------------------------------------------------------------------------
/pkg/utils/docker/tag.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2016 The Kubernetes Authors All rights reserved
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | package docker
18 |
19 | import (
20 | dockerlib "github.com/fsouza/go-dockerclient"
21 | "github.com/pkg/errors"
22 | log "github.com/sirupsen/logrus"
23 | )
24 |
25 | // Tag will provide methods for interaction with API regarding tagging images
26 | type Tag struct {
27 | Client dockerlib.Client
28 | }
29 |
30 | // TagImage function is responsible for tagging the docker image
31 | func (c *Tag) TagImage(image Image) error {
32 | options := dockerlib.TagImageOptions{
33 | Tag: image.Tag,
34 | Repo: image.Repository,
35 | }
36 |
37 | log.Infof("Tagging image '%s' into repository '%s'", image.Name, image.Repository)
38 | err := c.Client.TagImage(image.ShortName, options)
39 | if err != nil {
40 | log.Errorf("Unable to tag image '%s' into repository '%s'. Error: %s", image.Name, image.Registry, err)
41 | return errors.New("unable to tag docker image(s)")
42 | }
43 |
44 | log.Infof("Successfully tagged image '%s'", image.Remote)
45 | return nil
46 | }
47 |
--------------------------------------------------------------------------------
/pkg/version/version.go:
--------------------------------------------------------------------------------
1 | package version
2 |
3 | var (
4 | // VERSION is version number that will be displayed when running ./kompose version
5 | VERSION = "1.36.0"
6 | // GITCOMMIT is hash of the commit that will be displayed when running ./kompose version
7 | // this will be overwritten when running build like this: go build -ldflags="-X github.com/kubernetes/kompose/pkg/version.GITCOMMIT=$(GITCOMMIT)"
8 | // HEAD is default indicating that this was not set during build
9 | GITCOMMIT = "HEAD"
10 | )
11 |
--------------------------------------------------------------------------------
/script/check-gofmt.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2017 The Kubernetes Authors All rights reserved.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 |
18 | # This checks if all go source files in current directory are format using gofmt
19 |
20 | # Ignore vendor directory that's NOT in the main path
21 | GO_FILES=$(find . -path ./vendor -prune -o -name '*.go' -print )
22 |
23 | for file in $GO_FILES; do
24 | gofmtOutput=$(gofmt -l "$file")
25 | if [ "$gofmtOutput" ]; then
26 | errors+=("$gofmtOutput")
27 | fi
28 | done
29 |
30 |
31 | if [ ${#errors[@]} -eq 0 ]; then
32 | echo "gofmt OK"
33 | else
34 | echo "gofmt ERROR - These files are not formatted by gofmt:"
35 | for err in "${errors[@]}"; do
36 | echo "$err"
37 | done
38 | exit 1
39 | fi
--------------------------------------------------------------------------------
/script/manual-docs-sync.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ## README:
4 | ## This script is ran by running:
5 | ## cd script
6 | ## ./manual-docs-sync.sh
7 | ##
8 | ## This will take all documentation from the /docs folder of the main dir and push to the gh-pages branch (granted you have access)
9 |
10 | DOCS_REPO_NAME="kompose"
11 | DOCS_REPO_URL="git@github.com:kubernetes/kompose.git"
12 | DOCS_BRANCH="gh-pages"
13 | DOCS_FOLDER="docs"
14 |
15 | # clone the repo
16 | git clone "$DOCS_REPO_URL" "$DOCS_REPO_NAME"
17 |
18 | # change to that directory (to prevent accidental pushing to main, etc.)
19 | cd "$DOCS_REPO_NAME"
20 |
21 | # switch to gh-pages and grab the docs folder from main
22 | git checkout gh-pages
23 | git checkout main -- docs
24 |
25 | # Copy it all over to the current directory
26 | cp -r docs/* .
27 | rm -r docs
28 |
29 | git add --all
30 |
31 | # Check if anything changed, and if it's the case, push to origin/main.
32 | if git commit -m 'Update docs' -m "Synchronize documentation against website" ; then
33 | git push
34 | fi
35 |
36 | # cd back to the original root folder
37 | cd ..
38 |
--------------------------------------------------------------------------------
/script/test/README.md:
--------------------------------------------------------------------------------
1 | # Functional Test
2 |
3 | ### Requirements
4 |
5 | Install `jq - commandline JSON processor` with minimum version of 1.5
6 |
7 |
8 | ### Running tests
9 |
10 | Test running ./cmd/tests.sh
11 |
12 |
13 |
--------------------------------------------------------------------------------
/script/test/cmd/.coverprofile:
--------------------------------------------------------------------------------
1 | mode: atomic
2 |
--------------------------------------------------------------------------------
/script/test/cmd/cmd_test.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "bytes"
5 | "fmt"
6 | "os"
7 | "os/exec"
8 | "testing"
9 | )
10 |
11 | var ProjectPath = "$GOPATH/src/github.com/kubernetes/kompose/"
12 | var BinaryLocation = os.ExpandEnv(ProjectPath + "kompose")
13 |
14 | func Test_stdin(t *testing.T) {
15 | if testing.Short() {
16 | t.Skip("skipping test in short mode.")
17 | }
18 | kjson := `{"version": "2","services": {"redis": {"image": "redis:3.0","ports": ["6379"]}}}`
19 | cmdStr := fmt.Sprintf("%s convert --stdout -j -f - <