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 APIRule reconciliation loop #1140

Merged
merged 19 commits into from
Jul 9, 2024
Merged
5 changes: 5 additions & 0 deletions apis/gateway/v1beta1/apirule_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.
package v1beta1

import (
"github.com/kyma-project/api-gateway/apis/gateway/versions"
"istio.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -73,6 +74,10 @@ type APIRuleStatus struct {
AuthorizationPolicyStatus *APIRuleResourceStatus `json:"authorizationPolicyStatus,omitempty"`
}

func (s *APIRuleStatus) ApiRuleStatusVersion() versions.Version {
return versions.V1beta1
}

// APIRule is the Schema for ApiRule APIs.
// +kubebuilder:storageversion
// +kubebuilder:deprecatedversion:warning=APIRule version v1beta1 is deprecated in favor of v2alpha1. Please migrate APIRule to v2alpha1 as soon as possible.
Expand Down
5 changes: 5 additions & 0 deletions apis/gateway/v2alpha1/apirule_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.
package v2alpha1

import (
"github.com/kyma-project/api-gateway/apis/gateway/versions"
"istio.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down Expand Up @@ -71,6 +72,10 @@ type APIRuleStatus struct {
Description string `json:"description,omitempty"`
}

func (s *APIRuleStatus) ApiRuleStatusVersion() versions.Version {
return versions.V2alpha1
}

// APIRule is the Schema for ApiRule APIs.
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
Expand Down
19 changes: 19 additions & 0 deletions apis/gateway/versions/versions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package versions

const (
V1beta1 = iota
V2alpha1
)

type Version int

func (v Version) String() string {
switch v {
case V1beta1:
return "v1beta1"
case V2alpha1:
return "v2alpha1"
default:
return "unknown"
}
}
Loading
Loading