GithubHelp home page GithubHelp logo

redhat-cop / declarative-openshift Goto Github PK

View Code? Open in Web Editor NEW
24.0 18.0 15.0 74 KB

Working examples of manifests for openshift for use in a declarative management strategy.

Smarty 100.00%
container-cop gitops openshift

declarative-openshift's Introduction

Declarative OpenShift

Looking for old stuff?

Are you looking for older content that used to exist here? If so, please check out the v1.0.0 release.

Overview

This repository contains sets of example resources to be used with a declarative management strategy. Please familiarize yourself with the terminology in that document before reading on.

Kubernetes Cluster API

Starting with the 2.x version of this repositry, the focus is on using Cluster API paired with a varity of tools to support the full declarative approach for OpenShift Cluster provisioning / bootstrapping, upgrades and multi-cluster & multi-account management.

CAPA - Cluster API Provider AWS

For managing clusters hosted on AWS, including Red Hat OpenShift on AWS (ROSA), we utilize CAPA as it nicely integrates and works together with CAPI.

OpenShift GitOps - ArgoCD

Red Hat OpenShift GitOps may now play a role in the entire lifecycle of a cluster, and the entire deployment. Not only can be it be used to manage the content of an operational OpenShift cluster, but it can also be used as part of a management cluster setup to manage the targeted clusters mananged with CAPI.

ClusterResourceSet

As part of bootstrapping a new environment, there is a need to inject new content to allow for connectivity and initial setups for connecting tooling to talk to the cluster. This can be achieved in multiple ways - including running OpenShift GitOps in the cluster for a full content management, or using ClusterResourceSet to manage a minimal set of content in the even that an external content management system is used (e.g.: running OpenShift GitOps at a centralized management cluster).

Managing OpenShift Clusters

Prerequisites

Before applying any of the manifests to create a new cluster(s), the following prerequisites need to be met:

NOTE: Steps 1-3 from above will soon be replaced with declarative content within this repo. More to come on this soon...

Management Cluster

In order to deploy a new OpenShift Cluster using CAPI, you will need a management cluster with the necessary CAPI and CAPA deployments in an operational state.

To get started, install the following tools on your local machine:

Run the following commands to prepare the environment and management cluster:

  export KUBECONFIG=...
  export AWS_REGION=...
  export AWS_ACCESS_KEY_ID=...
  export AWS_SECRET_ACCESS_KEY=...
  export AWS_SESSION_TOKEN=... # (optional)
  export AWS_B64ENCODED_CREDENTIALS=$(clusterawsadm bootstrap credentials encode-as-profile)
  export EXP_ROSA="true"
  export EXP_MACHINE_POOL="true"
  clusterctl init --infrastructure aws

Apply customizations provided by this repo:

Optional: This step is needed if your mangement cluster is an OpenShift Cluster

  helm template --release-name rosa-hcp charts/openshift-management | oc apply -f -

Make sure the CAPI pods are operational before running the next apply.
This can be done by checking the output of the following commands:

  oc get pods -n capi-system
  oc get pods -n capa-system
  oc get pods -n capi-kubeadm-bootstrap-system
  oc get pods -n capi-kubeadm-control-plane-system

Apply CAPI specific configurations needed to support the upcoming workloads:

  helm template charts/capi-management | oc apply -f -

Run the following command to validate that everything is set up correctly, and ready for your first ROSA HCP cluster deployment with CAPI (all commands should return output containing the values in the grep part of the command):

  oc get crd | grep rosa
  oc get deployment -n capa-system capa-controller-manager -o yaml | grep ROSA=true
  oc get deploy capi-controller-manager -n capi-system -o yaml | grep MachinePool=true

Quickstart - Simple CAPI / CAPA

Install

With the above steps from the Management Cluster done, it is now time to deploy the first (workload) cluster. For this first simple quickstart, that is done in two steps:

  1. Tweak the values in charts/rosa-capi/values.yaml
  2. run helm template --release-name rosa-hcp --set ocmToken=jSDFsdfsdfSDF charts/rosa-capi | oc apply -f -

