Skip to content

Commit

Permalink
Fix schema
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Oct 31, 2024
1 parent a477a2a commit c46cfab
Show file tree
Hide file tree
Showing 29 changed files with 5,154 additions and 189 deletions.
13 changes: 2 additions & 11 deletions apis/installer/v1alpha1/ace_ace_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,19 +212,10 @@ type AcePlatformSettings struct {
}

type HostInfo struct {
Host string `json:"host"`
HostType HostType `json:"hostType"`
Host string `json:"host"`
HostType catgwapi.HostType `json:"hostType"`
}

// +kubebuilder:validation:Enum=domain;ip
// +kubebuilder:default=ip
type HostType string

const (
HostTypeDomain HostType = "domain"
HostTypeIP HostType = "ip"
)

type GlobalMonitoring struct {
Agent string `json:"agent"`
ServiceMonitor GlobalServiceMonitor `json:"serviceMonitor"`
Expand Down
6 changes: 3 additions & 3 deletions apis/installer/v1alpha1/ace_options_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ func (a *AceOptionsSpec) Host() string {
return a.Context.HostedDomain
}

func (a *AceOptionsSpec) HostType() HostType {
func (a *AceOptionsSpec) HostType() catgwapi.HostType {
if a.Infra.DNS.Provider == catgwapi.DNSProviderNone {
return HostTypeIP
return catgwapi.HostTypeIP
}
return HostTypeDomain
return catgwapi.HostTypeDomain
}

type RegistrySpec struct {
Expand Down
4 changes: 2 additions & 2 deletions apis/installer/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&ReloaderList{},
&S3proxy{},
&S3proxyList{},
&ServiceGateways{},
&ServiceGatewaysList{},
&ServiceGateway{},
&ServiceGatewayList{},
&ServiceGatewayPresets{},
&ServiceGatewayPresetsList{},
&ServiceProvider{},
Expand Down
14 changes: 7 additions & 7 deletions apis/installer/v1alpha1/service_gateway_presets_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ limitations under the License.
package v1alpha1

import (
catgwapi "go.bytebuilders.dev/catalog/api/gateway/v1alpha1"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
uiapi "kmodules.xyz/resource-metadata/apis/ui/v1alpha1"
)

const (
Expand All @@ -43,12 +44,11 @@ type ServiceGatewayPresets struct {
}

type ServiceGatewayPresetsSpec struct {
ServiceGatewaysSpec `json:",inline,omitempty"`
ClusterMetadata *StashClusterMetadata `json:"clusterMetadata,omitempty"`
SkipGatewayPreset bool `json:"skipGatewayPreset"`
// Chart specifies the chart information that will be used by the FluxCD to install the respective feature
// +optional
Chart uiapi.ChartInfo `json:"chart,omitempty"`
NameOverride string `json:"nameOverride"`
FullnameOverride string `json:"fullnameOverride"`
ClusterMetadata StashClusterMetadata `json:"clusterMetadata"`
SkipGatewayPreset bool `json:"skipGatewayPreset"`
catgwapi.GatewayConfigSpec `json:",inline,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
36 changes: 16 additions & 20 deletions apis/installer/v1alpha1/service_gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,42 @@ import (
)

const (
ResourceKindServiceGateways = "ServiceGateways"
ResourceServiceGateways = "servicegateways"
ResourceServiceGatewayss = "servicegatewayss"
ResourceKindServiceGateway = "ServiceGateway"
ResourceServiceGateway = "servicegateways"
ResourceServiceGateways = "servicegateways"
)

// ServiceGateways defines the schama for ServiceGateways chart.
// ServiceGateway defines the schama for ServiceGateway chart.

// +genclient
// +genclient:skipVerbs=updateStatus
// +k8s:openapi-gen=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// +kubebuilder:object:root=true
// +kubebuilder:resource:path=servicegatewayss,singular=servicegateways,categories={kubeops,appscode}
type ServiceGateways struct {
// +kubebuilder:resource:path=servicegateways,singular=servicegateways,categories={kubeops,appscode}
type ServiceGateway struct {
metav1.TypeMeta `json:",inline,omitempty"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ServiceGatewaysSpec `json:"spec,omitempty"`
Spec ServiceGatewaySpec `json:"spec,omitempty"`
}

type ServiceGatewaysSpec struct {
NameOverride string `json:"nameOverride"`
FullnameOverride string `json:"fullnameOverride"`
ClusterMetadata StashClusterMetadata `json:"clusterMetadata"`
Infra catgwapi.ServiceProviderInfra `json:"infra"`
GatewayDns catgwapi.ServiceGatewayDns `json:"gateway-dns"`
Cluster catgwapi.ServiceProviderCluster `json:"cluster"`
Envoy catgwapi.SimpleImageRef `json:"envoy"`
Echoserver catgwapi.SimpleImageRef `json:"echoserver"`
type ServiceGatewaySpec struct {
NameOverride string `json:"nameOverride"`
FullnameOverride string `json:"fullnameOverride"`
ClusterMetadata StashClusterMetadata `json:"clusterMetadata"`
catgwapi.GatewaySpec `json:",inline,omitempty"`
}

// +kubebuilder:validation:Enum=ca
type ClusterTLSIssuerType string

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ServiceGatewaysList is a list of ServiceGatewayss
type ServiceGatewaysList struct {
// ServiceGatewayList is a list of ServiceGateways
type ServiceGatewayList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
// Items is a list of ServiceGateways CRD objects
Items []ServiceGateways `json:"items,omitempty"`
// Items is a list of ServiceGateway CRD objects
Items []ServiceGateway `json:"items,omitempty"`
}
1 change: 1 addition & 0 deletions apis/installer/v1alpha1/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func TestDefaultValues(t *testing.T) {
sc.TestCase{Obj: v1alpha1.PlatformUiSpec{}},
sc.TestCase{Obj: v1alpha1.S3proxySpec{}},
sc.TestCase{Obj: v1alpha1.ServiceBackendSpec{}},
sc.TestCase{Obj: v1alpha1.ServiceGatewaySpec{}},
sc.TestCase{Obj: v1alpha1.ServiceGatewayPresetsSpec{}},
sc.TestCase{Obj: v1alpha1.ServiceProviderSpec{}},
sc.TestCase{Obj: v1alpha1.ServiceVaultSpec{}},
Expand Down
97 changes: 44 additions & 53 deletions apis/installer/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
{{ $defaults := printf `
clusterMetadata:
uid: %q
name: %q
envoy:
image: %s
echoserver:
image: %s
infra:
clusterName: %q
gateway:
config:
envoyGateway:
gateway:
controllerName: gateway.voyagermesh.com/ace
deployment:
envoyGateway:
image:
repository: %s
kubeRbacProxy:
image:
repository: %s
gateway-converter:
registryFQDN: %s
`
$.Values.clusterMetadata.uid
$.Values.clusterMetadata.name
(include "image.ghcr" (merge (dict "_repo" "voyagermesh/envoy") $))
(include "image.ghcr" (merge (dict "_repo" "voyagermesh/echoserver") $))
$.Values.clusterMetadata.name
(include "image.ghcr" (merge (dict "_repo" "voyagermesh/gateway") $))
(include "image.ghcr" (merge (dict "_repo" "appscode/kube-rbac-proxy") $))
(include "registry.ghcr" $)
| fromYaml }}
{{ $vals := dig "service-gateway-presets" "values" (dict) .Values.helm.releases }}
Expand Down
Loading

0 comments on commit c46cfab

Please sign in to comment.