Skip to content

Commit

Permalink
Finish implementation and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mmorhun committed Aug 15, 2023
1 parent fe6ea2f commit d29161a
Show file tree
Hide file tree
Showing 15 changed files with 148 additions and 115 deletions.
4 changes: 2 additions & 2 deletions api/v1beta1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

// Package v1beta1 contains API Schema definitions for the appstudio.redhat.com v1beta1 API group
// +kubebuilder:object:generate=true
// +groupName=appstudio.redhat.com.appstudio.redhat.com
// +groupName=appstudio.redhat.com
package v1beta1

import (
Expand All @@ -26,7 +26,7 @@ import (

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "appstudio.redhat.com.appstudio.redhat.com", Version: "v1beta1"}
GroupVersion = schema.GroupVersion{Group: "appstudio.redhat.com", Version: "v1beta1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta1/imagerepository_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type ImageParameters struct {
// If ommited, then defaults to "cr-namespace/cr-name".
// This field cannot be changed after the resource creation.
// +optional
// +kubebuilder:validation:Pattern="[a-z0-9][.a-z0-9_-]*(/[a-z0-9][.a-z0-9_-]*)*"
// +kubebuilder:validation:Pattern="^[a-z0-9][.a-z0-9_-]*(/[a-z0-9][.a-z0-9_-]*)*$"
Name string `json:"name,omitempty"`

// Visibility defines whether the image is publicly visible.
Expand Down Expand Up @@ -94,6 +94,7 @@ type ImageStatus struct {
URL string `json:"url,omitempty"`

// Visibility shows actual generated image repository visibility.
// +kubebuilder:validation:Enum=public;private
Visibility ImageVisibility `json:"visibility,omitempty"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: imagerepositories.appstudio.redhat.com.appstudio.redhat.com
name: imagerepositories.appstudio.redhat.com
spec:
group: appstudio.redhat.com.appstudio.redhat.com
group: appstudio.redhat.com
names:
kind: ImageRepository
listKind: ImageRepositoryList
Expand Down Expand Up @@ -58,7 +58,7 @@ spec:
description: Name of the image within configured Quay organization.
If ommited, then defaults to "cr-namespace/cr-name". This field
cannot be changed after the resource creation.
pattern: '[a-z0-9][.a-z0-9_-]*(/[a-z0-9][.a-z0-9_-]*)*'
pattern: ^[a-z0-9][.a-z0-9_-]*(/[a-z0-9][.a-z0-9_-]*)*$
type: string
visibility:
description: Visibility defines whether the image is publicly
Expand Down Expand Up @@ -113,11 +113,15 @@ spec:
/ pull from.
type: string
visibility:
allOf:
- enum:
- public
- private
- enum:
- public
- private
description: Visibility shows actual generated image repository
visibility.
enum:
- public
- private
type: string
type: object
message:
Expand Down
2 changes: 1 addition & 1 deletion config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# It should be run by config/default
#resources:
#- bases/appstudio.redhat.com_components.yaml
- bases/appstudio.redhat.com.appstudio.redhat.com_imagerepositories.yaml
- bases/appstudio.redhat.com_imagerepositories.yaml
#+kubebuilder:scaffold:crdkustomizeresource

#patchesStrategicMerge:
Expand Down
2 changes: 1 addition & 1 deletion config/crd/patches/cainjection_in_imagerepositories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
name: imagerepositories.appstudio.redhat.com.appstudio.redhat.com
name: imagerepositories.appstudio.redhat.com
2 changes: 1 addition & 1 deletion config/crd/patches/webhook_in_imagerepositories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: imagerepositories.appstudio.redhat.com.appstudio.redhat.com
name: imagerepositories.appstudio.redhat.com
spec:
conversion:
strategy: Webhook
Expand Down
4 changes: 2 additions & 2 deletions config/rbac/imagerepository_editor_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: imagerepository-editor-role
rules:
- apiGroups:
- appstudio.redhat.com.appstudio.redhat.com
- appstudio.redhat.com
resources:
- imagerepositories
verbs:
Expand All @@ -17,7 +17,7 @@ rules:
- update
- watch
- apiGroups:
- appstudio.redhat.com.appstudio.redhat.com
- appstudio.redhat.com
resources:
- imagerepositories/status
verbs:
Expand Down
4 changes: 2 additions & 2 deletions config/rbac/imagerepository_viewer_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ metadata:
name: imagerepository-viewer-role
rules:
- apiGroups:
- appstudio.redhat.com.appstudio.redhat.com
- appstudio.redhat.com
resources:
- imagerepositories
verbs:
- get
- list
- watch
- apiGroups:
- appstudio.redhat.com.appstudio.redhat.com
- appstudio.redhat.com
resources:
- imagerepositories/status
verbs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: appstudio.redhat.com.appstudio.redhat.com/v1beta1
apiVersion: appstudio.redhat.com/v1beta1
kind: ImageRepository
metadata:
name: imagerepository-sample
Expand Down
1 change: 0 additions & 1 deletion controllers/component_image_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ var _ = Describe("Component image controller", func() {
Context("Image repository provision flow", func() {

It("should prepare environment", func() {
deleteNamespace(defaultNamespace)
createNamespace(defaultNamespace)

ResetTestQuayClient()
Expand Down
Loading

0 comments on commit d29161a

Please sign in to comment.