protected createNamespaceIfNeeded()

in lib/addons/velero/index.ts [152:168]


    protected createNamespaceIfNeeded(clusterInfo: ClusterInfo, defaultName: string, namespace: string, create: boolean): {name: string, manifest?: KubernetesManifest} {
        // Create Namespace if namespace is not explicied defined.
        if (namespace){
            // Create Namespace if the "create" option is true
            if (create) {
                const namespaceManifest = createNamespace(namespace, clusterInfo.cluster);
                return { name: namespace, manifest: namespaceManifest };
            }
            // If the "create" option if false, then namespace will not be created, return namespace.name
            else{
                return { name: namespace };
            }
        }
        else{
            return { name: defaultName }; // initial value of veleroNamespace
        }
    }