-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(api): role/clusterole/podlist endpoints (#8881)
* fix: role/clusterrole listing, improve logging when metrics are disabled and add container statuses to pod list * fix unit tests and license check * update cd-helm workflow * remove chart lint from master workflow * remove debug log line * regenerate schema
- Loading branch information
Showing
14 changed files
with
352 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,6 @@ jobs: | |
with: | ||
version: v3.12.1 | ||
- uses: helm/[email protected] | ||
- run: ct lint --config=.ct.yml --target-branch ${{ github.event.repository.default_branch }} | ||
- uses: helm/[email protected] | ||
with: | ||
node_image: kindest/node:v1.29.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2017 The Kubernetes Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package pod | ||
|
||
import ( | ||
v1 "k8s.io/api/core/v1" | ||
) | ||
|
||
type ContainerStatus struct { | ||
Name string `json:"name"` | ||
State ContainerState `json:"state"` | ||
Ready bool `json:"ready"` | ||
} | ||
|
||
type ContainerState string | ||
|
||
const ( | ||
Waiting ContainerState = "Waiting" | ||
Running ContainerState = "Running" | ||
Terminated ContainerState = "Terminated" | ||
Unknown ContainerState = "Unknown" | ||
) | ||
|
||
func ToContainerStatuses(containerStatuses []v1.ContainerStatus) []ContainerStatus { | ||
result := make([]ContainerStatus, len(containerStatuses)) | ||
for i, c := range containerStatuses { | ||
result[i] = ContainerStatus{ | ||
Name: c.Name, | ||
State: toContainerState(c.State), | ||
Ready: c.Ready, | ||
} | ||
} | ||
|
||
return result | ||
} | ||
|
||
func toContainerState(state v1.ContainerState) ContainerState { | ||
if state.Waiting != nil { | ||
return Waiting | ||
} | ||
|
||
if state.Terminated != nil { | ||
return Terminated | ||
} | ||
|
||
if state.Running != nil { | ||
return Running | ||
} | ||
|
||
return Unknown | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.