Skip to content

Commit

Permalink
Merge pull request #150 from nickwsuse/nickconfigmapmain
Browse files Browse the repository at this point in the history
[Main] Configmap Template for Creating Configmaps
  • Loading branch information
anupama2501 authored Jun 28, 2024
2 parents 48a07ba + 35dd516 commit bd372ac
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions extensions/kubeapi/configmaps/configmaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,26 @@ func CreateConfigMap(client *rancher.Client, clusterName, configMapName, descrip
}
return newConfig, nil
}

// NewConfigmapTemplate is a constructor that creates a configmap template
func NewConfigmapTemplate(configmapName, namespace string, annotations, labels, data map[string]string) coreV1.ConfigMap {
if annotations == nil {
annotations = make(map[string]string)
}
if labels == nil {
labels = make(map[string]string)
}
if data == nil {
data = make(map[string]string)
}

return coreV1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: configmapName,
Namespace: namespace,
Annotations: annotations,
Labels: labels,
},
Data: data,
}
}

0 comments on commit bd372ac

Please sign in to comment.