diff --git a/Makefile b/Makefile index f4f2093a0..35574a53d 100644 --- a/Makefile +++ b/Makefile @@ -40,9 +40,14 @@ else IMAGESUFFIX := :dev endif +ifeq ($(MANIFESTSUFFIX),-) + # Release setting + MANIFESTSUFFIX := +else ifndef MANIFESTSUFFIX MANIFESTSUFFIX := -dev endif +endif MANIFESTPATHDEPLOYMENT := manifests/arango-deployment$(MANIFESTSUFFIX).yaml MANIFESTPATHSTORAGE := manifests/arango-storage$(MANIFESTSUFFIX).yaml ifndef DEPLOYMENTNAMESPACE diff --git a/manifests/arango-deployment.yaml b/manifests/arango-deployment.yaml new file mode 100644 index 000000000..06b815f7b --- /dev/null +++ b/manifests/arango-deployment.yaml @@ -0,0 +1,103 @@ +## deployment/rbac.yaml +## Cluster role granting access to ArangoDeployment resources. +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: arango-deployments +rules: +- apiGroups: ["database.arangodb.com"] + resources: ["arangodeployments"] + verbs: ["*"] + +--- + +## Cluster role granting access to all resources needed by the ArangoDeployment operator. +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: arango-deployment-operator +rules: +- apiGroups: ["database.arangodb.com"] + resources: ["arangodeployments"] + verbs: ["*"] +- apiGroups: ["apiextensions.k8s.io"] + resources: ["customresourcedefinitions"] + verbs: ["get"] +- apiGroups: [""] + resources: ["pods", "services", "endpoints", "persistentvolumeclaims", "events", "secrets"] + verbs: ["*"] +- apiGroups: ["apps"] + resources: ["deployments"] + verbs: ["*"] +- apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list"] + +--- + +## Bind the cluster role granting access to ArangoLocalStorage resources +## to the default service account of the configured namespace. +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: RoleBinding +metadata: + name: arango-deployments + namespace: default +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: arango-deployments +subjects: +- kind: ServiceAccount + name: default + namespace: default + +--- + +## Bind the cluster role granting access to all resources needed by +## the ArangoDeployment operator to the default service account +## the is being used to run the operator deployment. +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: arango-deployment-operator-default +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: arango-deployment-operator +subjects: +- kind: ServiceAccount + name: default + namespace: default + +--- + +## deployment/deployment.yaml + +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: arango-deployment-operator + namespace: default +spec: + replicas: 1 + template: + metadata: + labels: + name: arango-deployment-operator + spec: + containers: + - name: operator + imagePullPolicy: IfNotPresent + image: arangodb/kube-arangodb@sha256:748421ba01fd52d9589cc1830c79b62c3a7af3f4366b9cba0247e09d0a7d6e19 + args: + - --operator.deployment + env: + - name: MY_POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: MY_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + diff --git a/manifests/arango-storage.yaml b/manifests/arango-storage.yaml new file mode 100644 index 000000000..8b5f7158a --- /dev/null +++ b/manifests/arango-storage.yaml @@ -0,0 +1,115 @@ +## storage/rbac.yaml +## Cluster role granting access to ArangoLocalStorage resources. +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: arango-storages +rules: +- apiGroups: ["storage.arangodb.com"] + resources: ["arangolocalstorages"] + verbs: ["*"] + +--- + +## Cluster role granting access to all resources needed by the ArangoLocalStorage operator. +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: arango-storage-operator +rules: +- apiGroups: ["storage.arangodb.com"] + resources: ["arangolocalstorages"] + verbs: ["*"] +- apiGroups: ["apiextensions.k8s.io"] + resources: ["customresourcedefinitions"] + verbs: ["get"] +- apiGroups: [""] + resources: ["persistentvolumes", "persistentvolumeclaims", "endpoints", "events", "services"] + verbs: ["*"] +- apiGroups: [""] + resources: ["pods"] + verbs: ["get"] +- apiGroups: ["apps"] + resources: ["daemonsets"] + verbs: ["*"] +- apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["*"] + +--- + +## Bind the cluster role granting access to ArangoLocalStorage resources +## to the default service account of the configured namespace. +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: RoleBinding +metadata: + name: arango-storages + namespace: default +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: arango-storages +subjects: +- kind: ServiceAccount + name: default + namespace: default + +--- + +## Bind the cluster role granting access to all resources needed by +## the ArangoLocalStorage operator to the default service account +## the is being used to run the operator deployment. +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: arango-storage-operator +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: arango-storage-operator +subjects: +- kind: ServiceAccount + name: arango-storage-operator + namespace: kube-system + +--- + +## storage/deployment.yaml +## Service accounts +apiVersion: v1 +kind: ServiceAccount +metadata: + namespace: kube-system + name: arango-storage-operator + +--- + +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: arango-storage-operator + namespace: kube-system +spec: + replicas: 1 + template: + metadata: + labels: + name: arango-storage-operator + spec: + serviceAccountName: arango-storage-operator + containers: + - name: operator + imagePullPolicy: IfNotPresent + image: arangodb/kube-arangodb@sha256:748421ba01fd52d9589cc1830c79b62c3a7af3f4366b9cba0247e09d0a7d6e19 + args: + - --operator.storage + env: + - name: MY_POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: MY_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + diff --git a/tools/release/release.go b/tools/release/release.go index 76ff013fb..e51b4b484 100644 --- a/tools/release/release.go +++ b/tools/release/release.go @@ -47,7 +47,7 @@ func init() { flag.StringVar(&versionFile, "versionfile", "./VERSION", "Path of the VERSION file") flag.StringVar(&releaseType, "type", "patch", "Type of release to build (major|minor|patch)") flag.StringVar(&ghRelease, "github-release", ".gobuild/bin/github-release", "Full path of github-release tool") - flag.StringVar(&ghUser, "github-user", "arangodbdb", "Github account name to create release in") + flag.StringVar(&ghUser, "github-user", "arangodb", "Github account name to create release in") flag.StringVar(&ghRepo, "github-repo", "kube-arangodb", "Github repository name to create release in") } @@ -60,7 +60,7 @@ func main() { make("all", map[string]string{ "DOCKERNAMESPACE": "arangodb", "IMAGETAG": version, - "MANIFESTPATH": "manifests/arango-operator.yaml", + "MANIFESTSUFFIX": "-", }) make("build-ghrelease", nil) gitCommitAll(fmt.Sprintf("Updated manifest to %s", version)) // Commit manifest