Azure Service Fabric Service Health Incorrectly Reported when Fabric URI is Reused Under New Application - azure-service-fabric

Service Fabric Versions:
Runtime - 9.0.1028.9590
SDK - 6.0.1028.9590
When moving a Service Fabric service instance to a new Service Fabric Application instance of the same Application Type, we reuse the Fabric URI as it existed under the original application under which it was created. However, the new service instance is reporting its health status to the original application, rather than to the new application. Below is a synthetic example that replicates our issue as it appears in our development environments (both OneBox and an actual Service Fabric cluster):
Initial Conditions:
Application Types:
A.B.Type
Applications:
fabric:/A/B (hosting fabric:/A/B/C/D)
Services:
fabric:/A/B/C/D (hosted under fabric:/A/B)
Process (Note: all steps are done either via PowerShell Service Fabric Module or Service Fabric Explorer, both produce identical results):
Create an identical Application instance from the existing Application Type but with a modified name (fabric:/A/B/C)
Remove the existing service (fabric:/A/B/C/D) from the originating application (fabric:/A/B)
Recreate the service using the same name (fabric:/A/B/C/D) under the new application (fabric:/A/B/C)
Observe the health reporting for the new service is reported back to the originating application (fabric:/A/B)
Final Conditions:
Application Types:
A.B.Type
Applications:
fabric:/A/B (hosting no services)
fabric:/A/B/C (hosting fabric:/A/B/C/D)
Services:
fabric:/A/B/C/D (hosted under fabric:/A/B/C, but service health and service/replica information reported to fabric:/A/B)
The recreated (new service with reused name) service knows it is being hosted under the new application:
Get-ServiceFabricServiceDescription -ServiceName 'fabric:/A/B/C/D'
ApplicationName : fabric:/A/B/C
ServiceName : fabric:/A/B/C/D
ServiceTypeName : Web1Type
ServiceKind : Stateful
HasPersistedState : True
MinReplicaSetSize : 3
TargetReplicaSetSize : 3
The new service reports its own health correctly:
Get-ServiceFabricServiceHealth -ServiceName 'fabric:/A/B/C/D'
ServiceName : fabric:/A/B/C/D
AggregatedHealthState : Ok
PartitionHealthStates :
PartitionId : 6a2ecddb-0f26-4703-8141-0dcaf80faa67
AggregatedHealthState : Ok
HealthEvents :
SourceId : System.FM
Property : State
HealthState : Ok
SequenceNumber : 504
SentAt : 9/19/2022 20:41:39
ReceivedAt : 9/19/2022 20:42:00
TTL : Infinite
Description : Service has been created.
RemoveWhenExpired : False
IsExpired : False
HealthReportID : FM_7.0_1008
Transitions : Warning->Ok = 9/19/2022 20:42:00, LastError = 1/1/0001 00:00:00
HealthStatistics :
Replica : 3 Ok, 0 Warning, 0 Error
Partition : 1 Ok, 0 Warning, 0 Error
The applications are not reporting the correct health (original application):
Get-ServiceFabricApplicationHealth -ApplicationName 'fabric:/A/B'
ApplicationName : fabric:/A/B
AggregatedHealthState : Ok
ServiceHealthStates :
ServiceName : fabric:/A/B/C/D
AggregatedHealthState : Ok
DeployedApplicationHealthStates : None
HealthEvents :
SourceId : System.CM
Property : State
HealthState : Ok
SequenceNumber : 52266
SentAt : 9/19/2022 20:39:38
ReceivedAt : 9/19/2022 20:39:38
TTL : Infinite
Description : Application has been created.
RemoveWhenExpired : False
IsExpired : False
HealthReportID : CM_7.0_1000
Transitions : Warning->Ok = 9/19/2022 20:39:38, LastError = 1/1/0001 00:00:00
HealthStatistics :
Replica : 3 Ok, 0 Warning, 0 Error
Partition : 1 Ok, 0 Warning, 0 Error
Service : 1 Ok, 0 Warning, 0 Error
DeployedApplication : 0 Ok, 0 Warning, 0 Error
DeployedServicePackage : 0 Ok, 0 Warning, 0 Error
New application:
Get-ServiceFabricApplicationHealth -ApplicationName 'fabric:/A/B/C'
ApplicationName : fabric:/A/B/C
AggregatedHealthState : Ok
ServiceHealthStates : None
DeployedApplicationHealthStates :
ApplicationName : fabric:/A/B/C
NodeName : _Node_0
AggregatedHealthState : Ok
ApplicationName : fabric:/A/B/C
NodeName : _Node_3
AggregatedHealthState : Ok
ApplicationName : fabric:/A/B/C
NodeName : _Node_1
AggregatedHealthState : Ok
HealthEvents :
SourceId : System.CM
Property : State
HealthState : Ok
SequenceNumber : 52289
SentAt : 9/19/2022 20:41:26
ReceivedAt : 9/19/2022 20:41:26
TTL : Infinite
Description : Application has been created.
RemoveWhenExpired : False
IsExpired : False
HealthReportID : CM_7.0_1000
Transitions : Warning->Ok = 9/19/2022 20:41:26, LastError = 1/1/0001 00:00:00
HealthStatistics :
Service : 0 Ok, 0 Warning, 0 Error
Replica : 0 Ok, 0 Warning, 0 Error
Partition : 0 Ok, 0 Warning, 0 Error
DeployedServicePackage : 3 Ok, 0 Warning, 0 Error
DeployedApplication : 3 Ok, 0 Warning, 0 Error
The service is actively reporting its health. Attempts to send updated health reports using either Send-ServiceFabricApplicationHealthReport or Send-ServiceFabricServiceHealthReport do not produce corrected results.
Creating subsequent new service instances under either application (without removing and recreating) result in correct health and service/replica reporting.
Question Is this a bug or is this scenario of reusing a service name that previously existed under another application not supported?

