github.com/containerd/nerdctl/v2@v2.0.0-beta.5.0.20240520001846-b5758f54fa28/examples/nerdctl-ipfs-registry-kubernetes/ipfs-stargz-snapshotter/bootstrap.yaml.sh (about)

     1  #!/bin/bash
     2  
     3  #   Copyright The containerd Authors.
     4  
     5  #   Licensed under the Apache License, Version 2.0 (the "License");
     6  #   you may not use this file except in compliance with the License.
     7  #   You may obtain a copy of the License at
     8  
     9  #       http://www.apache.org/licenses/LICENSE-2.0
    10  
    11  #   Unless required by applicable law or agreed to in writing, software
    12  #   distributed under the License is distributed on an "AS IS" BASIS,
    13  #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  #   See the License for the specific language governing permissions and
    15  #   limitations under the License.
    16  
    17  # Example script to prepare swarm key secret for IPFS bootstrap,
    18  # Example: ./bootstrap.yaml.sh > ./bootstrap.yaml
    19  
    20  set -eu -o pipefail
    21  
    22  for d in ipfs-swarm-key-gen ; do
    23      if ! command -v $d >/dev/null 2>&1 ; then
    24          echo "$d not found"
    25          exit 1
    26      fi
    27  done
    28  
    29  SWARM_KEY=$(ipfs-swarm-key-gen | base64 | tr -d '\n')
    30  
    31  cat <<EOF
    32  apiVersion: v1
    33  kind: Secret
    34  metadata:
    35    name: secret-config
    36  type: Opaque
    37  data:
    38    ipfs-swarm-key: $SWARM_KEY
    39  EOF