Skip to content

Commit

Permalink
Merge pull request #609 from njhale/package-server-subscription
Browse files Browse the repository at this point in the history
feat(package-server): create subscription manifest
  • Loading branch information
njhale authored Dec 10, 2018
2 parents 6eda410 + 3fb1c34 commit 8cdb2cc
Show file tree
Hide file tree
Showing 129 changed files with 1,197 additions and 497 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,27 @@ $(CMDS):
run-local:
. ./scripts/build_local.sh
mkdir -p build/resources
. ./scripts/package-release.sh 1.0.0-local build/resources Documentation/install/local-values.yaml
. ./scripts/package-release.sh 1.0.0 build/resources Documentation/install/local-values.yaml
. ./scripts/install_local.sh local build/resources
rm -rf build

deploy-local:
mkdir -p build/resources
. ./scripts/package-release.sh 1.0.0-local build/resources Documentation/install/local-values.yaml
. ./scripts/package-release.sh 1.0.0 build/resources Documentation/install/local-values.yaml
. ./scripts/install_local.sh local build/resources
rm -rf build

run-local-shift:
. ./scripts/build_local_shift.sh
mkdir -p build/resources
. ./scripts/package-release.sh 1.0.0-local build/resources Documentation/install/local-values-shift.yaml
. ./scripts/package-release.sh 1.0.0 build/resources Documentation/install/local-values-shift.yaml
. ./scripts/install_local.sh local build/resources
rm -rf build

# useful if running e2e directly with `go test -tags=bare`
setup-bare:
. ./scripts/build_bare.sh
. ./scripts/package-release.sh 1.0.0-e2e test/e2e/resources test/e2e/e2e-bare-values.yaml
. ./scripts/package-release.sh 1.0.0 test/e2e/resources test/e2e/e2e-bare-values.yaml
. ./scripts/install_bare.sh $(shell cat ./e2e.namespace) test/e2e/resources

e2e:
Expand Down
2 changes: 1 addition & 1 deletion cmd/catalog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"

log "github.com/sirupsen/logrus"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"

"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog"
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/signals"
Expand Down
2 changes: 1 addition & 1 deletion cmd/olm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/prometheus/client_golang/prometheus"
log "github.com/sirupsen/logrus"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"

"github.com/operator-framework/operator-lifecycle-manager/pkg/api/client"
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install"
Expand Down
78 changes: 0 additions & 78 deletions deploy/chart/templates/0000_30_13-packageserver.csv.yaml

This file was deleted.

