Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ RUN --mount=type=secret,id=apikey hack/build.sh
FROM registry.access.redhat.com/ubi9/ubi-minimal
WORKDIR /
RUN microdnf install git-core -y && microdnf clean all
RUN mkdir -p /.config/helm && mkdir /.cache && chmod 770 /.config/helm && chmod 770 /.cache
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not need this, when you instance settings = cli.New() you get an EnvSettings dict and there you can override RepositoryConfig and RepositoryCache to something writable. I think you can totally use /tmp for this

COPY --from=builder /workspace/manager .
USER 65532:65532

Expand Down
13 changes: 13 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Code generated by tool. DO NOT EDIT.
# This file is used to track the info used to scaffold your project
# and allow the plugins properly work.
# More info: https://book.kubebuilder.io/reference/project-config.html
domain: hybrid-cloud-patterns.io
layout:
- go.kubebuilder.io/v3
Expand All @@ -16,4 +20,13 @@ resources:
kind: Pattern
path: github.com/hybrid-cloud-patterns/patterns-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: hybrid-cloud-patterns.io
group: gitops
kind: GiteaServer
path: github.com/hybrid-cloud-patterns/patterns-operator/api/v1alpha1
version: v1alpha1
version: "3"
98 changes: 98 additions & 0 deletions api/v1alpha1/giteaserver_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
Copyright 2022.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop these

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// GiteaServerSpec defines the desired state of GiteaServer
type GiteaServerSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Helm Chart URL. Default value: https://charts.validatedpatterns.io
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=1
HelmChartUrl string `json:"helmChartUrl,omitempty"`
// Namespace where helm chart will be deployed to. Default: gitea
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=2
Namespace string `json:"namespace,omitempty"`
// Helm Repo name. Default: helm-charts
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=3
RepoName string `json:"repoName,omitempty"`
// Chart Name that we will deploy. Default: gitea-chart
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=4
ChartName string `json:"chartName,omitempty"`
// Version for the chart. Default: 0.0.3
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=5
Version string `json:"version,omitempty"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HelmChartVersion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also how is the version of gitea itself managed? Is this a parameter in the helm chart or is it tightly coupled with the helm chart version? Just asking to make sure we are aware and consciously choosing a path

// Release name used to deploy the chart. Default: gitea
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=6
ReleaseName string `json:"releaseName,omitempty"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This I would drop entirely as it is mostly a hidden implementation detail of helm

}

const (
GiteaServerFinalizer string = "foregroundDeleteGiteaServer"
)

// GiteaServerStatus defines the observed state of GiteaServer
type GiteaServerStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Comment on lines +57 to +58
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop these


// Status of the chart
ChartStatus string `json:"chartStatus,omitempty"`

// Route for the service
Route string `json:"route,omitempty"`

// Last action related to the Gitea deployment
// +operator-sdk:csv:customresourcedefinitions:type=status
LastStep string `json:"lastStep,omitempty"`

// Last error encountered by the pattern
// +operator-sdk:csv:customresourcedefinitions:type=status
LastError string `json:"lastError,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// GiteaServer is the Schema for the giteaservers API
type GiteaServer struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec GiteaServerSpec `json:"spec,omitempty"`
Status GiteaServerStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// GiteaServerList contains a list of GiteaServer
type GiteaServerList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []GiteaServer `json:"items"`
}

func init() {
SchemeBuilder.Register(&GiteaServer{}, &GiteaServerList{})
}
90 changes: 90 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

74 changes: 74 additions & 0 deletions bundle/manifests/gitops.hybrid-cloud-patterns.io_giteaservers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.4
creationTimestamp: null
name: giteaservers.gitops.hybrid-cloud-patterns.io
spec:
group: gitops.hybrid-cloud-patterns.io
names:
kind: GiteaServer
listKind: GiteaServerList
plural: giteaservers
singular: giteaserver
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: GiteaServer is the Schema for the giteaservers API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: GiteaServerSpec defines the desired state of GiteaServer
properties:
chartName:
type: string
helmChartUrl:
type: string
namespace:
type: string
releaseName:
type: string
repoName:
type: string
type: object
status:
description: GiteaServerStatus defines the observed state of GiteaServer
properties:
chartStatus:
description: Status of the chart
type: string
lastError:
description: Last error encountered by the pattern
type: string
lastStep:
description: Last action related to the Gitea deployment
type: string
route:
description: Route for the service
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: null
storedVersions: null
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
controller-gen.kubebuilder.io/version: v0.11.4
creationTimestamp: null
name: patterns.gitops.hybrid-cloud-patterns.io
spec:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
creationTimestamp: null
name: patterns-operator-manager-role
rules:
- apiGroups:
- route.openshift.io
resources:
- routes
- routes/custom-host
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
Loading