Skip to content

Commit

Permalink
Change labels to new format based on issue #2
Browse files Browse the repository at this point in the history
  • Loading branch information
etsauer committed Jun 9, 2020
1 parent 70e081e commit 711338f
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 67 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The purpose of these examples is twofold:
The simple cluster bootstrapping example shows how cluster administrators might begin managing OpenShift clusters using just `oc apply`. Each resource in this example carries a common label (`example.com/project: simple-bootstrap`) that associates it with this `project`. In doing this, we can manage the full lifecycle of our resources with a single command.

```
until oc apply -Rf simple-bootstrap/ --prune -l example.com/project=simple-bootstrap; do sleep 2; done
until oc apply -Rf simple-bootstrap/ --prune -l config.example.com/name=simple-bootstrap; do sleep 2; done
```

Explanation of the command is below.
Expand Down Expand Up @@ -52,7 +52,7 @@ Now, let's remove a namespace and re-run the same command:
```
$ rm simple-bootstrap/0-namespaces/deleteable.yaml
$ oc apply -Rf simple-bootstrap/ --prune -l example.com/project=simple-bootstrap
$ oc apply -Rf simple-bootstrap/ --prune -l config.example.com/name=simple-bootstrap
namespace/namespace-operator configured
operatorgroup.operators.coreos.com/namespace-operator unchanged
subscription.operators.coreos.com/namespace-configuration-operator unchanged
Expand All @@ -66,7 +66,7 @@ We can see that by deleting the file, the resource gets deleted.
In order to be able to handle pruning of custom resources, we have to customize the set of resource types that we are searching for with our label. To do this, we pass the `--prune-whitelist` flag. In order to simplify this, we've written the set of flags that we're handling to a file that we add to the command.

```
$ oc apply -Rf simple-bootstrap/ --prune -l example.com/project=simple-bootstrap $(cat prune-whitelist.txt)
$ oc apply -Rf simple-bootstrap/ --prune -l config.example.com/name=simple-bootstrap $(cat prune-whitelist.txt)
namespace/deleteable configured
namespace/namespace-operator configured
operatorgroup.operators.coreos.com/namespace-operator unchanged
Expand All @@ -88,7 +88,7 @@ Error from server (NotFound): error when creating "simple-bootstrap/3-operator-c
The simplest way to handle this is with a simple retry loop.

