github.com/joelanford/operator-sdk@v0.8.2/internal/pkg/scaffold/ansible/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 ansible 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 StaticInput 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/client-go" 54 version = "kubernetes-1.13.1" 55 56 [prune] 57 go-tests = true 58 unused-packages = true 59 ` 60 61 func PrintDepGopkgTOML(asFile bool) error { 62 if asFile { 63 _, err := fmt.Println(gopkgTomlTmpl) 64 return err 65 } 66 return deps.PrintDepGopkgTOML(gopkgTomlTmpl) 67 }