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

THREESCALE-10882 Managed services bump #972

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
ab472ad
THREESCALE-10842 initial implementation of preflights
MStokluska Mar 15, 2024
ab19390
THREESCALE-10842 fix gomod after rebase
MStokluska Mar 20, 2024
24344af
THREESCALE-10842 fix other files after rebase
MStokluska Mar 20, 2024
81ad190
THREESCALE-10842 fix target ns mode issues
MStokluska Mar 20, 2024
017057b
THREESCALE-10842 further updates to logic and refactor
MStokluska Mar 21, 2024
059cae3
THREESCALE-10842 additional improvements and typos
MStokluska Mar 22, 2024
c401ef4
THREESCALE-10842 address comments p3
MStokluska Mar 25, 2024
dd4efae
THREESCALE-10842 remove unnecessary permission
MStokluska Mar 25, 2024
8d16523
THREESCALE-10842 add docs and update to apim required version message
MStokluska Mar 27, 2024
2bfe09e
THREESCALE-10842 update doc as per comments
MStokluska Mar 27, 2024
c640283
THREESCALE-10842 address comments
MStokluska Mar 27, 2024
a999c8a
THREESCALE-10842 reduce redis requirement and update redis image
MStokluska Mar 28, 2024
83a8303
Merge pull request #948 from MStokluska/THREESCALE-10842
MStokluska Mar 28, 2024
93ceec3
THREESCALE-10280 Bump dependencies to address otelhttp CVE
carlkyrillos Mar 25, 2024
82b9916
THREESCALE-10842 improve log around nil install plan reference
MStokluska Mar 29, 2024
fb8af7c
Merge pull request #956 from carlkyrillos/THREESCALE-10280
carlkyrillos Mar 29, 2024
6757516
THREESCALE-10842-2 improve the ready condition reporting
MStokluska Mar 29, 2024
7c1c5c7
THREESCALE-10842-2 edit existing unit test to skip endless reconciler…
MStokluska Mar 29, 2024
06b80f2
Merge pull request #960 from MStokluska/THREESCALE-10842-2
MStokluska Mar 29, 2024
392b99a
THREESCALE-10937 update upstream db images
MStokluska Apr 2, 2024
bdb5250
THREESCALE-10940 support custom postgres port number
MStokluska Apr 2, 2024
14ec7f8
Merge pull request #961 from MStokluska/THREESCALE-10937
MStokluska Apr 2, 2024
08e12ab
THREESCALE-10937-2 update redis image
MStokluska Apr 2, 2024
031668f
THREESCALE-10613 add userkey and applicationKey via cr
austincunningham Mar 22, 2024
fcda28d
Merge pull request #962 from MStokluska/THREESCALE-10940
MStokluska Apr 2, 2024
4e151c7
Merge pull request #963 from MStokluska/THREESCALE-10937-2
MStokluska Apr 2, 2024
95924cf
Merge pull request #953 from austincunningham/THREESCALE-10613
austincunningham Apr 3, 2024
ff1adee
THREESCALE-10946 subscription fetch improvement
MStokluska Apr 3, 2024
942f16b
THREESCALE-10209 Remove support for Redis namespace
valerymo Mar 28, 2024
8916b4e
Merge pull request #964 from MStokluska/THREESCALE-10946
MStokluska Apr 3, 2024
69ab864
THREESCALE-10209 Remove support for Redis namespace - update
valerymo Apr 2, 2024
4f5c660
THREESCALE-10950 add the status messages to the proxyConfigPromote docs
austincunningham Apr 4, 2024
93e03dc
Merge pull request #966 from austincunningham/THREESCALE-10950
austincunningham Apr 4, 2024
77de265
THREESCALE-10209 Remove support for Redis namespace - update
valerymo Apr 4, 2024
b48aa45
Merge pull request #957 from valerymo/THREESCALE-10209
austincunningham Apr 5, 2024
5d7d996
THREESCALE-9711 include patch release of 3scale in APIM
MStokluska Apr 5, 2024
b03914b
Merge pull request #967 from MStokluska/THREESCALE-9711
MStokluska Apr 5, 2024
d7e5757
THREESCALE-10949 Preserve DC annotations, labels, and env vars
carlkyrillos Apr 3, 2024
31f9670
THREESCALE-10949 Preserve DC replica counts
carlkyrillos Apr 4, 2024
811fc6e
THREESCALE-10949 Preserve DC volumes and volume mounts
carlkyrillos Apr 4, 2024
8d2d812
Merge pull request #965 from carlkyrillos/THREESCALE-10949
carlkyrillos Apr 5, 2024
cb4998a
THREESCALE 9308 HeadCrab Vulnerability (Redis)
valerymo Apr 7, 2024
91c2d43
THREESCALE 9308 HeadCrab Vulnerability (Redis)- CM sync first
valerymo Apr 7, 2024
49ce6d0
THREESCALE-10955 add 2.14 to 2.15 condition
MStokluska Apr 9, 2024
5b3fa24
THREESCALE-10956 Update CSV internal dbs for upstream
valerymo Apr 9, 2024
65cef0a
THREESCALE 9308 HeadCrab Vulnerability - avoid impact existing config…
valerymo Apr 8, 2024
f69d56b
Merge pull request #968 from valerymo/THREESCALE-9308-2
valerymo Apr 9, 2024
703f6ea
Merge pull request #969 from MStokluska/THREESCALE-10955
MStokluska Apr 9, 2024
9c48fc5
THREESCALE-10957 improve multi minor hop message
MStokluska Apr 9, 2024
34a97db
Merge pull request #970 from valerymo/THREESCALE-10956
valerymo Apr 9, 2024
230a9df
Merge pull request #971 from MStokluska/THREESCALE-10957
MStokluska Apr 9, 2024
bc58caf
THREESCALE-10882 set version to 0.12.1 for the operator
austincunningham Mar 12, 2024
9516454
THREESCALE-10882 bump the product version
austincunningham Mar 13, 2024
f009c31
THREESCALE-10882 bump version to 2.15 in makefile and version
austincunningham Apr 10, 2024
8e451fd
Merge branch 'managed-services' into managed-services
austincunningham Apr 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
SHELL := /bin/bash
# Current Operator version
VERSION ?= 0.0.1
# Current Threescale version
THREESCALE_VERSION ?= 2.15
# Default bundle image tag
BUNDLE_IMG ?= controller-bundle:$(VERSION)
# Options for 'bundle-build'
Expand Down Expand Up @@ -93,7 +95,8 @@ manager: generate fmt vet
run: export WATCH_NAMESPACE=$(LOCAL_RUN_NAMESPACE)
run: export THREESCALE_DEBUG=1
run: generate fmt vet manifests
$(GO) run ./main.go --zap-devel
@-oc process THREESCALE_VERSION=$(THREESCALE_VERSION) -f config/requirements/operator-requirements.yaml | oc apply -f - -n $(WATCH_NAMESPACE)
$(GO) run ./main.go --zap-devel

