sigs.k8s.io/cluster-api-provider-aws@v1.5.5/pkg/cloud/services/userdata/bastion.go (about) 1 /* 2 Copyright 2018 The Kubernetes Authors. 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 userdata 18 19 const ( 20 bastionBashScript = `{{.Header}} 21 22 BASTION_BOOTSTRAP_FILE=bastion_bootstrap.sh 23 BASTION_BOOTSTRAP=https://s3.amazonaws.com/aws-quickstart/quickstart-linux-bastion/scripts/bastion_bootstrap.sh 24 25 curl -s -o $BASTION_BOOTSTRAP_FILE $BASTION_BOOTSTRAP 26 chmod +x $BASTION_BOOTSTRAP_FILE 27 28 # This gets us far enough in the bastion script to be useful. 29 apt-get -y update && apt-get -y install python-pip 30 pip install --upgrade pip &> /dev/null 31 32 ./$BASTION_BOOTSTRAP_FILE --enable true 33 ` 34 ) 35 36 // BastionInput defines the context to generate a bastion instance user data. 37 type BastionInput struct { 38 baseUserData 39 } 40 41 // NewBastion returns the user data string to be used on a bastion instance. 42 func NewBastion(input *BastionInput) (string, error) { 43 input.Header = defaultHeader 44 return generate("bastion", bastionBashScript, input) 45 }