NOTE: Replace the rosa-hcp release name and OCM Token above with your own values - alternatively set your OCM Token in the values file. The OCM Token can be fetched from https://console.redhat.com/openshift/token/rosa.

Validation steps

Check the status of the the ROSAControlPlane deployment:

  oc get rosacontrolplane <name-of-cluster>

Once the cluster shows state "READY" as "true", the cluster is available to access. Extract the kubeconfig and use it access the cluster:

  oc get secrets <cluste-rname>-kubeconfig -o jsonpath='{.data.value}' | base64 -d > /tmp/rosa-capi.kubeconfig
  export KUBECONFIG=/tmp/rosa-capi.kubeconfig
  oc get nodes

Troubleshooting

coming soon...

declarative-openshift's People

Contributors

alyibrahim avatar etsauer avatar fwcoder avatar hornjason avatar jhorn-redhat avatar jkupferer avatar nickjordan avatar oybed avatar sabre1041 avatar senthilredhat avatar truncj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

declarative-openshift's Issues

Ability to generate a valid prune-whitelist for existing cluster & bootstrap repo.

In order to use oc apply --prune with an OpenShift cluster, we need to extend the set of APIs that the --prune flag will act on. By default it is a static set of Kubernetes core apis. Right now we are handling this statically in a text file in the repo, but it would be better to generate a list of <Group/Version/Kind>s based on the cluster we are targetting and the set of resources we are managing.

Create, Manage, and Link secrets

Creating secrets should be fairly straightforward, but we don't have many examples of declaratively defining links from secrets to serviceaccounts. The classic example is creating a source secret and linking it to a builder serviceaccount.

Namespace management for CAPI

Build a structure around how namespaces are managed in CAPI Cluster creation. Currently, the namespace is set to default.

Deploy and Configure Logging Stack

This should include a custom config of Fluentd. In order to keep this self-contained, the suggested customization would be to stand up a second ES instance for audit logs, and configure the Fluentd stack to send audit logs there instead of to the primary ES instance

Document how to handle CRD/CR race condition

There is a race condition frequently created when deploying operators via OLM, where attempting to create the OperatorGroup and Subscription in the same oc apply command where the CR for that operator is also created, then the CRD for the operator hasn't yet been created. Since we don't directly create the CRD, we need to insert a conditional wait to ensure that the CRD exists before moving on.

It would also be nice if we could automate the detection of the CRDs we are waiting on, so we don't have to hardcode them in the workflow.

Manage Operators (through OperatorHub)

We need an example of an deploying an operator and configuring its CRs to "make it do something". We'll need to handle the race condition where we can't try to apply the CR before the CRD has been created by OLM. We should be able to use the status of the Subscription or an annotation on the Subscription to check that.

Manage Namespaces

several things to address here:

  • using the namespace configuration operator to create a namespace based on user creation (sandbox use case)
  • creating the namespace based on a group (application use case)
  • how to apply additional configs to a namespace:
    • quotas & limits
    • custom rbac
    • networkpolicies

We also want to ensure proper labels are placed on the namespace to represent the owner (group or user)

Argo CD basic example failed creating basic-example

I am testing the creation of ArgoCD instance on OCP 4.5, and I got this error:
The ArgoCD "example-argocd" is invalid: spec.server.route: Invalid value: "boolean": spec.server.route in body must be of type object: "boolean"

It turned out from the CD that the CRD is looking for an object instead of a boolean on the new operator version.

Manage Security Context Constraints

We should include an example of how to configure an SCC. We should also deploy some sort of privileged container in a namespace that we can use to prove escalated privileges.

Cluster Role Based Access Control

Need examples of managing RBAC. Two things we should include:

  1. A custom role of some kind, possibly using aggregate-to.
  2. a ClusterRoleBinding to a user or group

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.