Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove unused conditions associated to deployment #60

Merged
merged 2 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions internal/adapter/converter/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ func (converter *DockerAPIConverter) UpdateDeploymentFromContainerInfo(deploymen
deployment.Status.ReadyReplicas = 1
deployment.Status.AvailableReplicas = 1

// set the deployment conditions to available and progressing
// if the container is running
deployment.Status.Conditions = []apps.DeploymentCondition{
{
Type: apps.DeploymentAvailable,
Expand All @@ -46,19 +44,10 @@ func (converter *DockerAPIConverter) UpdateDeploymentFromContainerInfo(deploymen
Reason: "MinimumReplicasAvailable",
LastTransitionTime: metav1.NewTime(time.Now()),
},
{
Type: apps.DeploymentProgressing,
Status: "True",
Message: "NewReplicaSetAvailable",
Reason: "NewReplicaSetAvailable",
LastTransitionTime: metav1.NewTime(time.Now()),
},
}
} else {
deployment.Status.UnavailableReplicas = 1

// set the deployment conditions to unavailable and progressing
// if the container is not running
deployment.Status.Conditions = []apps.DeploymentCondition{
{
Type: apps.DeploymentAvailable,
Expand Down
68 changes: 34 additions & 34 deletions internal/api/core/v1/v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ type V1Service struct {
events events.EventService
namespaces namespaces.NamespaceService
nodes nodes.NodeService
persistentvolumes persistentvolumes.PersistentVolumeService
persistentvolumeclaims persistentvolumeclaims.PersistentVolumeClaimService
pods pods.PodService
secrets secrets.SecretService
services services.ServiceService
persistentvolumes persistentvolumes.PersistentVolumeService
persistentvolumeclaims persistentvolumeclaims.PersistentVolumeClaimService
}

func NewV1Service(adapter *adapter.KubeDockerAdapter, operations chan controller.Operation) V1Service {
Expand All @@ -34,11 +34,11 @@ func NewV1Service(adapter *adapter.KubeDockerAdapter, operations chan controller
events: events.NewEventService(adapter),
namespaces: namespaces.NewNamespaceService(adapter, operations),
nodes: nodes.NewNodeService(adapter),
persistentvolumes: persistentvolumes.NewPersistentVolumeService(adapter),
persistentvolumeclaims: persistentvolumeclaims.NewPersistentVolumeClaimService(adapter, operations),
pods: pods.NewPodService(adapter, operations),
secrets: secrets.NewSecretService(adapter, operations),
services: services.NewServiceService(adapter, operations),
persistentvolumes: persistentvolumes.NewPersistentVolumeService(adapter),
persistentvolumeclaims: persistentvolumeclaims.NewPersistentVolumeClaimService(adapter, operations),
}
}

Expand All @@ -62,19 +62,27 @@ func (svc V1Service) ListAPIResources(r *restful.Request, w *restful.Response) {
GroupVersion: "v1",
APIResources: []metav1.APIResource{
{
Kind: "Namespace",
Kind: "ConfigMap",
SingularName: "",
Name: "namespaces",
Name: "configmaps",
Verbs: []string{"create", "list", "delete", "get", "patch"},
Namespaced: true,
ShortNames: []string{"cm"},
},
{
Kind: "Event",
SingularName: "",
Name: "events",
Verbs: []string{"list"},
Namespaced: false,
ShortNames: []string{"ns"},
},
{
Kind: "Pod",
Kind: "Namespace",
SingularName: "",
Name: "pods",
Name: "namespaces",
Verbs: []string{"create", "list", "delete", "get", "patch"},
Namespaced: true,
Namespaced: false,
ShortNames: []string{"ns"},
},
{
Kind: "Node",
Expand All @@ -84,20 +92,27 @@ func (svc V1Service) ListAPIResources(r *restful.Request, w *restful.Response) {
Namespaced: false,
},
{
Kind: "Service",
Kind: "PersistentVolume",
SingularName: "",
Name: "services",
Name: "persistentvolumes",
Verbs: []string{"list", "get"},
Namespaced: false,
ShortNames: []string{"pv"},
},
{
Kind: "PersistentVolumeClaim",
SingularName: "",
Name: "persistentvolumeclaims",
Verbs: []string{"create", "list", "delete", "get", "patch"},
Namespaced: true,
ShortNames: []string{"svc"},
ShortNames: []string{"pvc"},
},
{
Kind: "ConfigMap",
Kind: "Pod",
SingularName: "",
Name: "configmaps",
Name: "pods",
Verbs: []string{"create", "list", "delete", "get", "patch"},
Namespaced: true,
ShortNames: []string{"cm"},
},
{
Kind: "Secret",
Expand All @@ -107,27 +122,12 @@ func (svc V1Service) ListAPIResources(r *restful.Request, w *restful.Response) {
Namespaced: true,
},
{
Kind: "Event",
SingularName: "",
Name: "events",
Verbs: []string{"list"},
Namespaced: false,
},
{
Kind: "PersistentVolume",
SingularName: "",
Name: "persistentvolumes",
Verbs: []string{"list", "get"},
Namespaced: false,
ShortNames: []string{"pv"},
},
{
Kind: "PersistentVolumeClaim",
Kind: "Service",
SingularName: "",
Name: "persistentvolumeclaims",
Name: "services",
Verbs: []string{"create", "list", "delete", "get", "patch"},
Namespaced: true,
ShortNames: []string{"pvc"},
ShortNames: []string{"svc"},
},
},
}
Expand Down