github.com/joelanford/operator-sdk@v0.8.2/internal/pkg/scaffold/helm/gopkgtoml.go (about) 1 // Copyright 2019 The Operator-SDK Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package helm 16 17 import ( 18 "fmt" 19 20 "github.com/operator-framework/operator-sdk/internal/pkg/scaffold" 21 "github.com/operator-framework/operator-sdk/internal/pkg/scaffold/input" 22 "github.com/operator-framework/operator-sdk/internal/pkg/scaffold/internal/deps" 23 ) 24 25 // GopkgToml - the Gopkg.toml file for a hybrid operator 26 type GopkgToml struct { 27 input.Input 28 } 29 30 func (s *GopkgToml) GetInput() (input.Input, error) { 31 if s.Path == "" { 32 s.Path = scaffold.GopkgTomlFile 33 } 34 s.TemplateBody = gopkgTomlTmpl 35 return s.Input, nil 36 } 37 38 const gopkgTomlTmpl = `[[constraint]] 39 name = "github.com/operator-framework/operator-sdk" 40 # The version rule is used for a specific release and the master branch for in between releases. 41 # branch = "v0.8.x" #osdk_branch_annotation 42 version = "=v0.8.2" #osdk_version_annotation 43 44 [[override]] 45 name = "k8s.io/api" 46 version = "kubernetes-1.13.1" 47 48 [[override]] 49 name = "k8s.io/apimachinery" 50 version = "kubernetes-1.13.1" 51 52 [[override]] 53 name = "k8s.io/apiextensions-apiserver" 54 version = "kubernetes-1.13.1" 55 56 [[override]] 57 name = "k8s.io/apiserver" 58 version = "kubernetes-1.13.1" 59 60 [[override]] 61 name = "k8s.io/client-go" 62 version = "kubernetes-1.13.1" 63 64 [[override]] 65 name = "k8s.io/cli-runtime" 66 version = "kubernetes-1.13.1" 67 68 # We need overrides for the following imports because dep can't resolve them 69 # correctly. The easiest way to get this right is to use the versions that 70 # k8s.io/helm uses. See https://github.com/helm/helm/blob/v2.13.1/glide.lock 71 [[override]] 72 name = "k8s.io/kubernetes" 73 revision = "c6d339953bd4fd8c021a6b5fb46d7952b30be9f9" 74 75 [[override]] 76 name = "github.com/russross/blackfriday" 77 revision = "300106c228d52c8941d4b3de6054a6062a86dda3" 78 79 [[override]] 80 name = "github.com/docker/distribution" 81 revision = "edc3ab29cdff8694dd6feb85cfeb4b5f1b38ed9c" 82 83 [[override]] 84 name = "github.com/docker/docker" 85 revision = "a9fbbdc8dd8794b20af358382ab780559bca589d" 86 87 [prune] 88 go-tests = true 89 unused-packages = true 90 ` 91 92 func PrintDepGopkgTOML(asFile bool) error { 93 if asFile { 94 _, err := fmt.Println(gopkgTomlTmpl) 95 return err 96 } 97 return deps.PrintDepGopkgTOML(gopkgTomlTmpl) 98 }