40 changes: 40 additions & 0 deletions deploy/chart/templates/0000_30_14-olm-operators.configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: olm-operators
namespace: {{ .Values.catalog_namespace }}
{{ $root := . }}
data:
customResourceDefinitions: |-
{{- range $path, $bytes := .Files.Glob "catalog_resources/olm-operators/**.crd.yaml" }}
{{- range $index, $line := $root.Files.Lines $path }}
{{- if eq $index 0 }}
{{- $line | printf "%s%s" "- " | nindent 4 }}
{{- else }}
{{- $line | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}
clusterServiceVersions: |-
{{- include "packageserver.clusterserviceversion" . | nindent 4 }}
{{- range $path, $bytes := .Files.Glob "catalog_resources/olm-operators/**.clusterserviceversion.yaml" }}
{{- range $index, $line := $root.Files.Lines $path }}
{{- if eq $index 0 }}
{{- $line | printf "%s%s" "- " | nindent 4 }}
{{- else }}
{{- $line | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}
packages: |-
{{- include "packageserver.package" . | nindent 4 }}
{{- range $path, $bytes := .Files.Glob "catalog_resources/olm-operators/**.package.yaml" }}
{{- range $index, $line := $root.Files.Lines $path }}
{{- if eq $index 0 }}
{{- $line | printf "%s%s" "- " | nindent 4 }}
{{- else }}
{{- $line | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}

12 changes: 12 additions & 0 deletions deploy/chart/templates/0000_30_15-olm-operators.catalogsource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! validate-crd: ./deploy/chart/templates/05-catalogsource.crd.yaml
#! parse-kind: CatalogSource
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: olm-operators
namespace: {{ .Values.catalog_namespace }}
spec:
sourceType: internal
configMap: olm-operators
displayName: OLM Operators
publisher: Red Hat
11 changes: 11 additions & 0 deletions deploy/chart/templates/0000_30_17-packageserver.subscription.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#! validate-crd: ./deploy/chart/templates/04-subscription.crd.yaml
#! parse-kind: Subscription
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: packageserver
namespace: {{ .Values.namespace }}
spec:
source: olm-operators
name: packageserver
channel: alpha
112 changes: 112 additions & 0 deletions deploy/chart/templates/_packageserver.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{{- define "packageserver.clusterserviceversion" }}
- apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
name: packageserver.v{{ .Chart.Version }}
namespace: {{ .Values.namespace }}
spec:
displayName: Package Server
description: Represents an Operator package that is available from a given CatalogSource which will resolve to a ClusterServiceVersion.
keywords: ['packagemanifests', 'olm', 'packages']
maintainers:
- name: Red Hat
email: openshift-operators@redhat.com
provider:
name: Red Hat
links:
- name: Package Server
url: https://github.com/operator-framework/operator-lifecycle-manager/tree/master/pkg/packageserver
install:
strategy: deployment
spec:
clusterPermissions:
- serviceAccountName: packageserver
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- apiGroups:
- "operators.coreos.com"
resources:
- catalogsources
verbs:
- get
- list
- watch
- apiGroups:
- "packages.apps.redhat.com"
resources:
- packagemanifests
verbs:
- get
- list
- watch
- create
- delete
- patch
- update
deployments:
- name: packageserver
spec:
replicas: {{ .Values.package.replicaCount }}
strategy:
type: RollingUpdate
selector:
matchLabels:
app: packageserver
template:
metadata:
labels:
app: packageserver
spec:
serviceAccountName: packageserver
containers:
- name: packageserver
command:
- /bin/package-server
- -v=4
{{- if .Values.watchedNamespaces }}
- --watched-namespaces
- {{ .Values.watchedNamespaces }}
{{- end }}
- --secure-port
- {{ .Values.package.service.internalPort | quote }}
- --global-namespace
- {{ .Values.namespace }}
{{- if .Values.debug }}
- --debug
{{- end }}
{{- if .Values.package.commandArgs }}
- {{ .Values.package.commandArgs }}
{{- end }}
image: {{ .Values.package.image.ref }}
imagePullPolicy: {{ .Values.package.image.pullPolicy }}
ports:
- containerPort: {{ .Values.package.service.internalPort }}
livenessProbe:
httpGet:
scheme: HTTPS
path: /healthz
port: {{ .Values.package.service.internalPort }}
readinessProbe:
httpGet:
scheme: HTTPS
path: /healthz
port: {{ .Values.package.service.internalPort }}
maturity: alpha
version: {{ .Chart.Version }}
apiservicedefinitions:
owned:
- group: packages.apps.redhat.com
version: v1alpha1
kind: PackageManifest
displayName: PackageManifest
description: A PackageManifest is a resource generated from existing CatalogSources and their ConfigMaps
deploymentName: packageserver
containerPort: {{ .Values.package.service.internalPort }}
{{- end }}
6 changes: 6 additions & 0 deletions deploy/chart/templates/_packageserver.package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{- define "packageserver.package" }}
- packageName: packageserver
channels:
- name: alpha
currentCSV: packageserver.v{{ .Chart.Version }}
{{- end}}
2 changes: 1 addition & 1 deletion deploy/ocp/manifests/0.8.0/0000_30_00-namespace.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##---
---
# Source: olm/templates/0000_30_00-namespace.yaml
apiVersion: v1
kind: Namespace
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##---
---
# Source: olm/templates/0000_30_01-olm-operator.serviceaccount.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##---
---
# Source: olm/templates/0000_30_02-clusterserviceversion.crd.yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
Expand Down
2 changes: 1 addition & 1 deletion deploy/ocp/manifests/0.8.0/0000_30_03-installplan.crd.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##---
---
# Source: olm/templates/0000_30_03-installplan.crd.yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##---
---
# Source: olm/templates/0000_30_04-subscription.crd.yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##---
---
# Source: olm/templates/0000_30_05-catalogsource.crd.yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##---
---
# Source: olm/templates/0000_30_06-rh-operators.configmap.yaml

kind: ConfigMap
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##---
---
# Source: olm/templates/0000_30_07-certified-operators.configmap.yaml

kind: ConfigMap
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##---
---
# Source: olm/templates/0000_30_08-certified-operators.catalogsource.yaml

#! validate-crd: ./deploy/chart/templates/05-catalogsource.crd.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##---
---
# Source: olm/templates/0000_30_09-rh-operators.catalogsource.yaml

#! validate-crd: ./deploy/chart/templates/05-catalogsource.crd.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##---
---
# Source: olm/templates/0000_30_10-olm-operator.deployment.yaml
apiVersion: apps/v1
kind: Deployment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##---
---
# Source: olm/templates/0000_30_11-catalog-operator.deployment.yaml
apiVersion: apps/v1
kind: Deployment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##---
---
# Source: olm/templates/0000_30_12-aggregated.clusterrole.yaml
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
Loading

0 comments on commit 8cdb2cc

Please sign in to comment.