# find or download controller-gen
# download controller-gen if necessary
Expand Down
92 changes: 84 additions & 8 deletions apis/apps/v1alpha1/apimanager_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"k8s.io/apimachinery/pkg/util/validation/field"

"github.com/3scale/3scale-operator/apis/apps"
"github.com/3scale/3scale-operator/pkg/3scale/amp/product"
"github.com/3scale/3scale-operator/pkg/apispkg/common"
"github.com/3scale/3scale-operator/version"
)
Expand All @@ -38,9 +37,10 @@ import (
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

const (
ThreescaleVersionAnnotation = "apps.3scale.net/apimanager-threescale-version"
OperatorVersionAnnotation = "apps.3scale.net/threescale-operator-version"
Default3scaleAppLabel = "3scale-api-management"
ThreescaleVersionAnnotation = "apps.3scale.net/apimanager-threescale-version"
OperatorVersionAnnotation = "apps.3scale.net/threescale-operator-version"
Default3scaleAppLabel = "3scale-api-management"
ThreescaleRequirementsConfirmed = "apps.3scale.net/apimanager-confirmed-requirements-version"
)

const (
Expand Down Expand Up @@ -147,8 +147,9 @@ type APIManager struct {
}

const (
APIManagerAvailableConditionType common.ConditionType = "Available"
APIManagerWarningConditionType common.ConditionType = "Warning"
APIManagerAvailableConditionType common.ConditionType = "Available"
APIManagerWarningConditionType common.ConditionType = "Warning"
APIManagerPreflightsConditionType common.ConditionType = "Preflights"
)

type APIManagerCommonSpec struct {
Expand Down Expand Up @@ -885,6 +886,81 @@ func (apimanager *APIManager) SetDefaults() (bool, error) {
return changed, err
}

func (apimanager *APIManager) IsInFreshInstallationScenario() bool {
threescaleAnnotationFound := true

if _, ok := apimanager.Annotations[ThreescaleVersionAnnotation]; ok {
threescaleAnnotationFound = false
}

return threescaleAnnotationFound
}

func (apimanager *APIManager) IsHealthyUpgradeScenario() bool {
threescaleAnnotationFound := false

// is the version annotation present
if _, ok := apimanager.Annotations[ThreescaleVersionAnnotation]; ok {
threescaleAnnotationFound = true
}

// is the condition set to "available" = "true"
conditionAvailable := apimanager.IsExistingInstallationHealthy()

if threescaleAnnotationFound && conditionAvailable {
return true
}

return false
}

func (apimanager *APIManager) IsExistingInstallationHealthy() bool {
// Fetch ready condition
availableCondition := apimanager.Status.Conditions.GetCondition(APIManagerAvailableConditionType)

// return true if the ready condition is set to true
if availableCondition != nil && availableCondition.Status == v1.ConditionTrue {
return true
}

return false
}

func (apimanager *APIManager) RequirementsConfirmed(requirementsConfigMapResourceVersion string) bool {
if val, ok := apimanager.Annotations[ThreescaleRequirementsConfirmed]; ok && val == requirementsConfigMapResourceVersion {
return true
}

return false
}

func (apimanager *APIManager) RetrieveRHTVersion() string {
if val, ok := apimanager.Annotations[ThreescaleVersionAnnotation]; ok && val != "" {
return val
}

return ""
}

func (apimanager *APIManager) IsMultiMinorHopDetected() (bool, error) {
var currentlyInstalledVersion string
var multiMinorHopDetected bool

if val, ok := apimanager.Annotations[ThreescaleVersionAnnotation]; ok && val != "" {
currentlyInstalledVersion = val
}

if currentlyInstalledVersion != "" {
multiMinorHop, err := common.CompareMinorVersions(currentlyInstalledVersion, version.ThreescaleVersionMajorMinor())
if err != nil {
return true, err
}
multiMinorHopDetected = multiMinorHop
}

return multiMinorHopDetected, nil
}

func (apimanager *APIManager) setAPIManagerAnnotationsDefaults() bool {
changed := false

Expand All @@ -898,8 +974,8 @@ func (apimanager *APIManager) setAPIManagerAnnotationsDefaults() bool {
changed = true
}

if v, ok := apimanager.Annotations[ThreescaleVersionAnnotation]; !ok || v != product.ThreescaleRelease {
apimanager.Annotations[ThreescaleVersionAnnotation] = product.ThreescaleRelease
if v, ok := apimanager.Annotations[ThreescaleVersionAnnotation]; !ok || v != version.ThreescaleVersionMajorMinorPatch() {
apimanager.Annotations[ThreescaleVersionAnnotation] = version.ThreescaleVersionMajorMinorPatch()
changed = true
}

Expand Down
3 changes: 1 addition & 2 deletions apis/apps/v1alpha1/apimanager_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"github.com/google/go-cmp/cmp"

"github.com/3scale/3scale-operator/pkg/3scale/amp/product"
"github.com/3scale/3scale-operator/version"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand All @@ -26,7 +25,7 @@ func TestSetDefaults(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
OperatorVersionAnnotation: version.Version,
ThreescaleVersionAnnotation: product.ThreescaleRelease,
ThreescaleVersionAnnotation: version.ThreescaleVersionMajorMinorPatch(),
},
},
Spec: APIManagerSpec{
Expand Down
105 changes: 105 additions & 0 deletions apis/capabilities/v1beta1/applicationauth_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
Copyright 2020 Red Hat.

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 v1beta1

import (
"github.com/3scale/3scale-operator/pkg/apispkg/common"
"github.com/go-logr/logr"
"github.com/google/go-cmp/cmp"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

const (
ApplicationAuthReadyConditionType common.ConditionType = "Ready"
ApplicationAuthFailedConditionType common.ConditionType = "Failed"
)

// ApplicationAuthSpec defines the desired state of ApplicationAuth
type ApplicationAuthSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// application CR metadata.name
ApplicationCRName string `json:"applicationCRName"`

// GenerateSecret Secret is generated if true and empty
// +optional
GenerateSecret *bool `json:"generateSecret,omitempty"`

// AuthSecretRef references account provider credentials
AuthSecretRef *corev1.LocalObjectReference `json:"authSecretRef"`

// ProviderAccountRef references account provider credentials
// +optional
ProviderAccountRef *corev1.LocalObjectReference `json:"providerAccountRef,omitempty"`
}

// ApplicationAuthStatus defines the observed state of ApplicationAuth
type ApplicationAuthStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Current state of the ApplicationAuth resource.
// Conditions represent the latest available observations of an object's state
// +optional
// +patchMergeKey=type
// +patchStrategy=merge
Conditions common.Conditions `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// ApplicationAuth is the Schema for the applicationauths API
type ApplicationAuth struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ApplicationAuthSpec `json:"spec,omitempty"`
Status ApplicationAuthStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// ApplicationAuthList contains a list of ApplicationAuth
type ApplicationAuthList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ApplicationAuth `json:"items"`
}

func init() {
SchemeBuilder.Register(&ApplicationAuth{}, &ApplicationAuthList{})
}

func (a *ApplicationAuthStatus) Equals(other *ApplicationAuthStatus, logger logr.Logger) bool {

// Marshalling sorts by condition type
currentMarshaledJSON, _ := a.Conditions.MarshalJSON()
otherMarshaledJSON, _ := other.Conditions.MarshalJSON()
if string(currentMarshaledJSON) != string(otherMarshaledJSON) {
diff := cmp.Diff(string(currentMarshaledJSON), string(otherMarshaledJSON))
logger.V(1).Info("Conditions not equal", "difference", diff)
return false
}

return true
}
2 changes: 1 addition & 1 deletion apis/capabilities/v1beta1/proxyconfigpromote_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type ProxyConfigPromoteStatus struct {
//+optional
LatestStagingVersion int `json:"latestStagingVersion,omitempty"`

// Current state of the activedoc resource.
// Current state of the ProxyConfigPromote resource.
// Conditions represent the latest available observations of an object's state
// +optional
// +patchMergeKey=type
Expand Down
111 changes: 111 additions & 0 deletions apis/capabilities/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.