Documentation ¶
Index ¶
- func GenerateModifiedConfigFile(dataFiles [][]byte, patchData []byte, fns []string, rsName string, ...) ([]byte, error)
- func GenerateModifiedYamlFileForExistingResources(patchData []byte, existingResData []byte, resName string) ([]byte, error)
- func GetPatchFromFile(fns []string) ([]byte, error)
- func GetPatchFromPatchJSON(p []map[string]interface{}) ([]byte, error)
- func SetBaseConfigMap(fns []string, cmName string) ([]byte, error)
- func SetBaseSecret(fns []string, cmName string) ([]byte, error)
- type ConfigMapResource
- type MetaDataStr
- type SecretResource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateModifiedConfigFile ¶
func GenerateModifiedConfigFile(dataFiles [][]byte, patchData []byte, fns []string, rsName string, rsKind string) ([]byte, error)
GenerateModifiedConfigFile takes in two JSON bytes arrays. First JSON byte array consists of data which the generated configMap shall contain or the raw data that the files contain. Second JSON byte array consists of the patch JSON. Example of both JSONs configMap.json
[{ "scenario": "traffic", "address": "Dawson Creek", "location": { "lat": 45.539626, "lon": -122.929569 }, "sensors": [{ "address": "Shute & Dawson Creek", "location": { "lat": 45.544223, "lon": -122.926128 }, "algorithm": "object-detection", "mnth": 75.0, "alpha": 45.0, "fovh": 90.0, "fovv": 68.0, "theta": 0.0, "simsn": "cams1o1c0", "simfile": "_traffic.mp4$" }] }]
PatchJSON: [
{ "op": "replace", "path": "/data/config.json", "value": "1" }
]
func GenerateModifiedYamlFileForExistingResources ¶
func GenerateModifiedYamlFileForExistingResources(patchData []byte, existingResData []byte, resName string) ([]byte, error)
GenerateModifiedYamlFileForExistingResources takes in the patchData and the existing resource's yaml file and returns the modified yaml file for the resource
func GetPatchFromFile ¶
GetPatchFromFile generates patch files. Patch files are array of JSON, eg:
[ { "op": "replace", "path": "/Data/config1.json", "value": "1" }, { "op": "replace", "path": "/Data/config2.json", "value": "1" } ] Here "config.json" shall be replaced by the fileNames.
func GetPatchFromPatchJSON ¶
GetPatchFromPatchJSON generates patch files in bytes. This is used when the user requests
the patchType as "json" and patchJSON as below: "patchType": "json", "patchJson": [ { "op": "replace", "path": "/spec/replicas", "value": "1" } ]
func SetBaseConfigMap ¶
SetBaseConfigMap returns a base configMap JSON in form of bytes
Types ¶
type ConfigMapResource ¶
type ConfigMapResource struct { APIVersion string `yaml:"apiVersion"` Kind string `yaml:"kind"` MetaData MetaDataStr `yaml:"metadata"` Data map[string]string `yaml:"data"` }
ConfigMapResource consists of ApiVersion, Kind, MetaData and Data map
type MetaDataStr ¶
MetaDataStr consists of Name and Namespace. Namespace is optional
type SecretResource ¶
type SecretResource struct { APIVersion string `yaml:"apiVersion"` Kind string `yaml:"kind"` MetaData MetaDataStr `yaml:"metadata"` Type string `yaml:"type"` Data map[string]string `yaml:"data"` }
SecretResource consists of ApiVersion, Kind, MetaData, type and Data map