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

Add warning when manageTLS=true but service port is 9080 #634

Merged
merged 3 commits into from
Apr 23, 2024
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ endif

.PHONY: install
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl apply -f -
$(KUSTOMIZE) build config/crd | kubectl apply --server-side -f -

.PHONY: uninstall
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
Expand Down
24 changes: 24 additions & 0 deletions api/v1/webspherelibertyapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ const (
StatusConditionTypeReconciled StatusConditionType = "Reconciled"
StatusConditionTypeResourcesReady StatusConditionType = "ResourcesReady"
StatusConditionTypeReady StatusConditionType = "Ready"
StatusConditionTypeWarning StatusConditionType = "Warning"

// Status Endpoint Scopes
StatusEndpointScopeExternal StatusEndpointScope = "External"
Expand All @@ -567,6 +568,9 @@ type StatusVersions struct {
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status",priority=0,description="Status of the component ready condition"
// +kubebuilder:printcolumn:name="ReadyReason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason",priority=1,description="Reason for the failure of component ready condition"
// +kubebuilder:printcolumn:name="ReadyMessage",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message",priority=1,description="Failure message from component ready condition"
// +kubebuilder:printcolumn:name="Warning",type="string",JSONPath=".status.conditions[?(@.type=='Warning')].status",priority=0,description="Status of the component warning condition"
// +kubebuilder:printcolumn:name="WarningReason",type="string",JSONPath=".status.conditions[?(@.type=='Warning')].reason",priority=1,description="Reason for the failure of component warning condition"
// +kubebuilder:printcolumn:name="WarningMessage",type="string",JSONPath=".status.conditions[?(@.type=='Warning')].message",priority=1,description="Failure message from component warning condition"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",priority=0,description="Age of the resource"
// +operator-sdk:csv:customresourcedefinitions:displayName="WebSphereLibertyApplication",resources={{Deployment,v1},{Service,v1},{StatefulSet,v1},{Route,v1},{HorizontalPodAutoscaler,v1},{ServiceAccount,v1},{Secret,v1},{NetworkPolicy,v1}}

Expand Down Expand Up @@ -1448,6 +1452,22 @@ func (s *WebSphereLibertyApplicationStatus) SetCondition(c common.StatusConditio
}
}

func (s *WebSphereLibertyApplicationStatus) UnsetCondition(c common.StatusCondition) {
for i := range s.Conditions {
if s.Conditions[i].GetType() == c.GetType() {
// Found the condition to remove
if i+1 == len(s.Conditions) {
// the match is the last element, can just shorten by one
s.Conditions = s.Conditions[:i]
} else {
// there are more elements after the match.
s.Conditions = append(s.Conditions[:i], s.Conditions[i+1])
}
return
}
}
}

func convertToCommonStatusConditionType(c StatusConditionType) common.StatusConditionType {
switch c {
case StatusConditionTypeReconciled:
Expand All @@ -1456,6 +1476,8 @@ func convertToCommonStatusConditionType(c StatusConditionType) common.StatusCond
return common.StatusConditionTypeResourcesReady
case StatusConditionTypeReady:
return common.StatusConditionTypeReady
case StatusConditionTypeWarning:
return common.StatusConditionTypeWarning
default:
panic(c)
}
Expand All @@ -1469,6 +1491,8 @@ func convertFromCommonStatusConditionType(c common.StatusConditionType) StatusCo
return StatusConditionTypeResourcesReady
case common.StatusConditionTypeReady:
return StatusConditionTypeReady
case common.StatusConditionTypeWarning:
return StatusConditionTypeWarning
default:
panic(c)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ spec:
name: ReadyMessage
priority: 1
type: string
- description: Status of the component warning condition
jsonPath: .status.conditions[?(@.type=='Warning')].status
name: Warning
type: string
- description: Reason for the failure of component warning condition
jsonPath: .status.conditions[?(@.type=='Warning')].reason
name: WarningReason
priority: 1
type: string
- description: Failure message from component warning condition
jsonPath: .status.conditions[?(@.type=='Warning')].message
name: WarningMessage
priority: 1
type: string
- description: Age of the resource
jsonPath: .metadata.creationTimestamp
name: Age
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ spec:
name: ReadyMessage
priority: 1
type: string
- description: Status of the component warning condition
jsonPath: .status.conditions[?(@.type=='Warning')].status
name: Warning
type: string
- description: Reason for the failure of component warning condition
jsonPath: .status.conditions[?(@.type=='Warning')].reason
name: WarningReason
priority: 1
type: string
- description: Failure message from component warning condition
jsonPath: .status.conditions[?(@.type=='Warning')].message
name: WarningMessage
priority: 1
type: string
- description: Age of the resource
jsonPath: .metadata.creationTimestamp
name: Age
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/WASdev/websphere-liberty-operator
go 1.21

require (
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20240411140236-ec7079edcb2c
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20240418093352-75f8d52a0afa
github.com/cert-manager/cert-manager v1.11.5
github.com/go-logr/logr v1.2.4
github.com/openshift/api v0.0.0-20230928134114-673ed0cfc7f1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20240411140236-ec7079edcb2c h1:qHy1UZT8tIUn/EMNFsRbWu0ibRNPIYMFX4TuxpLgT/I=
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20240411140236-ec7079edcb2c/go.mod h1:QI32wLzUBxvvisPG+p1XeogxeUhk64Vc/U0lx7rxx5M=
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20240418093352-75f8d52a0afa h1:1EdnXjNuPJkoNIYdD8ZDQPmuPuIeBXpyWLHIVAEWXlg=
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20240418093352-75f8d52a0afa/go.mod h1:QI32wLzUBxvvisPG+p1XeogxeUhk64Vc/U0lx7rxx5M=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
Expand Down
Loading