Skip to content

*: move crd definition out of operator.yaml into crd.yaml#223

Merged
fanminshi merged 2 commits intooperator-framework:masterfrom
fanminshi:split_operator_yaml
May 4, 2018
Merged

*: move crd definition out of operator.yaml into crd.yaml#223
fanminshi merged 2 commits intooperator-framework:masterfrom
fanminshi:split_operator_yaml

Conversation

@fanminshi
Copy link
Copy Markdown
Contributor

fixes #76

cc/ @hasbro17 @spahl

@fanminshi
Copy link
Copy Markdown
Contributor Author

Manual Test:

$ operator-sdk new app-operator --api-version=app.example.com/v1alpha1 --kind=App
$ cd  app-operator

$ cat deploy/crd.yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: apps.app.example.com
spec:
  group: app.example.com
  names:
    kind: App
    listKind: AppList
    plural: apps
    singular: app
  scope: Namespaced
  version: v1alpha1

$ cat deploy/operator.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: app-operator
spec:
  replicas: 1
  selector:
    matchLabels:
      name: app-operator
  template:
    metadata:
      labels:
        name: app-operator
    spec:
      containers:
        - name: app-operator
          image: quay.io/fanminshi/example:app-operator
          command:
          - app-operator
          imagePullPolicy: Always

$ kubectl create -f deploy/rbac.yaml
role "app-operator" created
$ kubectl create -f deploy/crd.yaml
customresourcedefinition "apps.app.example.com" created

$ operator-sdk build quay.io/fanminshi/example:app-operator
$ docker push quay.io/fanminshi/example:app-operator
The push refers to a repository [quay.io/fanminshi/example]

$ kubectl create -f deploy/operator.yaml
deployment "app-operator" created
$ kubectl create -f deploy/cr.yaml
app "example" created

$ kubectl get po
NAME                            READY     STATUS    RESTARTS   AGE
app-operator-867fb9f787-bh8nf   1/1       Running   0          8m
busy-box                        1/1       Running   0          7m

Comment thread pkg/generator/gen_deploy.go Outdated

// renderCRDYaml generates deploy/crd.yaml
func renderCRDYaml(w io.Writer, kind, apiVersion string) error {
t := template.New(crTmplName)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I know the template name doesn't actually matter but this should be crdTmplName.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@hasbro17 yeah, the name doens't matter. just for formality i guess. good catch on this one.

@fanminshi fanminshi force-pushed the split_operator_yaml branch from d1b68aa to aa96f4f Compare May 3, 2018 18:10
@hasbro17
Copy link
Copy Markdown
Contributor

hasbro17 commented May 4, 2018

LGTM

@fanminshi fanminshi merged commit c989c2b into operator-framework:master May 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep deployment and CRD manifests separate

2 participants