Skip to content

Commit

Permalink
fix(harborcluster): improve the get -o printing columns (#547)
Browse files Browse the repository at this point in the history
fix(harborcluster): improve the get -o printing columns

Signed-off-by: wangcanfeng <wangcanfeng@corp.netease.com>
  • Loading branch information
wangcanfengxs committed Apr 13, 2021
1 parent 41cb383 commit 7f62810
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 35 deletions.
10 changes: 2 additions & 8 deletions apis/goharbor.io/v1alpha3/harborcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,8 @@ const (
ServiceReady HarborClusterConditionType = "ServiceReady"
// ConfigurationReady means the configuration is applied to harbor.
ConfigurationReady HarborClusterConditionType = "ConfigurationReady"
// StatusUnknown is the status of unknown.
StatusUnknown ClusterStatus = "unknown"
// StatusCreating is the status of creating.
StatusCreating ClusterStatus = "creating"
// StatusCreating is the status of provisioning.
StatusProvisioning ClusterStatus = "provisioning"
// StatusHealthy is the status of healthy.
StatusHealthy ClusterStatus = "healthy"
// StatusUnHealthy is the status of unhealthy.
Expand Down Expand Up @@ -229,10 +227,6 @@ const (
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Public URL",type=string,JSONPath=`.spec.externalURL`,description="The public URL to the Harbor application",priority=0
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.status`,description="The overall status of the Harbor cluster",priority=0
// +kubebuilder:printcolumn:name="Service Ready",type=string,JSONPath=`.status.conditions[?(@.type=="ServiceReady")].status`,description="The current status of the new Harbor spec",priority=10
// +kubebuilder:printcolumn:name="Cache Ready",type=string,JSONPath=`.status.conditions[?(@.type=="CacheReady")].status`,description="The current status of the new Cache spec",priority=20
// +kubebuilder:printcolumn:name="Database Ready",type=string,JSONPath=`.status.conditions[?(@.type=="DatabaseReady")].status`,description="The current status of the new Database spec",priority=20
// +kubebuilder:printcolumn:name="Storage Ready",type=string,JSONPath=`.status.conditions[?(@.type=="StorageReady")].status`,description="The current status of the new Storage spec",priority=20
// +kubebuilder:printcolumn:name="Operator Version",type=string,JSONPath=`.status.operator.controllerVersion`,description="The operator version ",priority=30
// +kubebuilder:printcolumn:name="Operator Git Commit",type=string,JSONPath=`.status.operator.controllerGitCommit`,description="The operator git commit",priority=30
// HarborCluster is the Schema for the harborclusters API.
Expand Down
9 changes: 2 additions & 7 deletions controllers/goharbor/harborcluster/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func newStatus(source *goharborv1.HarborCluster) *status {
cr: source,
locker: &sync.Mutex{},
data: &goharborv1.HarborClusterStatus{
Status: goharborv1.StatusUnknown,
Status: goharborv1.StatusProvisioning,
Revision: time.Now().UnixNano(),
Conditions: make([]goharborv1.HarborClusterCondition, 0),
},
Expand Down Expand Up @@ -231,12 +231,7 @@ func (s *status) overallStatus() goharborv1.ClusterStatus {
return goharborv1.StatusUnHealthy
}

// Not all are completed yet
if ready == len(s.data.Conditions) {
return goharborv1.StatusCreating
}

return goharborv1.StatusUnknown
return goharborv1.StatusProvisioning
}

func (s *status) validate() error {
Expand Down
20 changes: 0 additions & 20 deletions manifests/cluster/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2225,26 +2225,6 @@ spec:
jsonPath: .status.status
name: Status
type: string
- description: The current status of the new Harbor spec
jsonPath: .status.conditions[?(@.type=="ServiceReady")].status
name: Service Ready
priority: 10
type: string
- description: The current status of the new Cache spec
jsonPath: .status.conditions[?(@.type=="CacheReady")].status
name: Cache Ready
priority: 20
type: string
- description: The current status of the new Database spec
jsonPath: .status.conditions[?(@.type=="DatabaseReady")].status
name: Database Ready
priority: 20
type: string
- description: The current status of the new Storage spec
jsonPath: .status.conditions[?(@.type=="StorageReady")].status
name: Storage Ready
priority: 20
type: string
- description: 'The operator version '
jsonPath: .status.operator.controllerVersion
name: Operator Version
Expand Down

0 comments on commit 7f62810

Please sign in to comment.