github.com/joelanford/operator-sdk@v0.8.2/internal/pkg/scaffold/ansible/molecule_default_molecule.go (about) 1 // Copyright 2018 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 "path/filepath" 19 20 "github.com/operator-framework/operator-sdk/internal/pkg/scaffold/input" 21 ) 22 23 const MoleculeDefaultMoleculeFile = "molecule.yml" 24 25 type MoleculeDefaultMolecule struct { 26 StaticInput 27 } 28 29 // GetInput - gets the input 30 func (m *MoleculeDefaultMolecule) GetInput() (input.Input, error) { 31 if m.Path == "" { 32 m.Path = filepath.Join(MoleculeDefaultDir, MoleculeDefaultMoleculeFile) 33 } 34 m.TemplateBody = moleculeDefaultMoleculeAnsibleTmpl 35 36 return m.Input, nil 37 } 38 39 const moleculeDefaultMoleculeAnsibleTmpl = `--- 40 dependency: 41 name: galaxy 42 driver: 43 name: docker 44 lint: 45 name: yamllint 46 enabled: False 47 platforms: 48 - name: kind-default 49 groups: 50 - k8s 51 image: bsycorp/kind:latest-1.12 52 privileged: True 53 override_command: no 54 exposed_ports: 55 - 8443/tcp 56 - 10080/tcp 57 published_ports: 58 - 0.0.0.0:${TEST_CLUSTER_PORT:-9443}:8443/tcp 59 pre_build_image: yes 60 provisioner: 61 name: ansible 62 log: True 63 lint: 64 name: ansible-lint 65 enabled: False 66 inventory: 67 group_vars: 68 all: 69 namespace: ${TEST_NAMESPACE:-osdk-test} 70 env: 71 K8S_AUTH_KUBECONFIG: /tmp/molecule/kind-default/kubeconfig 72 KUBECONFIG: /tmp/molecule/kind-default/kubeconfig 73 ANSIBLE_ROLES_PATH: ${MOLECULE_PROJECT_DIRECTORY}/roles 74 KIND_PORT: '${TEST_CLUSTER_PORT:-9443}' 75 scenario: 76 name: default 77 verifier: 78 name: testinfra 79 lint: 80 name: flake8 81 `