Skip to content

Commit

Permalink
Merge pull request GoogleCloudPlatform#2474 from justinsb/tcpuptimech…
Browse files Browse the repository at this point in the history
…eck_immutable

tests: fix tcpuptimecheckconfig test for immutable change
  • Loading branch information
google-oss-prow[bot] authored Aug 12, 2024
2 parents b0171d3 + 92f3267 commit 3bd442f
Show file tree
Hide file tree
Showing 3 changed files with 353 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: monitoring.cnrm.cloud.google.com/v1beta1
kind: MonitoringUptimeCheckConfig
metadata:
annotations:
cnrm.cloud.google.com/management-conflict-prevention-policy: none
cnrm.cloud.google.com/mutable-but-unreadable-fields: '{}'
cnrm.cloud.google.com/observed-secret-versions: (removed)
cnrm.cloud.google.com/state-into-spec: merge
finalizers:
- cnrm.cloud.google.com/finalizer
- cnrm.cloud.google.com/deletion-defender
generation: 3
labels:
cnrm-test: "true"
name: monitoringuptimecheckconfig-${uniqueId}
namespace: ${uniqueId}
spec:
displayName: updated-tcp-uptime-check
period: 60s
projectRef:
external: projects/${projectId}
resourceGroup:
groupRef:
name: monitoringgroup-${uniqueId}
resourceType: INSTANCE
resourceID: ${uptimeCheckConfigId}
tcpCheck:
port: 80
timeout: 45s
status:
conditions:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: The resource is up to date
reason: UpToDate
status: "True"
type: Ready
observedGeneration: 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,314 @@
POST https://monitoring.googleapis.com/v3/projects/${projectId}/groups?alt=json
Content-Type: application/json
User-Agent: kcc/controller-manager DeclarativeClientLib/0.0.1

{
"displayName": "sample-group",
"filter": "resource.metadata.region=europe-west2",
"isCluster": true
}

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"displayName": "sample-group",
"filter": "resource.metadata.region=europe-west2",
"isCluster": true,
"name": "projects/${projectId}/groups/1723315727009128224"
}

---

GET https://monitoring.googleapis.com/v3/projects/${projectId}/groups/1723315727009128224?alt=json
Content-Type: application/json
User-Agent: kcc/controller-manager DeclarativeClientLib/0.0.1

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"displayName": "sample-group",
"filter": "resource.metadata.region=europe-west2",
"isCluster": true,
"name": "projects/${projectId}/groups/1723315727009128224"
}

---

POST https://monitoring.googleapis.com/v3/projects/${projectId}/uptimeCheckConfigs?alt=json
Content-Type: application/json
User-Agent: kcc/controller-manager DeclarativeClientLib/0.0.1

{
"displayName": "tcp-uptime-check",
"period": "60s",
"resourceGroup": {
"groupId": "1723315727009128224",
"resourceType": "INSTANCE"
},
"tcpCheck": {
"port": 80
},
"timeout": "30s"
}

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"checkerType": "STATIC_IP_CHECKERS",
"displayName": "tcp-uptime-check",
"name": "projects/${projectId}/uptimeCheckConfigs/${uptimeCheckConfigId}",
"period": "60s",
"resourceGroup": {
"groupId": "1723315727009128224",
"resourceType": "INSTANCE"
},
"tcpCheck": {
"port": 80
},
"timeout": "30s"
}

---

GET https://monitoring.googleapis.com/v3/projects/${projectId}/uptimeCheckConfigs/${uptimeCheckConfigId}?alt=json
Content-Type: application/json
User-Agent: kcc/controller-manager DeclarativeClientLib/0.0.1

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"checkerType": "STATIC_IP_CHECKERS",
"displayName": "tcp-uptime-check",
"name": "projects/${projectId}/uptimeCheckConfigs/${uptimeCheckConfigId}",
"period": "60s",
"resourceGroup": {
"groupId": "1723315727009128224",
"resourceType": "INSTANCE"
},
"tcpCheck": {
"port": 80
},
"timeout": "30s"
}

---

PATCH https://monitoring.googleapis.com/v3/projects/${projectId}/uptimeCheckConfigs/${uptimeCheckConfigId}?alt=json&updateMask=displayName%2Ctimeout
Content-Type: application/json
User-Agent: kcc/controller-manager DeclarativeClientLib/0.0.1

{
"displayName": "updated-tcp-uptime-check",
"name": "projects/projects/${projectId}/uptimeCheckConfigs/${uptimeCheckConfigId}",
"period": "60s",
"tcpCheck": {
"port": 80
},
"timeout": "45s"
}

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"checkerType": "STATIC_IP_CHECKERS",
"displayName": "updated-tcp-uptime-check",
"name": "projects/${projectId}/uptimeCheckConfigs/${uptimeCheckConfigId}",
"period": "60s",
"resourceGroup": {
"groupId": "1723315727009128224",
"resourceType": "INSTANCE"
},
"tcpCheck": {
"port": 80
},
"timeout": "45s"
}

---

GET https://monitoring.googleapis.com/v3/projects/${projectId}/uptimeCheckConfigs/${uptimeCheckConfigId}?alt=json
Content-Type: application/json
User-Agent: kcc/controller-manager DeclarativeClientLib/0.0.1

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"checkerType": "STATIC_IP_CHECKERS",
"displayName": "updated-tcp-uptime-check",
"name": "projects/${projectId}/uptimeCheckConfigs/${uptimeCheckConfigId}",
"period": "60s",
"resourceGroup": {
"groupId": "1723315727009128224",
"resourceType": "INSTANCE"
},
"tcpCheck": {
"port": 80
},
"timeout": "45s"
}

---

DELETE https://monitoring.googleapis.com/v3/projects/${projectId}/uptimeCheckConfigs/${uptimeCheckConfigId}?alt=json
Content-Type: application/json
User-Agent: kcc/controller-manager DeclarativeClientLib/0.0.1

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{}

---

GET https://monitoring.googleapis.com/v3/projects/${projectId}/uptimeCheckConfigs/${uptimeCheckConfigId}?alt=json
Content-Type: application/json
User-Agent: kcc/controller-manager DeclarativeClientLib/0.0.1

404 Not Found
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"error": {
"code": 404,
"message": "Config not found for check ${uptimeCheckConfigId} in project ${projectId}",
"status": "NOT_FOUND"
}
}

---

GET https://monitoring.googleapis.com/v3/projects/${projectId}/groups/1723315727009128224?alt=json
Content-Type: application/json
User-Agent: kcc/controller-manager DeclarativeClientLib/0.0.1

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"displayName": "sample-group",
"filter": "resource.metadata.region=europe-west2",
"isCluster": true,
"name": "projects/${projectId}/groups/1723315727009128224"
}

---

DELETE https://monitoring.googleapis.com/v3/projects/${projectId}/groups/1723315727009128224?alt=json
Content-Type: application/json
User-Agent: kcc/controller-manager DeclarativeClientLib/0.0.1

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{}

---

GET https://monitoring.googleapis.com/v3/projects/${projectId}/groups/1723315727009128224?alt=json
Content-Type: application/json
User-Agent: kcc/controller-manager DeclarativeClientLib/0.0.1

404 Not Found
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"error": {
"code": 404,
"message": "Could not find group definition for '1723315727009128224'.",
"status": "NOT_FOUND"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ spec:
name: monitoringgroup-${uniqueId}
resourceType: INSTANCE
tcpCheck:
port: 81
# port: 81 # infeasible update: ({true <nil> TcpCheck.Port}) would require recreation
port: 80

0 comments on commit 3bd442f

Please sign in to comment.