Pulumi:如何忽略对先前部署的资源所做的更改?

时间:2020-09-10 22:45:17

标签: c# azure-application-gateway pulumi

在我的一个Pulumi Azure堆栈中,我使用Application Gateway Ingress Router for Kubernetes

创建了一个Azure应用网关路由器和一个Azure Kubernetes服务群集。

我的最初AppGW部署将由Application Gateway入口路由器在幕后进行修改-在我们在Kubernetes集群中创建其他Ingress Kubernetes资源时添加新的设置和绑定。

如果我曾经在包含AppGW路由器的堆栈上运行pulumi refresh命令,则Pulumi将获取Ingress资源所做的所有更改,并在随后的{{1} }操作-破坏了我们所有的DNS和路由。

如何在Kubernetes中编程我的AppGW资源以忽略这些后续更改?以下是到目前为止我使用pulumi up字段尝试过的操作:

CustomResourceOptions.IgnoreChanges

但是,设置完这些值之后,当我尝试运行var applicationGateway = new ApplicationGateway("appgateway", new ApplicationGatewayArgs() { Name = "aks-appgateway", ResourceGroupName = resourceGroup.Name, Sku = new ApplicationGatewaySkuArgs() { Capacity = 2, Name = "Standard_v2", Tier = "Standard_v2", }, GatewayIpConfigurations = new ApplicationGatewayGatewayIpConfigurationArgs[] { new ApplicationGatewayGatewayIpConfigurationArgs { Name = "appGatewayIpConfig", SubnetId = appGateWaySubnet.Id, } }, FrontendPorts = new ApplicationGatewayFrontendPortArgs[] { new ApplicationGatewayFrontendPortArgs { Name = "httpPort", Port = 80 }, new ApplicationGatewayFrontendPortArgs { Name = "httpsPort", Port = 443 }, }, FrontendIpConfigurations = new[] { new ApplicationGatewayFrontendIpConfigurationArgs() { Name = "aksFrontEndIp", PublicIpAddressId = appGatewayIp.Id, } }, BackendHttpSettings = new[] { new ApplicationGatewayBackendHttpSettingArgs() { Name = "HttpRouting", CookieBasedAffinity = "Disabled", Port = 80, Protocol = "Http", RequestTimeout = 60 } }, BackendAddressPools = new ApplicationGatewayBackendAddressPoolArgs() { Name = "aks-backend" }, EnableHttp2 = true, HttpListeners = new[] { new ApplicationGatewayHttpListenerArgs() { Name = "aks-HttpListener", // need to match the values declared earlier FrontendIpConfigurationName = "aksFrontEndIp", FrontendPortName = "httpPort", Protocol = "Http" }, new ApplicationGatewayHttpListenerArgs() { Name = "aks-HttpsListener", // need to match the values declared earlier FrontendIpConfigurationName = "aksFrontEndIp", FrontendPortName = "httpsPort", Protocol = "Https", SslCertificateName = "sdkbin-ssl" } }, RequestRoutingRules = new ApplicationGatewayRequestRoutingRuleArgs() { BackendAddressPoolName = "aks-backend", HttpListenerName = "aks-HttpListener", BackendHttpSettingsName = "HttpRouting", RuleType = "Basic", Name = "aks-routing" }, SslCertificates = new ApplicationGatewaySslCertificateArgs() { Name = "sdkbin-ssl", KeyVaultSecretId = config.RequireSecret("tlsSecret") }, Identity = new ApplicationGatewayIdentityArgs { IdentityIds = gatewayIdentity.Id }, }, new CustomResourceOptions() { Protect = IsProtected, IgnoreChanges = new List<string>() { "httpListeners", "probes", "backendAddressPools", "backendHttpSettings", "frontendPorts", "tags" } }) ; // ignore changes 时出现以下错误:

pulumi up

忽略这些字段的更改似乎会导致所有这些错误-那么,最好的方法是什么?不放弃Kubernetes对我在Pulumi中的Application Gateway路由器所做的更改?

0 个答案:

没有答案