GoogleCloudPlatform / google-cloud-visualstudio

Google Cloud Tools for Visual Studio
https://cloud.google.com/tools/visual-studio/docs/
Apache License 2.0
87 stars 51 forks source link

VS 2022 - Kubernetes publish not working - asp.net core 6 #1121

Closed myappfree closed 2 years ago

myappfree commented 2 years ago

Publishing [ProjectNameHere] to Kubernetes. Failed to deploy project [ProjectNameHere] to Kubernetes.

evenr the generate app.yaml fails

at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>cDisplayClass15_0.b0() at Microsoft.VisualStudio.Composition.DelegateServices.<>cDisplayClass2_0`1.b0() at System.Lazy1.CreateValue() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Lazy1.get_Value() at GoogleCloudExtension.Services.Configuration.AppEngineConfiguration.CheckProjectConfiguration(IParsedProject project) at GoogleCloudExtension.GenerateConfigurationCommand.GenerateConfigurationContextMenuCommand.d4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at GoogleCloudExtension.Utils.ErrorHandlerUtils.d2.MoveNext()

myappfree commented 2 years ago

@jskeet any chance to fix the iussue? Thanks

Here my Workaround

first of all you need to install docker desktop

right click on project -> Add -> Docker Supoport

righ click on project-> open in Terminal

you need first time authentication

gcloud auth login
gcloud container clusters get-credentials {your cluster} --region {region} --project {project} gcloud auth configure-docker

create a script ps1


 $version = [DateTimeOffset]::Now.ToUnixTimeSeconds()

 docker build -t gcr.io/{project}/{your deployment name}:$version .

 docker push gcr.io/{project}/{your deployment name}:$version

 $deployment_yaml = (Get-Content .\Conf\Prod\deployment.yaml) -replace "{{version}}", $version

 $deployment_yaml | kubectl apply -f -

here an example of deployment.yaml please note the I have added {version} placeholder

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {your deployment name}
spec:
  replicas: 2
  selector:
    matchLabels:
      run: {your deployment name}
  template:
    metadata:
      creationTimestamp: null
      labels:
        run: {your deployment name}
    spec:
      containers:
      - image: gcr.io/{project}/{your deployment name}:{{version}}
        imagePullPolicy: IfNotPresent
        name: {your deployment name}
        ports:
        - containerPort: 8080
          protocol: TCP
        resources:
          limits:
            cpu: "2"
            memory: 2Gi
          requests:
            cpu: "2"
            memory: 2Gi
jskeet commented 2 years ago

The Visual Studio extension is no longer supported or maintained, I'm afraid.

myappfree commented 2 years ago

Thanks, could you please update the readme file to inform other developer that the project is not supported anymore?

jskeet commented 2 years ago

Yes, I've asked the product manager responsible to do so. Apologies for that not being done before.