Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ linters:
- duplicatemarkers
- integers
- jsontags
- kustomizeref
- maxlength
# NOTE: we have a number of boolean fields. Should we convert them to
# string?
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ modules:
go mod tidy

.PHONY: generate
generate: generate-resources generate-controller-gen generate-codegen generate-go generate-docs modules manifests
generate: generate-resources generate-controller-gen generate-kustomizeconfig generate-codegen generate-go generate-docs modules manifests

.PHONY: generate-resources
generate-resources:
Expand All @@ -68,6 +68,10 @@ generate-resources:
generate-controller-gen: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

.PHONY: generate-kustomizeconfig
generate-kustomizeconfig: generate-resources generate-controller-gen ## Generate examples/components/kustomizeconfig/kustomizeconfig.yaml from +orc:kustomize:ref markers on the API types.
go run ./cmd/kustomizeconfig-generator

.PHONY: generate-codegen
generate-codegen: generate-controller-gen ## codegen requires DeepCopy etc
./hack/update-codegen.sh
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/addressscope_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type AddressScopeResourceSpec struct {
// projectRef is a reference to the ORC Project which this resource is associated with.
// +optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="projectRef is immutable"
// +orc:kustomize:ref=Project
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`

// ipVersion is the IP protocol version.
Expand All @@ -51,6 +52,7 @@ type AddressScopeFilter struct {

// projectRef is a reference to the ORC Project which this resource is associated with.
// +optional
// +orc:kustomize:ref=Project
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`

// ipVersion is the IP protocol version.
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/applicationcredential_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type ApplicationCredentialAccessRule struct {

// serviceRef identifier for the service that the application credential is permitted to access
// +optional
// +orc:kustomize:ref=Service
ServiceRef *KubernetesNameRef `json:"serviceRef,omitempty"`
}

Expand All @@ -67,6 +68,7 @@ type ApplicationCredentialResourceSpec struct {
// userRef is a reference to the ORC User which this resource is associated with.
// Note: Due to the nature of the OpenStack API, managing application credentials for a user different than the one ORC is authenticated against can be computationally expensive. In the worst case, all application credentials of all users have to be queried.
// +required
// +orc:kustomize:ref=User
UserRef KubernetesNameRef `json:"userRef,omitempty"`

// unrestricted is a flag indicating whether the application credential may be used for creation or destruction of other application credentials or trusts
Expand All @@ -75,12 +77,14 @@ type ApplicationCredentialResourceSpec struct {

// secretRef is a reference to a Secret containing the application credential secret
// +required
// +orc:kustomize:ref=Secret
SecretRef KubernetesNameRef `json:"secretRef,omitempty"`

// roleRefs may only contain roles that the user has assigned on the project. If not provided, the roles assigned to the application credential will be the same as the roles in the current token.
// +kubebuilder:validation:MaxItems:=256
// +listType=atomic
// +optional
// +orc:kustomize:ref=Role
RoleRefs []KubernetesNameRef `json:"roleRefs,omitempty"`

// accessRules is a list of fine grained access control rules
Expand All @@ -100,6 +104,7 @@ type ApplicationCredentialFilter struct {
// userRef is a reference to the ORC User which this resource is associated with.
// Note: Due to the nature of the OpenStack API, managing application credentials for a user different than the one ORC is authenticated against can be computationally expensive. In the worst case, all application credentials of all users have to be queried.
// +required
// +orc:kustomize:ref=User
UserRef KubernetesNameRef `json:"userRef,omitempty"`

// name of the existing resource
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/credentials_ref.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type CloudCredentialsReference struct {
// +required
// +kubebuilder:validation:MinLength:=1
// +kubebuilder:validation:MaxLength:=253
// +orc:kustomize:ref=Secret
SecretName string `json:"secretName,omitempty"`

// cloudName specifies the name of the entry in the clouds.yaml file to use.
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/endpoint_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type EndpointResourceSpec struct {
// serviceRef is a reference to the ORC Service which this resource is associated with.
// +required
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="serviceRef is immutable"
// +orc:kustomize:ref=Service
ServiceRef KubernetesNameRef `json:"serviceRef,omitempty"`
}

Expand All @@ -55,6 +56,7 @@ type EndpointFilter struct {

// serviceRef is a reference to the ORC Service which this resource is associated with.
// +optional
// +orc:kustomize:ref=Service
ServiceRef *KubernetesNameRef `json:"serviceRef,omitempty"`

// url is the URL of the existing endpoint.
Expand Down
7 changes: 7 additions & 0 deletions api/v1alpha1/floatingip_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,18 @@ type FloatingIPFilter struct {

// floatingNetworkRef is a reference to the ORC Network which this resource is associated with.
// +optional
// +orc:kustomize:ref=Network
FloatingNetworkRef *KubernetesNameRef `json:"floatingNetworkRef,omitempty"`

// portRef is a reference to the ORC Port which this resource is associated with.
// +optional
// +orc:kustomize:ref=Port
PortRef *KubernetesNameRef `json:"portRef,omitempty"`

// projectRef is a reference to the ORC Project this resource is associated with.
// Typically, only used by admin.
// +optional
// +orc:kustomize:ref=Project
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`

// status is the status of the floatingip.
Expand All @@ -64,11 +67,13 @@ type FloatingIPResourceSpec struct {
// floatingNetworkRef references the network to which the floatingip is associated.
// +optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="floatingNetworkRef is immutable"
// +orc:kustomize:ref=Network
FloatingNetworkRef *KubernetesNameRef `json:"floatingNetworkRef,omitempty"`

// floatingSubnetRef references the subnet to which the floatingip is associated.
// +optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="floatingSubnetRef is immutable"
// +orc:kustomize:ref=Subnet
FloatingSubnetRef *KubernetesNameRef `json:"floatingSubnetRef,omitempty"`

// floatingIP is the IP that will be assigned to the floatingip. If not set, it will
Expand All @@ -80,6 +85,7 @@ type FloatingIPResourceSpec struct {
// portRef is a reference to the ORC Port which this resource is associated with.
// +optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="portRef is immutable"
// +orc:kustomize:ref=Port
PortRef *KubernetesNameRef `json:"portRef,omitempty"`

// fixedIP is the IP address of the port to which the floatingip is associated.
Expand All @@ -91,6 +97,7 @@ type FloatingIPResourceSpec struct {
// Typically, only used by admin.
// +optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="projectRef is immutable"
// +orc:kustomize:ref=Project
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`
}

Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/group_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type GroupResourceSpec struct {
// domainRef is a reference to the ORC Domain which this resource is associated with.
// +optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="domainRef is immutable"
// +orc:kustomize:ref=Domain
DomainRef *KubernetesNameRef `json:"domainRef,omitempty"`
}

Expand All @@ -44,6 +45,7 @@ type GroupFilter struct {

// domainRef is a reference to the ORC Domain which this resource is associated with.
// +optional
// +orc:kustomize:ref=Domain
DomainRef *KubernetesNameRef `json:"domainRef,omitempty"`
}

Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/network_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ type NetworkResourceSpec struct {
// Typically, only used by admin.
// +optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="projectRef is immutable"
// +orc:kustomize:ref=Project
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`
}

Expand All @@ -136,6 +137,7 @@ type NetworkFilter struct {
// projectRef is a reference to the ORC Project this resource is associated with.
// Typically, only used by admin.
// +optional
// +orc:kustomize:ref=Project
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`

FilterByNeutronTags `json:",inline"`
Expand Down
7 changes: 7 additions & 0 deletions api/v1alpha1/port_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ type PortFilter struct {

// networkRef is a reference to the ORC Network which this port is associated with.
// +optional
// +orc:kustomize:ref=Network
NetworkRef KubernetesNameRef `json:"networkRef"`

// projectRef is a reference to the ORC Project this resource is associated with.
// Typically, only used by admin.
// +optional
// +orc:kustomize:ref=Project
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`

// adminStateUp is the administrative state of the port,
Expand Down Expand Up @@ -66,6 +68,7 @@ type HostID struct {
// the Server's status.resource.hostID field.
// This is mutually exclusive with id.
// +optional
// +orc:kustomize:ref=Server
ServerRef KubernetesNameRef `json:"serverRef,omitempty"`
}

Expand Down Expand Up @@ -106,6 +109,7 @@ type Address struct {
// subnetRef references the subnet from which to allocate the IP
// address.
// +required
// +orc:kustomize:ref=Subnet
SubnetRef KubernetesNameRef `json:"subnetRef,omitempty"`
}

Expand Down Expand Up @@ -148,6 +152,7 @@ type PortResourceSpec struct {
// networkRef is a reference to the ORC Network which this port is associated with.
// +required
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="networkRef is immutable"
// +orc:kustomize:ref=Network
NetworkRef KubernetesNameRef `json:"networkRef,omitempty"`

// tags is a list of tags which will be applied to the port.
Expand Down Expand Up @@ -180,6 +185,7 @@ type PortResourceSpec struct {
// +kubebuilder:validation:MaxItems:=64
// +listType=set
// +optional
// +orc:kustomize:ref=SecurityGroup
SecurityGroupRefs []KubernetesNameRef `json:"securityGroupRefs,omitempty"`

// vnicType specifies the type of vNIC which this port should be
Expand Down Expand Up @@ -207,6 +213,7 @@ type PortResourceSpec struct {
// Typically, only used by admin.
// +optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="projectRef is immutable"
// +orc:kustomize:ref=Project
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`

// macAddress is the MAC address of the port.
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/project_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type ProjectResourceSpec struct {
// domainRef is a reference to the ORC Domain which this resource is associated with.
// +optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="domainRef is immutable"
// +orc:kustomize:ref=Domain
DomainRef *KubernetesNameRef `json:"domainRef,omitempty"`

// enabled defines whether a project is enabled or not. Default is true.
Expand All @@ -90,6 +91,7 @@ type ProjectFilter struct {

// domainRef is a reference to the ORC Domain which this resource is associated with.
// +optional
// +orc:kustomize:ref=Domain
DomainRef *KubernetesNameRef `json:"domainRef,omitempty"`

FilterByKeystoneTags `json:",inline"`
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/role_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type RoleResourceSpec struct {
// domainRef is a reference to the ORC Domain which this resource is associated with.
// +optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="domainRef is immutable"
// +orc:kustomize:ref=Domain
DomainRef *KubernetesNameRef `json:"domainRef,omitempty"`
}

Expand All @@ -44,6 +45,7 @@ type RoleFilter struct {

// domainRef is a reference to the ORC Domain which this resource is associated with.
// +optional
// +orc:kustomize:ref=Domain
DomainRef *KubernetesNameRef `json:"domainRef,omitempty"`
}

Expand Down
10 changes: 10 additions & 0 deletions api/v1alpha1/roleassignment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,31 @@ package v1alpha1
type RoleAssignmentResourceSpec struct {
// roleRef references the Role being assigned.
// +required
// +orc:kustomize:ref=Role
RoleRef KubernetesNameRef `json:"roleRef,omitempty"`

// userRef references the User receiving the role assignment.
// Exactly one of userRef or groupRef must be specified.
// +optional
// +orc:kustomize:ref=User
UserRef *KubernetesNameRef `json:"userRef,omitempty"`

// groupRef references the Group receiving the role assignment.
// Exactly one of userRef or groupRef must be specified.
// +optional
// +orc:kustomize:ref=Group
GroupRef *KubernetesNameRef `json:"groupRef,omitempty"`

// projectRef references the Project scope for the assignment.
// Exactly one of projectRef or domainRef must be specified.
// +optional
// +orc:kustomize:ref=Project
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`

// domainRef references the Domain scope for the assignment.
// Exactly one of projectRef or domainRef must be specified.
// +optional
// +orc:kustomize:ref=Domain
DomainRef *KubernetesNameRef `json:"domainRef,omitempty"`
}

Expand All @@ -54,22 +59,27 @@ type RoleAssignmentResourceSpec struct {
type RoleAssignmentFilter struct {
// roleRef filters by the referenced Role.
// +optional
// +orc:kustomize:ref=Role
RoleRef *KubernetesNameRef `json:"roleRef,omitempty"`

// userRef filters by the referenced User.
// +optional
// +orc:kustomize:ref=User
UserRef *KubernetesNameRef `json:"userRef,omitempty"`

// groupRef filters by the referenced Group.
// +optional
// +orc:kustomize:ref=Group
GroupRef *KubernetesNameRef `json:"groupRef,omitempty"`

// projectRef filters by the referenced Project scope.
// +optional
// +orc:kustomize:ref=Project
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`

// domainRef filters by the referenced Domain scope.
// +optional
// +orc:kustomize:ref=Domain
DomainRef *KubernetesNameRef `json:"domainRef,omitempty"`
}

Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/router_interface_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ type RouterInterfaceSpec struct {

// routerRef references the router to which this interface belongs.
// +required
// +orc:kustomize:ref=Router
RouterRef KubernetesNameRef `json:"routerRef,omitempty"`

// subnetRef references the subnet the router interface is created on.
// +unionMember
// +optional
// +orc:kustomize:ref=Subnet
SubnetRef *KubernetesNameRef `json:"subnetRef,omitempty"`

// resyncPeriod defines how frequently the controller will re-reconcile
Expand Down
3 changes: 3 additions & 0 deletions api/v1alpha1/router_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type RouterFilter struct {
// projectRef is a reference to the ORC Project this resource is associated with.
// Typically, only used by admin.
// +optional
// +orc:kustomize:ref=Project
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`

FilterByNeutronTags `json:",inline"`
Expand All @@ -39,6 +40,7 @@ type ExternalGateway struct {
// networkRef is a reference to the ORC Network which the external
// gateway is on.
// +required
// +orc:kustomize:ref=Network
NetworkRef KubernetesNameRef `json:"networkRef,omitempty"`
}

Expand Down Expand Up @@ -95,6 +97,7 @@ type RouterResourceSpec struct {
// Typically, only used by admin.
// +optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="projectRef is immutable"
// +orc:kustomize:ref=Project
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`
}

Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/securitygroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ type SecurityGroupResourceSpec struct {
// Typically, only used by admin.
// +optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="projectRef is immutable"
// +orc:kustomize:ref=Project
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`
}

Expand All @@ -233,6 +234,7 @@ type SecurityGroupFilter struct {
// projectRef is a reference to the ORC Project this resource is associated with.
// Typically, only used by admin.
// +optional
// +orc:kustomize:ref=Project
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`

FilterByNeutronTags `json:",inline"`
Expand Down
Loading
Loading