sigs.k8s.io/cluster-api-provider-aws@v1.5.5/pkg/cloud/services/userdata/files.go (about)

     1  /*
     2  Copyright 2019 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  	filesTemplate = `{{ define "files" -}}
    21  write_files:{{ range . }}
    22  -   path: {{.Path}}
    23      encoding: "base64"
    24      owner: {{.Owner}}
    25      permissions: '{{.Permissions}}'
    26      content: |
    27  {{.Content | Base64Encode | Indent 6}}
    28  {{- end -}}
    29  {{- end -}}
    30  `
    31  )
    32  
    33  // Files defines the input for generating write_files in cloud-init.
    34  type Files struct {
    35  	// Path specifies the full path on disk where to store the file.
    36  	Path string `json:"path"`
    37  
    38  	// Owner specifies the ownership of the file, e.g. "root:root".
    39  	Owner string `json:"owner"`
    40  
    41  	// Permissions specifies the permissions to assign to the file, e.g. "0640".
    42  	Permissions string `json:"permissions"`
    43  
    44  	// Content is the actual content of the file.
    45  	Content string `json:"content"`
    46  }