-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18723 from juanvallejo/jvallejo/mark-found-deploy…
…ment-nodes Automatic merge from submit-queue. tags existing deployment nodes as "found" Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1544183#c3 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1540560#c7 Followup to: #18579 cc @soltysh
- Loading branch information
Showing
7 changed files
with
303 additions
and
2 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
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,66 @@ | ||
package graphview | ||
|
||
import ( | ||
appsedges "github.com/openshift/origin/pkg/oc/graph/appsgraph" | ||
osgraph "github.com/openshift/origin/pkg/oc/graph/genericgraph" | ||
kubeedges "github.com/openshift/origin/pkg/oc/graph/kubegraph" | ||
kubegraph "github.com/openshift/origin/pkg/oc/graph/kubegraph/nodes" | ||
) | ||
|
||
type DaemonSet struct { | ||
DaemonSet *kubegraph.DaemonSetNode | ||
|
||
OwnedPods []*kubegraph.PodNode | ||
CreatedPods []*kubegraph.PodNode | ||
|
||
Images []ImagePipeline | ||
} | ||
|
||
// AllDaemonSets returns all the DaemonSets that aren't in the excludes set and the set of covered NodeIDs | ||
func AllDaemonSets(g osgraph.Graph, excludeNodeIDs IntSet) ([]DaemonSet, IntSet) { | ||
covered := IntSet{} | ||
views := []DaemonSet{} | ||
|
||
for _, uncastNode := range g.NodesByKind(kubegraph.DaemonSetNodeKind) { | ||
if excludeNodeIDs.Has(uncastNode.ID()) { | ||
continue | ||
} | ||
|
||
view, covers := NewDaemonSet(g, uncastNode.(*kubegraph.DaemonSetNode)) | ||
covered.Insert(covers.List()...) | ||
views = append(views, view) | ||
} | ||
|
||
return views, covered | ||
} | ||
|
||
// NewDaemonSet returns the DaemonSet and a set of all the NodeIDs covered by the DaemonSet | ||
func NewDaemonSet(g osgraph.Graph, node *kubegraph.DaemonSetNode) (DaemonSet, IntSet) { | ||
covered := IntSet{} | ||
covered.Insert(node.ID()) | ||
|
||
view := DaemonSet{} | ||
view.DaemonSet = node | ||
|
||
for _, uncastPodNode := range g.PredecessorNodesByEdgeKind(node, kubeedges.ManagedByControllerEdgeKind) { | ||
podNode := uncastPodNode.(*kubegraph.PodNode) | ||
covered.Insert(podNode.ID()) | ||
view.OwnedPods = append(view.OwnedPods, podNode) | ||
} | ||
|
||
for _, istNode := range g.PredecessorNodesByEdgeKind(node, kubeedges.TriggersDeploymentEdgeKind) { | ||
imagePipeline, covers := NewImagePipelineFromImageTagLocation(g, istNode, istNode.(ImageTagLocation)) | ||
covered.Insert(covers.List()...) | ||
view.Images = append(view.Images, imagePipeline) | ||
} | ||
|
||
// for image that we use, create an image pipeline and add it to the list | ||
for _, tagNode := range g.PredecessorNodesByEdgeKind(node, appsedges.UsedInDeploymentEdgeKind) { | ||
imagePipeline, covers := NewImagePipelineFromImageTagLocation(g, tagNode, tagNode.(ImageTagLocation)) | ||
|
||
covered.Insert(covers.List()...) | ||
view.Images = append(view.Images, imagePipeline) | ||
} | ||
|
||
return view, covered | ||
} |
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,83 @@ | ||
apiVersion: v1 | ||
items: | ||
- apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
annotations: | ||
deployment.kubernetes.io/revision: "1" | ||
image.openshift.io/triggers: '[{"from":{"kind":"ImageStreamTag","name":"ruby-deploy:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\"ruby-deploy\")].image"}]' | ||
openshift.io/generated-by: OpenShiftNewApp | ||
generation: 1 | ||
labels: | ||
app: ruby-deploy | ||
name: ruby-deploy | ||
spec: | ||
progressDeadlineSeconds: 600 | ||
replicas: 1 | ||
revisionHistoryLimit: 10 | ||
selector: | ||
matchLabels: | ||
app: ruby-deploy | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 25% | ||
maxUnavailable: 25% | ||
type: RollingUpdate | ||
template: | ||
metadata: | ||
creationTimestamp: null | ||
labels: | ||
app: ruby-deploy | ||
spec: | ||
containers: | ||
- image: busybox@sha256:4cee1979ba0bf7db9fc5d28fb7b798ca69ae95a47c5fecf46327720df4ff352d | ||
imagePullPolicy: IfNotPresent | ||
name: ruby-deploy | ||
ports: | ||
- containerPort: 8080 | ||
protocol: TCP | ||
resources: {} | ||
terminationMessagePath: /dev/termination-log | ||
terminationMessagePolicy: File | ||
dnsPolicy: ClusterFirst | ||
restartPolicy: Always | ||
schedulerName: default-scheduler | ||
securityContext: {} | ||
terminationGracePeriodSeconds: 30 | ||
status: | ||
conditions: | ||
- lastTransitionTime: 2018-02-24T00:51:47Z | ||
lastUpdateTime: 2018-02-24T00:51:47Z | ||
message: Deployment does not have minimum availability. | ||
reason: MinimumReplicasUnavailable | ||
status: "False" | ||
type: Available | ||
- lastTransitionTime: 2018-02-24T00:51:47Z | ||
lastUpdateTime: 2018-02-24T00:51:47Z | ||
message: ReplicaSet "ruby-deploy-599994c49b" is progressing. | ||
reason: ReplicaSetUpdated | ||
status: "True" | ||
type: Progressing | ||
observedGeneration: 1 | ||
replicas: 1 | ||
unavailableReplicas: 1 | ||
updatedReplicas: 1 | ||
- apiVersion: autoscaling/v1 | ||
kind: HorizontalPodAutoscaler | ||
metadata: | ||
name: ruby-deploy | ||
spec: | ||
maxReplicas: 1 | ||
minReplicas: 1 | ||
scaleTargetRef: | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
name: ruby-deploy | ||
targetCPUUtilizationPercentage: 80 | ||
status: | ||
currentReplicas: 0 | ||
desiredReplicas: 0 | ||
kind: List | ||
metadata: | ||
resourceVersion: "" | ||
selfLink: "" |
28 changes: 28 additions & 0 deletions
28
pkg/oc/graph/genericgraph/test/rollingupdate-daemonset.yaml
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,28 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: DaemonSet | ||
metadata: | ||
name: bind | ||
creationTimestamp: 2016-04-07T04:11:25Z | ||
spec: | ||
updateStrategy: | ||
type: RollingUpdate | ||
rollingUpdate: | ||
maxUnavailable: 10% | ||
template: | ||
metadata: | ||
labels: | ||
service: bind | ||
spec: | ||
affinity: | ||
podAntiAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- labelSelector: | ||
matchExpressions: | ||
- key: "service" | ||
operator: "In" | ||
values: ["bind"] | ||
topologyKey: "kubernetes.io/hostname" | ||
namespaces: [] | ||
containers: | ||
- name: kubernetes-pause | ||
image: gcr.io/google-containers/pause:2.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
Oops, something went wrong.