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

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

Merged
merged 2 commits into from
May 4, 2018

Conversation

fanminshi
Copy link
Contributor

fixes #76

cc/ @hasbro17 @spahl

@fanminshi
Copy link
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


// renderCRDYaml generates deploy/crd.yaml
func renderCRDYaml(w io.Writer, kind, apiVersion string) error {
t := template.New(crTmplName)
Copy link
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
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.

@hasbro17
Copy link
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