Skip to content

Commit

Permalink
v1 dnspolicy and tlspolicy api
Browse files Browse the repository at this point in the history
Signed-off-by: craig <[email protected]>

rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED
  • Loading branch information
maleck13 committed Oct 18, 2024
1 parent fea0231 commit 44e1984
Show file tree
Hide file tree
Showing 47 changed files with 188 additions and 255 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ endef

.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) crd paths="./api/v1alpha1;./api/v1beta1;./api/v1beta2;./api/v1beta3" output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) crd paths="./api/v1;./api/v1beta1;./api/v1beta2;./api/v1beta3" output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) rbac:roleName=manager-role webhook paths="./..."

.PHONY: dependencies-manifests
Expand Down
6 changes: 3 additions & 3 deletions api/v1alpha1/dnspolicy_types.go → api/v1/dnspolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1

import (
"context"
Expand Down Expand Up @@ -280,9 +280,9 @@ func (p *DNSPolicy) WithTargetGateway(gwName string) *DNSPolicy {
func (p *DNSPolicy) WithHealthCheckFor(endpoint string, port int, protocol string, failureThreshold int) *DNSPolicy {
return p.WithHealthCheck(dnsv1alpha1.HealthCheckSpec{
Path: endpoint,
Port: &port,
Port: port,

Check warning on line 283 in api/v1/dnspolicy_types.go

View check run for this annotation

Codecov / codecov/patch

api/v1/dnspolicy_types.go#L283

Added line #L283 was not covered by tests
Protocol: dnsv1alpha1.Protocol(protocol),
FailureThreshold: &failureThreshold,
FailureThreshold: failureThreshold,

Check warning on line 285 in api/v1/dnspolicy_types.go

View check run for this annotation

Codecov / codecov/patch

api/v1/dnspolicy_types.go#L285

Added line #L285 was not covered by tests
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
// Package v1alpha1 contains API Schema definitions for the kuadrant.io v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=kuadrant.io
package v1alpha1
package v1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
Expand All @@ -26,7 +26,7 @@ import (

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "kuadrant.io", Version: "v1alpha1"}
GroupVersion = schema.GroupVersion{Group: "kuadrant.io", Version: "v1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/topology.go → api/v1/topology.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v1alpha1
package v1

// Contains of this file allow the DNSPolicy and TLSPolicy to adhere to the machinery.Policy interface

Expand Down

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

44 changes: 11 additions & 33 deletions bundle/manifests/kuadrant-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,18 @@ metadata:
alm-examples: |-
[
{
"apiVersion": "kuadrant.io/v1alpha1",
"apiVersion": "kuadrant.io/v1",
"kind": "DNSPolicy",
"metadata": {
"name": "dnspolicy-sample"
},
"spec": {
"healthCheck": {
"endpoint": "/",
"protocol": "HTTP"
},
"targetRef": {
"group": "gateway.networking.k8s.io",
"kind": "Gateway",
"name": "example-gateway"
}
}
},
{
"apiVersion": "kuadrant.io/v1alpha1",
"kind": "TLSPolicy",
"metadata": {
"name": "tlspolicy-sample"
},
"spec": {
"issuerRef": {
"group": "cert-manager.io",
"kind": "ClusterIssuer",
"name": "self-signed-ca"
"failureThreshold": 5,
"interval": "10s",
"path": "/",
"port": 443,
"protocol": "HTTPS"
},
"targetRef": {
"group": "gateway.networking.k8s.io",
Expand Down Expand Up @@ -106,7 +90,7 @@ metadata:
capabilities: Basic Install
categories: Integration & Delivery
containerImage: quay.io/kuadrant/kuadrant-operator:latest
createdAt: "2024-10-18T15:08:50Z"
createdAt: "2024-10-18T20:16:38Z"
description: A Kubernetes Operator to manage the lifecycle of the Kuadrant system
operators.operatorframework.io/builder: operator-sdk-v1.32.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
Expand All @@ -124,12 +108,9 @@ spec:
kind: AuthPolicy
name: authpolicies.kuadrant.io
version: v1beta2
- description: DNSPolicy configures how North-South based traffic should be balanced
and reach the gateways
displayName: DNSPolicy
kind: DNSPolicy
- kind: DNSPolicy
name: dnspolicies.kuadrant.io
version: v1alpha1
version: v1
- description: Kuadrant configures installations of Kuadrant Service Protection
components
displayName: Kuadrant
Expand All @@ -142,12 +123,9 @@ spec:
kind: RateLimitPolicy
name: ratelimitpolicies.kuadrant.io
version: v1beta3
- description: TLSPolicy provides tls for gateway listeners by managing the lifecycle
of tls certificates
displayName: TLSPolicy
kind: TLSPolicy
- kind: TLSPolicy
name: tlspolicies.kuadrant.io
version: v1alpha1
version: v1
description: A Kubernetes Operator to manage the lifecycle of the Kuadrant system
displayName: Kuadrant Operator
icon:
Expand Down
2 changes: 1 addition & 1 deletion bundle/manifests/kuadrant.io_dnspolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v1
schema:
openAPIV3Schema:
description: DNSPolicy is the Schema for the dnspolicies API
Expand Down
2 changes: 1 addition & 1 deletion bundle/manifests/kuadrant.io_tlspolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v1
schema:
openAPIV3Schema:
description: TLSPolicy is the Schema for the tlspolicies API
Expand Down
4 changes: 2 additions & 2 deletions charts/kuadrant-operator/templates/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13243,7 +13243,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v1
schema:
openAPIV3Schema:
description: DNSPolicy is the Schema for the dnspolicies API
Expand Down Expand Up @@ -14423,7 +14423,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v1
schema:
openAPIV3Schema:
description: TLSPolicy is the Schema for the tlspolicies API
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/kuadrant.io_dnspolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v1
schema:
openAPIV3Schema:
description: DNSPolicy is the Schema for the dnspolicies API
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/kuadrant.io_tlspolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v1
schema:
openAPIV3Schema:
description: TLSPolicy is the Schema for the tlspolicies API
Expand Down
13 changes: 0 additions & 13 deletions config/samples/kuadrant_v1alpha1_dnspolicy.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions config/samples/kuadrant_v1alpha1_tlspolicy.yaml

This file was deleted.

10 changes: 5 additions & 5 deletions config/samples/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Append samples you want in your CSV to this file as resources ##
resources:
- kuadrant_v1beta1_kuadrant.yaml
- kuadrant_v1beta2_authpolicy.yaml
- kuadrant_v1beta3_ratelimitpolicy.yaml
- kuadrant_v1alpha1_dnspolicy.yaml
- kuadrant_v1alpha1_tlspolicy.yaml
- kuadrant_v1beta1_kuadrant.yaml
- kuadrant_v1beta2_authpolicy.yaml
- kuadrant_v1beta3_ratelimitpolicy.yaml
- kuadrant_v1_dnspolicy.yaml
- kuadrant_v1_tlspolicy.yaml
#+kubebuilder:scaffold:manifestskustomizesamples
9 changes: 4 additions & 5 deletions controllers/dns_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import (

kuadrantdnsv1alpha1 "github.com/kuadrant/dns-operator/api/v1alpha1"
"github.com/kuadrant/dns-operator/pkg/builder"

"github.com/kuadrant/kuadrant-operator/api/v1alpha1"
v1 "github.com/kuadrant/kuadrant-operator/api/v1"
)

const (
Expand All @@ -26,7 +25,7 @@ type dnsHelper struct {
client.Client
}

func commonDNSRecordLabels(gwKey client.ObjectKey, p *v1alpha1.DNSPolicy) map[string]string {
func commonDNSRecordLabels(gwKey client.ObjectKey, p *v1.DNSPolicy) map[string]string {

Check warning on line 28 in controllers/dns_helper.go

View check run for this annotation

Codecov / codecov/patch

controllers/dns_helper.go#L28

Added line #L28 was not covered by tests
commonLabels := map[string]string{}
for k, v := range policyDNSRecordLabels(p) {
commonLabels[k] = v
Expand All @@ -37,7 +36,7 @@ func commonDNSRecordLabels(gwKey client.ObjectKey, p *v1alpha1.DNSPolicy) map[st
return commonLabels
}

func policyDNSRecordLabels(p *v1alpha1.DNSPolicy) map[string]string {
func policyDNSRecordLabels(p *v1.DNSPolicy) map[string]string {

Check warning on line 39 in controllers/dns_helper.go

View check run for this annotation

Codecov / codecov/patch

controllers/dns_helper.go#L39

Added line #L39 was not covered by tests
return map[string]string{
p.DirectReferenceAnnotationName(): p.Name,
fmt.Sprintf("%s-namespace", p.DirectReferenceAnnotationName()): p.Namespace,
Expand Down Expand Up @@ -117,7 +116,7 @@ func (g GatewayWrapper) GetAddresses() []builder.TargetAddress {
return addresses
}

func (g *GatewayWrapper) RemoveExcludedStatusAddresses(p *v1alpha1.DNSPolicy) error {
func (g *GatewayWrapper) RemoveExcludedStatusAddresses(p *v1.DNSPolicy) error {

Check warning on line 119 in controllers/dns_helper.go

View check run for this annotation

Codecov / codecov/patch

controllers/dns_helper.go#L119

Added line #L119 was not covered by tests
g.excludedAddresses = p.Spec.ExcludeAddresses
newAddresses := []gatewayapiv1.GatewayStatusAddress{}
for _, address := range g.Gateway.Status.Addresses {
Expand Down
Loading

0 comments on commit 44e1984

Please sign in to comment.