Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/argoproj/argo-cd
Browse files Browse the repository at this point in the history
  • Loading branch information
reggie-k committed Sep 19, 2024
2 parents a3897eb + f4c519a commit a6449b8
Show file tree
Hide file tree
Showing 130 changed files with 2,531 additions and 119 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ WORKDIR /home/argocd
####################################################################################################
# Argo CD UI stage
####################################################################################################
FROM --platform=$BUILDPLATFORM docker.io/library/node:22.8.0@sha256:bd00c03095f7586432805dbf7989be10361d27987f93de904b1fc003949a4794 AS argocd-ui
FROM --platform=$BUILDPLATFORM docker.io/library/node:22.9.0@sha256:cbe2d5f94110cea9817dd8c5809d05df49b4bd1aac5203f3594d88665ad37988 AS argocd-ui

WORKDIR /src
COPY ["ui/package.json", "ui/yarn.lock", "./"]
Expand Down
1 change: 1 addition & 0 deletions cmd/argocd-notification/commands/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func NewCommand() *cobra.Command {
}()

go ctrl.Run(ctx, processorsCount)
<-ctx.Done()
return nil
},
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ require (
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1
github.com/olekukonko/tablewriter v0.0.5
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/prometheus/client_golang v1.20.3
github.com/prometheus/client_golang v1.20.4
github.com/r3labs/diff v1.1.0
github.com/redis/go-redis/v9 v9.6.1
github.com/robfig/cron/v3 v3.0.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,8 @@ github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4=
github.com/prometheus/client_golang v1.20.3/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI=
github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
Expand Down
54 changes: 54 additions & 0 deletions resource_customizations/gateway.solo.io/Gateway/health.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
hs = {
status = "Progressing",
message = "Update in progress"
}

function getStatus(status)
-- Accepted
if status.state == "Accepted" or status.state == 1 then
hs.status = "Healthy"
hs.message = "The resource has been validated"
return hs
end

-- Warning
if status.state == "Warning" or status.state == 3 then
hs.status = "Degraded"
hs.message = status.reason
return hs
end

-- Pending
if status.state == "Pending" or status.state == 0 then
hs.status = "Suspended"
hs.message = "The resource has not yet been validated"
return hs
end

-- Rejected
if status.state == "Rejected" or status.state == 2 then
hs.status = "Degraded"
hs.message = status.reason
return hs
end

return hs
end

if obj.status ~= nil then
-- Namespaced version of status
if obj.status.statuses ~= nil then
for i, namespace in pairs(obj.status.statuses) do
hs = getStatus(namespace)
if hs.status ~= "Progressing" then
return hs
end
end
end

-- Older non-namespaced version of status
if obj.status.state ~= nil then
hs = getStatus(obj.status)
end
end
return hs
37 changes: 37 additions & 0 deletions resource_customizations/gateway.solo.io/Gateway/health_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
tests:
- healthStatus:
status: Degraded
message: "message that will describe all the reasons for warning"
inputPath: testdata/gloo-warning.yaml
- healthStatus:
status: Suspended
message: "The resource has not yet been validated"
inputPath: testdata/gloo-pending.yaml
- healthStatus:
status: Healthy
message: "The resource has been validated"
inputPath: testdata/gloo-accepted.yaml
- healthStatus:
status: Degraded
message: "message that will describe all the reasons for rejection"
inputPath: testdata/gloo-rejected.yaml
- healthStatus:
status: Degraded
message: "message that will describe all the reasons for warning"
inputPath: testdata/non-namespaced-gloo-warning.yaml
- healthStatus:
status: Suspended
message: "The resource has not yet been validated"
inputPath: testdata/non-namespaced-gloo-pending.yaml
- healthStatus:
status: Healthy
message: "The resource has been validated"
inputPath: testdata/non-namespaced-gloo-accepted.yaml
- healthStatus:
status: Degraded
message: "message that will describe all the reasons for rejection"
inputPath: testdata/non-namespaced-gloo-rejected.yaml
- healthStatus:
status: Progressing
message: "Update in progress"
inputPath: testdata/gloo-no-status.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: gateway.solo.io/v1
kind: Gateway
status:
statuses:
gloo-system:
reportedBy: gateway
state: Accepted
subresourceStatuses:
'*v1.Proxy.gateway-proxy_gloo-system':
reportedBy: gloo
state: Accepted
'*v1.Proxy.internal-proxy_gloo-system':
reportedBy: gloo
state: Accepted
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
apiVersion: gateway.solo.io/v1
kind: Gateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: gateway.solo.io/v1
kind: Gateway
status:
statuses:
gloo-system:
reportedBy: gateway
state: Pending
subresourceStatuses:
'*v1.Proxy.gateway-proxy_gloo-system':
reportedBy: gloo
state: Accepted
'*v1.Proxy.internal-proxy_gloo-system':
reportedBy: gloo
state: Pending
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: gateway.solo.io/v1
kind: Gateway
status:
statuses:
gloo-system:
reason: "message that will describe all the reasons for rejection"
reportedBy: gateway
state: Rejected
subresourceStatuses:
'*v1.Proxy.gateway-proxy_gloo-system':
reportedBy: gloo
state: Accepted
'*v1.Proxy.internal-proxy_gloo-system':
reportedBy: gloo
state: Rejected
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: gateway.solo.io/v1
kind: Gateway
status:
statuses:
gloo-system:
reason: "message that will describe all the reasons for warning"
reportedBy: gateway
state: Warning
subresourceStatuses:
'*v1.Proxy.gateway-proxy_gloo-system':
reportedBy: gloo
state: Accepted
'*v1.Proxy.internal-proxy_gloo-system':
reportedBy: gloo
state: Warning
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: gateway.solo.io/v1
kind: Gateway
status:
reportedBy: gateway
state: 1
subresourceStatuses:
'*v1.Proxy.gateway-proxy_gloo-system':
reportedBy: gloo
state: 1
'*v1.Proxy.internal-proxy_gloo-system':
reportedBy: gloo
state: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: gateway.solo.io/v1
kind: Gateway
status:
statuses:
gloo-system:
reportedBy: gateway
state: 0
subresourceStatuses:
'*v1.Proxy.gateway-proxy_gloo-system':
reportedBy: gloo
state: 1
'*v1.Proxy.internal-proxy_gloo-system':
reportedBy: gloo
state: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: gateway.solo.io/v1
kind: Gateway
status:
reason: "message that will describe all the reasons for rejection"
reportedBy: gateway
state: 2
subresourceStatuses:
'*v1.Proxy.gateway-proxy_gloo-system':
reportedBy: gloo
state: 1
'*v1.Proxy.internal-proxy_gloo-system':
reportedBy: gloo
state: 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: gateway.solo.io/v1
kind: Gateway
status:
reason: "message that will describe all the reasons for warning"
reportedBy: gateway
state: 3
subresourceStatuses:
'*v1.Proxy.gateway-proxy_gloo-system':
reportedBy: gloo
state: 1
'*v1.Proxy.internal-proxy_gloo-system':
reportedBy: gloo
state: 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
hs = {
status = "Progressing",
message = "Update in progress"
}

function getStatus(status)
-- Accepted
if status.state == "Accepted" or status.state == 1 then
hs.status = "Healthy"
hs.message = "The resource has been validated"
return hs
end

-- Warning
if status.state == "Warning" or status.state == 3 then
hs.status = "Degraded"
hs.message = status.reason
return hs
end

-- Pending
if status.state == "Pending" or status.state == 0 then
hs.status = "Suspended"
hs.message = "The resource has not yet been validated"
return hs
end

-- Rejected
if status.state == "Rejected" or status.state == 2 then
hs.status = "Degraded"
hs.message = status.reason
return hs
end

return hs
end

if obj.status ~= nil then
-- Namespaced version of status
if obj.status.statuses ~= nil then
for i, namespace in pairs(obj.status.statuses) do
hs = getStatus(namespace)
if hs.status ~= "Progressing" then
return hs
end
end
end

-- Older non-namespaced version of status
if obj.status.state ~= nil then
hs = getStatus(obj.status)
end
end
return hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
tests:
- healthStatus:
status: Degraded
message: "message that will describe all the reasons for warning"
inputPath: testdata/gloo-warning.yaml
- healthStatus:
status: Suspended
message: "The resource has not yet been validated"
inputPath: testdata/gloo-pending.yaml
- healthStatus:
status: Healthy
message: "The resource has been validated"
inputPath: testdata/gloo-accepted.yaml
- healthStatus:
status: Degraded
message: "message that will describe all the reasons for rejection"
inputPath: testdata/gloo-rejected.yaml
- healthStatus:
status: Degraded
message: "message that will describe all the reasons for warning"
inputPath: testdata/non-namespaced-gloo-warning.yaml
- healthStatus:
status: Suspended
message: "The resource has not yet been validated"
inputPath: testdata/non-namespaced-gloo-pending.yaml
- healthStatus:
status: Healthy
message: "The resource has been validated"
inputPath: testdata/non-namespaced-gloo-accepted.yaml
- healthStatus:
status: Degraded
message: "message that will describe all the reasons for rejection"
inputPath: testdata/non-namespaced-gloo-rejected.yaml
- healthStatus:
status: Progressing
message: "Update in progress"
inputPath: testdata/gloo-no-status.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: gateway.solo.io/v1
kind: MatchableHttpGateway
status:
statuses:
gloo-system:
reportedBy: gateway
state: Accepted
subresourceStatuses:
'*v1.Proxy.gateway-proxy_gloo-system':
reportedBy: gloo
state: Accepted
'*v1.Proxy.internal-proxy_gloo-system':
reportedBy: gloo
state: Accepted
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
apiVersion: gateway.solo.io/v1
kind: MatchableHttpGateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: gateway.solo.io/v1
kind: MatchableHttpGateway
status:
statuses:
gloo-system:
reportedBy: gateway
state: Pending
subresourceStatuses:
'*v1.Proxy.gateway-proxy_gloo-system':
reportedBy: gloo
state: Accepted
'*v1.Proxy.internal-proxy_gloo-system':
reportedBy: gloo
state: Pending
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: gateway.solo.io/v1
kind: MatchableHttpGateway
status:
statuses:
gloo-system:
reason: "message that will describe all the reasons for rejection"
reportedBy: gateway
state: Rejected
subresourceStatuses:
'*v1.Proxy.gateway-proxy_gloo-system':
reportedBy: gloo
state: Accepted
'*v1.Proxy.internal-proxy_gloo-system':
reportedBy: gloo
state: Rejected
Loading

0 comments on commit a6449b8

Please sign in to comment.