Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClusterServiceVersion #279

Merged
merged 1 commit into from
Aug 17, 2020
Merged
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 .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deploy
21 changes: 7 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
# Build the manager binary
FROM golang:1.13 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

# Copy the go source
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY pkg/ pkg/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -o manager main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/manager .
USER nonroot:nonroot
FROM scratch
WORKDIR /workspace
COPY --from=builder /workspace/manager manager
COPY kustomize/ kustomize/

ENTRYPOINT ["/manager"]
ENTRYPOINT ["/workspace/manager"]
12 changes: 12 additions & 0 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM quay.io/operator-framework/upstream-registry-builder as builder

COPY manifests manifests
RUN ./bin/initializer -o ./bundles.db

FROM scratch
COPY --from=builder /build/bundles.db /bundles.db
COPY --from=builder /build/bin/registry-server /registry-server
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
EXPOSE 50051
ENTRYPOINT ["/registry-server"]
CMD ["--database", "bundles.db"]

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
name: quayregistries.quay.redhat.com
spec:
group: quay.redhat.com
names:
kind: QuayRegistry
listKind: QuayRegistryList
plural: quayregistries
singular: quayregistry
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: QuayRegistry is the Schema for the quayregistries 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: QuayRegistrySpec defines the desired state of QuayRegistry.
properties:
configBundleSecret:
description: ConfigBundleSecret is the name of the Kubernetes `Secret`
in the same namespace which contains the base Quay config and extra
certs.
type: string
managedComponents:
description: ManagedComponents declare which supplemental services should
be included in this Quay deployment.
items:
properties:
kind:
type: string
type: object
type: array
type: object
status:
description: QuayRegistryStatus defines the observed state of QuayRegistry.
type: object
type: object
version: v1
versions:
- name: v1
served: true
storage: true
5 changes: 5 additions & 0 deletions deploy/manifests/quay-operator/quay-operator.package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- currentCSV: quay-operator.v0.0.1
name: alpha
defaultChannel: alpha
packageName: quay-tng
7 changes: 7 additions & 0 deletions deploy/quay-operator.catalogsource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: quay-operator
spec:
sourceType: grpc
image: quay.io/projectquay/quay-operator-catalog@sha256:f64e1efa2e202b3727049f03537d1420fc03044aabfc8e49e9859ac4d27aa4a4
11 changes: 11 additions & 0 deletions deploy/quay-operator.subscription.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: quay-tng
spec:
channel: alpha
installPlanApproval: Automatic
name: quay-tng
source: quay-operator
sourceNamespace: openshift-marketplace
startingCSV: quay-operator.v0.0.1
7 changes: 2 additions & 5 deletions pkg/kustomize/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package kustomize

import (
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
Expand Down Expand Up @@ -84,16 +83,13 @@ func ModelFor(gvk schema.GroupVersionKind) k8sruntime.Object {

// generate uses Kustomize as a library to build the runtime objects to be applied to a cluster.
func generate(kustomization *types.Kustomization, quayConfigFiles map[string][]byte) ([]k8sruntime.Object, error) {
// FIXME(alecmerdler): Just load the `kustomize` directory into memory to avoid all these annoying filesystem permissions...
fmt.Println("FIXME((alecmerdler): Debugging")
fSys := filesys.MakeEmptyDirInMemory()
filepath.Walk(kustomizeDir(), func(path string, info os.FileInfo, err error) error {
err := filepath.Walk(kustomizeDir(), func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}

if !info.IsDir() {
fmt.Println(path)
f, err := ioutil.ReadFile(path)
if err != nil {
return err
Expand All @@ -106,6 +102,7 @@ func generate(kustomization *types.Kustomization, quayConfigFiles map[string][]b
}
return nil
})
check(err)

// Write `kustomization.yaml` to filesystem
kustomizationFile, err := yaml.Marshal(kustomization)
Expand Down