```
$ until oc apply -Rf simple-bootstrap/ --prune -l example.com/project=simple-bootstrap $(cat prune-whitelist.txt); do sleep 2; done
$ until oc apply -Rf simple-bootstrap/ --prune -l config.example.com/name=simple-bootstrap $(cat prune-whitelist.txt); do sleep 2; done
namespace/deleteable configured
namespace/namespace-operator configured
operatorgroup.operators.coreos.com/namespace-operator unchanged
Expand Down
8 changes: 4 additions & 4 deletions argocd-bootstrap/0-namespaces/argocd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ apiVersion: v1
kind: Namespace
metadata:
annotations:
example.com/managed-by: gitops
example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
config.example.com/managed-by: gitops
config.example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
labels:
example.com/project: argocd-bootstrap
example.com/component: namespaces
config.example.com/name: argocd-bootstrap
config.example.com/component: namespaces
name: argocd
spec:
16 changes: 8 additions & 8 deletions argocd-bootstrap/1-operators/argocd-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
annotations:
example.com/managed-by: gitops
example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
config.example.com/managed-by: gitops
config.example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
labels:
example.com/project: argocd-bootstrap
example.com/component: operators
config.example.com/name: argocd-bootstrap
config.example.com/component: operators
name: argocd-operator
namespace: argocd
spec:
Expand All @@ -18,11 +18,11 @@ apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
annotations:
example.com/managed-by: gitops
example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
config.example.com/managed-by: gitops
config.example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
labels:
example.com/project: argocd-bootstrap
example.com/component: operators
config.example.com/name: argocd-bootstrap
config.example.com/component: operators
name: argocd-operator
namespace: argocd
spec:
Expand Down
8 changes: 4 additions & 4 deletions argocd-bootstrap/3-argocd/argocd-basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ apiVersion: argoproj.io/v1alpha1
kind: ArgoCD
metadata:
annotations:
example.com/managed-by: gitops
example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
config.example.com/managed-by: gitops
config.example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
labels:
example: basic
example.com/component: operators
example.com/project: argocd-bootstrap
config.example.com/component: operators
config.example.com/name: argocd-bootstrap
name: example-argocd
namespace: argocd
spec: {}
14 changes: 7 additions & 7 deletions argocd-bootstrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ This directory contains the manifests required to install the [Argo CD operator]
The argo-cd cluster bootstrapping example shows how cluster administrators might begin deploying the argo-cd operator `oc apply`. Each resource in this example carries a common label (`example.com/project: argocd-bootstrap`) that associates it with this `project`. In doing this, we can manage the full lifecycle of our resources with a single command.

```
oc apply -Rf ../argocd-bootstrap/ --prune -l example.com/project=argocd-bootstrap
oc apply -Rf ../argocd-bootstrap/ --prune -l config.example.com/name=argocd-bootstrap
```

The `apply` command idempotently ensures that the live configuration is in sync with our configuration files, while the `--prune` flag allows us to also manage the deletion of live objects by simply deleting the associated file in this repository.

As an example, let's bootstrap our cluster for the first time:

```
$ oc apply -Rf ../argocd-bootstrap/ --prune -l example.com/project=argocd-bootstrap
$ oc apply -Rf ../argocd-bootstrap/ --prune -l config.example.com/name=argocd-bootstrap
namespace/argocd configured
operatorgroup.operators.coreos.com/argocd-operator created
subscription.operators.coreos.com/argocd-operator created
Expand Down Expand Up @@ -69,19 +69,19 @@ apiVersion: argoproj.io/v1alpha1
kind: ArgoCD
metadata:
annotations:
example.com/managed-by: gitops
example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
config.example.com/managed-by: gitops
config.example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
labels:
example: basic
example.com/component: operators
example.com/project: argocd-bootstrap
config.example.com/component: operators
config.example.com/name: argocd-bootstrap
name: example-argocd
spec:
server:
route: true
$ oc apply -Rf simple-bootstrap/ --prune -l example.com/project=simple-bootstrap
$ oc apply -Rf simple-bootstrap/ --prune -l config.example.com/name=simple-bootstrap
namespace/argocd configured
operatorgroup.operators.coreos.com/argocd-operator unchanged
subscription.operators.coreos.com/argocd-operator unchanged
Expand Down
8 changes: 4 additions & 4 deletions simple-bootstrap/0-namespaces/cluster-ops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ apiVersion: v1
kind: Namespace
metadata:
annotations:
example.com/managed-by: gitops
example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
config.example.com/managed-by: gitops
config.example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
labels:
example.com/project: simple-bootstrap
example.com/component: namespaces
config.example.com/name: simple-bootstrap
config.example.com/component: namespaces
name: cluster-ops
spec:
8 changes: 4 additions & 4 deletions simple-bootstrap/0-namespaces/deleteable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ apiVersion: v1
kind: Namespace
metadata:
annotations:
example.com/managed-by: gitops
example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
config.example.com/managed-by: gitops
config.example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
labels:
example.com/project: simple-bootstrap
example.com/component: namespaces
config.example.com/name: simple-bootstrap
config.example.com/component: namespaces
name: deleteable
spec:
8 changes: 4 additions & 4 deletions simple-bootstrap/0-namespaces/namespace-config-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ apiVersion: v1
kind: Namespace
metadata:
annotations:
example.com/managed-by: gitops
example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
config.example.com/managed-by: gitops
config.example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
labels:
example.com/project: simple-bootstrap
example.com/component: namespaces
config.example.com/name: simple-bootstrap
config.example.com/component: namespaces
name: namespace-operator
spec:
16 changes: 8 additions & 8 deletions simple-bootstrap/1-operators/namespace-config-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
annotations:
example.com/managed-by: gitops
example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
config.example.com/managed-by: gitops
config.example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
labels:
example.com/project: simple-bootstrap
example.com/component: operators
config.example.com/name: simple-bootstrap
config.example.com/component: operators
name: namespace-operator
namespace: namespace-operator
spec:
Expand All @@ -18,11 +18,11 @@ apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
annotations:
example.com/managed-by: gitops
example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
config.example.com/managed-by: gitops
config.example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
labels:
example.com/project: simple-bootstrap
example.com/component: operators
config.example.com/name: simple-bootstrap
config.example.com/component: operators
name: namespace-configuration-operator
namespace: namespace-operator
spec:
Expand Down
8 changes: 4 additions & 4 deletions simple-bootstrap/2-rbac/cluster-admins-rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
example.com/managed-by: gitops
example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
config.example.com/managed-by: gitops
config.example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
labels:
example.com/project: simple-bootstrap
example.com/component: rbac
config.example.com/name: simple-bootstrap
config.example.com/component: rbac
name: cluster-administrators
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
24 changes: 12 additions & 12 deletions simple-bootstrap/3-operator-configs/gitops-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apiVersion: batch/v1beta1
kind: CronJob
metadata:
annotations:
example.com/managed-by: gitops
example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
config.example.com/managed-by: gitops
config.example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
labels:
example.com/project: simple-bootstrap
example.com/component: configs
config.example.com/name: simple-bootstrap
config.example.com/component: configs
name: cronjob-gitops
namespace: cluster-ops
spec:
Expand Down Expand Up @@ -66,11 +66,11 @@ apiVersion: authorization.openshift.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
example.com/managed-by: gitops
example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
config.example.com/managed-by: gitops
config.example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
labels:
example.com/project: simple-bootstrap
example.com/component: configs
config.example.com/name: simple-bootstrap
config.example.com/component: configs
name: system:project-pruners
roleRef:
name: cluster-admin
Expand All @@ -85,10 +85,10 @@ apiVersion: v1
kind: ServiceAccount
metadata:
annotations:
example.com/managed-by: gitops
example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
config.example.com/managed-by: gitops
config.example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
labels:
example.com/project: simple-bootstrap
example.com/component: configs
config.example.com/name: simple-bootstrap
config.example.com/component: configs
name: gitops
namespace: cluster-ops
8 changes: 4 additions & 4 deletions simple-bootstrap/3-operator-configs/sandbox-userconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apiVersion: redhatcop.redhat.io/v1alpha1
kind: UserConfig
metadata:
annotations:
example.com/managed-by: gitops
example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
config.example.com/managed-by: gitops
config.example.com/scm-url: git@github.com:redhat-cop/declarative-openshift.git
labels:
example.com/project: simple-bootstrap
example.com/component: operator-configs
config.example.com/name: simple-bootstrap
config.example.com/component: operator-configs
name: sandboxes
spec:
provider: corp-ldap
Expand Down

0 comments on commit 711338f

Please sign in to comment.