通过VSCode Cloud Studio部署到Kubernetes时的MongoDB持久性

njthzxwz  于 2023-01-20  发布在  Kubernetes
关注(0)|答案(1)|浏览(127)

我正在尝试使用VSCode Cloud Studio插件在Kubernetes中部署和调试一个项目。当我在那里使用intellij和Cloud Studio插件时,一切都很完美。我的MongoDB在每次部署时都是持久的。当我在那里使用VSCode和Cloud Studio时,MongoDB不再是持久的。我希望能有任何提示让它在VSCode中工作。
当我通过intellij部署时,它使用相同的持久卷声明。当我通过VSCode部署时,它每次都创建一个新的持久卷声明。
下面是VSCode的launch.json:

{
    "configurations": [
        {
            "name": "Kubernetes: Run/Debug",
            "type": "cloudcode.kubernetes",
            "request": "launch",
            "skaffoldConfig": "${workspaceFolder}\\skaffold.yaml",
            "watch": false,
            "cleanUp": false,
            "portForward": true,
            "imageRegistry": "XYZ",
            "debug": [
                {
                    "image": "XYZ",
                    "containerName": "XYZ",
                    "sourceFileMap": {
                        "${workspaceFolder}": "/root/"
                    }
                }
            ]
        }
    ]
}

下面是来自intellij的workspace.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="b5a077d4-323a-4042-8c4a-3bdd2d997e47" name="Changes" comment="" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="Git.Settings">
    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
  </component>
  <component name="MarkdownSettingsMigration">
    <option name="stateVersion" value="1" />
  </component>
  <component name="ProjectId" id="2KV2OUqPUEf43q5Aj0UCGkKKm10" />
  <component name="ProjectViewState">
    <option name="hideEmptyMiddlePackages" value="true" />
    <option name="showLibraryContents" value="true" />
  </component>
  <component name="PropertiesComponent">
    <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
    <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
    <property name="WebServerToolWindowFactoryState" value="false" />
    <property name="com.google.cloudcode.ide_session_index" value="20230118_0001" />
    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
    <property name="nodejs_package_manager_path" value="npm" />
    <property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
    <property name="ts.external.directory.path" value="C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.2\plugins\JavaScriptLanguage\jsLanguageServicesImpl\external" />
  </component>
  <component name="RunDashboard">
    <option name="excludedTypes">
      <set>
        <option value="gcp-app-engine-local-run" />
      </set>
    </option>
  </component>
  <component name="RunManager">
    <configuration name="Develop on Kubernetes" type="google-container-tools-skaffold-run-config" factoryName="google-container-tools-skaffold-run-config-dev" show_console_on_std_err="false" show_console_on_std_out="false">
      <option name="allowRunningInParallel" value="false" />
      <option name="buildEnvironment" value="Local" />
      <option name="cleanupDeployments" value="false" />
      <option name="deployToCurrentContext" value="true" />
      <option name="deployToMinikube" value="false" />
      <option name="envVariables" />
      <option name="imageRepositoryOverride" />
      <option name="kubernetesContext" />
      <option name="mappings">
        <list />
      </option>
      <option name="moduleDeploymentType" value="DEPLOY_MODULE_SUBSET" />
      <option name="projectPathOnTarget" />
      <option name="resourceDeletionTimeoutMins" value="2" />
      <option name="selectedOptions">
        <list />
      </option>
      <option name="skaffoldConfigurationFilePath" value="$PROJECT_DIR$/skaffold.yaml" />
      <option name="skaffoldModules">
        <list>
          <option value="XYZ" />
        </list>
      </option>
      <option name="skaffoldNamespace" />
      <option name="skaffoldProfile" />
      <option name="skaffoldWatchMode" value="ON_DEMAND" />
      <option name="statusCheck" value="true" />
      <option name="verbosity" value="WARN" />
      <method v="2" />
    </configuration>
  </component>
  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="b5a077d4-323a-4042-8c4a-3bdd2d997e47" name="Changes" comment="" />
      <created>1674045398429</created>
      <option name="number" value="Default" />
      <option name="presentableId" value="Default" />
      <updated>1674045398429</updated>
      <workItem from="1674045401219" duration="2543000" />
    </task>
    <servers />
  </component>
  <component name="TypeScriptGeneratedFilesManager">
    <option name="version" value="3" />
  </component>
</project>

当然,项目的所有其他文件都是相同的。

yzuktlbb

yzuktlbb1#

看起来IntelliJ配置的云代码将部署限制到XYZ模块,但VS代码配置的云代码中没有。

相关问题