Skip to content

Commit

Permalink
first validation controller
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Mar 27, 2024
1 parent 0e0c37e commit 5a4c731
Show file tree
Hide file tree
Showing 7 changed files with 907 additions and 214 deletions.
13 changes: 7 additions & 6 deletions api/v1alpha1/rpaasinstance.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import (
)

const (
DefaultLabelKeyPrefix = "rpaas.extensions.tsuru.io"
RpaasOperatorInstanceNameLabelKey = DefaultLabelKeyPrefix + "/instance-name"
RpaasOperatorServiceNameLabelKey = DefaultLabelKeyPrefix + "/service-name"
RpaasOperatorPlanNameLabelKey = DefaultLabelKeyPrefix + "/plan-name"
RpaasOperatorTeamOwnerLabelKey = DefaultLabelKeyPrefix + "/team-owner"
RpaasOperatorClusterNameLabelKey = DefaultLabelKeyPrefix + "/cluster-name"
DefaultLabelKeyPrefix = "rpaas.extensions.tsuru.io"
RpaasOperatorValidationNameLabelKey = DefaultLabelKeyPrefix + "/validation-name"
RpaasOperatorInstanceNameLabelKey = DefaultLabelKeyPrefix + "/instance-name"
RpaasOperatorServiceNameLabelKey = DefaultLabelKeyPrefix + "/service-name"
RpaasOperatorPlanNameLabelKey = DefaultLabelKeyPrefix + "/plan-name"
RpaasOperatorTeamOwnerLabelKey = DefaultLabelKeyPrefix + "/team-owner"
RpaasOperatorClusterNameLabelKey = DefaultLabelKeyPrefix + "/cluster-name"

LegacyRpaasOperatorInstanceNameLabelKey = "rpaas_instance"
LegacyRpaasOperatorServiceNameLabelKey = "rpaas_service"
Expand Down
50 changes: 4 additions & 46 deletions api/v1alpha1/rpaasvalidation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package v1alpha1

import (
nginxv1alpha1 "github.com/tsuru/nginx-operator/api/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -18,49 +17,8 @@ type RpaasValidation struct {
metav1.ObjectMeta `json:"metadata,omitempty"`

Status RpaasValidationStatus `json:"status,omitempty"`
Spec RpaasValidationSpec `json:"spec,omitempty"`
}

// RpaasValidationSpec defines the desired state of RpaasInstance
type RpaasValidationSpec struct {
// Flavors are references to RpaasFlavors resources. When provided, each flavor
// merges its instance template spec with this instance spec.
// +optional
Flavors []string `json:"flavors,omitempty"`

// PlanTemplate allow overriding fields in the specified plan.
// +optional
PlanTemplate *RpaasPlanSpec `json:"planTemplate,omitempty"`

// Binds is the list of apps bounded to the instance
// +optional
Binds []Bind `json:"binds,omitempty"`

// Blocks are configuration file fragments added to the generated nginx
// config.
Blocks map[BlockType]Value `json:"blocks,omitempty"`

// Locations hold paths that can be configured to forward resquests to
// one destination app or include raw NGINX configurations itself.
// +optional
Locations []Location `json:"locations,omitempty"`

// TLS configuration.
// +optional
TLS []nginxv1alpha1.NginxTLS `json:"tls,omitempty"`

// Files is a list of regular files of general purpose to be mounted on
// Nginx pods. As ConfigMap stores the file content, a file cannot exceed 1MiB.
// +optional
Files []File `json:"files,omitempty"`

// PodTemplate used to configure the NGINX pod template.
// +optional
PodTemplate nginxv1alpha1.NginxPodTemplateSpec `json:"podTemplate,omitempty"`

// DynamicCertificates enables automatic issuing and renewal for TLS certificates.
// +optional
DynamicCertificates *DynamicCertificates `json:"dynamicCertificates,omitempty"`
// Spec reuse the same properties of RpaasInstance, just to avoid duplication of code
Spec RpaasInstanceSpec `json:"spec,omitempty"`
}

// RpaasValidationStatus defines the observed state of RpaasValidation
Expand All @@ -72,10 +30,10 @@ type RpaasValidationStatus struct {
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

// Valid determines whether validation is valid
Valid bool `json:"valid"`
Valid *bool `json:"valid,omitempty"`

// Feedback of validation of nginx
Error string `json:"error"`
Error string `json:"error,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
71 changes: 6 additions & 65 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Loading

0 comments on commit 5a4c731

Please sign in to comment.