From 381e07becd6e47be25b50ccd427a1f976837c0fa Mon Sep 17 00:00:00 2001 From: Nikhil Thomas Date: Thu, 12 Sep 2019 13:13:42 +0530 Subject: [PATCH] Add exp multi name CSV --- deploy/crds/icndbfun_v1alpha1_funapp_cr.yaml | 8 +- ...ator.v2.0.0-exp.clusterserviceversion.yaml | 132 ++++++++++++++++++ .../icndbfun_v1alpha1_funapp_crd.yaml | 66 +++++++++ .../icndb-app-operator.package.yaml | 2 + deploy/operator.yaml | 2 +- .../icndb-app-operator.package.yaml | 7 + ...r.v1.0.0.clusterserviceversion-v1.0.0.yaml | 129 +++++++++++++++++ ...ator.v2.0.0-exp.clusterserviceversion.yaml | 132 ++++++++++++++++++ ...operator.v2.0.0.clusterserviceversion.yaml | 131 +++++++++++++++++ .../icndbfun_v1alpha1_funapp_crd.yaml | 66 +++++++++ manifests/version-exp/operator-source.yaml | 12 ++ manifests/version-exp/os-operator-source.yaml | 12 ++ pkg/controller/funapp/funapp_controller.go | 13 +- 13 files changed, 704 insertions(+), 8 deletions(-) create mode 100644 deploy/olm-catalog/icndb-app-operator/2.0.0-exp/icndb-app-operator.v2.0.0-exp.clusterserviceversion.yaml create mode 100644 deploy/olm-catalog/icndb-app-operator/2.0.0-exp/icndbfun_v1alpha1_funapp_crd.yaml create mode 100644 manifests/version-exp/icndb-app-operator/icndb-app-operator.package.yaml create mode 100644 manifests/version-exp/icndb-app-operator/icndb-app-operator.v1.0.0.clusterserviceversion-v1.0.0.yaml create mode 100644 manifests/version-exp/icndb-app-operator/icndb-app-operator.v2.0.0-exp.clusterserviceversion.yaml create mode 100644 manifests/version-exp/icndb-app-operator/icndb-app-operator.v2.0.0.clusterserviceversion.yaml create mode 100644 manifests/version-exp/icndb-app-operator/icndbfun_v1alpha1_funapp_crd.yaml create mode 100644 manifests/version-exp/operator-source.yaml create mode 100644 manifests/version-exp/os-operator-source.yaml diff --git a/deploy/crds/icndbfun_v1alpha1_funapp_cr.yaml b/deploy/crds/icndbfun_v1alpha1_funapp_cr.yaml index 65fcb21..b99f5de 100644 --- a/deploy/crds/icndbfun_v1alpha1_funapp_cr.yaml +++ b/deploy/crds/icndbfun_v1alpha1_funapp_cr.yaml @@ -5,5 +5,9 @@ metadata: spec: funpods: 4 params: - - key: Name - value: Superstar Rajnikanth + - key: Name + value: Superstar Rajnikanth + - key: Name + value: Chuck Norris + - key: Name + value: John Abraham diff --git a/deploy/olm-catalog/icndb-app-operator/2.0.0-exp/icndb-app-operator.v2.0.0-exp.clusterserviceversion.yaml b/deploy/olm-catalog/icndb-app-operator/2.0.0-exp/icndb-app-operator.v2.0.0-exp.clusterserviceversion.yaml new file mode 100644 index 0000000..798c31d --- /dev/null +++ b/deploy/olm-catalog/icndb-app-operator/2.0.0-exp/icndb-app-operator.v2.0.0-exp.clusterserviceversion.yaml @@ -0,0 +1,132 @@ +apiVersion: operators.coreos.com/v1alpha1 +kind: ClusterServiceVersion +metadata: + annotations: + alm-examples: '[{"apiVersion":"icndbfun.dev/v1alpha1","kind":"FunApp","metadata":{"name":"devopsday-funapp"},"spec":{"funpods":4,"params":[{"key":"Name","value":"Superstar + Rajnikanth"},{"key":"Name","value":"Chuck Norris"},{"key":"Name","value":"John + Abraham"}]}}]' + capabilities: Basic Install + name: icndb-app-operator.v2.0.0-exp + namespace: placeholder +spec: + apiservicedefinitions: {} + customresourcedefinitions: + owned: + - description: Create an instance of FUnApp CRD to launch FunApp in this namespace + displayName: FunApp CRD + kind: FunApp + name: funapps.icndbfun.dev + version: v1alpha1 + description: Icndb App Operator manages the lifecycle of ICNDB App https://github.com/nikhil-thomas/icndp-app + displayName: Icndb App Operator + install: + spec: + clusterPermissions: + - rules: + - apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - events + - configmaps + - secrets + verbs: + - '*' + - apiGroups: + - apps + resources: + - deployments + - daemonsets + - replicasets + - statefulsets + verbs: + - '*' + - apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - get + - create + - apiGroups: + - apps + resourceNames: + - icndb-app-operator + resources: + - deployments/finalizers + verbs: + - update + - apiGroups: + - "" + resources: + - pods + verbs: + - get + - apiGroups: + - apps + resources: + - replicasets + verbs: + - get + - apiGroups: + - icndbfun.dev + resources: + - '*' + verbs: + - '*' + serviceAccountName: icndb-app-operator + deployments: + - name: icndb-app-operator + spec: + replicas: 1 + selector: + matchLabels: + name: icndb-app-operator + strategy: {} + template: + metadata: + labels: + name: icndb-app-operator + spec: + containers: + - command: + - icndb-app-operator + env: + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.annotations['olm.targetNamespaces'] + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: icndb-app-operator + image: nikhilvep/icndb-app-operator:version-exp + imagePullPolicy: Always + name: icndb-app-operator + resources: {} + serviceAccountName: icndb-app-operator + strategy: deployment + installModes: + - supported: true + type: OwnNamespace + - supported: false + type: SingleNamespace + - supported: true + type: MultiNamespace + - supported: true + type: AllNamespaces + keywords: + - olm-example + maintainers: + - email: nikhilthomas1@gmail.com + name: Nikhil Thomas + maturity: alpha + provider: + name: Nikhil Thomas + replaces: icndb-app-operator.v2.0.0 + version: 2.0.0-exp diff --git a/deploy/olm-catalog/icndb-app-operator/2.0.0-exp/icndbfun_v1alpha1_funapp_crd.yaml b/deploy/olm-catalog/icndb-app-operator/2.0.0-exp/icndbfun_v1alpha1_funapp_crd.yaml new file mode 100644 index 0000000..03f302e --- /dev/null +++ b/deploy/olm-catalog/icndb-app-operator/2.0.0-exp/icndbfun_v1alpha1_funapp_crd.yaml @@ -0,0 +1,66 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: funapps.icndbfun.dev +spec: + group: icndbfun.dev + names: + kind: FunApp + listKind: FunAppList + plural: funapps + singular: funapp + scope: Namespaced + subresources: + status: {} + validation: + openAPIV3Schema: + 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/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/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + funpods: + description: Funpods specify number of replicas in the deployment created + format: int32 + type: integer + params: + description: Params specify additional configuration if required + items: + properties: + key: + type: string + value: + type: string + required: + - key + - value + type: object + type: array + required: + - funpods + type: object + status: + properties: + podnames: + description: Podnames list all the pods created for FunApp + items: + type: string + type: array + required: + - podnames + type: object + version: v1alpha1 + versions: + - name: v1alpha1 + served: true + storage: true diff --git a/deploy/olm-catalog/icndb-app-operator/icndb-app-operator.package.yaml b/deploy/olm-catalog/icndb-app-operator/icndb-app-operator.package.yaml index 5b9f795..2b16f6c 100644 --- a/deploy/olm-catalog/icndb-app-operator/icndb-app-operator.package.yaml +++ b/deploy/olm-catalog/icndb-app-operator/icndb-app-operator.package.yaml @@ -1,5 +1,7 @@ channels: - currentCSV: icndb-app-operator.v2.0.0 name: alpha +- currentCSV: icndb-app-operator.v2.0.0-exp + name: experimental defaultChannel: alpha packageName: icndb-app-operator diff --git a/deploy/operator.yaml b/deploy/operator.yaml index 51713fd..32c6cf6 100644 --- a/deploy/operator.yaml +++ b/deploy/operator.yaml @@ -16,7 +16,7 @@ spec: containers: - name: icndb-app-operator # Replace this with the built image name - image: nikhilvep/icndb-app-operator:version-2.0 + image: nikhilvep/icndb-app-operator:version-exp command: - icndb-app-operator imagePullPolicy: Always diff --git a/manifests/version-exp/icndb-app-operator/icndb-app-operator.package.yaml b/manifests/version-exp/icndb-app-operator/icndb-app-operator.package.yaml new file mode 100644 index 0000000..2b16f6c --- /dev/null +++ b/manifests/version-exp/icndb-app-operator/icndb-app-operator.package.yaml @@ -0,0 +1,7 @@ +channels: +- currentCSV: icndb-app-operator.v2.0.0 + name: alpha +- currentCSV: icndb-app-operator.v2.0.0-exp + name: experimental +defaultChannel: alpha +packageName: icndb-app-operator diff --git a/manifests/version-exp/icndb-app-operator/icndb-app-operator.v1.0.0.clusterserviceversion-v1.0.0.yaml b/manifests/version-exp/icndb-app-operator/icndb-app-operator.v1.0.0.clusterserviceversion-v1.0.0.yaml new file mode 100644 index 0000000..3ef9a71 --- /dev/null +++ b/manifests/version-exp/icndb-app-operator/icndb-app-operator.v1.0.0.clusterserviceversion-v1.0.0.yaml @@ -0,0 +1,129 @@ +apiVersion: operators.coreos.com/v1alpha1 +kind: ClusterServiceVersion +metadata: + annotations: + alm-examples: '[{"apiVersion":"icndbfun.dev/v1alpha1","kind":"FunApp","metadata":{"name":"devopsday-funapp"},"spec":{"funpods":4}}]' + capabilities: Basic Install + name: icndb-app-operator.v1.0.0 + namespace: placeholder +spec: + apiservicedefinitions: {} + customresourcedefinitions: + owned: + - kind: FunApp + name: funapps.icndbfun.dev + version: v1alpha1 + displayName: FunApp CRD + description: Create an instance of FUnApp CRD to launch FunApp in this namespace + description: Icndb App Operator manages the lifecycle of ICNDB App https://github.com/nikhil-thomas/icndp-app + displayName: Icndb App Operator + install: + spec: + clusterPermissions: + - rules: + - apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - events + - configmaps + - secrets + verbs: + - '*' + - apiGroups: + - apps + resources: + - deployments + - daemonsets + - replicasets + - statefulsets + verbs: + - '*' + - apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - get + - create + - apiGroups: + - apps + resourceNames: + - icndb-app-operator + resources: + - deployments/finalizers + verbs: + - update + - apiGroups: + - "" + resources: + - pods + verbs: + - get + - apiGroups: + - apps + resources: + - replicasets + verbs: + - get + - apiGroups: + - icndbfun.dev + resources: + - '*' + verbs: + - '*' + serviceAccountName: icndb-app-operator + deployments: + - name: icndb-app-operator + spec: + replicas: 1 + selector: + matchLabels: + name: icndb-app-operator + strategy: {} + template: + metadata: + labels: + name: icndb-app-operator + spec: + containers: + - command: + - icndb-app-operator + env: + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.annotations['olm.targetNamespaces'] + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: icndb-app-operator + image: nikhilvep/icndb-app-operator:version-1.0 + imagePullPolicy: Always + name: icndb-app-operator + resources: {} + serviceAccountName: icndb-app-operator + strategy: deployment + installModes: + - supported: true + type: OwnNamespace + - supported: false + type: SingleNamespace + - supported: true + type: MultiNamespace + - supported: true + type: AllNamespaces + maturity: alpha + provider: + name: Nikhil Thomas + maintainers: + - email: nikhilthomas1@gmail.com + name: Nikhil Thomas + keywords: + - olm-example + version: 1.0.0 diff --git a/manifests/version-exp/icndb-app-operator/icndb-app-operator.v2.0.0-exp.clusterserviceversion.yaml b/manifests/version-exp/icndb-app-operator/icndb-app-operator.v2.0.0-exp.clusterserviceversion.yaml new file mode 100644 index 0000000..798c31d --- /dev/null +++ b/manifests/version-exp/icndb-app-operator/icndb-app-operator.v2.0.0-exp.clusterserviceversion.yaml @@ -0,0 +1,132 @@ +apiVersion: operators.coreos.com/v1alpha1 +kind: ClusterServiceVersion +metadata: + annotations: + alm-examples: '[{"apiVersion":"icndbfun.dev/v1alpha1","kind":"FunApp","metadata":{"name":"devopsday-funapp"},"spec":{"funpods":4,"params":[{"key":"Name","value":"Superstar + Rajnikanth"},{"key":"Name","value":"Chuck Norris"},{"key":"Name","value":"John + Abraham"}]}}]' + capabilities: Basic Install + name: icndb-app-operator.v2.0.0-exp + namespace: placeholder +spec: + apiservicedefinitions: {} + customresourcedefinitions: + owned: + - description: Create an instance of FUnApp CRD to launch FunApp in this namespace + displayName: FunApp CRD + kind: FunApp + name: funapps.icndbfun.dev + version: v1alpha1 + description: Icndb App Operator manages the lifecycle of ICNDB App https://github.com/nikhil-thomas/icndp-app + displayName: Icndb App Operator + install: + spec: + clusterPermissions: + - rules: + - apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - events + - configmaps + - secrets + verbs: + - '*' + - apiGroups: + - apps + resources: + - deployments + - daemonsets + - replicasets + - statefulsets + verbs: + - '*' + - apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - get + - create + - apiGroups: + - apps + resourceNames: + - icndb-app-operator + resources: + - deployments/finalizers + verbs: + - update + - apiGroups: + - "" + resources: + - pods + verbs: + - get + - apiGroups: + - apps + resources: + - replicasets + verbs: + - get + - apiGroups: + - icndbfun.dev + resources: + - '*' + verbs: + - '*' + serviceAccountName: icndb-app-operator + deployments: + - name: icndb-app-operator + spec: + replicas: 1 + selector: + matchLabels: + name: icndb-app-operator + strategy: {} + template: + metadata: + labels: + name: icndb-app-operator + spec: + containers: + - command: + - icndb-app-operator + env: + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.annotations['olm.targetNamespaces'] + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: icndb-app-operator + image: nikhilvep/icndb-app-operator:version-exp + imagePullPolicy: Always + name: icndb-app-operator + resources: {} + serviceAccountName: icndb-app-operator + strategy: deployment + installModes: + - supported: true + type: OwnNamespace + - supported: false + type: SingleNamespace + - supported: true + type: MultiNamespace + - supported: true + type: AllNamespaces + keywords: + - olm-example + maintainers: + - email: nikhilthomas1@gmail.com + name: Nikhil Thomas + maturity: alpha + provider: + name: Nikhil Thomas + replaces: icndb-app-operator.v2.0.0 + version: 2.0.0-exp diff --git a/manifests/version-exp/icndb-app-operator/icndb-app-operator.v2.0.0.clusterserviceversion.yaml b/manifests/version-exp/icndb-app-operator/icndb-app-operator.v2.0.0.clusterserviceversion.yaml new file mode 100644 index 0000000..27afd83 --- /dev/null +++ b/manifests/version-exp/icndb-app-operator/icndb-app-operator.v2.0.0.clusterserviceversion.yaml @@ -0,0 +1,131 @@ +apiVersion: operators.coreos.com/v1alpha1 +kind: ClusterServiceVersion +metadata: + annotations: + alm-examples: '[{"apiVersion":"icndbfun.dev/v1alpha1","kind":"FunApp","metadata":{"name":"devopsday-funapp"},"spec":{"funpods":4,"params":[{"key":"Name","value":"Superstar + Rajnikanth"}]}}]' + capabilities: Basic Install + name: icndb-app-operator.v2.0.0 + namespace: placeholder +spec: + apiservicedefinitions: {} + customresourcedefinitions: + owned: + - description: Create an instance of FUnApp CRD to launch FunApp in this namespace + displayName: FunApp CRD + kind: FunApp + name: funapps.icndbfun.dev + version: v1alpha1 + description: Icndb App Operator manages the lifecycle of ICNDB App https://github.com/nikhil-thomas/icndp-app + displayName: Icndb App Operator + install: + spec: + clusterPermissions: + - rules: + - apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - events + - configmaps + - secrets + verbs: + - '*' + - apiGroups: + - apps + resources: + - deployments + - daemonsets + - replicasets + - statefulsets + verbs: + - '*' + - apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - get + - create + - apiGroups: + - apps + resourceNames: + - icndb-app-operator + resources: + - deployments/finalizers + verbs: + - update + - apiGroups: + - "" + resources: + - pods + verbs: + - get + - apiGroups: + - apps + resources: + - replicasets + verbs: + - get + - apiGroups: + - icndbfun.dev + resources: + - '*' + verbs: + - '*' + serviceAccountName: icndb-app-operator + deployments: + - name: icndb-app-operator + spec: + replicas: 1 + selector: + matchLabels: + name: icndb-app-operator + strategy: {} + template: + metadata: + labels: + name: icndb-app-operator + spec: + containers: + - command: + - icndb-app-operator + env: + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.annotations['olm.targetNamespaces'] + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: icndb-app-operator + image: nikhilvep/icndb-app-operator:version-2.0 + imagePullPolicy: Always + name: icndb-app-operator + resources: {} + serviceAccountName: icndb-app-operator + strategy: deployment + installModes: + - supported: true + type: OwnNamespace + - supported: false + type: SingleNamespace + - supported: true + type: MultiNamespace + - supported: true + type: AllNamespaces + keywords: + - olm-example + maintainers: + - email: nikhilthomas1@gmail.com + name: Nikhil Thomas + maturity: alpha + provider: + name: Nikhil Thomas + replaces: icndb-app-operator.v1.0.0 + version: 2.0.0 diff --git a/manifests/version-exp/icndb-app-operator/icndbfun_v1alpha1_funapp_crd.yaml b/manifests/version-exp/icndb-app-operator/icndbfun_v1alpha1_funapp_crd.yaml new file mode 100644 index 0000000..03f302e --- /dev/null +++ b/manifests/version-exp/icndb-app-operator/icndbfun_v1alpha1_funapp_crd.yaml @@ -0,0 +1,66 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: funapps.icndbfun.dev +spec: + group: icndbfun.dev + names: + kind: FunApp + listKind: FunAppList + plural: funapps + singular: funapp + scope: Namespaced + subresources: + status: {} + validation: + openAPIV3Schema: + 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/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/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + funpods: + description: Funpods specify number of replicas in the deployment created + format: int32 + type: integer + params: + description: Params specify additional configuration if required + items: + properties: + key: + type: string + value: + type: string + required: + - key + - value + type: object + type: array + required: + - funpods + type: object + status: + properties: + podnames: + description: Podnames list all the pods created for FunApp + items: + type: string + type: array + required: + - podnames + type: object + version: v1alpha1 + versions: + - name: v1alpha1 + served: true + storage: true diff --git a/manifests/version-exp/operator-source.yaml b/manifests/version-exp/operator-source.yaml new file mode 100644 index 0000000..298ea1b --- /dev/null +++ b/manifests/version-exp/operator-source.yaml @@ -0,0 +1,12 @@ +apiVersion: operators.coreos.com/v1 +kind: OperatorSource +metadata: + name: nikhil-thomas-operators + namespace: marketplace +spec: + type: appregistry + endpoint: https://quay.io/cnr + registryNamespace: nikhil_thomas + displayName: "Nikhil's Operators" + publisher: "Nikhil Thomas" + diff --git a/manifests/version-exp/os-operator-source.yaml b/manifests/version-exp/os-operator-source.yaml new file mode 100644 index 0000000..b3cdd3f --- /dev/null +++ b/manifests/version-exp/os-operator-source.yaml @@ -0,0 +1,12 @@ +apiVersion: operators.coreos.com/v1 +kind: OperatorSource +metadata: + name: nikhil-thomas-operators + namespace: openshift-marketplace +spec: + type: appregistry + endpoint: https://quay.io/cnr + registryNamespace: nikhil_thomas + displayName: "Nikhil's Operators" + publisher: "Nikhil Thomas" + diff --git a/pkg/controller/funapp/funapp_controller.go b/pkg/controller/funapp/funapp_controller.go index dfc7ba8..eb52bce 100644 --- a/pkg/controller/funapp/funapp_controller.go +++ b/pkg/controller/funapp/funapp_controller.go @@ -198,14 +198,17 @@ func (r *ReconcileFunApp) deploymentForFunApp(fa *icndbfunv1alpha1.FunApp) *apps ls := labelsForFunApp(fa.Name) replicas := fa.Spec.Funpods - args := []string{} + names := "" for _, param := range fa.Spec.Params { if strings.EqualFold(param.Key, "Name") { - args = append(args, "--name") - args = append(args, param.Value) - break + if names != "" { + names += "," + } + names += param.Value + } } + args := []string{"--names", names} reqLogger.Info("::::::::::::::::", "ards:", args ) @@ -225,7 +228,7 @@ func (r *ReconcileFunApp) deploymentForFunApp(fa *icndbfunv1alpha1.FunApp) *apps }, Spec: corev1.PodSpec{ Containers: []corev1.Container{{ - Image: "nikhilvep/icndb-app:version-2.0", + Image: "nikhilvep/icndb-app:version-exp", Name: "icndb-server", Args: args, Ports: []corev1.ContainerPort{{