Open bigkraig opened 4 years ago
I believe this would also allow us to specify annotations for clusters that are using kube2iam
This is really needed.
To eliminate the need to deal with output/input types, I'm doing this:
class ExtendedPodBuilder extends kx.PodBuilder {
public asExtendedDeploymentSpec(
args?: types.PodBuilderDeploymentSpec,
metadata?: k8s.types.input.meta.v1.ObjectMeta
): pulumi.Output<k8s.types.input.apps.v1.DeploymentSpec> {
const podName = this.podSpec.containers.apply((containers: any) => {
return pulumi.output(containers[0].name);
});
const appLabels = { app: podName };
const _args = args || {};
const deploymentSpec: k8s.types.input.apps.v1.DeploymentSpec = {
..._args,
selector: { matchLabels: appLabels },
replicas: _args.replicas ?? 1,
template: {
metadata: { labels: appLabels, ...(metadata || {}) },
spec: this.podSpec,
},
};
return pulumi.output(deploymentSpec);
}
}
And then:
pb.asExtendedDeploymentSpec(
{ replicas: 1 },
{
annotations: myAnnotations,
}
),
Please modify the PodBuilder to allow specifying customized metadata in a pod template. I need to be able to specify annotations (for Prometheus discovery) and labels (for compliance) on my pods.
Thanks!