Related

filtering objects imported via CSV file

I'm trying to make a dynamic multiple selection menu via powershell, based on data imported via a CSV file.
After importing objects via CSV, and try to add multiple filters on the SEL and RESTART fields and on their values. I see a strange behavior of the counter, to count the number of objects which are conform the different conditions/filters.
It seems that counting 01 returns no display ... suggestion, ideas (I've it also done with one filtering ... same problem)
## MENU
$csvFilePathMENU=CheckFileExcist –FileName $csvFileMENU -FilePath $csvPathMENU
# import the objects ... and put it into a variable
$global:menus = Import-Csv $csvFilePathMENU
$global:nrElemsMENU=$menus.Count
write-output "$($nrElemsMENU)"
I tried two different ways ... to filter
$nrRestarts=$($menus | Where-Object {( $_.RESTART -as [int] -eq 1 )} | Where-Object {( $_.SEL -as [int] -eq 1 )} ).count
write-host "nrRestarts : ", $nrRestarts
$nrRestarts2=$($menus | Where {( $_.RESTART -as [int] -eq 1 ) -and ( $_.SEL -as [int] -eq 1 )}).count
write-host "nrRestarts : ", $nrRestarts2
[I've tried it with several combinations]
left side picture
INPUT CSV 01 : where SEL and RESTART are 1
MENU : MEINBERG
SEL : 1
RESTART : 1
...
MENU : NTP
SEL : 1
RESTART : 1
RESULT 01 :
nrRestarts : 2
nrRestarts : 2
right side picture
INPUT CSV 02 : where SEL and RESTART are 1
MENU : NTP
SEL : 1
RESTART : 1
RESULT 02 :
nrRestarts :
nrRestarts :
WRONG/NO RESULT ... ??? 01 ???
any body a suggestion?
In the Windows Powershell ISE ... the feedback
PS C:\Users\Administrator> $nrElemsMENU
9
PS C:\Users\Administrator> $menus
MENU : anti-virus : Windows-Defender
info : Windows-Defender has to be uninstalled, before installing an other anti-virus program
function : Windows-Defender
status : -1
SEL : 0
RESTART : 0
FUNC : stopWindowsDefender
PARENT : Anti-virus
MENU : Windows 'ServerStandard'
info : Windows has to be upgraded if working with an EVALUATION prod key
function :
status : -1
SEL : 0
RESTART : 1
FUNC :
PARENT :
MENU : F-SEC
info : F-SEC has to be configured as an isolated machine on the CSI server
function : F-SEC
status : -1
SEL : 0
RESTART : 0
FUNC : startFSec
PARENT :
MENU : NTP
info : disable default Windows NTP service
function :
status : -1
SEL : 1
RESTART : 0
FUNC :
PARENT : NTP
MENU : MEINBERG
info : disable default Windows NTP service
function :
status : -1
SEL : 0
RESTART : 1
FUNC :
PARENT :
MENU : NTP
info : disable default Windows NTP service
function :
status : -1
SEL : 1
RESTART : 1
FUNC :
PARENT :
MENU : openssl
info : disable default Windows NTP service
function :
status : -1
SEL : 0
RESTART : 0
FUNC :
PARENT : OpenSSL
MENU : execute
info :
function :
status : -1
SEL : 0
RESTART : 1
FUNC :
PARENT :
MENU : quite
info :
function :
status : -1
SEL : 0
RESTART : 1
FUNC :
PARENT :

How can I see the POST parameters through Powershell when using Get-WebRequest method?

I am working on a simple PowerShell script which will allow me to inspect all incoming web requests to my IIS. Script works quite well, however it appears that I cannot see the POST parameters sent from the client to the server. If the method is 'GET' these are shown fine on the the URL, but the method is 'POST' these are not.
These are the details that I can see for every request. As you can see, I cannot see the post parameters:
requestId : fc00000680003d08
connectionId : fc00000660003d07
verb : POST
url : /test.php?method=getCustomers
siteId : 2
localPort : 443
hostName : m.mytestdomain.com
clientIpAddress : 127.0.0.1
timeElapsed : 313
pipeLineState : 128
timeInState : 313
currentModule : IsapiModule
timeInModule : 313
localIpAddress : 127.0.0.1
RunspaceId : 0e0d6f6f-24ec-44f7-8097-adb9932c2f7f
Attributes : {Microsoft.IIs.PowerShell.Framework.ConfigurationAttribute, Microsoft.IIs.PowerShell.Framework.ConfigurationAttribute, Microsoft.IIs.PowerShell.Framework.ConfigurationAttribute, Microsoft.IIs.PowerShell.Framework.ConfigurationAttribute…}
ChildElements : {}
ElementTagName : request
Methods :
Schema : Microsoft.IIs.PowerShell.Framework.ConfigurationElementSchema
Any ideas?
thank you.

Pulumi invalid network configuration for bridge mode ECS service

I'm trying to create an ECS Service using Pulumi with task with network mode bridge in order to run multiple tasks on an instance.
When creating the service, pulumi outputs error: Plan apply failed: InvalidParameterException: Network Configuration is not valid for the given networkMode of this task definition. which is not valid.
It seems pulumi provides a networkConfiguration even though this is not permitted when the network mode is bridge:
[urn=urn:pulumi:dev::pulumi::pulumi:pulumi:Stack::pulumi-dev]
+ aws:ecs/service:Service: (create)
[urn=urn:pulumi:dev::pulumi::awsx:x:ecs:EC2Service$aws:ecs/service:Service::test]
cluster : "arn:aws:ecs:eu-central-1:131009595785:cluster/test-12196f9"
deploymentMaximumPercent : 200
deploymentMinimumHealthyPercent: 100
desiredCount : 2
enableEcsManagedTags : false
launchType : "EC2"
loadBalancers : [
[0]: {
containerName : "backend"
containerPort : 3000
targetGroupArn: "arn:aws:elasticloadbalancing:eu-central-1:131009595785:targetgroup/57d096ee-73ab93e/fce1408d3c067066"
}
]
name : "test-3e870ec"
networkConfiguration : {
assignPublicIp: false
securityGroups: [
[0]: "sg-035513ef294414b65"
]
subnets : [
[0]: "subnet-08831ff5642406fc7"
[1]: "subnet-00e3e870707b6aa90"
]
}
schedulingStrategy : "REPLICA"
taskDefinition : "arn:aws:ecs:eu-central-1:131009595785:task-definition/test-aece9bcd:24"
waitForSteadyState : true
Is there a way to avoid setting the networkConfiguration? I can set securityGroups and subnets of the service to [] but there is no way to set assignPublicIp.
Looks like this was not yet supported by pulumi but was fixed in PR 233 with this change.
The fix is included in pulumi-awsx 0.18.2.
A networkConfiguration is now only specified for network mode awsvpc.

Monitoring Service Fabric deployments

Im doing deployments from Jenkins job using powershell. THe job will be sucessful and the deployment starts on the cluster, but sometimes that fails and rollsback in which case I don't get notification of it.
Is there a way to monitor the upgrade from my jenkins job using a powershell cmdlet to poll the status or some way to know if it completed with a success or failure?
No clue if there is a smarter way, but you can get the upgrade state for a given application using the "Get-ServiceFabricApplicationUpgrade" cmdlet.
Get-ServiceFabricApplicationUpgrade -ApplicationName fabric:/your/awesomeApp
By pure coincidence i have an upgrade running on our cluster just now, and you get and output like the following (i have adjusted some names parameters etc):
ApplicationName : fabric:/your/awesomeApp
ApplicationTypeName : YourAwesomeApp.FabricType
TargetApplicationTypeVersion : 2017.1005.2-r20.1
ApplicationParameters : { "Param1" = "Value1";
"Param2" = "Value2";
"ActorService_MinReplicaSetSize" = "2";
"ActorService_PartitionCount" = "1";
"ActorService_TargetReplicaSetSize" = "3";
}
StartTimestampUtc : 05.10.2017 08.49.39
UpgradeState : RollingForwardInProgress
UpgradeDuration : 00:09:01
CurrentUpgradeDomainDuration : 00:00:00
NextUpgradeDomain : 4
UpgradeDomainsStatus : { "3" = "InProgress";
"0" = "Completed";
"1" = "Completed";
"2" = "Completed";
"4" = "Pending" }
UpgradeKind : Rolling
RollingUpgradeMode : Monitored
FailureAction : Rollback
ForceRestart : False
UpgradeReplicaSetCheckTimeout : 49710.06:28:15
HealthCheckWaitDuration : 00:00:00
HealthCheckStableDuration : 00:02:00
HealthCheckRetryTimeout : 00:10:00
UpgradeDomainTimeout : 00:30:00
UpgradeTimeout : 01:00:00
ConsiderWarningAsError :
MaxPercentUnhealthyPartitionsPerService :
MaxPercentUnhealthyReplicasPerPartition :
MaxPercentUnhealthyServices :
MaxPercentUnhealthyDeployedApplications :
ServiceTypeHealthPolicyMap :
This will also report if it is in a rollback state.
It might be interesting to figure out if you can get a callback/event or something from the Health Monitoring, because that is basically what causes the upgrade to rollback.

DSC V5 - Keeps attempting to reapply a failed configuraiton

We have started using DSC to deploy some applications. We are pushing out the configurations and only want it to run this configuration once and then stop. However it seems that if a configuration fails we end up with a pending configuration which DSC seems to keep attempting to reapply. Is this intended behavior? Is there anyway for us to prevent this happening.
Here are our LCM settings
ActionAfterReboot : ContinueConfiguration
AgentId : 4314CBF5-928E-11E5-941E-00155D0****
AllowModuleOverWrite : True
CertificateID : EBB297F164BDA1C1A7918C12C31D0F70110****
ConfigurationDownloadManagers : {[ConfigurationRepositoryWeb]DSCHTTP}
ConfigurationID : 3fa96bab-ac50-4b80-a9ac-384bfd*****
ConfigurationMode : ApplyOnly
ConfigurationModeFrequencyMins : 15
Credential :
DebugMode : {NONE}
DownloadManagerCustomData :
DownloadManagerName :
LCMCompatibleVersions : {1.0, 2.0}
LCMState : Idle
LCMStateDetail :
LCMVersion : 2.0
StatusRetentionTimeInDays : 10
PartialConfigurations :
RebootNodeIfNeeded : True
RefreshFrequencyMins : 30
RefreshMode : Push
ReportManagers : {}
ResourceModuleManagers : {[ResourceRepositoryWeb]DSCHTTP}
PSComputerName : D6B*****01
PSComputerName : D6B*****01
Here is a blog that explains how LCM behaves and how you can get out of it http://nanalakshmanan.github.io/blog/Converging-to-a-desired-state/