ayrorg / infra

Common infrastructure as code repository.
Apache License 2.0
3 stars 2 forks source link

kubeconfig pulumi error #80

Open braaar opened 1 year ago

braaar commented 1 year ago

We are getting a strange error from pulumi preview action

    pulumi:pulumi:Stack (infra-core-prod):
      error: Error: call of google-native:container/v1:Cluster/getKubeconfig returned an error: marshaling properties: awaiting input property "kubeconfig": no output "endpoint" on resource ""
          at Object.callback (/home/runner/work/infra/infra/node_modules/@pulumi/google-native/node_modules/@pulumi/runtime/invoke.ts:282:37)
          at Object.onReceiveStatus (/home/runner/work/infra/infra/node_modules/@grpc/grpc-js/src/client.ts:338:26)
          at Object.onReceiveStatus (/home/runner/work/infra/infra/node_modules/@grpc/grpc-js/src/client-interceptors.ts:426:34)
          at Object.onReceiveStatus (/home/runner/work/infra/infra/node_modules/@grpc/grpc-js/src/client-interceptors.ts:389:48)
          at /home/runner/work/infra/infra/node_modules/@grpc/grpc-js/src/call-stream.ts:276:24
          at processTicksAndRejections (node:internal/process/task_queues:77:11)
braaar commented 1 year ago

Here's the related code:

import * as k8s from '@pulumi/kubernetes';
import { cluster } from '../google/gke';

export const provider = new k8s.Provider('k8s-provider', {
  kubeconfig: cluster.getKubeconfig(),
});
braaar commented 1 year ago

and in google/gke:

import * as google from '@pulumi/google-native';
import { region, zone } from '../config';
import { provider } from './providers';

const serverConfig = google.container.v1.getServerConfigOutput({
  location: region,
});

const engineVersion = serverConfig.apply((conf) => conf.validMasterVersions[0]);

export const cluster = new google.container.v1.Cluster(
  'main-cluster',
  {
    name: 'ayr-main-cluster',
    initialClusterVersion: engineVersion,
    autopilot: { enabled: true },
  },
  { provider: provider.google },
);
braaar commented 1 year ago

The issue still presists